mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2024-11-14 16:40:57 +00:00
Fixed out-of-bounds array access when trying to draw saveshot for back action in save/load menus.
Also some other changes for renaming roguepath() to FS_RoguePath() I forgot to commit.
This commit is contained in:
parent
af85a6bf80
commit
66c41c11aa
7 changed files with 43 additions and 29 deletions
|
@ -516,9 +516,9 @@ void M_Menu_Credits_f (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (modType("xatrix")) // Xatrix
|
||||
if (FS_ModType("xatrix")) // Xatrix
|
||||
credits = xatcredits;
|
||||
else if (modType("rogue")) // Rogue
|
||||
else if (FS_ModType("rogue")) // Rogue
|
||||
credits = roguecredits;
|
||||
else
|
||||
credits = idcredits;
|
||||
|
|
|
@ -49,7 +49,7 @@ SAVESHOT HANDLING
|
|||
*/
|
||||
|
||||
char m_savestrings[MAX_SAVEGAMES][32];
|
||||
qboolean m_savevalid[MAX_SAVEGAMES];
|
||||
qboolean m_savevalid[MAX_SAVEGAMES+1];
|
||||
time_t m_savetimestamps[MAX_SAVEGAMES];
|
||||
qboolean m_savechanged[MAX_SAVEGAMES];
|
||||
qboolean m_saveshotvalid[MAX_SAVEGAMES+1];
|
||||
|
@ -68,7 +68,7 @@ void Load_Savestrings (qboolean update)
|
|||
time_t old_timestamp;
|
||||
struct stat st;
|
||||
|
||||
for (i=0 ; i<MAX_SAVEGAMES ; i++)
|
||||
for (i=0; i<MAX_SAVEGAMES; i++)
|
||||
{
|
||||
Com_sprintf (name, sizeof(name), "%s/save/kmq2save%i/server.ssv", FS_Gamedir(), i);
|
||||
|
||||
|
@ -196,22 +196,33 @@ void UI_InitSavegameData (void)
|
|||
m_saveshotvalid[MAX_SAVEGAMES] = true;
|
||||
else
|
||||
m_saveshotvalid[MAX_SAVEGAMES] = false;
|
||||
|
||||
m_savevalid[MAX_SAVEGAMES] = false; // this element is always false to handle the back action
|
||||
}
|
||||
|
||||
|
||||
void DrawSaveshot (qboolean loadmenu)
|
||||
{
|
||||
char shotname [MAX_QPATH];
|
||||
char mapshotname [MAX_QPATH];
|
||||
int i;
|
||||
if (loadmenu)
|
||||
i = s_loadgame_actions[s_loadgame_menu.cursor].generic.localdata[0];
|
||||
else
|
||||
i = s_savegame_actions[s_savegame_menu.cursor].generic.localdata[0];
|
||||
char shotname [MAX_QPATH];
|
||||
char mapshotname [MAX_QPATH];
|
||||
int i;
|
||||
|
||||
if (loadmenu) {
|
||||
if ( (s_loadgame_menu.cursor < 0) || (s_loadgame_menu.cursor >= MAX_SAVEGAMES)) // catch back action
|
||||
i = MAX_SAVEGAMES;
|
||||
else
|
||||
i = s_loadgame_actions[s_loadgame_menu.cursor].generic.localdata[0];
|
||||
}
|
||||
else { // save menu
|
||||
if ( (s_savegame_menu.cursor < 0) || (s_savegame_menu.cursor >= MAX_SAVEGAMES-1)) // catch back action
|
||||
i = MAX_SAVEGAMES;
|
||||
else
|
||||
i = s_savegame_actions[s_savegame_menu.cursor].generic.localdata[0];
|
||||
}
|
||||
|
||||
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-60, 244, 184, ALIGN_CENTER, 60,60,60,255);
|
||||
|
||||
if ( loadmenu && i==0 && m_savevalid[i] && m_saveshotvalid[i]) // m_mapshotvalid ) // autosave shows mapshot
|
||||
if ( loadmenu && (i == 0) && m_savevalid[i] && m_saveshotvalid[i]) // m_mapshotvalid ) // autosave shows mapshot
|
||||
{
|
||||
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", m_mapname);
|
||||
|
||||
|
@ -286,8 +297,8 @@ void LoadGame_MenuInit ( void )
|
|||
Menu_AddItem( &s_loadgame_menu, &s_loadgame_actions[i] );
|
||||
}
|
||||
|
||||
s_loadgame_back_action.generic.type = MTYPE_ACTION;
|
||||
s_loadgame_back_action.generic.flags = QMF_LEFT_JUSTIFY;
|
||||
s_loadgame_back_action.generic.type = MTYPE_ACTION;
|
||||
s_loadgame_back_action.generic.flags = QMF_LEFT_JUSTIFY;
|
||||
s_loadgame_back_action.generic.x = 0;
|
||||
s_loadgame_back_action.generic.y = (MAX_SAVEGAMES+3)*MENU_LINE_SIZE;
|
||||
s_loadgame_back_action.generic.name = " back";
|
||||
|
|
|
@ -225,8 +225,8 @@ static char *menu_in_sound = "misc/menu1.wav";
|
|||
static char *menu_move_sound = "misc/menu2.wav";
|
||||
static char *menu_out_sound = "misc/menu3.wav";
|
||||
|
||||
qboolean m_entersound; // play after drawing a frame, so caching
|
||||
// won't disrupt the sound
|
||||
extern qboolean m_entersound; // play after drawing a frame, so caching
|
||||
// won't disrupt the sound
|
||||
|
||||
int MainMenuMouseHover;
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ extern menulist_s s_rules_box;
|
|||
|
||||
qboolean CTF_menumode (void)
|
||||
{
|
||||
if ( (roguepath() && s_rules_box.curvalue >= 3)
|
||||
|| (!roguepath() && s_rules_box.curvalue >= 2) )
|
||||
if ( (FS_RoguePath() && s_rules_box.curvalue >= 3)
|
||||
|| (!FS_RoguePath() && s_rules_box.curvalue >= 2) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ static void DMFlagCallback ( void *self )
|
|||
bit = DF_QUAD_DROP;
|
||||
}
|
||||
// Knightmare added
|
||||
else if (modType("xatrix"))
|
||||
else if (FS_ModType("xatrix"))
|
||||
{
|
||||
if ( f == &s_quadfire_drop_box)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ static void DMFlagCallback ( void *self )
|
|||
}
|
||||
//=======
|
||||
//ROGUE
|
||||
else if (roguepath())
|
||||
else if (FS_RoguePath())
|
||||
{
|
||||
if ( f == &s_no_mines_box)
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ void DMOptions_MenuInit( void )
|
|||
s_friendlyfire_box.curvalue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0;
|
||||
|
||||
// Knightmare added
|
||||
if (modType("xatrix"))
|
||||
if (FS_ModType("xatrix"))
|
||||
{
|
||||
s_quadfire_drop_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_quadfire_drop_box.generic.x = 0;
|
||||
|
@ -400,7 +400,7 @@ void DMOptions_MenuInit( void )
|
|||
//============
|
||||
//ROGUE
|
||||
//Knightmare 12/23/2001
|
||||
else if (roguepath())
|
||||
else if (FS_RoguePath())
|
||||
{
|
||||
s_no_mines_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_no_mines_box.generic.x = 0;
|
||||
|
@ -489,11 +489,11 @@ void DMOptions_MenuInit( void )
|
|||
Menu_AddItem( &s_dmoptions_menu, &s_friendlyfire_box );
|
||||
|
||||
// Xatrix
|
||||
if (modType("xatrix"))
|
||||
if (FS_ModType("xatrix"))
|
||||
Menu_AddItem( &s_dmoptions_menu, &s_quadfire_drop_box );
|
||||
|
||||
// Rogue
|
||||
else if (roguepath())
|
||||
else if (FS_RoguePath())
|
||||
{
|
||||
Menu_AddItem( &s_dmoptions_menu, &s_no_mines_box );
|
||||
Menu_AddItem( &s_dmoptions_menu, &s_no_nukes_box );
|
||||
|
|
|
@ -518,7 +518,7 @@ void RulesChangeFunc (void *self)
|
|||
UI_RefreshMapList (MAP_3TCTF);
|
||||
}
|
||||
// ROGUE GAMES
|
||||
else if (roguepath() && s_rules_box.curvalue == 4) // tag
|
||||
else if (FS_RoguePath() && s_rules_box.curvalue == 4) // tag
|
||||
{
|
||||
s_maxclients_field.generic.statusbar = NULL;
|
||||
if (atoi(s_maxclients_field.buffer) <= 8) // set default of 8
|
||||
|
@ -553,7 +553,7 @@ void StartServerActionFunc (void *self)
|
|||
Cvar_SetValue ("coop", s_rules_box.curvalue == 1);
|
||||
Cvar_SetValue ("ctf", s_rules_box.curvalue == 2);
|
||||
Cvar_SetValue ("ttctf", s_rules_box.curvalue == 3);
|
||||
Cvar_SetValue ("gamerules", roguepath() ? ((s_rules_box.curvalue == 4) ? 2 : 0) : 0);
|
||||
Cvar_SetValue ("gamerules", FS_RoguePath() ? ((s_rules_box.curvalue == 4) ? 2 : 0) : 0);
|
||||
|
||||
spot = NULL;
|
||||
if (s_rules_box.curvalue == 1) // PGM
|
||||
|
@ -646,7 +646,7 @@ void StartServer_MenuInit (void)
|
|||
s_rules_box.generic.y = y += 2*MENU_LINE_SIZE;
|
||||
s_rules_box.generic.name = "rules";
|
||||
//PGM - rogue games only available with rogue DLL.
|
||||
if (roguepath())
|
||||
if (FS_RoguePath())
|
||||
s_rules_box.itemnames = dm_coop_names_rogue;
|
||||
else
|
||||
s_rules_box.itemnames = dm_coop_names;
|
||||
|
@ -655,7 +655,7 @@ void StartServer_MenuInit (void)
|
|||
s_rules_box.curvalue = 3;
|
||||
else if (Cvar_VariableValue("ctf"))
|
||||
s_rules_box.curvalue = 2;
|
||||
else if (roguepath() && Cvar_VariableValue("gamerules") == 2)
|
||||
else if (FS_RoguePath() && Cvar_VariableValue("gamerules") == 2)
|
||||
s_rules_box.curvalue = 4;
|
||||
else if (Cvar_VariableValue("coop"))
|
||||
s_rules_box.curvalue = 1;
|
||||
|
|
|
@ -38,7 +38,7 @@ MULTIPLAYER MENU
|
|||
=======================================================================
|
||||
*/
|
||||
|
||||
menuframework_s s_multiplayer_menu;
|
||||
menuframework_s s_multiplayer_menu;
|
||||
static menuaction_s s_join_network_server_action;
|
||||
static menuaction_s s_start_network_server_action;
|
||||
static menuaction_s s_player_setup_action;
|
||||
|
|
|
@ -29,6 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
cvar_t *ui_cursor_scale;
|
||||
|
||||
qboolean m_entersound; // play after drawing a frame, so caching
|
||||
// won't disrupt the sound
|
||||
|
||||
void (*m_drawfunc) (void);
|
||||
const char *(*m_keyfunc) (int key);
|
||||
|
||||
|
|
Loading…
Reference in a new issue