Skip to content

Commit

Permalink
- actorstayput
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Nov 21, 2021
1 parent e7be898 commit 1d6b7f3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion source/games/duke/src/actors.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/actors_d.cpp
Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/actors_r.cpp
Expand Up @@ -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);
Expand Down
10 changes: 3 additions & 7 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions source/games/duke/src/spawn.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/spawn_d.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/spawn_r.cpp
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions source/games/duke/src/types.h
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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));
}
Expand Down

0 comments on commit 1d6b7f3

Please sign in to comment.