Introduced state_quick_item so we can safly check if there is a valid quicksave slot wihtout messing around with state_Default_item which is supposed to always show a valid slot in the first place
This commit is contained in:
parent
785fffca90
commit
bc775b1331
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
||||||
20100719
|
20100719
|
||||||
--------
|
--------
|
||||||
misc/hmp.c: Did not close hmp after MIDI conversion which caused some unfree memory - fixed
|
misc/hmp.c: Did not close hmp after MIDI conversion which caused some unfree memory - fixed
|
||||||
|
main/gameseq.c, main/state.c, main/state.h: Introduced state_quick_item so we can safly check if there is a valid quicksave slot wihtout messing around with state_Default_item which is supposed to always show a valid slot in the first place
|
||||||
|
|
||||||
20100718
|
20100718
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -731,12 +731,11 @@ void InitPlayerObject()
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void game_disable_cheats();
|
extern void game_disable_cheats();
|
||||||
extern int state_default_item;
|
|
||||||
|
|
||||||
//starts a new game on the given level
|
//starts a new game on the given level
|
||||||
void StartNewGame(int start_level)
|
void StartNewGame(int start_level)
|
||||||
{
|
{
|
||||||
state_default_item = -2; // for first blind save, pick slot to save in
|
state_quick_item = -1; // for first blind save, pick slot to save in
|
||||||
|
|
||||||
Game_mode = GM_NORMAL;
|
Game_mode = GM_NORMAL;
|
||||||
|
|
||||||
|
|
12
main/state.c
12
main/state.c
|
@ -147,7 +147,10 @@ void rpad_string( char * string, int max_chars )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int state_default_item = 0;
|
static int state_default_item = 0;
|
||||||
|
//Since state_default_item should ALWAYS point to a valid savegame slot, we use this to check if we once already actually SAVED a game. If yes, state_quick_item will be equal state_default_item, otherwise it should be -1 on every new mission and tell us we need to select a slot for quicksave.
|
||||||
|
int state_quick_item = -1;
|
||||||
|
|
||||||
|
|
||||||
/* Present a menu for selection of a savegame filename.
|
/* Present a menu for selection of a savegame filename.
|
||||||
* For saving, dsc should be a pre-allocated buffer into which the new
|
* For saving, dsc should be a pre-allocated buffer into which the new
|
||||||
|
@ -212,11 +215,8 @@ int state_get_savegame_filename(char * fname, char * dsc, char * caption, int bl
|
||||||
|
|
||||||
sc_last_item = -1;
|
sc_last_item = -1;
|
||||||
|
|
||||||
if (blind_save && state_default_item < 0)
|
if (blind_save && state_quick_item < 0)
|
||||||
{
|
|
||||||
blind_save = 0; // haven't picked a slot yet
|
blind_save = 0; // haven't picked a slot yet
|
||||||
state_default_item = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blind_save)
|
if (blind_save)
|
||||||
choice = state_default_item + 1;
|
choice = state_default_item + 1;
|
||||||
|
@ -231,7 +231,7 @@ int state_get_savegame_filename(char * fname, char * dsc, char * caption, int bl
|
||||||
if (choice > 0) {
|
if (choice > 0) {
|
||||||
strcpy( fname, filename[choice-1] );
|
strcpy( fname, filename[choice-1] );
|
||||||
if ( dsc != NULL ) strcpy( dsc, desc[choice-1] );
|
if ( dsc != NULL ) strcpy( dsc, desc[choice-1] );
|
||||||
state_default_item = choice - 1;
|
state_quick_item = state_default_item = choice - 1;
|
||||||
return choice;
|
return choice;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels);
|
||||||
int state_restore_all_sub(char *filename);
|
int state_restore_all_sub(char *filename);
|
||||||
|
|
||||||
extern uint state_game_id;
|
extern uint state_game_id;
|
||||||
|
extern int state_quick_item;
|
||||||
|
|
||||||
int state_get_save_file(char * fname, char * dsc, int blind_save);
|
int state_get_save_file(char * fname, char * dsc, int blind_save);
|
||||||
int state_get_restore_file(char * fname );
|
int state_get_restore_file(char * fname );
|
||||||
|
|
Loading…
Reference in a new issue