From b336d43f75b1a27b959057e1dc9c55164b219067 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 7 Aug 2010 22:52:58 +0000 Subject: [PATCH] Another 64-bit crash fix git-svn-id: https://svn.eduke32.com/eduke32@1685 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index d4d9345d3..a1e9cd0da 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -380,9 +380,15 @@ int32_t G_GetAngleDelta(int32_t a,int32_t na) GAMEEXEC_STATIC GAMEEXEC_INLINE void VM_AlterAng(int32_t a) { - intptr_t *moveptr = (intptr_t *)vm.g_t[1]; + intptr_t *moveptr; int32_t ticselapsed = (vm.g_t[0])&31; + if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > (&script[0]+g_scriptSize)) + { + vm.g_t[1] = 0; + OSD_Printf(CON_ERROR "%s %d bad moveptr for actor %d (%d)!\n",g_errorLineNum, keyw[g_tw], vm.g_i, vm.g_sp->picnum); + } + vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)/5; if (vm.g_sp->zvel < 648) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)/5; @@ -515,6 +521,11 @@ GAMEEXEC_STATIC void VM_Move(void) if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1; if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1; } + else + { + vm.g_t[1] = 0; + OSD_Printf(CON_ERROR "%s %d bad moveptr for actor %d (%d)!\n",g_errorLineNum, keyw[g_tw], vm.g_i, vm.g_sp->picnum); + } if (a&dodgebullet && !deadflag) A_Dodge(vm.g_sp);