- renamed temp_data[0] to 'counter' and map temp_data[5] to the now free temp_data[0].

This not only matches its use in CON but seems to be used as a counter in most other places as well.
The main reason is to improve readability of CON to ZScript conversions.
This commit is contained in:
Christoph Oelckers 2022-12-22 09:49:42 +01:00
parent 8bd88b8678
commit 60af1b4c62
50 changed files with 403 additions and 400 deletions

View file

@ -445,9 +445,9 @@ void movedummyplayers(void)
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->spr.pos.Z = act->sector()->ceilingz + 27;
act->spr.Angles.Yaw = ps[p].GetActor()->spr.Angles.Yaw;
if (act->temp_data[0] == 8)
act->temp_data[0] = 0;
else act->temp_data[0]++;
if (act->counter == 8)
act->counter = 0;
else act->counter++;
}
else
{
@ -604,7 +604,7 @@ void movefallers(void)
{
auto sectp = act->sector();
if (act->temp_data[0] == 0)
if (act->counter == 0)
{
act->spr.pos.Z -= 16;
DAngle saved_angle = act->spr.Angles.Yaw;
@ -616,13 +616,13 @@ void movefallers(void)
{
if (act->spr.extra <= 0)
{
act->temp_data[0] = 1;
act->counter = 1;
DukeStatIterator itj(STAT_FALLER);
while (auto a2 = itj.Next())
{
if (a2->spr.hitag == act->spr.hitag)
{
a2->temp_data[0] = 1;
a2->counter = 1;
a2->spr.cstat &= ~CSTAT_SPRITE_ONE_SIDE;
if (a2->IsKindOf(NAME_DukeSteamBase))
a2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
@ -639,7 +639,7 @@ void movefallers(void)
act->spr.Angles.Yaw = saved_angle;
act->spr.pos.Z += 16;
}
else if (act->temp_data[0] == 1)
else if (act->counter == 1)
{
if (act->spr.lotag > 0)
{
@ -749,11 +749,11 @@ void detonate(DDukeActor *actor, PClassActor* explosion)
effector->temp_data[4] = 1;
else if (effector->spr.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)
{
if (effector->temp_data[0] == 0)
effector->temp_data[0] = 1;
if (effector->counter == 0)
effector->counter = 1;
}
else if (effector->spr.lotag == SE_21_DROP_FLOOR)
effector->temp_data[0] = 1;
effector->counter = 1;
}
}
@ -901,8 +901,8 @@ void handle_se00(DDukeActor* actor)
}
else
{
if (Owner->temp_data[0] == 0) return;
if (Owner->temp_data[0] == 2)
if (Owner->counter == 0) return;
if (Owner->counter == 2)
{
actor->Destroy();
return;
@ -980,7 +980,7 @@ void handle_se01(DDukeActor *actor)
{
if (ac->spr.lotag == SE_19_EXPLOSION_LOWERS_CEILING && ac->spr.hitag == sh)
{
actor->temp_data[0] = 0;
actor->counter = 0;
break;
}
}
@ -1003,7 +1003,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (actor->GetOwner() == nullptr)
{
auto NewOwner = LocateTheLocator(actor->temp_data[3], &sector[actor->temp_data[0]]);
auto NewOwner = LocateTheLocator(actor->temp_data[3], &sector[actor->counter]);
if (NewOwner == nullptr)
{
@ -1021,11 +1021,11 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (Owner->spr.hitag & 1)
actor->temp_data[4] = sc->extra; //Slow it down
actor->temp_data[3]++;
auto NewOwner = LocateTheLocator(actor->temp_data[3], &sector[actor->temp_data[0]]);
auto NewOwner = LocateTheLocator(actor->temp_data[3], &sector[actor->counter]);
if (NewOwner == nullptr)
{
actor->temp_data[3] = 0;
NewOwner = LocateTheLocator(0, &sector[actor->temp_data[0]]);
NewOwner = LocateTheLocator(0, &sector[actor->counter]);
}
if (NewOwner) actor->SetOwner(NewOwner);
}
@ -1202,7 +1202,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (Owner == nullptr)
{
actor->temp_data[3] = !actor->temp_data[3];
Owner = LocateTheLocator(actor->temp_data[3], &sector[actor->temp_data[0]]);
Owner = LocateTheLocator(actor->temp_data[3], &sector[actor->counter]);
actor->SetOwner(Owner);
}
else
@ -1356,37 +1356,37 @@ void handle_se02(DDukeActor* actor)
auto sc = actor->sector();
int sh = actor->spr.hitag;
if (actor->temp_data[4] > 0 && actor->temp_data[0] == 0)
if (actor->temp_data[4] > 0 && actor->counter == 0)
{
if (actor->temp_data[4] < sh)
actor->temp_data[4]++;
else actor->temp_data[0] = 1;
else actor->counter = 1;
}
if (actor->temp_data[0] > 0)
if (actor->counter > 0)
{
actor->temp_data[0]++;
actor->counter++;
actor->vel.X = 3 / 16.;
if (actor->temp_data[0] > 96)
if (actor->counter > 96)
{
actor->temp_data[0] = -1; //Stop the quake
actor->counter = -1; //Stop the quake
actor->temp_data[4] = -1;
actor->Destroy();
return;
}
else
{
if ((actor->temp_data[0] & 31) == 8)
if ((actor->counter & 31) == 8)
{
ud.earthquaketime = 48;
S_PlayActorSound(EARTHQUAKE, ps[screenpeek].GetActor());
}
if (abs(sc->floorheinum - actor->temp_data[5]) < 8)
sc->setfloorslope(actor->temp_data[5]);
else sc->setfloorslope(sc->getfloorslope() + (Sgn(actor->temp_data[5] - sc->getfloorslope()) << 4));
if (abs(sc->floorheinum - actor->temp_data[0]) < 8)
sc->setfloorslope(actor->temp_data[0]);
else sc->setfloorslope(sc->getfloorslope() + (Sgn(actor->temp_data[0] - sc->getfloorslope()) << 4));
}
auto vect = actor->spr.Angles.Yaw.ToVector() * actor->vel.X;
@ -1434,23 +1434,23 @@ void handle_se03(DDukeActor *actor)
{
sc->ceilingpal = palvals >> 8;
sc->floorpal = palvals & 0xff;
actor->temp_data[0] = actor->spr.shade + (global_random & 15);
actor->counter = actor->spr.shade + (global_random & 15);
}
else
{
sc->ceilingpal = actor->spr.pal;
sc->floorpal = actor->spr.pal;
actor->temp_data[0] = actor->temp_data[3];
actor->counter = actor->temp_data[3];
}
sc->ceilingshade = actor->temp_data[0];
sc->floorshade = actor->temp_data[0];
sc->ceilingshade = actor->counter;
sc->floorshade = actor->counter;
for(auto& wal : sc->walls)
{
if (wal.hitag != 1)
{
wal.shade = actor->temp_data[0];
wal.shade = actor->counter;
if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided())
{
wal.nextWall()->shade = wal.shade;
@ -1476,7 +1476,7 @@ void handle_se04(DDukeActor *actor)
if ((global_random / (sh + 1) & 31) < 4)
{
actor->temp_data[1] = actor->spr.shade + (global_random & 15);//Got really bright
actor->temp_data[0] = actor->spr.shade + (global_random & 15);
actor->counter = actor->spr.shade + (global_random & 15);
sc->ceilingpal = palvals >> 8;
sc->floorpal = palvals & 0xff;
j = 1;
@ -1484,7 +1484,7 @@ void handle_se04(DDukeActor *actor)
else
{
actor->temp_data[1] = actor->temp_data[2];
actor->temp_data[0] = actor->temp_data[3];
actor->counter = actor->temp_data[3];
sc->ceilingpal = actor->spr.pal;
sc->floorpal = actor->spr.pal;
@ -1502,7 +1502,7 @@ void handle_se04(DDukeActor *actor)
if (wal.hitag != 1)
{
wal.shade = actor->temp_data[0];
wal.shade = actor->counter;
if ((wal.cstat & CSTAT_WALL_BOTTOM_SWAP) && wal.twoSided())
wal.nextWall()->shade = wal.shade;
}
@ -1611,7 +1611,7 @@ void handle_se05(DDukeActor* actor)
actor->spr.pos.Z += actor->vel.Z;
sc->setceilingz(actor->vel.Z);
sector[actor->temp_data[0]].setceilingz(actor->vel.Z);
sector[actor->counter].setceilingz(actor->vel.Z);
movesector(actor, actor->temp_data[1], actor->temp_angle);
//SetActor(actor, actor->spr.pos);
}
@ -1682,8 +1682,8 @@ void handle_se08(DDukeActor *actor, bool checkhitag1)
if (sect->floorshade < minshade)
sect->floorshade = minshade;
else if (sect->floorshade > ac->temp_data[0])
sect->floorshade = ac->temp_data[0];
else if (sect->floorshade > ac->counter)
sect->floorshade = ac->counter;
if (sect->ceilingshade < minshade)
sect->ceilingshade = minshade;
@ -1721,7 +1721,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
if (j == 1)
{
if (actor->temp_data[0] > sh)
if (actor->counter > sh)
{
if (specialtags) for (int i = 0; specialtags[i]; i++)
{
@ -1731,12 +1731,12 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
}
}
fi.activatebysector(actor->sector(), actor);
actor->temp_data[0] = 0;
actor->counter = 0;
}
else actor->temp_data[0]++;
else actor->counter++;
}
}
else actor->temp_data[0] = 0;
else actor->counter = 0;
}
//---------------------------------------------------------------------------
@ -1748,9 +1748,9 @@ void handle_se10(DDukeActor* actor, const int* specialtags)
void handle_se11(DDukeActor *actor)
{
auto sc = actor->sector();
if (actor->temp_data[5] > 0)
if (actor->temp_data[0] > 0)
{
actor->temp_data[5]--;
actor->temp_data[0]--;
return;
}
@ -1779,7 +1779,7 @@ void handle_se11(DDukeActor *actor)
{
if (ac->GetOwner() && IsCloseToWall(ac->spr.pos.XY(), &wal, 9) == EClose::InFront)
{
actor->temp_data[5] = 8; // Delay
actor->temp_data[0] = 8; // Delay
actor->temp_angle -= mapangle(k);
actor->temp_data[4] -= k;
movesector(actor, actor->temp_data[1], actor->temp_angle);
@ -1808,7 +1808,7 @@ void handle_se11(DDukeActor *actor)
void handle_se12(DDukeActor *actor, int planeonly)
{
auto sc = actor->sector();
if (actor->temp_data[0] == 3 || actor->temp_data[3] == 1) //Lights going off
if (actor->counter == 3 || actor->temp_data[3] == 1) //Lights going off
{
sc->floorpal = 0;
sc->ceilingpal = 0;
@ -1823,7 +1823,7 @@ void handle_se12(DDukeActor *actor, int planeonly)
}
sc->floorshade = actor->temp_data[1];
sc->ceilingshade = actor->temp_data[2];
actor->temp_data[0] = 0;
actor->counter = 0;
DukeSectIterator it(sc);
while (auto a2 = it.Next())
@ -1842,7 +1842,7 @@ void handle_se12(DDukeActor *actor, int planeonly)
return;
}
}
if (actor->temp_data[0] == 1) //Lights flickering on
if (actor->counter == 1) //Lights flickering on
{
// planeonly 1 is RRRA SE47, planeonly 2 is SE48
int compshade = planeonly == 2 ? sc->ceilingshade : sc->floorshade;
@ -1863,7 +1863,7 @@ void handle_se12(DDukeActor *actor, int planeonly)
}
}
}
else actor->temp_data[0] = 2;
else actor->counter = 2;
DukeSectIterator it(actor->sector());
while (auto a2 = it.Next())
@ -2044,7 +2044,7 @@ void handle_se17(DDukeActor* actor)
int sh = actor->spr.hitag;
double refheight = actor->spr.yint * zmaptoworld;
double q = actor->temp_data[0] * refheight * 4;
double q = actor->counter * refheight * 4;
sc->addceilingz(q);
sc->addfloorz(q);
@ -2068,7 +2068,7 @@ void handle_se17(DDukeActor* actor)
act1->ceilingz = sc->ceilingz;
}
if (actor->temp_data[0]) //If in motion
if (actor->counter) //If in motion
{
if (abs(sc->floorz - actor->temp_pos.X) <= refheight)
{
@ -2076,7 +2076,7 @@ void handle_se17(DDukeActor* actor)
return;
}
if (actor->temp_data[0] == -1)
if (actor->counter == -1)
{
if (sc->floorz > actor->temp_pos.Y)
return;
@ -2091,7 +2091,7 @@ void handle_se17(DDukeActor* actor)
while ((act2 = itr.Next()))
{
if (actor != act2 && (act2->spr.lotag) == 17)
if ((sc->hitag - actor->temp_data[0]) == (act2->sector()->hitag) && sh == (act2->spr.hitag))
if ((sc->hitag - actor->counter) == (act2->sector()->hitag) && sh == (act2->spr.hitag))
break;
}
@ -2155,7 +2155,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
double extra = sc->extra * zmaptoworld;
double goal = FixedToFloat<8>(actor->temp_data[1]);
if (actor->temp_data[0])
if (actor->counter)
{
if (actor->spr.pal)
{
@ -2240,7 +2240,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (actor->temp_data[2] >= actor->spr.hitag)
{
actor->temp_data[2] = 0;
actor->temp_data[0] = 0;
actor->counter = 0;
}
}
}
@ -2273,11 +2273,11 @@ void handle_se19(DDukeActor *actor)
auto sc = actor->sector();
int sh = actor->spr.hitag;
if (actor->temp_data[0])
if (actor->counter)
{
if (actor->temp_data[0] == 1)
if (actor->counter == 1)
{
actor->temp_data[0]++;
actor->counter++;
for (auto& wal : sc->walls)
{
if (tileflags(wal.overtexture) & TFLAG_FORCEFIELD)
@ -2309,7 +2309,7 @@ void handle_se19(DDukeActor *actor)
auto sectp = a2Owner->sector();
a2->sector()->floorpal = a2->sector()->ceilingpal = sectp->floorpal;
a2->sector()->floorshade = a2->sector()->ceilingshade = sectp->floorshade;
a2Owner->temp_data[0] = 2;
a2Owner->counter = 2;
}
}
actor->Destroy();
@ -2344,9 +2344,9 @@ void handle_se19(DDukeActor *actor)
case 19:
if (sh == ac->spr.hitag)
if (ac->temp_data[0] == 0)
if (ac->counter == 0)
{
ac->temp_data[0] = 1; //Shut them all on
ac->counter = 1; //Shut them all on
ac->SetOwner(actor);
}
@ -2367,20 +2367,20 @@ void handle_se20(DDukeActor* actor)
{
auto sc = actor->sector();
if (actor->temp_data[0] == 0) return;
if (actor->counter == 0) return;
//if(actor->vel.X != 0) //Moving
{
auto vec = actor->spr.Angles.Yaw.ToVector() * (actor->temp_data[0] == 1 ? 0.5 : -0.5);
auto vec = actor->spr.Angles.Yaw.ToVector() * (actor->counter == 1 ? 0.5 : -0.5);
actor->temp_data[3] += actor->temp_data[0] == 1? 8 :- 8;
actor->temp_data[3] += actor->counter == 1? 8 :- 8;
actor->spr.pos += vec;
if (actor->temp_data[3] <= 0 || (actor->temp_data[3] >> 6) >= (actor->spr.yint >> 6))
{
actor->spr.pos -= vec;
actor->temp_data[0] = 0;
actor->counter = 0;
callsound(actor->sector(), actor);
return;
}
@ -2429,17 +2429,17 @@ void handle_se21(DDukeActor* actor)
auto sc = actor->sector();
double lp;
if (actor->temp_data[0] == 0) return;
if (actor->counter == 0) return;
if (actor->spr.intangle == 1536)
lp = sc->ceilingz;
else
lp = sc->floorz;
if (actor->temp_data[0] == 1) //Decide if the sector should go up or down
if (actor->counter == 1) //Decide if the sector should go up or down
{
actor->vel.Z = (Sgn(actor->spr.pos.Z - lp) * (actor->spr.yint << 4) * zmaptoworld);
actor->temp_data[0]++;
actor->counter++;
}
if (sc->extra == 0)
@ -2472,7 +2472,7 @@ void handle_se22(DDukeActor* actor)
auto sc = actor->sector();
if (actor->temp_data[1])
{
if (getanimationindex(anim_ceilingz, &sector[actor->temp_data[0]]) >= 0)
if (getanimationindex(anim_ceilingz, &sector[actor->counter]) >= 0)
sc->addceilingz(sc->extra * 9 * zmaptoworld);
else actor->temp_data[1] = 0;
}
@ -2543,10 +2543,10 @@ void handle_se27(DDukeActor* actor)
p = findplayer(actor, &xx);
if (ps[p].GetActor()->spr.extra > 0 && myconnectindex == screenpeek)
{
if (actor->temp_data[0] < 0)
if (actor->counter < 0)
{
ud.cameraactor = actor;
actor->temp_data[0]++;
actor->counter++;
}
else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
{
@ -2555,16 +2555,16 @@ void handle_se27(DDukeActor* actor)
if (xx < sh * maptoworld)
{
ud.cameraactor = actor;
actor->temp_data[0] = 999;
actor->counter = 999;
actor->spr.Angles.Yaw += deltaangle(actor->spr.Angles.Yaw, (ps[p].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
actor->spr.yint = 100 + int((actor->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) * (256. / 257.));
}
else if (actor->temp_data[0] == 999)
else if (actor->counter == 999)
{
if (ud.cameraactor == actor)
actor->temp_data[0] = 0;
else actor->temp_data[0] = -10;
actor->counter = 0;
else actor->counter = -10;
ud.cameraactor = actor;
}
@ -2573,11 +2573,11 @@ void handle_se27(DDukeActor* actor)
{
actor->spr.Angles.Yaw = (ps[p].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle();
if (actor->temp_data[0] == 999)
if (actor->counter == 999)
{
if (ud.cameraactor == actor)
actor->temp_data[0] = 0;
else actor->temp_data[0] = -20;
actor->counter = 0;
else actor->counter = -20;
ud.cameraactor = actor;
}
}
@ -2693,7 +2693,7 @@ void handle_se32(DDukeActor *actor)
{
auto sc = actor->sector();
if (actor->temp_data[0] == 1)
if (actor->counter == 1)
{
// Choose dir
@ -2708,7 +2708,7 @@ void handle_se32(DDukeActor *actor)
sc->setceilingz(actor->spr.pos.Z);
callsound(actor->sector(), actor);
actor->temp_data[2] = 0;
actor->temp_data[0] = 0;
actor->counter = 0;
}
else sc->addceilingz(Sgn(actor->spr.pos.Z - sc->ceilingz) * targetval);
}
@ -2719,7 +2719,7 @@ void handle_se32(DDukeActor *actor)
sc->setceilingz(actor->temp_pos.Z);
callsound(actor->sector(), actor);
actor->temp_data[2] = 0;
actor->temp_data[0] = 0;
actor->counter = 0;
}
else sc->addceilingz(Sgn(actor->temp_pos.Z - sc->ceilingz) * targetval);
}
@ -2730,7 +2730,7 @@ void handle_se32(DDukeActor *actor)
{
if (abs(sc->ceilingz - actor->spr.pos.Z) < targetval * 2)
{
actor->temp_data[0] = 0;
actor->counter = 0;
actor->temp_data[2] = !actor->temp_data[2];
callsound(actor->sector(), actor);
sc->setceilingz(actor->spr.pos.Z);
@ -2741,7 +2741,7 @@ void handle_se32(DDukeActor *actor)
{
if (abs(sc->ceilingz - actor->temp_pos.Z) < targetval * 2)
{
actor->temp_data[0] = 0;
actor->counter = 0;
actor->temp_data[2] = !actor->temp_data[2];
callsound(actor->sector(), actor);
}
@ -2778,21 +2778,21 @@ void handle_se35(DDukeActor *actor)
double targetval = actor->spr.yint * zmaptoworld;
switch (actor->temp_data[0])
switch (actor->counter)
{
case 0:
sc->addceilingz(targetval);
if (sc->ceilingz > sc->floorz)
sc->setfloorz(sc->ceilingz);
if (sc->ceilingz > actor->spr.pos.Z + 32)
actor->temp_data[0]++;
actor->counter++;
break;
case 1:
sc->addceilingz(-targetval * 4);
if (sc->ceilingz < actor->temp_pos.Y)
{
sc->setceilingz(actor->temp_pos.Y);
actor->temp_data[0] = 0;
actor->counter = 0;
}
break;
}
@ -2828,7 +2828,7 @@ void handle_se128(DDukeActor *actor)
if (nextwal)
nextwal->setovertexture(newtex);
if (actor->temp_data[0] < actor->temp_data[1]) actor->temp_data[0]++;
if (actor->counter < actor->temp_data[1]) actor->counter++;
else
{
wal->cstat &= (CSTAT_WALL_TRANSLUCENT | CSTAT_WALL_1WAY | CSTAT_WALL_XFLIP | CSTAT_WALL_ALIGN_BOTTOM | CSTAT_WALL_BOTTOM_SWAP);
@ -2848,12 +2848,12 @@ void handle_se130(DDukeActor *actor, int countmax)
{
auto sc = actor->sector();
if (actor->temp_data[0] > countmax)
if (actor->counter > countmax)
{
actor->Destroy();
return;
}
else actor->temp_data[0]++;
else actor->counter++;
double x = sc->floorz - sc->ceilingz;
@ -2896,7 +2896,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
auto sec = actor->sector();
if (actor->temp_data[0] == 1)
if (actor->counter == 1)
{
// Choose dir
@ -2914,7 +2914,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
sec->setfloorz(actor->spr.pos.Z);
actor->temp_data[2] = 0;
actor->temp_data[0] = 0;
actor->counter = 0;
if (choosedir) actor->temp_data[3] = actor->spr.hitag;
callsound(actor->sector(), actor);
}
@ -2944,7 +2944,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
sec->setfloorz(actor->temp_pos.Y);
callsound(actor->sector(), actor);
actor->temp_data[2] = 0;
actor->temp_data[0] = 0;
actor->counter = 0;
if (choosedir) actor->temp_data[3] = actor->spr.hitag;
}
else
@ -2974,7 +2974,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
if (abs(actor->spr.pos.Z - sec->floorz) < actor->temp_pos.Z)
{
callsound(actor->sector(), actor);
actor->temp_data[0] = 0;
actor->counter = 0;
actor->temp_data[2] = 1;
if (choosedir) actor->temp_data[3] = actor->spr.hitag;
}
@ -3001,7 +3001,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (abs(sec->floorz - actor->temp_pos.Y) < actor->temp_pos.Z)
{
actor->temp_data[0] = 0;
actor->counter = 0;
callsound(actor->sector(), actor);
actor->temp_data[2] = 1;
actor->temp_data[3] = actor->spr.hitag;
@ -3186,7 +3186,7 @@ DAngle furthestangle(DDukeActor *actor, int angs)
DAngle angincs = DAngle360 / angs;
if (!actor->isPlayer())
if ((actor->temp_data[0] & 63) > 2) return(actor->spr.Angles.Yaw + DAngle180);
if ((actor->counter & 63) > 2) return(actor->spr.Angles.Yaw + DAngle180);
for (DAngle j = actor->spr.Angles.Yaw; j < DAngle360 + actor->spr.Angles.Yaw; j += angincs)
{
@ -3214,7 +3214,7 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, DVector2& pos)
DAngle angincs;
HitInfo hit{};
if ((actor->temp_data[0] & 63)) return -1;
if ((actor->counter & 63)) return -1;
if (ud.multimode < 2 && ud.player_skill < 3)
angincs = DAngle180;
@ -3251,7 +3251,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
auto moveptr = &ScriptCode[actor->temp_data[1]];
ticselapsed = (actor->temp_data[0]) & 31;
ticselapsed = (actor->counter) & 31;
aang = actor->spr.Angles.Yaw;

View file

@ -350,7 +350,7 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip
{
if (dasectp && dasectp->lotag == ST_1_ABOVE_WATER && actor->spr.picnum == DTILE_LIZMAN)
actor->spr.Angles.Yaw = randomAngle();
else if ((actor->temp_data[0]&3) == 1 && actor->spr.picnum != DTILE_COMMANDER)
else if ((actor->counter&3) == 1 && actor->spr.picnum != DTILE_COMMANDER)
actor->spr.Angles.Yaw = randomAngle();
SetActor(actor,actor->spr.pos);
if (dasectp == nullptr) dasectp = &sector[0];
@ -536,7 +536,7 @@ void movetransports_d(void)
int sectlotag = sectp->lotag;
int onfloorz = act->temp_data[4];
if (act->temp_data[0] > 0) act->temp_data[0]--;
if (act->counter > 0) act->counter--;
DukeSectIterator itj(act->sector());
while (auto act2 = itj.Next())
@ -572,8 +572,8 @@ void movetransports_d(void)
if (Owner->GetOwner() != Owner)
{
act->temp_data[0] = 13;
Owner->temp_data[0] = 13;
act->counter = 13;
Owner->counter = 13;
ps[p].transporter_hold = 13;
}
@ -700,9 +700,9 @@ void movetransports_d(void)
if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
{
if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != STAT_MISC)
if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->counter > 0 && act2->spr.statnum != STAT_MISC)
{
act->temp_data[0]++;
act->counter++;
goto BOLT;
}
warpspriteto = 1;
@ -761,8 +761,8 @@ void movetransports_d(void)
if (Owner && Owner->GetOwner() == Owner)
{
act->temp_data[0] = 13;
Owner->temp_data[0] = 13;
act->counter = 13;
Owner->counter = 13;
}
ChangeActorSect(act2, Owner->sector());
@ -835,7 +835,7 @@ void handle_se06_d(DDukeActor* actor)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act2 = it.Next())
{
if ((act2->spr.lotag == SE_14_SUBWAY_CAR) && (sh == act2->spr.hitag) && (act2->temp_data[0] == actor->temp_data[0]))
if ((act2->spr.lotag == SE_14_SUBWAY_CAR) && (sh == act2->spr.hitag) && (act2->counter == actor->counter))
{
act2->vel.X = actor->vel.X;
//if( actor->temp_data[4] == 1 )
@ -862,19 +862,19 @@ void handle_se06_d(DDukeActor* actor)
static void handle_se28(DDukeActor* actor)
{
if (actor->temp_data[5] > 0)
if (actor->temp_data[0] > 0)
{
actor->temp_data[5]--;
actor->temp_data[0]--;
return;
}
if (actor->temp_data[0] == 0)
if (actor->counter == 0)
{
double x;
findplayer(actor, &x);
if (x > 15500 / 16.)
return;
actor->temp_data[0] = 1;
actor->counter = 1;
actor->temp_data[1] = 64 + (krand() & 511);
actor->temp_data[2] = 0;
}
@ -883,7 +883,7 @@ static void handle_se28(DDukeActor* actor)
actor->temp_data[2]++;
if (actor->temp_data[2] > actor->temp_data[1])
{
actor->temp_data[0] = 0;
actor->counter = 0;
ps[screenpeek].visibility = ud.const_visibility;
return;
}
@ -1095,13 +1095,13 @@ void moveeffectors_d(void) //STATNUM 3
break;
case SE_36_PROJ_SHOOTER:
if (act->temp_data[0])
if (act->counter)
{
if (act->temp_data[0] == 1)
if (act->counter == 1)
fi.shoot(act, sc->extra, nullptr);
else if (act->temp_data[0] == 26 * 5)
act->temp_data[0] = 0;
act->temp_data[0]++;
else if (act->counter == 26 * 5)
act->counter = 0;
act->counter++;
}
break;
@ -1145,7 +1145,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a == -1) a = 0;
actor->temp_data[0]++;
actor->counter++;
if (a & face_player)
{
@ -1158,7 +1158,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
}
if (a & spin)
actor->spr.Angles.Yaw += DAngle45 * BobVal(actor->temp_data[0] << 3);
actor->spr.Angles.Yaw += DAngle45 * BobVal(actor->counter << 3);
if (a & face_player_slow)
{
@ -1172,8 +1172,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if ((a & jumptoplayer) == jumptoplayer)
{
if (actor->temp_data[0] < 16)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2;
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2;
}
if (a & face_player_smart)
@ -1297,12 +1297,12 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((actor->temp_data[0] & 1) || ps[playernum].actorsqu == actor) return;
if ((actor->counter & 1) || ps[playernum].actorsqu == actor) return;
else daxvel *= 2;
}
else
{
if ((actor->temp_data[0] & 3) || ps[playernum].actorsqu == actor) return;
if ((actor->counter & 3) || ps[playernum].actorsqu == actor) return;
else daxvel *= 4;
}
}

View file

@ -314,7 +314,7 @@ int movesprite_ex_r(DDukeActor* actor, const DVector3& change, unsigned int clip
{
if (dasectp && dasectp->lotag == ST_1_ABOVE_WATER)
actor->spr.Angles.Yaw = randomAngle();
else if ((actor->temp_data[0] & 3) == 1)
else if ((actor->counter & 3) == 1)
actor->spr.Angles.Yaw = randomAngle();
SetActor(actor, actor->spr.pos);
if (dasectp == nullptr) dasectp = &sector[0];
@ -465,7 +465,7 @@ void movetransports_r(void)
onfloorz = act->temp_data[4];
if (act->temp_data[0] > 0) act->temp_data[0]--;
if (act->counter > 0) act->counter--;
DukeSectIterator itj(act->sector());
while (auto act2 = itj.Next())
@ -498,8 +498,8 @@ void movetransports_r(void)
if (Owner->GetOwner() != Owner)
{
act->temp_data[0] = 13;
Owner->temp_data[0] = 13;
act->counter = 13;
Owner->counter = 13;
ps[p].transporter_hold = 13;
}
@ -663,9 +663,9 @@ void movetransports_r(void)
if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
{
if (Owner->GetOwner() != Owner && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != 5)
if (Owner->GetOwner() != Owner && onfloorz && act->counter > 0 && act2->spr.statnum != 5)
{
act->temp_data[0]++;
act->counter++;
continue;
}
warpspriteto = 1;
@ -723,8 +723,8 @@ void movetransports_r(void)
if (Owner->GetOwner() != Owner)
{
act->temp_data[0] = 13;
Owner->temp_data[0] = 13;
act->counter = 13;
Owner->counter = 13;
}
ChangeActorSect(act2, Owner->sector());
@ -975,7 +975,7 @@ void handle_se06_r(DDukeActor *actor)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act2 = it.Next())
{
if ((act2->spr.lotag == SE_14_SUBWAY_CAR) && (sh == act2->spr.hitag) && (act2->temp_data[0] == actor->temp_data[0]))
if ((act2->spr.lotag == SE_14_SUBWAY_CAR) && (sh == act2->spr.hitag) && (act2->counter == actor->counter))
{
act2->vel.X = actor->vel.X;
//if( actor->temp_data[4] == 1 )
@ -1156,13 +1156,13 @@ void moveeffectors_r(void) //STATNUM 3
break;
case SE_36_PROJ_SHOOTER:
if (act->temp_data[0])
if (act->counter)
{
if (act->temp_data[0] == 1)
if (act->counter == 1)
fi.shoot(act, sc->extra, nullptr);
else if (act->temp_data[0] == 26 * 5)
act->temp_data[0] = 0;
act->temp_data[0]++;
else if (act->counter == 26 * 5)
act->counter = 0;
act->counter++;
}
break;
@ -1222,7 +1222,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a == -1) a = 0;
actor->temp_data[0]++;
actor->counter++;
if (a & face_player)
{
@ -1235,7 +1235,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
if (a & spin)
actor->spr.Angles.Yaw += DAngle45 * BobVal(actor->temp_data[0] << 3);
actor->spr.Angles.Yaw += DAngle45 * BobVal(actor->counter << 3);
if (a & face_player_slow)
{
@ -1261,51 +1261,51 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (actor->spr.picnum == RTILE_CHEER)
{
if (actor->temp_data[0] < 16)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 1.6;
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.6;
}
else
{
if (actor->temp_data[0] < 16)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2;
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2;
}
}
if (a & justjump1)
{
if (actor->spr.picnum == RTILE_RABBIT)
{
if (actor->temp_data[0] < 8)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2.133;
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.133;
}
else if (actor->spr.picnum == RTILE_MAMA)
{
if (actor->temp_data[0] < 8)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 1.83;
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.83;
}
}
if (a & justjump2)
{
if (actor->spr.picnum == RTILE_RABBIT)
{
if (actor->temp_data[0] < 8)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2.667;
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.667;
}
else if (actor->spr.picnum == RTILE_MAMA)
{
if (actor->temp_data[0] < 8)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2.286;
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.286;
}
}
if (a & windang)
{
if (actor->temp_data[0] < 8)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4) * 2.667);
if (actor->counter < 8)
actor->vel.Z -= BobVal(512 + (actor->counter << 4) * 2.667);
}
}
else if ((a & jumptoplayer) == jumptoplayer)
{
if (actor->temp_data[0] < 16)
actor->vel.Z -= BobVal(512 + (actor->temp_data[0] << 4)) * 2;
if (actor->counter < 16)
actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2;
}
@ -1424,12 +1424,12 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((actor->temp_data[0] & 1) || ps[pnum].actorsqu == actor) return;
if ((actor->counter & 1) || ps[pnum].actorsqu == actor) return;
else daxvel *= 2;
}
else
{
if ((actor->temp_data[0] & 3) || ps[pnum].actorsqu == actor) return;
if ((actor->counter & 3) || ps[pnum].actorsqu == actor) return;
else daxvel *= 4;
}
}

View file

@ -73,7 +73,7 @@ static const char *cheatGod(int myconnectindex, int state)
if (isRRRA()) S_PlaySound(218, CHAN_AUTO, CHANF_UI);
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->temp_data[0] = 0;
act->counter = 0;
act->temp_data[3] = 0;
act->curAction = &actions[0];
act->curMove = &moves[0];

View file

@ -324,7 +324,7 @@ void cameratext(DDukeActor *cam)
DrawTexture(twod, texids[tile], false, x, y, DTA_ViewportX, viewport3d.Left(), DTA_ViewportY, viewport3d.Top(), DTA_ViewportWidth, viewport3d.Width(),
DTA_ViewportHeight, viewport3d.Height(), DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_CenterOffsetRel, 2, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
};
if (!cam->temp_data[0])
if (!cam->counter)
{
drawitem(0, 24, 33, false, false);
drawitem(1, 320 - 26, 33, false, false);

View file

@ -1293,8 +1293,8 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, int(act->ovel.Y / maptoworld), sActor, sPlayer);
break;
case ACTOR_HTG_T0:
if (bSet) act->temp_data[0] = lValue;
else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer);
if (bSet) act->counter = lValue;
else SetGameVarID(lVar2, act->counter, sActor, sPlayer);
break;
case ACTOR_HTG_T1:
if (bSet) act->temp_data[1] = lValue;
@ -1313,8 +1313,8 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, act->temp_data[4], sActor, sPlayer);
break;
case ACTOR_HTG_T5:
if (bSet) act->temp_data[5] = lValue;
else SetGameVarID(lVar2, act->temp_data[5], sActor, sPlayer);
if (bSet) act->temp_data[0] = lValue;
else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer);
break;
default:
@ -1559,7 +1559,7 @@ int ParseState::parse(void)
g_ac->curMove = &moves[ai->move];
g_ac->spr.hitag = ai->moveflags;
g_ac->actioncounter = g_ac->curframe = 0;
g_ac->temp_data[0] = 0;
g_ac->counter = 0;
if (g_ac->spr.hitag & random_angle)
g_ac->spr.Angles.Yaw = randomAngle();
insptr++;
@ -1888,7 +1888,7 @@ int ParseState::parse(void)
while (1) if (parse()) break;
break;
case concmd_move:
g_ac->temp_data[0]=0;
g_ac->counter=0;
insptr++;
g_ac->curMove = &moves[*insptr];
insptr++;
@ -1931,7 +1931,7 @@ int ParseState::parse(void)
break;
case concmd_count:
insptr++;
g_ac->temp_data[0] = (short) *insptr;
g_ac->counter = (short) *insptr;
insptr++;
break;
case concmd_cstator:
@ -1989,7 +1989,7 @@ int ParseState::parse(void)
break;
case concmd_ifcount:
insptr++;
parseifelse(g_ac->temp_data[0] >= *insptr);
parseifelse(g_ac->counter >= *insptr);
break;
case concmd_ifactor:
insptr++;
@ -1997,7 +1997,7 @@ int ParseState::parse(void)
break;
case concmd_resetcount:
insptr++;
g_ac->temp_data[0] = 0;
g_ac->counter = 0;
break;
case concmd_addinventory:
insptr++;

View file

@ -2905,7 +2905,7 @@ HORIZONLY:
if (ud.clipping == 0 && psectp->lotag == 31)
{
auto secact = barrier_cast<DDukeActor*>(psectp->hitagactor);
if (secact && secact->vel.X != 0 && secact->temp_data[0] == 0)
if (secact && secact->vel.X != 0 && secact->counter == 0)
{
quickkill(p);
return;

View file

@ -3630,7 +3630,7 @@ HORIZONLY:
if (ud.clipping == 0 && psectp->lotag == ST_31_TWO_WAY_TRAIN)
{
auto act = barrier_cast<DDukeActor*>(psectp->hitagactor);
if (act && act->vel.X != 0 && act->temp_data[0] == 0)
if (act && act->vel.X != 0 && act->counter == 0)
{
quickkill(p);
return;

View file

@ -770,7 +770,7 @@ void resettimevars(void)
cloudclock = 0;
PlayClock = 0;
if (camsprite != nullptr)
camsprite->temp_data[0] = 0;
camsprite->counter = 0;
}
//---------------------------------------------------------------------------

View file

@ -290,7 +290,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
while (auto ac = it1.Next())
{
if (ac->spr.lotag == SE_12_LIGHT_SWITCH && ac->spr.hitag == actor->spr.lotag)
ac->temp_data[0] = 1;
ac->counter = 1;
}
}
}

View file

@ -578,7 +578,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
while (auto actj = it1.Next())
{
if (actj->spr.lotag == SE_12_LIGHT_SWITCH && actj->spr.hitag == ac->spr.lotag)
actj->temp_data[0] = 1;
actj->counter = 1;
}
}
}

View file

@ -95,13 +95,13 @@ int callsound(sectortype* sn, DDukeActor* whatsprite, bool endstate)
// Reset if the desired actor isn't playing anything.
bool hival = S_IsSoundValid(act->spr.hitag);
if (act->temp_data[0] == 1 && !hival && !endstate)
if (act->counter == 1 && !hival && !endstate)
{
if (!S_CheckActorSoundPlaying(act->temp_actor, snum))
act->temp_data[0] = 0;
act->counter = 0;
}
if (act->temp_data[0] == 0)
if (act->counter == 0)
{
if ((flags & (SF_GLOBAL | SF_DTAG)) != SF_GLOBAL)
{
@ -114,7 +114,7 @@ int callsound(sectortype* sn, DDukeActor* whatsprite, bool endstate)
}
if ((act->sector()->lotag & 0xff) != ST_22_SPLITTING_DOOR)
act->temp_data[0] = 1;
act->counter = 1;
}
}
else if (act->spr.hitag < 1000)
@ -129,7 +129,7 @@ int callsound(sectortype* sn, DDukeActor* whatsprite, bool endstate)
if (act->spr.hitag == act->spr.lotag) stopped = true;
}
if (act->spr.hitag && !stopped) S_PlayActorSound(act->spr.hitag, whatsprite);
act->temp_data[0] = 0;
act->counter = 0;
act->temp_actor = whatsprite;
}
return act->spr.lotag;
@ -173,7 +173,7 @@ int check_activator_motion(int lotag)
case SE_20_STRETCH_BRIDGE:
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
if (act2->temp_data[0])
if (act2->counter)
return(1);
break;
}
@ -537,7 +537,7 @@ bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum
if (act2->spr.lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->spr.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL))
if (act2->spr.hitag == actor->spr.hitag)
{
act2->temp_data[0] = d;
act2->counter = d;
if (act2->spr.lotag == SE_17_WARP_ELEVATOR) act2->temp_data[1] = d; //Make all check warp (only SE17, in SE18 this is a coordinate)
}
}
@ -739,7 +739,7 @@ static void handle_st29(sectortype* sptr, DDukeActor* actor)
{
act2->sector()->extra = -act2->sector()->extra;
act2->temp_data[0] = sectindex(sptr);
act2->counter = sectindex(sptr);
act2->temp_data[1] = 1;
}
}
@ -965,8 +965,8 @@ static void handle_st27(sectortype* sptr, DDukeActor* actor)
sptr->lotag ^= 0x8000;
if (sptr->lotag & 0x8000) //OPENING
act2->temp_data[0] = 1;
else act2->temp_data[0] = 2;
act2->counter = 1;
else act2->counter = 2;
callsound(sptr, actor);
break;
}
@ -997,9 +997,9 @@ static void handle_st28(sectortype* sptr, DDukeActor* actor)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act3 = it.Next())
{
if ((act3->spr.lotag & 0xff) == 21 && !act3->temp_data[0] &&
if ((act3->spr.lotag & 0xff) == 21 && !act3->counter &&
(act3->spr.hitag) == j)
act3->temp_data[0] = 1;
act3->counter = 1;
}
callsound(sptr, actor);
}
@ -1199,7 +1199,7 @@ void operateactivators(int low, player_struct* plr)
case SE_36_PROJ_SHOOTER:
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
a2->temp_data[0] = 1 - a2->temp_data[0];
a2->counter = 1 - a2->counter;
callsound(act->sector(), a2);
break;
}
@ -1725,9 +1725,9 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
case SE_12_LIGHT_SWITCH:
other->sector()->floorpal = 0;
other->temp_data[0]++;
if (other->temp_data[0] == 2)
other->temp_data[0]++;
other->counter++;
if (other->counter == 2)
other->counter++;
break;
case SE_24_CONVEYOR:

View file

@ -582,7 +582,7 @@ void S_StopSound(FSoundID soundid, DDukeActor* actor, int channel)
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
if (S_IsAmbientSFX(actor) && actor->sector()->lotag < 3) // ST_2_UNDERWATER
actor->temp_data[0] = 0;
actor->counter = 0;
}
}

View file

@ -336,7 +336,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
switch (actor->spr.lotag)
{
case SE_28_LIGHTNING:
if (!isRR()) actor->temp_data[5] = 65;// Delay for lightning
if (!isRR()) actor->temp_data[0] = 65;// Delay for lightning
break;
case SE_7_TELEPORT: // Transporters!!!!
case SE_23_ONE_WAY_TELEPORT:// XPTR END
@ -361,7 +361,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
return;
case SE_1_PIVOT:
actor->SetOwner(nullptr);
actor->temp_data[0] = 1;
actor->counter = 1;
break;
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
@ -603,7 +603,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
case SE_8_UP_OPEN_DOOR_LIGHTS:
//First, get the ceiling-floor shade
actor->temp_data[0] = sectp->floorshade;
actor->counter = sectp->floorshade;
actor->temp_data[1] = sectp->ceilingshade;
for (auto& wal : sectp->walls)
@ -618,7 +618,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
//First, get the ceiling-floor shade
if (!isRR()) break;
actor->temp_data[0] = sectp->floorshade;
actor->counter = sectp->floorshade;
actor->temp_data[1] = sectp->ceilingshade;
for (auto& wal : sectp->walls)
@ -713,7 +713,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
}
actor->SetOwner(nullptr);
actor->temp_data[0] = sectindex(s);
actor->counter = sectindex(s);
if (actor->spr.lotag != SE_30_TWO_WAY_TRAIN)
actor->temp_data[3] = actor->spr.hitag;
@ -734,7 +734,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
}
else if (actor->spr.lotag == SE_2_EARTHQUAKE)
{
actor->temp_data[5] = actor->sector()->getfloorslope();
actor->temp_data[0] = actor->sector()->getfloorslope();
actor->sector()->setfloorslope(0);
}
break;

View file

@ -90,7 +90,8 @@ public:
int tempsound;
};
// note: all this temp shit needs to be moved to subclass specific variables once things get cleaned up. This is a major issue with code readability.
int temp_data[6];
int counter; // sprite animation counters - were previously stored in temp_data.
int temp_data[5];
// 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, *actorstayput;
@ -99,7 +100,7 @@ public:
ActorMove* curMove;
ActorAction* curAction;
FName curAI; // no need to store the pointer here.
int16_t counter, actioncounter, curframe; // sprite animation counters - were previously stored in temp_data.
int16_t actioncounter, curframe; // sprite animation counters - were previously stored in temp_data.
EDukeFlags1 flags1;
EDukeFlags2 flags2;

View file

@ -226,6 +226,7 @@ DEFINE_FIELD(DDukeActor, floorz)
DEFINE_FIELD(DDukeActor, ceilingz)
DEFINE_FIELD(DDukeActor, saved_ammo)
DEFINE_FIELD(DDukeActor, palvals)
DEFINE_FIELD(DDukeActor, counter)
DEFINE_FIELD(DDukeActor, temp_data)
DEFINE_FIELD(DDukeActor, temp_actor)
DEFINE_FIELD(DDukeActor, seek_actor)

View file

@ -17,7 +17,7 @@ class DukeBloodPool : DukeActor
else if (Owner.pal == 6 || Owner.bGREENBLOOD)
{
self.pal = 0; // Green
self.temp_data[5] = 1; // this hurts!
self.temp_data[0] = 1; // this hurts!
}
else if (Owner.bBROWNBLOOD)
self.pal = 7; // Brown
@ -40,9 +40,9 @@ class DukeBloodPool : DukeActor
{
let sectp = self.sector;
if (self.temp_data[0] == 0)
if (self.counter == 0)
{
self.temp_data[0] = 1;
self.counter = 1;
if (sectp.floorstat & CSTAT_SECTOR_SLOPE)
{
self.Destroy();
@ -87,7 +87,7 @@ class DukeBloodPool : DukeActor
if (xx < 844 / 16. && self.scale.X > 0.09375 && self.scale.Y > 0.09375)
{
if (random(0, 256) < 16 && self.temp_data[5])
if (random(0, 256) < 16 && self.temp_data[0])
{
if (plr.boot_amount > 0)
plr.boot_amount--;

View file

@ -20,15 +20,15 @@ class DukeBloodSplat1 : DukeActor
override void Tick()
{
if (self.temp_data[0] < 14 * 26)
if (self.counter < 14 * 26)
{
let offset = frandom(0, 1);
let lerp = 1. - (double(self.temp_data[0]) / (14 * 26));
let lerp = 1. - (double(self.counter) / (14 * 26));
let zadj = (1. / 16.) * lerp;
let sadj = (1. / 12.) * lerp * REPEAT_SCALE;
self.pos.Z += zadj + offset * zadj;
self.scale.Y += sadj + offset * sadj;
self.temp_data[0]++;
self.counter++;
}
}

View file

@ -42,7 +42,7 @@ class DukeActivator : DukeActor
case SE_36_PROJ_SHOOTER:
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
a2.temp_data[0] = 1 - a2.temp_data[0];
a2.counter = 1 - a2.counter;
a2.callsound(self.sector());
break;
}

View file

@ -30,7 +30,7 @@ class DukeCrack : DukeActor
{
if (self.hitag > 0)
{
self.temp_data[0] = self.cstat;
self.counter = self.cstat;
self.temp_angle = self.angle;
if (self.ifhitbyweapon() == 2) // explosive damage
{
@ -45,7 +45,7 @@ class DukeCrack : DukeActor
}
else
{
self.cstat = self.temp_data[0];
self.cstat = self.counter;
self.angle = self.temp_angle;
self.extra = 0;
}

View file

@ -71,12 +71,12 @@ class DukeCrane : DukeActor
let sectp = self.sector;
double xx;
//self.temp_data[0] = state
//self.counter = state
//self.temp_data[1] = checking sector number
if (self.vel.X != 0) self.getGlobalZ();
if (self.temp_data[0] == 0) //Waiting to check the sector
if (self.counter == 0) //Waiting to check the sector
{
DukeSectIterator it;
for (DukeActor a2 = it.First(self.temp_sect); a2; a2 = it.Next())
@ -89,13 +89,13 @@ class DukeCrane : DukeActor
case STAT_PLAYER:
self.angle = (self.polepos - self.pos.XY).Angle();
if (a2.statnum != STAT_PLAYER) a2.SetPosition(( self.polepos, a2.pos.Z ));
self.temp_data[0]++;
self.counter++;
return;
}
}
}
else if (self.temp_data[0] == 1)
else if (self.counter == 1)
{
if (self.vel.X < 11.5)
{
@ -104,21 +104,21 @@ class DukeCrane : DukeActor
}
self.DoMove(CLIPMASK0);
if (self.sector == self.temp_sect)
self.temp_data[0]++;
self.counter++;
}
else if (self.temp_data[0] == 2 || self.temp_data[0] == 7)
else if (self.counter == 2 || self.counter == 7)
{
self.pos.Z += 6;
if (self.temp_data[0] == 2)
if (self.counter == 2)
{
if ((sectp.floorz - self.pos.Z) < 64)
if (self.spritesetindex != PIC_DEFAULT) self.setSpritesetImage(self.spritesetindex - 1);
if ((sectp.floorz - self.pos.Z) < 20)
self.temp_data[0]++;
self.counter++;
}
if (self.temp_data[0] == 7)
if (self.counter == 7)
{
if ((sectp.floorz - self.pos.Z) < 64)
{
@ -132,14 +132,14 @@ class DukeCrane : DukeActor
if (pp.on_crane == self)
pp.on_crane = null;
}
self.temp_data[0]++;
self.counter++;
self.isactive = false;
self.ownerActor = null;
}
}
}
}
else if (self.temp_data[0] == 3)
else if (self.counter == 3)
{
self.setSpritesetImage(self.spritesetindex + 1);
if (self.spritesetindex == PIC_CLOSED)
@ -169,43 +169,43 @@ class DukeCrane : DukeActor
}
}
self.temp_data[0]++;//Grabbed the sprite
self.counter++;//Grabbed the sprite
self.temp_data[2] = 0;
return;
}
}
else if (self.temp_data[0] == 4) //Delay before going up
else if (self.counter == 4) //Delay before going up
{
self.temp_data[2]++;
if (self.temp_data[2] > 10)
self.temp_data[0]++;
self.counter++;
}
else if (self.temp_data[0] == 5 || self.temp_data[0] == 8)
else if (self.counter == 5 || self.counter == 8)
{
if (self.temp_data[0] == 8 && self.spritesetindex < PIC_CLOSED)
if (self.counter == 8 && self.spritesetindex < PIC_CLOSED)
if ((sectp.floorz - self.pos.Z) > 32)
self.setSpritesetImage(self.spritesetindex + 1);
if (self.pos.Z < self.cranepos.Z)
{
self.temp_data[0]++;
self.counter++;
self.vel.X = 0;
}
else
self.pos.Z -= 6;
}
else if (self.temp_data[0] == 6)
else if (self.counter == 6)
{
if (self.vel.X < 12)
self.vel.X += 0.5;
self.angle = (self.cranepos.XY - self.pos.XY).Angle();
self.DoMove(CLIPMASK0);
if ((self.pos.XY - self.cranepos.XY).LengthSquared() < 8 * 8)
self.temp_data[0]++;
self.counter++;
}
else if (self.temp_data[0] == 9)
self.temp_data[0] = 0;
else if (self.counter == 9)
self.counter = 0;
if (self.poleactor)
self.poleactor.SetPosition(self.pos.plusZ(-34));

View file

@ -24,10 +24,10 @@ class DukeDuck : DukeLetter // shooting gallery target
{
if (self.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
self.temp_data[0]++;
if (self.temp_data[0] > 60)
self.counter++;
if (self.counter > 60)
{
self.temp_data[0] = 0;
self.counter = 0;
self.cstat = CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ALIGNMENT_WALL;
self.extra = 1;
}

View file

@ -11,7 +11,7 @@ class DukeFlamethrowerFlame : DukeActor
double xx;
Super.Tick(); // Run CON or its replacement.
if (self.bDestroyed) return; // killed by script.
self.temp_data[0]++;
self.counter++;
if (sectp.lotag == ST_2_UNDERWATER)
{
let spawned = self.spawn("DukeExplosion2");
@ -24,16 +24,16 @@ class DukeFlamethrowerFlame : DukeActor
self.getglobalz();
int ds = self.temp_data[0] / 6;
int ds = self.counter / 6;
if (self.scale.X < 0.1250)
{
self.scale.X += (ds * REPEAT_SCALE);
self.scale.Y = (self.scale.X);
}
self.clipdist += ds * 0.25;
if (self.temp_data[0] <= 2)
if (self.counter <= 2)
self.temp_data[3] = random(0, 9);
if (self.temp_data[0] > 30)
if (self.counter > 30)
{
let spawned = self.spawn("DukeExplosion2");
if (spawned) spawned.shade = 127;

View file

@ -14,7 +14,7 @@ class DukeFlammable : DukeActor
override void Tick()
{
if (self.temp_data[0] == 1)
if (self.counter == 1)
{
self.temp_data[1]++;
if ((self.temp_data[1] & 3) > 0) return;
@ -67,10 +67,10 @@ class DukeFlammable : DukeActor
{
if (hitter.bINFLAME)
{
if (self.temp_data[0] == 0)
if (self.counter == 0)
{
self.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
self.temp_data[0] = 1;
self.counter = 1;
self.spawn("DukeBurning");
}
}

View file

@ -86,28 +86,28 @@ class DukeForceSphere : DukeActor
if (!Owner) return;
if (Owner.temp_data[1] == 0)
{
if (self.temp_data[0] < 64)
if (self.counter < 64)
{
self.temp_data[0]++;
self.counter++;
size += 0.046875;
}
}
else
if (self.temp_data[0] > 64)
if (self.counter > 64)
{
self.temp_data[0]--;
self.counter--;
size -= 0.046875;
}
self.pos = Owner.pos;;
self.angle += Raze.BAngToDegree * Owner.temp_data[0];
self.angle += Raze.BAngToDegree * Owner.counter;
size = clamp(size, 1 / 64., 1.);
self.scale = (size, size);
self.shade = ((size * 32) - 48);
for (int j = self.temp_data[0]; j > 0; j--)
for (int j = self.counter; j > 0; j--)
self.DoMove(CLIPMASK0);
}
@ -143,7 +143,7 @@ class DukeForceSphere : DukeActor
let Owner = self.ownerActor;
if (Owner)
{
Owner.temp_data[0] = 32;
Owner.counter = 32;
Owner.temp_data[1] = !Owner.temp_data[1];
Owner.temp_data[2] ++;
}

View file

@ -24,15 +24,15 @@ class DukeFrameEffect : DukeActor
let Owner = self.ownerActor;
if (Owner)
{
self.temp_data[0]++;
self.counter++;
if (self.temp_data[0] > 7)
if (self.counter > 7)
{
self.Destroy();
return;
}
else if (self.temp_data[0] > 4) self.cstat |= CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
else if (self.temp_data[0] > 2) self.cstat |= CSTAT_SPRITE_TRANSLUCENT;
else if (self.counter > 4) self.cstat |= CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
else if (self.counter > 2) self.cstat |= CSTAT_SPRITE_TRANSLUCENT;
self.xoffset = Owner.xoffset;
self.yoffset = Owner.yoffset;
}

View file

@ -18,18 +18,18 @@ class DukeGlassPieces : DukeActor
return;
}
if (self.pos.Z == self.floorz - 1 && self.temp_data[0] < 3)
if (self.pos.Z == self.floorz - 1 && self.counter < 3)
{
self.vel.Z = -(3 - self.temp_data[0]) - frandom(0, 2);
self.vel.Z = -(3 - self.counter) - frandom(0, 2);
if (sectp.lotag == 2)
self.vel.Z *= 0.5;
self.scale *= 0.5;
if (Duke.rnd(96))
self.SetPosition(self.pos);
self.temp_data[0]++;//Number of bounces
self.counter++;//Number of bounces
}
else if (self.temp_data[0] == 3)
else if (self.counter == 3)
{
self.Destroy();
return;

View file

@ -53,13 +53,13 @@ class DukeGreenSlime : DukeActor
}
}
if (self.temp_data[0] == -5) // FROZEN
if (self.counter == -5) // FROZEN
{
self.temp_data[3]++;
if (self.temp_data[3] > 280)
{
self.pal = 0;
self.temp_data[0] = 0;
self.counter = 0;
return;
}
self.makeitfall();
@ -100,11 +100,11 @@ class DukeGreenSlime : DukeActor
self.cstat = 0;
else self.cstat = CSTAT_SPRITE_BLOCK_ALL;
if (self.temp_data[0] == -4) //On the player
if (self.counter == -4) //On the player
{
if (pactor.extra < 1)
{
self.temp_data[0] = 0;
self.counter = 0;
return;
}
@ -137,7 +137,7 @@ class DukeGreenSlime : DukeActor
if (spawned) spawned.pal = 0;
}
self.addkill();
self.temp_data[0] = -3;
self.counter = -3;
if (p.somethingonplayer == self)
p.somethingonplayer = nullptr;
self.Destroy();
@ -201,10 +201,10 @@ class DukeGreenSlime : DukeActor
if (p.somethingonplayer == nullptr)
{
p.somethingonplayer = self;
if (self.temp_data[0] == 3 || self.temp_data[0] == 2) //Falling downward
if (self.counter == 3 || self.counter == 2) //Falling downward
self.temp_data[2] = (12 << 8);
else self.temp_data[2] = -(13 << 8); //Climbing up duke
self.temp_data[0] = -4;
self.counter = -4;
}
}
@ -219,7 +219,7 @@ class DukeGreenSlime : DukeActor
if (j == 1) // freeze damage
{
self.PlayActorSound("SOMETHINGFROZE");
self.temp_data[0] = -5; self.temp_data[3] = 0;
self.counter = -5; self.temp_data[3] = 0;
return;
}
self.addkill();
@ -243,12 +243,12 @@ class DukeGreenSlime : DukeActor
spawned.pal = 6;
}
}
self.temp_data[0] = -3;
self.counter = -3;
self.Destroy();
return;
}
// All weap
if (self.temp_data[0] == -1) //Shrinking down
if (self.counter == -1) //Shrinking down
{
self.makeitfall();
@ -260,14 +260,14 @@ class DukeGreenSlime : DukeActor
else
{
self.scale = (0.625, 0.25);
self.temp_data[0] = 0;
self.counter = 0;
}
return;
}
else if (self.temp_data[0] != -2) self.getglobalz();
else if (self.counter != -2) self.getglobalz();
if (self.temp_data[0] == -2) //On top of somebody (an enemy)
if (self.counter == -2) //On top of somebody (an enemy)
{
DukeActor s5 = self.temp_actor;
self.makeitfall();
@ -284,7 +284,7 @@ class DukeGreenSlime : DukeActor
if (self.scale.X < 0.5) self.scale.X += (0.0625);
else
{
self.temp_data[0] = -1;
self.counter = -1;
self.temp_actor = nullptr;
double dist = (self.pos.XY - s5.pos.XY).LengthSquared();
if (dist < 48*48) {
@ -312,7 +312,7 @@ class DukeGreenSlime : DukeActor
if (dist < 48*48 && (abs(self.pos.Z - a2.pos.Z) < 16)) //Gulp them
{
self.temp_actor = a2;
self.temp_data[0] = -2;
self.counter = -2;
self.temp_data[1] = 0;
return;
}
@ -322,14 +322,14 @@ class DukeGreenSlime : DukeActor
//Moving on the ground or ceiling
if (self.temp_data[0] == 0 || self.temp_data[0] == 2)
if (self.counter == 0 || self.counter == 2)
{
self.setspriteSetImage(0);
if (random(0, 511) == 0)
self.PlayActorSound("SLIM_ROAM");
if (self.temp_data[0] == 2)
if (self.counter == 2)
{
self.vel.Z = 0;
self.cstat &= ~CSTAT_SPRITE_YFLIP;
@ -337,7 +337,7 @@ class DukeGreenSlime : DukeActor
if ((sectp.ceilingstat & CSTAT_SECTOR_SKY) || (self.ceilingz + 24) < self.pos.Z)
{
self.pos.Z += 8;
self.temp_data[0] = 3;
self.counter = 3;
return;
}
}
@ -369,12 +369,12 @@ class DukeGreenSlime : DukeActor
abs(self.floorz - self.ceilingz) < 192)
{
self.vel.Z = 0;
self.temp_data[0]++;
self.counter++;
}
}
if (self.temp_data[0] == 1)
if (self.counter == 1)
{
self.setspriteSetImage(0);
if (self.scale.Y < 0.625) self.scale.Y += (0.125);
@ -386,11 +386,11 @@ class DukeGreenSlime : DukeActor
{
self.pos.Z = self.ceilingz + 16;
self.vel.X = 0;
self.temp_data[0] = 2;
self.counter = 2;
}
}
if (self.temp_data[0] == 3)
if (self.counter == 3)
{
self.setspriteSetImage(1);
self.makeitfall();
@ -409,7 +409,7 @@ class DukeGreenSlime : DukeActor
if (self.pos.Z > self.floorz - 8)
{
self.pos.Z = self.floorz - 8;
self.temp_data[0] = 0;
self.counter = 0;
self.vel.X = 0;
}
}

View file

@ -96,13 +96,13 @@ class DukePipeBomb : DukeActor
if (sectp.lotag == ST_1_ABOVE_WATER && self.vel.Z == 0)
{
self.pos.Z += 32;
if (self.temp_data[5] == 0)
if (self.temp_data[0] == 0)
{
self.temp_data[5] = 1;
self.temp_data[0] = 1;
self.spawn("DukeWaterSplash");
}
}
else self.temp_data[5] = 0;
else self.temp_data[0] = 0;
if(self.vel.X > 0)
{
@ -140,7 +140,7 @@ class DukePipeBomb : DukeActor
if (bBoom) self.DetonateIt();
else self.pickupCheck(p);
if (self.temp_data[0] < 8) self.temp_data[0]++;
if (self.counter < 8) self.counter++;
}
void DetonateIt()
@ -179,7 +179,7 @@ class DukePipeBomb : DukeActor
let xx = (p.actor.pos - self.pos).Sum();
let Owner = self.ownerActor;
// Duke
if (xx < 788 / 16. && self.temp_data[0] > 7 && self.vel.X == 0)
if (xx < 788 / 16. && self.counter > 7 && self.vel.X == 0)
if (Raze.cansee(self.pos.plusZ(-8), self.sector, p.actor.pos.plusZ(p.actor.viewzoffset), p.cursector))
if (p.ammo_amount[weapon1] < gs.max_ammo_amount[weapon1])
{

View file

@ -18,11 +18,11 @@ class DukeCar : DukeActor
override void Tick()
{
self.pos.Z += self.vel.Z;
self.temp_data[0]++;
self.counter++;
if (self.temp_data[0] == 4) self.PlayActorSound("WAR_AMBIENCE2");
if (self.counter == 4) self.PlayActorSound("WAR_AMBIENCE2");
if (self.temp_data[0] > (26 * 8))
if (self.counter > (26 * 8))
{
Duke.PlaySound("RPG_EXPLODE");
for (int j = 0; j < 32; j++)
@ -31,7 +31,7 @@ class DukeCar : DukeActor
self.Destroy();
return;
}
else if ((self.temp_data[0] & 3) == 0)
else if ((self.counter & 3) == 0)
self.spawn("DukeExplosion2");
self.DoMove(CLIPMASK0);
}

View file

@ -65,8 +65,8 @@ class DukeJibs1 : DukeActor
if (!Raze.IsRR())
{
if (self.temp_data[5] < 30 * 10)
self.temp_data[5]++;
if (self.temp_data[0] < 30 * 10)
self.temp_data[0]++;
else
{
self.Destroy();
@ -101,14 +101,14 @@ class DukeJibs1 : DukeActor
self.temp_data[1] = 0;
if (self.behavior == 1)
{
if (self.temp_data[0] > 6) self.temp_data[0] = 0;
else self.temp_data[0]++;
if (self.counter > 6) self.counter = 0;
else self.counter++;
}
else
{
if (self.temp_data[0] > 2)
self.temp_data[0] = 0;
else self.temp_data[0]++;
if (self.counter > 2)
self.counter = 0;
else self.counter++;
}
}
@ -155,8 +155,8 @@ class DukeJibs1 : DukeActor
if (self.spritesetindex == 1)
{
self.temp_data[1]++;
if ((self.temp_data[1] & 3) == 0 && self.temp_data[0] < 7)
self.temp_data[0]++;
if ((self.temp_data[1] & 3) == 0 && self.counter < 7)
self.counter++;
if (self.temp_data[1] > 20)
{
self.Destroy();
@ -166,7 +166,7 @@ class DukeJibs1 : DukeActor
else if (self.getspritesetsize() > 1)
{
self.setSpritesetImage(1);
self.temp_data[0] = 0;
self.counter = 0;
self.temp_data[1] = 0;
}
else
@ -191,7 +191,7 @@ class DukeJibs1 : DukeActor
if (spritesetindex == 1)
{
tspr.SetSpritePic(self, 1 + self.temp_data[0]);
tspr.SetSpritePic(self, 1 + self.counter);
}
if (tspr.pal == 6) tspr.shade = -120;

View file

@ -29,7 +29,7 @@ class DukeMasterSwitch : DukeActor
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
case SE_36_PROJ_SHOOTER:
effector.temp_data[0] = 1;
effector.counter = 1;
break;
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
effector.temp_data[4] = 1;

View file

@ -12,7 +12,7 @@ class DukeMortar : DukeActor
override void Tick()
{
let spawned = self.spawn("DukeFrameEffect");
if (spawned) spawned.temp_data[0] = 3;
if (spawned) spawned.counter = 3;
Common(1);
}
@ -77,13 +77,13 @@ class DukeMortar : DukeActor
if (sectp.lotag == ST_1_ABOVE_WATER && self.vel.Z == 0)
{
self.pos.Z += 32;
if (self.temp_data[5] == 0)
if (self.temp_data[0] == 0)
{
self.temp_data[5] = 1;
self.temp_data[0] = 1;
self.spawn("DukeWaterSplash");
}
}
else self.temp_data[5] = 0;
else self.temp_data[0] = 0;
if (self.temp_data[3] == 0 && (coll.type || xx < 844 / 16.))
{
@ -149,7 +149,7 @@ class DukeMortar : DukeActor
return;
}
}
if (self.temp_data[0] < 8) self.temp_data[0]++;
if (self.counter < 8) self.counter++;
}
}

View file

@ -13,12 +13,12 @@ class DukeNukeButton : DukeActor
override void Tick()
{
if (self.temp_data[0])
if (self.counter)
{
self.temp_data[0]++;
self.counter++;
let Owner = self.ownerActor;
if (self.temp_data[0] == 8) self.setSpritesetImage(1);
else if (self.temp_data[0] == 16 && Owner)
if (self.counter == 8) self.setSpritesetImage(1);
else if (self.counter == 16 && Owner)
{
self.setSpritesetImage(2);
Owner.GetPlayer().fist_incs = 1;
@ -30,9 +30,9 @@ class DukeNukeButton : DukeActor
override bool OnUse(DukePlayer p)
{
if (self.temp_data[0] == 0 && !p.hitablockingwall())
if (self.counter == 0 && !p.hitablockingwall())
{
self.temp_data[0] = 1;
self.counter = 1;
self.ownerActor = p.actor;
p.buttonpalette = self.pal;
if (p.buttonpalette)

View file

@ -9,7 +9,7 @@ class DukeMoney : DukeActor
override void Initialize()
{
self.scale = (0.125, 0.125);
self.temp_data[0] = random(0, 2047);
self.counter = random(0, 2047);
self.cstat = self.randomFlip();
self.angle = frandom(0, 360);
self.ChangeStat(STAT_MISC);
@ -27,9 +27,9 @@ class DukeMoney : DukeActor
return;
}
self.vel.X = frandom(0, 0.5) + Raze.BobVal(self.temp_data[0]) * 2;
self.temp_data[0] += random(0, 63);
if ((self.temp_data[0] & 2047) > 512 && (self.temp_data[0] & 2047) < 1596)
self.vel.X = frandom(0, 0.5) + Raze.BobVal(self.counter) * 2;
self.counter += random(0, 63);
if ((self.counter & 2047) > 512 && (self.counter & 2047) < 1596)
{
if (sectp.lotag == ST_2_UNDERWATER)
{

View file

@ -646,9 +646,9 @@ class DukeFireball : DukeProjectile // WorldTour only
if (self.detail != 1)
{
if (self.temp_data[0] >= 1 && self.temp_data[0] < 6)
if (self.counter >= 1 && self.counter < 6)
{
double siz = 1.0 - (self.temp_data[0] * 0.2);
double siz = 1.0 - (self.counter * 0.2);
DukeActor trail = self.temp_actor;
let ball = self.spawn('DukeFireball');
if (ball)
@ -658,7 +658,7 @@ class DukeFireball : DukeProjectile // WorldTour only
ball.vel.X = self.vel.X;
ball.vel.Z = self.vel.Z;
ball.angle = self.angle;
if (self.temp_data[0] > 1)
if (self.counter > 1)
{
if (trail)
{
@ -678,7 +678,7 @@ class DukeFireball : DukeProjectile // WorldTour only
ball.ChangeStat(STAT_PROJECTILE);
}
}
self.temp_data[0]++;
self.counter++;
}
if (self.vel.Z < 15000. / 256.)
self.vel.Z += 200 / 256.;

View file

@ -34,12 +34,12 @@ class DukeRat : DukeActor
if (self.DoMove(CLIPMASK0))
{
if (!Raze.isRRRA() && random(0, 255) == 0) self.PlayActorSound("RATTY");
self.angle += Raze.BAngToDegree * (random(-15, 15) + Raze.BobVal(self.temp_data[0] << 8) * 8);
self.angle += Raze.BAngToDegree * (random(-15, 15) + Raze.BobVal(self.counter << 8) * 8);
}
else
{
self.temp_data[0]++;
if (self.temp_data[0] > 1)
self.counter++;
if (self.counter > 1)
{
self.Destroy();
return;

View file

@ -78,7 +78,7 @@ class DukeReactor : DukeActor
p.actor.extra--;
p.pals = Color(32, 32, 0, 0);
}
self.temp_data[0] += 128;
self.counter += 128;
if (self.temp_data[3] == 0)
self.temp_data[3] = 1;
}

View file

@ -25,7 +25,7 @@ class DukeRecon : DukeActor
override void initialize()
{
self.temp_data[5] = 0;
self.temp_data[0] = 0;
self.extra = 130;
self.pal = 0;
self.shade = -17;
@ -54,16 +54,16 @@ class DukeRecon : DukeActor
if (self.ifhitbyweapon() >= 0)
{
if (self.extra < 0 && self.temp_data[0] != -1)
if (self.extra < 0 && self.counter != -1)
{
self.temp_data[0] = -1;
self.counter = -1;
self.extra = 0;
}
if (painsnd >= 0) self.PlayActorSound(painsnd);
self.RANDOMSCRAP();
}
if (self.temp_data[0] == -1)
if (self.counter == -1)
{
self.pos.Z += 4;
self.temp_data[2]++;
@ -97,7 +97,7 @@ class DukeRecon : DukeActor
// 3 = findplayerz, 4 = shoot
if (self.temp_data[0] >= 4)
if (self.counter >= 4)
{
self.temp_data[2]++;
if ((self.temp_data[2] & 15) == 0)
@ -110,21 +110,21 @@ class DukeRecon : DukeActor
}
if (self.temp_data[2] > (26 * 3) || !Raze.cansee(self.pos.plusZ(-16), self.sector, pactor.pos.plusZ(pactor.viewzoffset), p.cursector))
{
self.temp_data[0] = 0;
self.counter = 0;
self.temp_data[2] = 0;
}
else self.temp_angle +=
deltaangle(self.temp_angle, (pactor.pos.XY - self.pos.XY).Angle()) / 3;
}
else if (self.temp_data[0] == 2 || self.temp_data[0] == 3)
else if (self.counter == 2 || self.counter == 3)
{
if(self.vel.X > 0) self.vel.X -= 1;
else self.vel.X = 0;
if (self.temp_data[0] == 2)
if (self.counter == 2)
{
double l = pactor.pos.Z + pactor.viewzoffset - self.pos.Z;
if (abs(l) < 48) self.temp_data[0] = 3;
if (abs(l) < 48) self.counter = 3;
else self.pos.Z += l < 0? -shift : shift; // The shift here differs between Duke and RR.
}
else
@ -132,7 +132,7 @@ class DukeRecon : DukeActor
self.temp_data[2]++;
if (self.temp_data[2] > (26 * 3) || !Raze.cansee(self.pos.plusZ(-16), self.sector, pactor.pos.plusZ(pactor.viewzoffset), p.cursector))
{
self.temp_data[0] = 1;
self.counter = 1;
self.temp_data[2] = 0;
}
else if ((self.temp_data[2] & 15) == 0 && attacksnd >= 0)
@ -144,7 +144,7 @@ class DukeRecon : DukeActor
self.angle += deltaangle(self.angle, (pactor.pos.XY - self.pos.XY).Angle()) * 0.25;
}
if (self.temp_data[0] != 2 && self.temp_data[0] != 3 && Owner)
if (self.counter != 2 && self.counter != 3 && Owner)
{
double dist = (Owner.pos.XY - self.pos.XY).Length();
if (dist <= 96)
@ -154,11 +154,11 @@ class DukeRecon : DukeActor
}
else a = (Owner.pos.XY - self.pos.XY).Angle();
if (self.temp_data[0] == 1 || self.temp_data[0] == 4) // Found a locator and going with it
if (self.counter == 1 || self.counter == 4) // Found a locator and going with it
{
dist = (Owner.pos - self.pos).Length();
if (dist <= 96) { if (self.temp_data[0] == 1) self.temp_data[0] = 0; else self.temp_data[0] = 5; }
if (dist <= 96) { if (self.counter == 1) self.counter = 0; else self.counter = 5; }
else
{
// Control speed here
@ -170,25 +170,25 @@ class DukeRecon : DukeActor
}
}
if (self.temp_data[0] < 2) self.temp_data[2]++;
if (self.counter < 2) self.temp_data[2]++;
if (xx < 384 && self.temp_data[0] < 2 && self.temp_data[2] > (26 * 4))
if (xx < 384 && self.counter < 2 && self.temp_data[2] > (26 * 4))
{
self.temp_data[0] = 2 + random(0, 1) * 2;
self.counter = 2 + random(0, 1) * 2;
self.temp_data[2] = 0;
self.temp_angle = self.angle;
}
}
if (self.temp_data[0] == 0 || self.temp_data[0] == 5)
if (self.counter == 0 || self.counter == 5)
{
if (self.temp_data[0] == 0)
self.temp_data[0] = 1;
else self.temp_data[0] = 4;
if (self.counter == 0)
self.counter = 1;
else self.counter = 4;
let NewOwner = dlevel.LocateTheLocator(self.hitag, nullptr);
if (!NewOwner)
{
self.hitag = self.temp_data[5];
self.hitag = self.temp_data[0];
NewOwner = dlevel.LocateTheLocator(self.hitag, nullptr);
if (!NewOwner)
{

View file

@ -16,15 +16,15 @@ class DukeRespawnMarker : DukeActor
override void Tick()
{
self.temp_data[0]++;
if (self.temp_data[0] > gs.respawnitemtime)
self.counter++;
if (self.counter > gs.respawnitemtime)
{
self.Destroy();
return;
}
if (self.temp_data[0] >= (gs.respawnitemtime >> 1) && self.temp_data[0] < ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
if (self.counter >= (gs.respawnitemtime >> 1) && self.counter < ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
self.setSpritesetImage(1);
else if (self.temp_data[0] > ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
else if (self.counter > ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
self.setSpritesetImage(2);
self.makeitfall();
}

View file

@ -48,15 +48,15 @@ class DukeScrap : DukeActor
if (self.spriteextra < Scrap6 + 8)
{
if (self.temp_data[0] > 6)
self.temp_data[0] = 0;
else self.temp_data[0]++;
if (self.counter > 6)
self.counter = 0;
else self.counter++;
}
else
{
if (self.temp_data[0] > 2)
self.temp_data[0] = 0;
else self.temp_data[0]++;
if (self.counter > 2)
self.counter = 0;
else self.counter++;
}
}
if (self.vel.Z < 16) self.vel.Z += (gs.gravity - 50 / 256.);
@ -87,7 +87,7 @@ class DukeScrap : DukeActor
}
else
{
let frame = self.spriteextra + self.temp_data[0];
let frame = self.spriteextra + self.counter;
if (frame < 0 || frame >= ScrapMax) frame = Scrap3;
tspr.setSpritePic(self, frame);
if (brighter[frame]) tspr.shade -= 6;

View file

@ -19,7 +19,7 @@ class DukeShell : DukeActor
let pactor = plr.actor;
ang = pactor.angle - Raze.BAngToDegree * (random(8, 71)); //Fine tune
self.temp_data[0] = random(0, 1);
self.counter = random(0, 1);
self.pos.Z = 3 + pactor.pos.Z + pactor.viewzoffset + plr.pyoff + tan(plr.getPitchWithView()) * 8. + (!isshell ? 3 : 0);
self.vel.Z = -frandom(0, 1);
}
@ -74,8 +74,8 @@ class DukeShell : DukeActor
if (self.temp_data[1] > 8)
{
self.temp_data[1] = 0;
self.temp_data[0]++;
self.temp_data[0] &= 3;
self.counter++;
self.counter &= 3;
}
if (self.vel.Z < 0.5) self. vel.Z += (gs.gravity / 13); // 8
else self.vel.Z -= 0.25;
@ -89,8 +89,8 @@ class DukeShell : DukeActor
if (self.temp_data[1] > 3)
{
self.temp_data[1] = 0;
self.temp_data[0]++;
self.temp_data[0] &= 3;
self.counter++;
self.counter &= 3;
}
if (self.vel.Z < 2) self.vel.Z += (gs.gravity / 3); // 52;
if(self.vel.X > 0)
@ -104,10 +104,10 @@ class DukeShell : DukeActor
override bool animate(tspritetype t)
{
if (self.GetSpriteSetsize() > 0) t.setspritepic(self, self.temp_data[0] & 1);
if (self.GetSpriteSetsize() > 0) t.setspritepic(self, self.counter & 1);
t.cstat |= (CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP);
if (self.temp_data[0] > 1) t.cstat &= ~CSTAT_SPRITE_XFLIP;
if (self.temp_data[0] > 2) t.cstat &= ~(CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP);
if (self.counter > 1) t.cstat &= ~CSTAT_SPRITE_XFLIP;
if (self.counter > 2) t.cstat &= ~(CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP);
return true;
}
}

View file

@ -21,23 +21,23 @@ class DukeSoundController : DukeActor
if (self.temp_data[1] != Raze.SoundEnabled())
{
self.temp_data[1] = Raze.SoundEnabled();
self.temp_data[0] = 0;
self.counter = 0;
}
let p = Duke.GetViewPlayer();
if (self.lotag >= 1000 && self.lotag < 2000)
{
double dist = (p.actor.pos.XY - self.pos.XY).LengthSquared();
if (dist < maxdist * maxdist && self.temp_data[0] == 0)
if (dist < maxdist * maxdist && self.counter == 0)
{
Raze.SetReverb(self.lotag - 1100);
self.temp_data[0] = 1;
self.counter = 1;
}
if (dist >= maxdist * maxdist && self.temp_data[0] == 1)
if (dist >= maxdist * maxdist && self.counter == 1)
{
Raze.SetReverb(0);
Raze.SetReverbDelay(0);
self.temp_data[0] = 0;
self.counter = 0;
}
}
else
@ -50,13 +50,13 @@ class DukeSoundController : DukeActor
{
double distance = (p.actor.pos - self.pos).Length();
if (distance < maxdist && self.temp_data[0] == 0)
if (distance < maxdist && self.counter == 0)
{
// Start playing an ambience sound.
self.PlayActorSound(Raze.FindSoundByResID(self.lotag), CHAN_AUTO, CHANF_LOOP);
self.temp_data[0] = 1; // AMBIENT_SFX_PLAYING
self.counter = 1; // AMBIENT_SFX_PLAYING
}
else if (distance >= maxdist && self.temp_data[0] == 1)
else if (distance >= maxdist && self.counter == 1)
{
// Stop playing ambience sound because we're out of its range.
self.StopSound(self.lotag);
@ -78,7 +78,7 @@ class DukeSoundController : DukeActor
override void OnDestroy()
{
if (self.temp_data[0] == 1)
if (self.counter == 1)
self.StopSound(-1);
Super.OnDestroy();
}

View file

@ -18,7 +18,7 @@ class DukeTongue : DukeActor
override void Tick()
{
self.temp_data[0] = int(Raze.BobVal(self.temp_data[1]) * 32);
self.counter = int(Raze.BobVal(self.temp_data[1]) * 32);
self.temp_data[1] += 32;
if (self.temp_data[1] > 2047 || statnum == STAT_MISC)
{
@ -35,7 +35,7 @@ class DukeTongue : DukeActor
self.angle = Owner.angle;
self.pos = Owner.pos.plusZ(Owner.isPlayer() ? -34 : 0);
for (int k = 0; k < self.temp_data[0]; k++)
for (int k = 0; k < self.counter; k++)
{
let pos = self.pos + self.angle.ToVector() * 2 * k;
pos.Z += k * self.vel.Z / 12;
@ -48,7 +48,7 @@ class DukeTongue : DukeActor
q.pal = 8;
}
}
int k = self.temp_data[0]; // do not depend on the above loop counter.
int k = self.counter; // do not depend on the above loop counter.
let pos = self.pos + self.angle.ToVector() * 2 * k;
pos.Z += k * self.vel.Z / 12;
let jaw = 'DukeInnerJaw';

View file

@ -82,14 +82,14 @@ class DukeTouchPlate : DukeActor
return;
}
if (self.temp_data[5] == 1) return;
if (self.temp_data[0] == 1) return;
p = Duke.checkcursectnums(sectp);
if (p != null && (p.on_ground || self.intangle == 512))
{
if (self.temp_data[0] == 0 && !dlevel.check_activator_motion(self.lotag))
if (self.counter == 0 && !dlevel.check_activator_motion(self.lotag))
{
self.temp_data[0] = 1;
self.counter = 1;
self.temp_data[1] = 1;
self.temp_data[3] = !self.temp_data[3];
dlevel.operatemasterswitches(self.lotag);
@ -97,11 +97,11 @@ class DukeTouchPlate : DukeActor
if (self.hitag > 0)
{
self.hitag--;
if (self.hitag == 0) self.temp_data[5] = 1;
if (self.hitag == 0) self.temp_data[0] = 1;
}
}
}
else self.temp_data[0] = 0;
else self.counter = 0;
if (self.temp_data[1] == 1)
{

View file

@ -100,15 +100,15 @@ class DukeTripBomb : DukeActor
self.angle = ang;
}
if (self.temp_data[0] < 32)
if (self.counter < 32)
{
DukePlayer p;
double x;
[p, x] = self.findplayer();
if (x > 48) self.temp_data[0]++;
else if (self.temp_data[0] > 16) self.temp_data[0]++;
if (x > 48) self.counter++;
else if (self.counter > 16) self.counter++;
}
if (self.temp_data[0] == 32)
if (self.counter == 32)
{
let ang = self.angle;
self.angle = self.temp_angle;
@ -164,7 +164,7 @@ class DukeTripBomb : DukeActor
}
}
self.temp_data[0]++;
self.counter++;
self.pos = self.temp_pos;
self.ChangeSector(oldSect);
self.temp_data[3] = 0;
@ -175,7 +175,7 @@ class DukeTripBomb : DukeActor
}
else self.temp_data[2] = 0;
}
if (self.temp_data[0] == 33)
if (self.counter == 33)
{
self.temp_data[1]++;
@ -211,7 +211,7 @@ class DukeTripBombPlaced : DukeTripBomb
self.ownerActor = self;
self.vel.X = 1;
self.DoMove(CLIPMASK0);
self.temp_data[0] = 17;
self.counter = 17;
self.temp_data[2] = 0;
self.temp_angle = self.angle;
self.ChangeStat(STAT_ZOMBIEACTOR);

View file

@ -29,7 +29,7 @@ class DukeViewscreen : DukeActor
{
camsprite = null;
self.yint = 0;
self.temp_data[0] = 0;
self.counter = 0;
}
}
}
@ -61,7 +61,7 @@ class DukeViewscreen : DukeActor
{
let actor = DukeActor(tspr.ownerActor);
let hitowner = actor.hitOwnerActor;
if (camsprite != null && hitowner && hitowner.temp_data[0] == 1)
if (camsprite != null && hitowner && hitowner.counter == 1)
{
tspr.SetSpritePic(self, 1);
tspr.cstat &= ~ (CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP);
@ -118,7 +118,7 @@ class DukeCamera : DukeActor
override void Tick()
{
if (self.temp_data[0] == 0)
if (self.counter == 0)
{
self.temp_data[1] += 8;
if (gs.camerashitable)
@ -126,7 +126,7 @@ class DukeCamera : DukeActor
int j = self.ifhitbyweapon();
if (j >= 0)
{
self.temp_data[0] = 1; // static
self.counter = 1; // static
self.cstat = CSTAT_SPRITE_INVISIBLE;
for (int x = 0; x < 5; x++)
self.RANDOMSCRAP();

View file

@ -25,12 +25,12 @@ class DukeWaterFountain : DukeActor
override void Tick()
{
if (self.temp_data[0] > 0 && self.spritesetindex < 4)
if (self.counter > 0 && self.spritesetindex < 4)
{
int frame = self.spritesetindex;
if (self.temp_data[0] < 20)
if (self.counter < 20)
{
self.temp_data[0]++;
self.counter++;
frame++;
@ -45,10 +45,10 @@ class DukeWaterFountain : DukeActor
// this does not really work, but fixing this will probably draw complaints for not being authentic.
if ((self.pos - p.actor.pos.plusZ(28)).Sum() > 32)
{
self.temp_data[0] = 0;
self.counter = 0;
self.setSpritesetImage(0);
}
else self.temp_data[0] = 1;
else self.counter = 1;
}
}
}
@ -71,9 +71,9 @@ class DukeWaterFountain : DukeActor
override bool onUse(DukePlayer user)
{
if (self.temp_data[0] != 1)
if (self.counter != 1)
{
self.temp_data[0] = 1;
self.counter = 1;
let act = user.actor;
self.ownerActor = act;

View file

@ -45,8 +45,8 @@ class DukeWatersplash : DukeActor
void DoTick(bool check)
{
let sectp = self.sector;
self.temp_data[0]++;
if (self.temp_data[0] == 1)
self.counter++;
if (self.counter == 1)
{
if (check)
{
@ -56,9 +56,9 @@ class DukeWatersplash : DukeActor
if (!Duke.CheckSoundPlaying("ITEM_SPLASH"))
self.PlayActorSound("ITEM_SPLASH");
}
if (self.temp_data[0] == 3)
if (self.counter == 3)
{
self.temp_data[0] = 0;
self.counter = 0;
self.temp_data[1]++;
}
if (self.temp_data[1] == 5)

View file

@ -168,7 +168,8 @@ class DukeActor : CoreActor native
native double floorz, ceilingz, hitang;
native int saved_ammo;
native int palvals;
native int temp_data[6];
native int counter;
native int temp_data[5];
native private int flags1, flags2, flags3;
native walltype temp_walls[2];
native sectortype temp_sect, actorstayput;