Hi all,

Before reading futher, I managed to fix most of the errors, only the gamesave images/screenshots/bmaps still get messed up.

For my game Quake Planes (on this site), I have some save/load bugs.

When I save and I load the save before I have loaded a new map or restarted the game, I have no problems.

However, when I load the savegame after a level load (with this I mean e.g. loading a savegame from map 2 when I am playing map 1) or when I save, quit the game, start the game again and load the savegame I get either a gamecrash or (and now it gets really strange) enemies will still detect me but not attack and move towards me. Instead they will move to the player starting point and keep looking down and run around (I you have spare time you should try it, it is hilarious :D).
And finally the image of the savegame (a screenshot to show where the save was made) is screwed (weird vertical stripes through the image).

Anyone?

Here is the save and load script:

Code:
// Displays the save panel
function Save_show()
{
	// No slot is selected by default
	SELECTED_SLOT = 0;
	
	// Freeze the game
	freeze_mode = 1;
		
	// Display it
	set(mainmenu_save_pan,SHOW);
	
	// Close other menu panels
reset(mainmenu_load_pan,SHOW);
reset(mainmenu_quit_pan,SHOW);
reset(mainmenu_options_pan,SHOW);
reset(mainmenu_options_txt1,SHOW);
reset(mainmenu_options_txt2,SHOW);
reset(mainmenu_options_txt3,SHOW);
reset(mainmenu_options_txt4,SHOW);
reset(mainmenu_options_txt5,SHOW);
reset(mainmenu_options_digit1,SHOW);
reset(mainmenu_options_digit2,SHOW);
reset(mainmenu_options_digit3,SHOW);
reset(mainmenu_options_digit4,SHOW);
reset(mainmenu_credits_pan,SHOW);
reset(mainmenu_credits_txt,SHOW);
reset(mainmenu_newgame_pan,SHOW);
reset(mainmenu_pan,SHOW);
}

// Displays the load panel
function Load_show()
{
	// No slot is selected by default
	SELECTED_SLOT = 0;
	
	// Freeze the game
	freeze_mode = 1;
		
	// Display it
	set(mainmenu_load_pan,SHOW);
	
	// Close other menu panels
reset(mainmenu_save_pan,SHOW);
reset(mainmenu_quit_pan,SHOW);
reset(mainmenu_options_pan,SHOW);
reset(mainmenu_options_txt1,SHOW);
reset(mainmenu_options_txt2,SHOW);
reset(mainmenu_options_txt3,SHOW);
reset(mainmenu_options_txt4,SHOW);
reset(mainmenu_options_txt5,SHOW);
reset(mainmenu_options_digit1,SHOW);
reset(mainmenu_options_digit2,SHOW);
reset(mainmenu_options_digit3,SHOW);
reset(mainmenu_options_digit4,SHOW);
reset(mainmenu_credits_pan,SHOW);
reset(mainmenu_credits_txt,SHOW);
reset(mainmenu_newgame_pan,SHOW);
reset(mainmenu_pan,SHOW);
}

// Select a save/load slot
function SELECT_SLOT(but,pan)
{
	// There are 2 other buttons defined first
	but -= 2;
	
	// Select slot
	SELECTED_SLOT = but;
}
/////////////////////////////////////////////////////
// Puts the save/load slot bmap handles into an array
// Also loads the bmaps already at the slots
function init_slots()
{
	// Set bmap handles
	SAVESLOT_BMAPS[0] = handle(saveloadslot_1);
	SAVESLOT_BMAPS[1] = handle(saveloadslot_2);
	SAVESLOT_BMAPS[2] = handle(saveloadslot_3);
	SAVESLOT_BMAPS[3] = handle(saveloadslot_4);
	SAVESLOT_BMAPS[4] = handle(saveloadslot_5);
	SAVESLOT_BMAPS[5] = handle(saveloadslot_6);
	
	// Bmaps initialized
	SAVESLOT_BMAPS_INIT = true;
	
	// Load bmaps
	game_load(savedPicturesFile,0);
}

// Saves the game
function GameSave(slot,pan)
{
	// Get the saving slot
	slot = SELECTED_SLOT - 1;
	
	// Load the handles, if not done yet
	if(!SAVESLOT_BMAPS_INIT) {init_slots();}
	
	// Hide visible panels
	reset(mainmenu_save_pan,SHOW);
	reset(saveload_selected_pan,SHOW);
	
	// Take the screenshot
	bmap_for_screen(ptr_for_handle(SAVESLOT_BMAPS[slot]),1,0);
	wait(3);
	
	// Save the screen shot, return if it fails
	if(!game_save(savedPicturesFile,0,SV_INFO + SV_BMAPS)) {return;}
	wait(1);
	
	// And now save the game
	if(game_save(saveSlot_name,slot,SV_ALL - SV_INFO))
	{
		// Play a "beep" sound, if successfull
		snd_play(beep_snd,75,10);
	}
	
	// Show main game menu
	set(mainmenu_pan,SHOW);
}
/////////////////////////////////////////////////////
// Load a game
function GameLoad(slot,pan)
{
	// Get the loading slot
	slot = SELECTED_SLOT - 1;
	
	// Load the handles, if not done yet
	if(!SAVESLOT_BMAPS_INIT) {init_slots();}
	
	// Load the game
	if(game_load(saveSlot_name,slot))
	{
		// Play a "beep" sound, if successfull
		snd_play(beep_snd,75,10);
		reset(defeat_pan,SHOW);
		reset(victory_pan,SHOW);
		media_stop(0);
		if (map == 1) media_loop("X-COM UFO Defense PSX - 02 - Geoscape2.mp3",NULL,MUSICVOLUME_i);
		if (map == 2) media_loop("X-COM UFO Defense PSX - 01 - Geoscape1.mp3",NULL,MUSICVOLUME_i);
	}
	
	wait(1);	
	// Hide the main menu
	reset(mainmenu_pan,SHOW);
	reset(defeat_pan,SHOW);	
	freeze_mode = 0;
}



and here is the loadmap script:

Code:
//////////////////////////////// Level loading  ///////////////////

function Load_Map2()
{
player.x = 100;
player.y = -100;
player.z = 130;	
camera.pan = 180;
level_load("QuakePlanesmap2.wmb");
map = 2;
snd_play(R_TELE5,SOUNDVOLUME_i,0);	
media_stop(0);
media_loop("X-COM UFO Defense PSX - 01 - Geoscape1.mp3",NULL,MUSICVOLUME_i);
sky_color.red = 0;
sky_color.green = 0;
sky_color.blue = 0;
my_sky = ent_createlayer("Skybox+6.tga", SKY | CUBE | VISIBLE, 0);
camera.clip_far  = 11500; // reduce clip_far for preventing sorting errors 	
camera.fog_start = 0.2 * camera.clip_far; // fog starts at 80% of clip range
camera.fog_end = 0.9 * camera.clip_far; // total foggy at 90% of clip range
d3d_fogcolor1.red = 10;
d3d_fogcolor1.green = 10;
d3d_fogcolor1.blue = 30; // gray fog  
fog_color = 1;
GoldKey = 0;		
}



Last edited by Reconnoiter; 02/16/12 14:37.