Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Menu

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menu

Mensajes - Mikenoworth

#16
CRM32Pro / Inquiry on Text Input progress..
23 de Febrero de 2007, 06:38:49 PM
Sorry :)  :oops:  

 Before we kill this thread, what is the dpf block type name for Sounds and Music?

 Thanks in advanced!
#17
CRM32Pro / Inquiry on Text Input progress..
22 de Febrero de 2007, 04:41:33 PM
Ahh the sprite data! I don't want to upset you, but I realized at the last minute I was trying to load sprites/tilesets the hard way. I don't know why I came to the conclusion that I needed the data structure, but in the end I found out I don't need it, and it really cut out alot of extra work.

 *shrug* It happens.

 The game is progressing. :)
#18
CRM32Pro / Inquiry on Text Input progress..
21 de Febrero de 2007, 09:50:58 PM
Hello. :) Ran into another situation where I use Text Input buttons!

 Having done that, I decided to inquire if you've had a chance to work out the bug and add the capital letters feature? (shift/capslock)

 I'm still using them in hopes a future version will have a fix + the caps  feature.

 Of course, there is no rush - I can code through it easily.
#19
CRM32Pro / IStuffDPF & DPF_BlockData (Tiles & Sprites structs)
08 de Febrero de 2007, 06:54:43 AM
Oh man sweet! Now I can get sprite manager module up and running!!


 Thanks!!
#20
CRM32Pro / The Map Editor - ATTN: TheAzazel
07 de Febrero de 2007, 12:19:37 AM
I really need the sprite structure :)
#21
CRM32Pro / The Map Editor - ATTN: TheAzazel
03 de Febrero de 2007, 10:02:30 AM
Well after a bunch of moping around wishing I knew what to code next, the editor is in a good state!!

 Lots of fixes/changes (GUI changes mostly..).  I still haven't added layers to the maps, not sure if I want to - as it isn't required for my game project :).

 The main issues are:

 Each tile is stored in a data array as a short like so:

   tile = data[ ((map x size * y position) + x position) ];

 Sadly, this leaves no room for other data. I was thinking about expanding it to a long, using the two extra bytes for tile flags, which could tell the game if the tile is accessible to the player or not. (ie. tile collision)
 
 But this would definitly complicate things and force me to expand the editor past what I intended it for. ;)  Besides all that, I want to move on to the actor (sprite) editor and then finally the game itself. So I've decided to release the editor to the public and call it good.
 
 I will include 100% source - Which will expose the inner-workings of the maps themselves - Letting anyone expand upon the basics I've put down. One big thing to note is I use MSVC 7.1, and cannot give support for other compiler packages. I simply don't know how to use them.

 The main editor code is something of a mess, but the map module is pretty clean, just not well-commented. All of the memory leaks that _I_ created have been removed (From the looks of it SDL creates alot of memory leaks on it's own.)

 Anywho, if you want to distribute the editor via your website, that would make it easier on me - I have no place to put the darn thing myself.

 A last bit on the editor before I go: There are some good editors listed on the crm32pro website, which are more flexible/featured than mine. I would rather use them if I didn't have to have things my way.  :lol:  But I would be proud if you wanted to use it to display how awesome CRM32Pro is.  :wink:

 p.s. - Thanks for all the help! 8)
#22
Its cool as long as you're aware of the problem!  8)
#23
I _could_ release it.. But weeks from now. There are plenty of features I still need to code for my project. Plus, the editor uses modules from my main game source - I don't want to release anything til it's ripe for the pickin'!

 And, as you noticed, the GUI for the Editor leaves too much to the imagination when it comes to figuring out "what does what".

 Ao so much to look forward to fixing.
#24
Cool! When I add the visual elements to show-off the new tileset system I'll send you a release build!

[edit]

 I've sent you an email with the editor attached to it - As well as a big explanation of how to use the editor.

[/edit]
#25
YES! I would love the sprite structure too!!

 Also, funny you should bring that code up  :lol:  - I just went through and made the exact same changes because the supplied color masks weren't working anyway!

 I still use SDL_CreateRGBSurfaceFrom(), but I may change if I find any memory leaks because of it. My only concern after the "is everything working?" concern, is leaving allocated memory allocated.
 
 Ah but I'm about back to where I was before I decided editor users shouldn't have to *know* what every tileset's name is in a DPF.

 Now if I could just get that dpf block data sprite structure from ya. ;)

 Thanks alot too!
#26
[and again]
 more changes to code.  8)
[/and again]

[edit again]
 I forgot to get the tile offset info, updated the code to do that too. :)
[/edit again]

[edit]
 Fixed - I accidentally coded it so it would quit out of the loop and the function and return NULL if the tileset wasn't found on the first loop every time.

 It _IS_ and always has been creating the SDL_Surface properly.

 Here's the fixed code if anyone is interested, but it has memory leaks:


// Loads (and creates) a Tileset and returns it's pointer. Returns NULL if Failed.
// You must delete the Tileset yourself when you are finished with it.
CRM32Pro_CTile* load_tileset(CRM32Pro_CTile* ptile, char* dpfname)
{
if(!sts_dpf_initialized) return NULL; // Always make sure a DPF was loaded, if not
// there's nothing here to do.
for(int i=0; i < sts_total_tilesets; ++i) // Now find dpfname in the tileset names list.
{
if(sts_tileset_names[i].compare(dpfname)==0) // If the Tileset asked for is in the array,
{ // we can begin to create that Tileset.
int dpfid = IStuffDPF->Open(sts_dpf_filename); // To get the Tileset's data, open the DPF.
if(dpfid<0) return NULL;
DPF_BlockData dpf_db; // If the data block has a size of 0 or less,
if(!IStuffDPF->LoadBlock(dpfid,"TILE2",dpfname,&dpf_db))// something went wrong and we must NULL out.
{
IStuffDPF->Close(dpfid);
return NULL;
}

SDL_Surface* tsurf = NULL; // Create some vars that will hold the data
long surf_x_size = 0; // used to create the Tileset's Surface (image),
long surf_y_size = 0; // and then to create the Tileset itself.
long pitch = 0; // sdl note: pitch is width of image in bytes
long x_off = 0;
long y_off = 0;
SDL_PixelFormat surf_pf;
int surf_pixels_size = dpf_db.size - 128;
char* surf_pixels = new char[ (surf_pixels_size) ];

// The following is a _guess_ on the methods of: how to get the data required to
// create a Tileset, and: How to, in return, create that Tileset.

/*CRM32Pro_*/ memcpy(&surf_x_size, &dpf_db.data[0], 4);
/*CRM32Pro_*/ memcpy(&surf_y_size, &dpf_db.data[4], 4);
/*CRM32Pro_*/ memcpy(&x_off, &dpf_db.data[20], 4);
/*CRM32Pro_*/ memcpy(&surf_pf, &dpf_db.data[24], 40);

pitch = surf_pf.BytesPerPixel * surf_x_size;
//pitch = surf_pixels_size / surf_y_size;

/*CRM32Pro_*/ memcpy(surf_pixels, &dpf_db.data[64], surf_pixels_size );
/*CRM32Pro_*/ memcpy(&y_off, &dpf_db.data[64 + surf_pixels_size], 4);

// Create SDL_Surface for Tileset.
tsurf = SDL_CreateRGBSurfaceFrom(surf_pixels, surf_x_size, surf_y_size, surf_pf.BitsPerPixel,
pitch, surf_pf.Rmask, surf_pf.Gmask, surf_pf.Bmask, surf_pf.Amask);
if(!tsurf) // If we failed to create the SDL_Surface for
{ // the Tileset we have to return NULL, there's
delete [] surf_pixels; // nothing else we can do to be successful.
IStuffDPF->Close(dpfid);
return NULL;
}

if(!ptile)
CRM32Pro_CTile* ptile = new CRM32Pro_CTile(); // Now we can create the Tileset, and set
ptile->Create(tsurf, dpfname); // it's data we just obtained.
ptile->SetTileSet(1, x_off, y_off); // Set Tileset flag and size per tile.
IStuffDPF->Close(dpfid);
//
// UNFREED MEMORY: (unintentional) tsurf, (unintentional) surf_pixels, (intentional) ptile
//
return ptile;
}
}
return NULL; // We've gone this far only if the Tileset
// dpfname we were searching for was not found.
}


[/edit]
#27
Thank you! There is also one more thing, very related, the DPF_BlockData::data structure for sprites as well. :)
#28
You're gonna kill me on sunday Azazel ;)

  With IStuffDPF I want to Load a DPF, find all the tilesets in the DPF and list them, select them, use 'em, etc.. (in a map editor)

  But I need to know what the format for DPF_BlockData::data is for a Tileset.

  Thanks in advance!
#29
I don't know if you know, but Input boxes are all messed up. :)

  [edit] I've got SetTextRect working, I checked the docs and it says something like "Call SetTextRect if you re-position the buttons." So ok, fixed that. :)

  However, the problem is when I type, I get double characters sometimes, and if you have  more than one key pressed at once (happens alot) the text input will fill up with characters instantly. Also, text input buttons don't support CAPSLOCK or the SHIFT key, why not????

Again,  ?? Whats up with Input boxes??  8)

[/edit]
#30
CRM32Pro / CRM32Pro_CSprite::SetPosition(x, y, 1 ?? )
15 de Enero de 2007, 09:17:59 PM
I want the same thing, but bad game design and the need for editors slows game progress.

  I'm working on it at least 8 hrs day.   :)





Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.