problems with raw images

Started by fitbo, Tue 09/01/2007 19:35:16

Previous topic - Next topic

fitbo

Hi,

I have a couple of  questions about the raw images:

1) Is there any way to save the raw images created in a room? I want them to remain at the same positions when the player character leaves the room, and then they should reappear after the player character enters the room again.

2) Also, is there a way that the raw images are drawn behind the walk behinds in the room, because that doesn't seem to work.


GarageGothic

1) You could do a DynamicSprite.CreateFromBackground on room-exit to store the background and then RawDraw that sprite on room-entry. It would be kept in the memory until you no longer need it, but unless you do it for multiple rooms  and at a high resolution, this shouldn't be a problem (all savegames will be a lot bigger though, since the background also need to be saved).

2) No, RawDraw doesn't take walkbehinds into consideration. An alternative could be to create the walkbehind foreground as objects in the room, or just RawDraw a sprite of the foreground on top of the (edited) background every frame.

monkey0506

#2
Regarding #1...and without actually testing it at all...wouldn't it cut down on size if he did something like:

Code: ags
// on room exit
DynamicSprite* dsBackground = DynamicSprite.CreateFromBackground();
dsBackground.SaveToFile("tmpXXX.bmp"); // XXX is room number
dsBackground.Delete();

// on room entrance
DynamicSprite* dsBackground = DynamicSprite.CreateFromFile("tmpXXX.bmp");
if (dsBackground != null) RawDrawImage(0, 0, dsBackground.Graphic);


That way he wouldn't have to have the sprite loaded into the memory all the time. Without testing I can't be sure, but it seems that it would help cut down on the size of save games and whatnot.

GarageGothic

Good idea, monkey. I wouldn't do that myself, since I hate external data files that users can mess with. But depending on the game it might work.

Only problem could be that the most recent change to the screen would be present even when loading an older savegame (unless you have as many saved pictures as there are save slots). Also, maybe you don't even have to save the full screen but only a smaller area, which could save harddrive space.

monkey0506

I hadn't considered that. The part about it loading more recent screenshots into older games...

As for the issue with the files being external...well...I was just trying to think of a way to get some of the filesize off the savegame files...but upon further consideration it wouldn't really be sensible to do it this way.

SMF spam blocked by CleanTalk