- actorstayput

This commit is contained in:
Christoph Oelckers 2021-11-18 20:55:22 +01:00
parent 4a81d45630
commit 8972dbe5da
8 changed files with 16 additions and 19 deletions

View file

@ -3169,7 +3169,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
{
if (a2->s->statnum == 1 && badguy(a2) && a2->s->picnum != SECTOREFFECTOR && a2->s->picnum != LOCATORS)
{
// if(a2->s.sectnum != s->sectnum)
// if(a2->s->sectnum != s->sectnum)
{
int k = a2->s->sectnum;
updatesector(a2->s->x, a2->s->y, &k);

View file

@ -567,7 +567,7 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
// conditional code from hell...
if (dasectnum < 0 || (dasectnum >= 0 &&
((actor->actorstayput >= 0 && actor->actorstayput != dasectnum) ||
((actor->actorstayput != nullptr && actor->actorstayput != dasectp) ||
((spri->picnum == BOSS2) && spri->pal == 0 && dasectp->lotag != 3) ||
((spri->picnum == BOSS1 || spri->picnum == BOSS2) && dasectp->lotag == ST_1_ABOVE_WATER) ||
(dasectp->lotag == ST_1_ABOVE_WATER && (spri->picnum == LIZMAN || (spri->picnum == LIZTROOP && spri->zvel == 0)))

View file

@ -402,7 +402,7 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
clipmove_ex(&pos, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), clipdist, (4 << 8), (4 << 8), cliptype, result);
}
if (dasectnum < 0 || (dasectnum >= 0 && actor->actorstayput >= 0 && actor->actorstayput != dasectnum))
if (dasectnum < 0 || (dasectnum >= 0 && actor->actorstayput != nullptr && actor->actorstayput != dasectp))
{
if (dasectp->lotag == ST_1_ABOVE_WATER)
spri->ang = (krand() & 2047);

View file

@ -1271,10 +1271,6 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
if (bSet) act->tempang = lValue;
else SetGameVarID(lVar2, act->tempang, sActor, sPlayer);
break;
case ACTOR_HTACTORSTAYPUT:
if (bSet) act->actorstayput = lValue;
else SetGameVarID(lVar2, act->actorstayput, sActor, sPlayer);
break;
case ACTOR_HTDISPICNUM:
if (bSet) act->dispicnum = lValue;
else SetGameVarID(lVar2, act->dispicnum, sActor, sPlayer);
@ -1525,7 +1521,7 @@ int ParseState::parse(void)
break;
case concmd_ifactornotstayput:
parseifelse(g_ac->actorstayput == -1);
parseifelse(g_ac->actorstayput == nullptr);
break;
case concmd_ifcansee:
parseifelse(ifcansee(g_ac, g_p));
@ -1890,7 +1886,7 @@ int ParseState::parse(void)
}
}
else ps[g_p].actors_killed += *insptr;
g_ac->actorstayput = -1;
g_ac->actorstayput = nullptr;
insptr++;
break;
case concmd_lotsofglass:
@ -2256,7 +2252,7 @@ int ParseState::parse(void)
g_ac->cgg = 0;
g_ac->movflag = 0;
g_ac->tempang = 0;
g_ac->actorstayput = -1;
g_ac->actorstayput = nullptr;
g_ac->dispicnum = 0;
g_ac->SetHitOwner(ps[g_p].GetActor());
g_ac->temp_data[4] = 0;

View file

@ -84,7 +84,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
act->lastvy = 0;
act->timetosleep = 0;
act->actorstayput = -1;
act->actorstayput = nullptr;
act->extra = -1;
act->cgg = 0;
act->movflag = 0;
@ -173,7 +173,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
act->lastvx = 0;
act->lastvy = 0;
act->actorstayput = -1;
act->actorstayput = nullptr;
t[0] = t[1] = t[2] = t[3] = t[4] = t[5] = 0;
act->temp_actor = nullptr;
@ -262,7 +262,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
makeitfall(act);
if (actorflag(act, SFLAG_BADGUYSTAYPUT))
act->actorstayput = sp->sectnum;
act->actorstayput = sp->sector();
if (!isRR() || actorflag(act, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
ps[myconnectindex].max_actors_killed++;

View file

@ -63,7 +63,7 @@ int spawn_d(int j, int pn)
case BOSS2STAYPUT:
case BOSS3STAYPUT:
case BOSS5STAYPUT:
act->actorstayput = sp->sectnum;
act->actorstayput = sp->sector();
[[fallthrough]];
case FIREFLY:
case BOSS5:
@ -792,7 +792,7 @@ int spawn_d(int j, int pn)
case PIGCOPDIVE:
case COMMANDERSTAYPUT:
case BOSS4STAYPUT:
act->actorstayput = sp->sectnum;
act->actorstayput = sp->sector();
[[fallthrough]];
case BOSS1:
case BOSS2:

View file

@ -793,7 +793,7 @@ int spawn_r(int j, int pn)
case MINIONSTAYPUT:
case COOTSTAYPUT:
rrra_stayput:
act->actorstayput = sp->sectnum;
act->actorstayput = sp->sector();
[[fallthrough]];
case BOULDER:
case BOULDER1:

View file

@ -26,7 +26,7 @@ struct DDukeActor
uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
short owner; // todo: make a pointer.
short picnum, ang, extra, movflag;
short tempang, actorstayput, dispicnum;
short tempang, dispicnum;
short timetosleep;
int floorz, ceilingz, lastvx, lastvy, aflags;
union
@ -37,7 +37,7 @@ struct DDukeActor
int temp_data[6];
// Some SE's stored indices in temp_data. For purposes of clarity avoid that. These variables are meant to store these elements now
walltype* temp_walls[2]; // SE20 + SE128
sectortype* temp_sect;
sectortype* temp_sect, *actorstayput;
DDukeActor* temp_actor, *seek_actor;
spritetype* s; // direct reference to the corresponding sprite.
@ -49,8 +49,9 @@ struct DDukeActor
DDukeActor& operator=(const DDukeActor& other) = delete;
void clear()
{
actorstayput = nullptr;
cgg = spriteextra = 0;
picnum = ang = extra = owner = movflag = tempang = actorstayput = dispicnum = timetosleep = 0;
picnum = ang = extra = owner = movflag = tempang = dispicnum = timetosleep = 0;
floorz = ceilingz = lastvx = lastvy = aflags = saved_ammo = 0;
memset(temp_data, 0, sizeof(temp_data));
}