Actor ST1 handling: clean up code a bit. (Preparation for real changes.)

In VM_Fall(), keep a temp preliminary new z position of the actor and
assign only when we return. This is to each ease watching its value in GDB.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4953 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-05 16:30:12 +00:00
parent 910716fa11
commit 36c3fd9216

View file

@ -666,7 +666,6 @@ GAMEEXEC_STATIC void VM_Move(void)
const uint16_t *movflagsptr = &AC_MOVFLAGS(vm.g_sp, &actor[vm.g_i]);
const int32_t movflags = /*(*movflagsptr==-1) ? 0 :*/ *movflagsptr;
const int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
int32_t badguyp;
AC_COUNT(vm.g_t)++;
@ -734,7 +733,7 @@ dead:
if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6)
vm.g_sp->xvel = 0;
badguyp = A_CheckEnemySprite(vm.g_sp);
int badguyp = A_CheckEnemySprite(vm.g_sp);
if (vm.g_sp->xvel || vm.g_sp->zvel)
{
@ -789,9 +788,12 @@ dead:
{
// All other actors besides ORGANTIC don't update .floorz or
// .ceilingz here.
if (vm.g_sp->zvel > 0 && actor[vm.g_i].floorz < vm.g_sp->z)
if (vm.g_sp->zvel > 0)
{
if (vm.g_sp->z > actor[vm.g_i].floorz)
vm.g_sp->z = actor[vm.g_i].floorz;
if (vm.g_sp->zvel < 0)
}
else if (vm.g_sp->zvel < 0)
{
const int32_t l = VM_GetCeilZOfSlope();
@ -939,20 +941,23 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
{
// Free fall.
g_sp->zvel = min(g_sp->zvel+grav, ACTOR_MAXFALLINGZVEL);
g_sp->z += g_sp->zvel;
int32_t z = g_sp->z + g_sp->zvel;
#ifdef YAX_ENABLE
if (yax_getbunch(g_sp->sectnum, YAX_FLOOR) >= 0 &&
(sector[g_sp->sectnum].floorstat&512)==0)
setspritez(g_i, (vec3_t *)g_sp);
else
#endif
if (g_sp->z > actor[g_i].floorz - ZOFFSET)
g_sp->z = actor[g_i].floorz - ZOFFSET;
if (z > actor[g_i].floorz - ZOFFSET)
z = actor[g_i].floorz - ZOFFSET;
g_sp->z = z;
return;
}
// SET_SPRITE_Z
g_sp->z = actor[g_i].floorz - ZOFFSET;
// Preliminary new z position of the actor.
int32_t z = actor[g_i].floorz - ZOFFSET;
if (A_CheckEnemySprite(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0))
{
@ -983,17 +988,6 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
}
}
#if 0
if (g_sp->z > actor[g_i].floorz - ZOFFSET)
{
// Unreachable because of SET_SPRITE_Z.
A_GetZLimits(g_i);
if (actor[g_i].floorz != sector[g_sp->sectnum].floorz)
g_sp->z = (actor[g_i].floorz - ZOFFSET);
return;
}
#endif
if (sector[g_sp->sectnum].lotag == ST_1_ABOVE_WATER)
{
switch (DYNAMICTILEMAP(g_sp->picnum))
@ -1018,19 +1012,20 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
#endif
))
{
// OSD_Printf("%d\n", (int)script[moveScriptOfs + 1]);
break;
}
// OSD_Printf("movflags: %d | %d\n", AC_MOVFLAGS(g_sp, &actor[vm.g_i]), totalclock);
g_sp->z += ACTOR_ONWATER_ADDZ;
z += ACTOR_ONWATER_ADDZ;
break;
}
}
g_sp->z = z;
return;
}
g_sp->z = z;
g_sp->zvel = 0;
}