mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Actor-related code cleanup part 2: give actor t_data[] indexes names.
Using macros like AC_COUNT(t). Clean up related code: - comment out the dead condition noted in the previous commit - Lunatic: use get_count() instead of get_t_data(0) in one place, rename to _get_t_data(), i.e. make that method internal git-svn-id: https://svn.eduke32.com/eduke32@3920 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
90ddee2296
commit
e164bd7f1e
9 changed files with 126 additions and 98 deletions
|
@ -782,14 +782,15 @@ static void A_MoveSector(int32_t i)
|
|||
}
|
||||
|
||||
#if !defined LUNATIC
|
||||
# define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*T4 : 0)
|
||||
// NOTE: T5 is AC_ACTION_ID
|
||||
# define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*AC_CURFRAME(actor[i].t_data) : 0)
|
||||
#else
|
||||
// SACTION
|
||||
// startframe + viewtype*[cyclic counter]
|
||||
# define LIGHTRAD_PICOFS (actor[i].ac.startframe + actor[i].ac.viewtype*T4)
|
||||
# define LIGHTRAD_PICOFS (actor[i].ac.startframe + actor[i].ac.viewtype*AC_CURFRAME(actor[i].t_data))
|
||||
#endif
|
||||
|
||||
// this is the same crap as in game.c's tspr manipulation. puke.
|
||||
// XXX: may access tilesizy out-of-bounds by bad user code.
|
||||
#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum + LIGHTRAD_PICOFS])
|
||||
#define LIGHTRAD2 (((s->yrepeat) + (rand()%(s->yrepeat>>2))) * tilesizy[s->picnum + LIGHTRAD_PICOFS])
|
||||
|
||||
|
|
|
@ -74,6 +74,18 @@ enum uactortypes_t {
|
|||
enemystayput
|
||||
};
|
||||
|
||||
// These macros are there to give names to the t_data[]/T*/vm.g_t[] indices
|
||||
// when used with actors. Greppability of source code is certainly a virtue.
|
||||
#define AC_COUNT(t) (t[0]) /* the actor's count */
|
||||
/* The ID of the actor's current move. In C-CON, the bytecode offset to the
|
||||
* move composite: */
|
||||
#define AC_MOVE_ID(t) (t[1])
|
||||
#define AC_ACTION_COUNT(t) (t[2]) /* the actor's action count */
|
||||
#define AC_CURFRAME(t) (t[3]) /* the actor's current frame offset */
|
||||
/* The ID of the actor's current action. In C-CON, the bytecode offset to the
|
||||
* action composite: */
|
||||
#define AC_ACTION_ID(t) (t[4])
|
||||
#define AC_AI_ID(t) (t[5]) /* the ID of the actor's current ai */
|
||||
|
||||
#ifdef LUNATIC
|
||||
struct action {
|
||||
|
@ -147,14 +159,14 @@ typedef struct {
|
|||
#endif
|
||||
#if UINTPTR_MAX == 0xffffffff
|
||||
/* 32-bit */
|
||||
# ifndef LUNATIC
|
||||
# if !defined LUNATIC
|
||||
int8_t filler[20];
|
||||
# else
|
||||
int8_t filler[4];
|
||||
# endif
|
||||
#else
|
||||
/* 64-bit */
|
||||
# ifndef LUNATIC
|
||||
# if !defined LUNATIC
|
||||
int8_t filler[16];
|
||||
# else
|
||||
/* no padding */
|
||||
|
|
|
@ -4804,8 +4804,8 @@ static int32_t G_InitActor(int32_t i, int32_t tilenum, int32_t set_movflag_uncon
|
|||
if (g_tile[tilenum].execPtr)
|
||||
{
|
||||
SH = *(g_tile[tilenum].execPtr);
|
||||
T5 = *(g_tile[tilenum].execPtr+1);
|
||||
T2 = *(g_tile[tilenum].execPtr+2);
|
||||
AC_ACTION_ID(actor[i].t_data) = *(g_tile[tilenum].execPtr+1);
|
||||
AC_MOVE_ID(actor[i].t_data) = *(g_tile[tilenum].execPtr+2);
|
||||
|
||||
if (set_movflag_uncond || SHT == 0)
|
||||
SHT = *(g_tile[tilenum].execPtr+3);
|
||||
|
@ -4819,8 +4819,8 @@ static int32_t G_InitActor(int32_t i, int32_t tilenum, int32_t set_movflag_uncon
|
|||
const el_actor_t *a = &g_elActors[tilenum];
|
||||
|
||||
SH = a->strength;
|
||||
T5 = a->act.id;
|
||||
T2 = a->mov.id;
|
||||
AC_ACTION_ID(actor[i].t_data) = a->act.id;
|
||||
AC_MOVE_ID(actor[i].t_data) = a->mov.id;
|
||||
Bmemcpy(&actor[i].ac, &a->act.ac, sizeof(struct action));
|
||||
Bmemcpy(&actor[i].mv, &a->mov.mv, sizeof(struct move));
|
||||
|
||||
|
@ -5025,7 +5025,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
CS |= 256;
|
||||
|
||||
if (!G_InitActor(i, s, 0))
|
||||
T2 = T5 = 0;
|
||||
T2 = T5 = 0; // AC_MOVE_ID, AC_ACTION_ID
|
||||
}
|
||||
|
||||
sp = &sprite[i];
|
||||
|
@ -7194,7 +7194,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
{
|
||||
int32_t switchpic;
|
||||
int32_t curframe;
|
||||
#ifndef LUNATIC
|
||||
#if !defined LUNATIC
|
||||
int32_t scrofs_action;
|
||||
#else
|
||||
int32_t startframe, viewtype;
|
||||
|
@ -7241,15 +7241,16 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
sect = s->sectnum;
|
||||
|
||||
Bassert(i >= 0);
|
||||
curframe = T4;
|
||||
#ifndef LUNATIC
|
||||
scrofs_action = T5; // SACTION
|
||||
curframe = AC_CURFRAME(actor[i].t_data);
|
||||
#if !defined LUNATIC
|
||||
scrofs_action = AC_ACTION_ID(actor[i].t_data);
|
||||
#else
|
||||
startframe = actor[i].ac.startframe;
|
||||
viewtype = actor[i].ac.viewtype;
|
||||
#endif
|
||||
switchpic = s->picnum;
|
||||
//some special cases because dynamictostatic system can't handle addition to constants
|
||||
// Some special cases because dynamictostatic system can't handle
|
||||
// addition to constants.
|
||||
if ((s->picnum >= SCRAP6) && (s->picnum<=SCRAP6+7))
|
||||
switchpic = SCRAP5;
|
||||
else if ((s->picnum==MONEY+1) || (s->picnum==MAIL+1) || (s->picnum==PAPER+1))
|
||||
|
@ -7508,7 +7509,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
{
|
||||
// Display APLAYER sprites with action PSTAND when viewed through
|
||||
// a camera. Not implemented for Lunatic.
|
||||
#ifndef LUNATIC
|
||||
#if !defined LUNATIC
|
||||
const intptr_t *aplayer_scr = g_tile[APLAYER].execPtr;
|
||||
// [0]=strength, [1]=actionofs, [2]=moveofs
|
||||
|
||||
|
@ -7603,7 +7604,7 @@ PALONLY:
|
|||
|
||||
if (G_HaveActor(s->picnum))
|
||||
{
|
||||
#ifndef LUNATIC
|
||||
#if !defined LUNATIC
|
||||
if ((unsigned)scrofs_action + 2 >= (unsigned)g_scriptSize)
|
||||
goto skip;
|
||||
|
||||
|
@ -7675,7 +7676,7 @@ PALONLY:
|
|||
/* completemirror() already reverses the drawn frame, so the above isn't necessary.
|
||||
* Even Polymost's and Polymer's mirror seems to function correctly this way. */
|
||||
|
||||
#ifndef LUNATIC
|
||||
#if !defined LUNATIC
|
||||
skip:
|
||||
#endif
|
||||
// XXX: Currently, for the splitscreen mod, sprites will be pal6-colored iff the first
|
||||
|
|
|
@ -252,14 +252,14 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
|
|||
{
|
||||
spritetype *s = &sprite[iActor];
|
||||
|
||||
if (s->picnum != APLAYER && (actor[iActor].t_data[0]&63) > 2)
|
||||
return(s->ang + 1024);
|
||||
if (s->picnum != APLAYER && (AC_COUNT(actor[iActor].t_data)&63) > 2)
|
||||
return s->ang + 1024;
|
||||
|
||||
{
|
||||
int32_t furthest_angle=0;
|
||||
int32_t d;
|
||||
int32_t greatestd = -(1<<30);
|
||||
int32_t angincs = 2048/angs,j;
|
||||
int32_t d, j;
|
||||
int32_t greatestd = INT32_MIN;
|
||||
int32_t angincs=2048/angs;
|
||||
hitdata_t hit;
|
||||
|
||||
for (j=s->ang; j<(2048+s->ang); j+=angincs)
|
||||
|
@ -278,13 +278,14 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
|
|||
furthest_angle = j;
|
||||
}
|
||||
}
|
||||
return (furthest_angle&2047);
|
||||
|
||||
return furthest_angle&2047;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t A_FurthestVisiblePoint(int32_t iActor, spritetype *ts, int32_t *dax, int32_t *day)
|
||||
{
|
||||
if ((actor[iActor].t_data[0]&63))
|
||||
if (AC_COUNT(actor[iActor].t_data)&63)
|
||||
return -1;
|
||||
|
||||
{
|
||||
|
@ -454,19 +455,19 @@ int32_t G_GetAngleDelta(int32_t a,int32_t na)
|
|||
|
||||
GAMEEXEC_STATIC void VM_AlterAng(int32_t movflags)
|
||||
{
|
||||
const int32_t ticselapsed = (vm.g_t[0])&31;
|
||||
const int32_t ticselapsed = (AC_COUNT(vm.g_t))&31;
|
||||
|
||||
#if !defined LUNATIC
|
||||
const intptr_t *moveptr;
|
||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
|
||||
if ((unsigned)AC_MOVE_ID(vm.g_t) >= (unsigned)g_scriptSize-1)
|
||||
|
||||
{
|
||||
vm.g_t[1] = 0;
|
||||
AC_MOVE_ID(vm.g_t) = 0;
|
||||
OSD_Printf_nowarn(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
||||
return;
|
||||
}
|
||||
|
||||
moveptr = script + vm.g_t[1]; // RESEARCH: what's with move 0 and >>> 1 <<<?
|
||||
moveptr = script + AC_MOVE_ID(vm.g_t);
|
||||
|
||||
vm.g_sp->xvel += (*moveptr - vm.g_sp->xvel)/5;
|
||||
if (vm.g_sp->zvel < 648)
|
||||
|
@ -591,16 +592,16 @@ GAMEEXEC_STATIC void VM_Move(void)
|
|||
#if !defined LUNATIC
|
||||
const intptr_t *moveptr;
|
||||
#endif
|
||||
// NOTE: source/gameexec.c:596:5: warning: comparison is always false due
|
||||
// to limited range of data type [-Wtype-limits]
|
||||
const int32_t movflags = (vm.g_sp->hitag==-1) ? 0 : vm.g_sp->hitag;
|
||||
// NOTE: commented out condition is dead since r3159 (making hi/lotag unsigned).
|
||||
// XXX: Does it break anything? Where are movflags with all bits set created?
|
||||
const int32_t movflags = /*(vm.g_sp->hitag==-1) ? 0 :*/ vm.g_sp->hitag;
|
||||
const int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
|
||||
int32_t badguyp, angdif;
|
||||
|
||||
vm.g_t[0]++;
|
||||
AC_COUNT(vm.g_t)++;
|
||||
|
||||
// If the move ID is zero, or the movflags are 0
|
||||
if (vm.g_t[1] == 0 || movflags == 0)
|
||||
if (AC_MOVE_ID(vm.g_t) == 0 || movflags == 0)
|
||||
{
|
||||
if (deadflag || (actor[vm.g_i].bpos.x != vm.g_sp->x) || (actor[vm.g_i].bpos.y != vm.g_sp->y))
|
||||
{
|
||||
|
@ -618,15 +619,15 @@ GAMEEXEC_STATIC void VM_Move(void)
|
|||
VM_FacePlayer(2);
|
||||
|
||||
if (movflags&spin)
|
||||
vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6;
|
||||
vm.g_sp->ang += sintable[((AC_COUNT(vm.g_t)<<3)&2047)]>>6;
|
||||
|
||||
if (movflags&face_player_slow)
|
||||
VM_FacePlayer(4);
|
||||
|
||||
if ((movflags&jumptoplayer) == jumptoplayer)
|
||||
{
|
||||
if (vm.g_t[0] < 16)
|
||||
vm.g_sp->zvel -= (sintable[(512+(vm.g_t[0]<<4))&2047]>>5);
|
||||
if (AC_COUNT(vm.g_t) < 16)
|
||||
vm.g_sp->zvel -= (sintable[(512+(AC_COUNT(vm.g_t)<<4))&2047]>>5);
|
||||
}
|
||||
|
||||
if (movflags&face_player_smart)
|
||||
|
@ -641,14 +642,14 @@ GAMEEXEC_STATIC void VM_Move(void)
|
|||
|
||||
dead:
|
||||
#if !defined LUNATIC
|
||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
|
||||
if ((unsigned)AC_MOVE_ID(vm.g_t) >= (unsigned)g_scriptSize-1)
|
||||
{
|
||||
vm.g_t[1] = 0;
|
||||
AC_MOVE_ID(vm.g_t) = 0;
|
||||
OSD_Printf_nowarn(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
||||
return;
|
||||
}
|
||||
|
||||
moveptr = script + vm.g_t[1]; // RESEARCH: what's with move 0 and >>> 1 <<<?
|
||||
moveptr = script + AC_MOVE_ID(vm.g_t);
|
||||
|
||||
if (movflags&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1;
|
||||
if (movflags&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
|
||||
|
@ -763,11 +764,13 @@ dead:
|
|||
}
|
||||
else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER)
|
||||
{
|
||||
if (ps->actorsqu == vm.g_i) return;
|
||||
if (ps->actorsqu == vm.g_i)
|
||||
return;
|
||||
|
||||
if (!A_CheckSpriteFlags(vm.g_i, SPRITE_SMOOTHMOVE))
|
||||
{
|
||||
if (vm.g_t[0]&1) return;
|
||||
if (AC_COUNT(vm.g_t)&1)
|
||||
return;
|
||||
daxvel <<= 1;
|
||||
}
|
||||
}
|
||||
|
@ -775,7 +778,8 @@ dead:
|
|||
|
||||
{
|
||||
vec3_t tmpvect = { (daxvel*(sintable[(angdif+512)&2047]))>>14,
|
||||
(daxvel*(sintable[angdif&2047]))>>14, vm.g_sp->zvel
|
||||
(daxvel*(sintable[angdif&2047]))>>14,
|
||||
vm.g_sp->zvel
|
||||
};
|
||||
|
||||
actor[vm.g_i].movflag = A_MoveSprite(
|
||||
|
@ -948,7 +952,7 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
|
|||
default:
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
int32_t moveScriptOfs = vm.g_t[1];
|
||||
int32_t moveScriptOfs = AC_MOVE_ID(vm.g_t);
|
||||
#endif
|
||||
// fix for flying/jumping monsters getting stuck in water
|
||||
if ((g_sp->hitag & jumptoplayer) ||
|
||||
|
@ -1349,18 +1353,18 @@ skip_check:
|
|||
case CON_AI:
|
||||
insptr++;
|
||||
//Following changed to use pointersizes
|
||||
vm.g_t[5] = *insptr++; // Ai
|
||||
AC_AI_ID(vm.g_t) = *insptr++; // Ai
|
||||
|
||||
vm.g_t[4] = *(script + vm.g_t[5]); // Action
|
||||
AC_ACTION_ID(vm.g_t) = *(script + AC_AI_ID(vm.g_t)); // Action
|
||||
|
||||
// NOTE: "if (g_t[5])" added in r1155. It used to be a pointer though.
|
||||
if (vm.g_t[5])
|
||||
{
|
||||
vm.g_t[1] = *(script + vm.g_t[5] + 1); // move
|
||||
}
|
||||
vm.g_sp->hitag = *(script + vm.g_t[5] + 2); // move flags
|
||||
// NOTE: "if" check added in r1155. It used to be a pointer though.
|
||||
if (AC_AI_ID(vm.g_t))
|
||||
AC_MOVE_ID(vm.g_t) = *(script + AC_AI_ID(vm.g_t) + 1); // move
|
||||
|
||||
vm.g_sp->hitag = *(script + AC_AI_ID(vm.g_t) + 2); // move flags
|
||||
|
||||
AC_COUNT(vm.g_t) = AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0;
|
||||
|
||||
vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ??
|
||||
if (!A_CheckEnemySprite(vm.g_sp) || vm.g_sp->extra > 0) // hack
|
||||
if (vm.g_sp->hitag&random_angle)
|
||||
vm.g_sp->ang = krand()&2047;
|
||||
|
@ -1368,8 +1372,8 @@ skip_check:
|
|||
|
||||
case CON_ACTION:
|
||||
insptr++;
|
||||
vm.g_t[2] = vm.g_t[3] = 0;
|
||||
vm.g_t[4] = *insptr++;
|
||||
AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0;
|
||||
AC_ACTION_ID(vm.g_t) = *insptr++;
|
||||
continue;
|
||||
|
||||
case CON_IFPLAYERSL:
|
||||
|
@ -1783,8 +1787,8 @@ skip_check:
|
|||
|
||||
case CON_MOVE:
|
||||
insptr++;
|
||||
vm.g_t[0]=0;
|
||||
vm.g_t[1] = *insptr++;
|
||||
AC_COUNT(vm.g_t) = 0;
|
||||
AC_MOVE_ID(vm.g_t) = *insptr++;
|
||||
vm.g_sp->hitag = *insptr++;
|
||||
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
|
||||
continue;
|
||||
|
@ -2205,32 +2209,37 @@ nullquote:
|
|||
CON_ERRPRINTF("Invalid statnum: %d\n", j);
|
||||
continue;
|
||||
}
|
||||
if (sprite[i].statnum == j) continue;
|
||||
if (sprite[i].statnum == j)
|
||||
continue;
|
||||
|
||||
/* initialize actor data when changing to an actor statnum because there's usually
|
||||
garbage left over from being handled as a hard coded object */
|
||||
|
||||
if (sprite[i].statnum > STAT_ZOMBIEACTOR && (j == STAT_ACTOR || j == STAT_ZOMBIEACTOR))
|
||||
{
|
||||
actor[i].lastvx = 0;
|
||||
actor[i].lastvy = 0;
|
||||
actor[i].timetosleep = 0;
|
||||
actor[i].cgg = 0;
|
||||
actor[i].movflag = 0;
|
||||
actor[i].tempang = 0;
|
||||
actor[i].dispicnum = 0;
|
||||
actor_t *a = &actor[i];
|
||||
|
||||
a->lastvx = 0;
|
||||
a->lastvy = 0;
|
||||
a->timetosleep = 0;
|
||||
a->cgg = 0;
|
||||
a->movflag = 0;
|
||||
a->tempang = 0;
|
||||
a->dispicnum = 0;
|
||||
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
||||
actor[i].flags = 0;
|
||||
a->flags = 0;
|
||||
sprite[i].hitag = 0;
|
||||
// TODO: Lunatic
|
||||
if (g_tile[sprite[i].picnum].execPtr)
|
||||
|
||||
if (G_HaveActor(sprite[i].picnum))
|
||||
{
|
||||
const intptr_t *actorptr = g_tile[sprite[i].picnum].execPtr;
|
||||
// offsets
|
||||
T5 = *(g_tile[sprite[i].picnum].execPtr+1); // action
|
||||
T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move
|
||||
sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits
|
||||
AC_ACTION_ID(a->t_data) = actorptr[1];
|
||||
AC_MOVE_ID(a->t_data) = actorptr[2];
|
||||
sprite[i].hitag = actorptr[3]; // ai bits (movflags)
|
||||
}
|
||||
}
|
||||
|
||||
changespritestat(i,j);
|
||||
continue;
|
||||
}
|
||||
|
@ -3179,22 +3188,22 @@ nullquote:
|
|||
|
||||
case CON_IFAI:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(vm.g_t[5] == *insptr);
|
||||
VM_CONDITIONAL(AC_AI_ID(vm.g_t) == *insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFACTION:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(vm.g_t[4] == *insptr);
|
||||
VM_CONDITIONAL(AC_ACTION_ID(vm.g_t) == *insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFACTIONCOUNT:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(vm.g_t[2] >= *insptr);
|
||||
VM_CONDITIONAL(AC_ACTION_COUNT(vm.g_t) >= *insptr);
|
||||
continue;
|
||||
|
||||
case CON_RESETACTIONCOUNT:
|
||||
insptr++;
|
||||
vm.g_t[2] = 0;
|
||||
AC_ACTION_COUNT(vm.g_t) = 0;
|
||||
continue;
|
||||
|
||||
case CON_DEBRIS:
|
||||
|
@ -3226,7 +3235,7 @@ nullquote:
|
|||
|
||||
case CON_COUNT:
|
||||
insptr++;
|
||||
vm.g_t[0] = (int16_t) *insptr++;
|
||||
AC_COUNT(vm.g_t) = (int16_t) *insptr++;
|
||||
continue;
|
||||
|
||||
case CON_CSTATOR:
|
||||
|
@ -3287,7 +3296,7 @@ nullquote:
|
|||
|
||||
case CON_IFMOVE:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(vm.g_t[1] == *insptr);
|
||||
VM_CONDITIONAL(AC_MOVE_ID(vm.g_t) == *insptr);
|
||||
continue;
|
||||
|
||||
case CON_RESETPLAYER:
|
||||
|
@ -3307,7 +3316,7 @@ nullquote:
|
|||
|
||||
case CON_IFCOUNT:
|
||||
insptr++;
|
||||
VM_CONDITIONAL(vm.g_t[0] >= *insptr);
|
||||
VM_CONDITIONAL(AC_COUNT(vm.g_t) >= *insptr);
|
||||
continue;
|
||||
|
||||
case CON_IFACTOR:
|
||||
|
@ -3317,7 +3326,7 @@ nullquote:
|
|||
|
||||
case CON_RESETCOUNT:
|
||||
insptr++;
|
||||
vm.g_t[0] = 0;
|
||||
AC_COUNT(vm.g_t) = 0;
|
||||
continue;
|
||||
|
||||
case CON_ADDINVENTORY:
|
||||
|
@ -5323,6 +5332,8 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
{
|
||||
#ifdef LUNATIC
|
||||
int32_t killit=0;
|
||||
#else
|
||||
intptr_t actionofs, *actionptr;
|
||||
#endif
|
||||
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
|
||||
&sprite[iActor], 0
|
||||
|
@ -5354,17 +5365,18 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
* which might be corrected if the code is converted to use offsets */
|
||||
/* Helixhorned: let's do away with intptr_t's... */
|
||||
#if !defined LUNATIC
|
||||
// NOTE: for Lunatic, need split into numeric literal / action label
|
||||
// (maybe >=0/<0, respectively?)
|
||||
if (vm.g_t[4]!=0 && (unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
|
||||
actionofs = AC_ACTION_ID(vm.g_t);
|
||||
actionptr = (actionofs!=0 && actionofs+4u < (unsigned)g_scriptSize) ?
|
||||
&script[actionofs] : NULL;
|
||||
|
||||
if (actionptr != NULL)
|
||||
#endif
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
const int32_t action_frames = *(script + vm.g_t[4] + 1);
|
||||
const int32_t action_incval = *(script + vm.g_t[4] + 3);
|
||||
const int32_t action_delay = *(script + vm.g_t[4] + 4);
|
||||
const int32_t action_frames = actionptr[1];
|
||||
const int32_t action_incval = actionptr[3];
|
||||
const int32_t action_delay = actionptr[4];
|
||||
#else
|
||||
// SACTION
|
||||
const int32_t action_frames = actor[vm.g_i].ac.numframes;
|
||||
const int32_t action_incval = actor[vm.g_i].ac.incval;
|
||||
const int32_t action_delay = actor[vm.g_i].ac.delay;
|
||||
|
@ -5373,14 +5385,14 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
|
||||
if (vm.g_sp->lotag > action_delay)
|
||||
{
|
||||
vm.g_t[2]++;
|
||||
AC_ACTION_COUNT(vm.g_t)++;
|
||||
vm.g_sp->lotag = 0;
|
||||
|
||||
vm.g_t[3] += action_incval;
|
||||
AC_CURFRAME(vm.g_t) += action_incval;
|
||||
}
|
||||
|
||||
if (klabs(vm.g_t[3]) >= klabs(action_frames * action_incval))
|
||||
vm.g_t[3] = 0;
|
||||
if (klabs(AC_CURFRAME(vm.g_t)) >= klabs(action_frames * action_incval))
|
||||
AC_CURFRAME(vm.g_t) = 0;
|
||||
}
|
||||
|
||||
#ifdef LUNATIC
|
||||
|
|
|
@ -393,7 +393,7 @@ local ActorLabels = {
|
|||
htbposy = AC".bpos.y",
|
||||
htbposz = AC".bpos.z",
|
||||
-- Read access differs from write ({ get, set }):
|
||||
htg_t = { AC":get_t_data(%s)", AC":_set_t_data(%s,%%s)" },
|
||||
htg_t = { AC":_get_t_data(%s)", AC":_set_t_data(%s,%%s)" },
|
||||
htflags = AC".flags",
|
||||
|
||||
-- (mostly) model-related flags
|
||||
|
|
|
@ -1272,7 +1272,7 @@ end
|
|||
|
||||
-- "otherspr" is either player or holoduke sprite
|
||||
local function A_FurthestVisiblePoint(aci, otherspr)
|
||||
if (bit.band(actor[aci]:get_t_data(0), 63) ~= 0) then
|
||||
if (bit.band(actor[aci]:get_count(), 63) ~= 0) then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -1063,7 +1063,7 @@ local actor_mt = {
|
|||
|
||||
-- Getters/setters.
|
||||
-- TODO: make a bcarray instead.
|
||||
get_t_data = function(a, idx)
|
||||
_get_t_data = function(a, idx)
|
||||
if (idx >= 10ULL) then
|
||||
error("invalid t_data index "..idx, 2)
|
||||
end
|
||||
|
|
|
@ -842,6 +842,7 @@ function static_members.sprite.changesect(spritenum, sectnum, noerr)
|
|||
end
|
||||
|
||||
function static_members.sprite.changestat(spritenum, statnum, noerr)
|
||||
-- TODO: see gameexec.c's CON_CHANGESPRITESTAT.
|
||||
check_sprite_idx(spritenum)
|
||||
if (statnum >= ffiC.MAXSTATUS+0ULL) then
|
||||
error("invalid status number "..statnum, 2)
|
||||
|
|
|
@ -4387,7 +4387,7 @@ void P_ProcessInput(int32_t snum)
|
|||
|
||||
if (p->pals.f > 0)
|
||||
{
|
||||
#ifndef LUNATIC
|
||||
#if !defined LUNATIC
|
||||
p->pals.f--;
|
||||
#else
|
||||
if (p->palsfadespeed > 0)
|
||||
|
@ -5138,6 +5138,7 @@ HORIZONLY:
|
|||
|
||||
if (!ud.noclip && sector[p->cursectnum].lotag == ST_31_TWO_WAY_TRAIN)
|
||||
{
|
||||
// XXX: POTENTIAL_OOB
|
||||
if (sprite[sector[p->cursectnum].hitag].xvel && actor[sector[p->cursectnum].hitag].t_data[0] == 0)
|
||||
{
|
||||
P_QuickKill(p);
|
||||
|
|
Loading…
Reference in a new issue