* Properly handles an illegal frame # sent to sp_frame instead of crashing

- Versioned to 2.75


git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1492 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-09-19 05:01:41 +00:00
parent 1adfda0aab
commit 79e8424266
4 changed files with 35 additions and 7 deletions

View file

@ -125,3 +125,6 @@ www.rtsoft.com
* Fixed some issues related to dynamic 8 bit to 32 bit surface changes (this can happen if you turn on the new shadows after starting to play or the game suddenly hits a 32 bit image)
- Note: Just to be safe, save state version has changed, so old save states won't load
------ Change log for 1.7.5 ----------
* Properly handles an illegal frame # sent to sp_frame instead of crashing

View file

@ -180,8 +180,8 @@ App::App()
m_bDidPostInit = false;
m_bHasDMODSupport = true;
//for mobiles
m_version = 1.74f;
m_versionString = "V1.7.4";
m_version = 1.75f;
m_versionString = "V1.7.5";
m_build = 1;
m_bCheatsEnabled = false;

View file

@ -3836,7 +3836,8 @@ bool get_parms(char proc_name[20], int32 script, char *h, int32 p[10])
} else
{
LogMsg("Procedure %s does not take %d parms in %s, offset %d. (%s?)", proc_name, i+1, g_scriptInstance[script]->name, g_scriptInstance[script]->current, h);
//set it to zero to be "safe"?
//(p[i]
return(false);
}
}
@ -4014,7 +4015,14 @@ bool check_pic_status(int picID)
{
if (picID == 0) return true;
assert(g_dglos.g_picInfo[picID].m_parentSeq != 0);
#ifdef _DEBUG
if (g_dglos.g_picInfo[picID].m_parentSeq == 0)
{
LogMsg("Huh, this should have a parent..");
}
#endif
if (g_pSpriteSurface[picID]) return true;
@ -4038,7 +4046,17 @@ LogMsg("Seq %d missing?", seq);
{
//LogMsg("Woah!");
}
#endif
if (frame < 0 || frame >= C_MAX_SPRITE_FRAMES)
{
//invalid!
assert(!"Illegal sprite frame. Track where it came from!");
return true; //avoid crash
}
if (frame != 0)
{
if (g_pSpriteSurface[g_dglos.g_seq[seq].frame[frame]]) return true;
@ -5045,7 +5063,7 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
{
int pic = getpic(h);
assert(!"The hell?");
LogMsg("Debug: Bad pic here");
}
#endif
@ -9017,7 +9035,15 @@ pass:
int32 p[20] = {1,1,0,0,0,0,0,0,0,0};
if (get_parms(ev[1], script, h, p))
{
if (g_nlist[1] < 0 || g_nlist[1] >= C_MAX_SPRITE_FRAMES)
{
LogMsg("sp_frame trying to set something to frame %d? Illegal, forcing to 1.", g_nlist[1]);
g_nlist[1] = 1;
}
g_dglos.g_returnint = change_sprite(g_nlist[0], g_nlist[1], &g_sprite[g_nlist[0]].frame);
return(0);
}
g_dglos.g_returnint = -1;

View file

@ -7,7 +7,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug GL|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-game dmods/init</LocalDebuggerCommandArguments>
</PropertyGroup>
</Project>