Loading and Saving maps

Started by
0 comments, last by ImmaGNUman 23 years, 7 months ago
ok, heres my problem. Say I have a structure like this: struct TILE_T { int foo; char bar; double baz; LPDIRECTDRAWSURFACE *bmp; } Now considering I dont want to save a DirectDraw surface to a file, should I: 1) Create a whole new struct for saving and loading with an HBITMAP instead of DDSurface? 2) Just add a pointer to an HBitmap and during the game make it 0 and use it only for saving/loading? or 3) Make it a void*, cast it to (lpdirectdrawsurface) when i use it and when i convert it cast it to hbitmap? (this sounds coolest) Just want some input, which might give the least overhead. ----------------------------- A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Advertisement
Actually I''d stip out the LPDIRECTDRAWSURFACE *bmp (is that right? i double pointer??) and have ethier an index number for the tile or some other way to indicate the image. All 3 options you have given rely on windows re-allocating the exact same memory block each time you run your app and that these memory blocks are all pre-allocated by your system. This will never happen, unless you re-program windows and DirectX to re-allocate the blocks of memory that you want - like that''s going to happen!

The best option would be to do the following:

LPDIRECTDRAWSURFACE *IsoMaps[MAXISOIMAGES];

struct TILE_T
{
int foo;
char bar;
double baz;
int TileNum;
}

I''ve just worked out why you had the double pointer to the surface.

When I find my code in tons of trouble,Friends and colleages come to me,Speaking words of wisdom:"Write in C."My Web Site

This topic is closed to new replies.

Advertisement