- variable renaming in movecrane for clarity

This commit is contained in:
Christoph Oelckers 2020-10-24 10:32:21 +02:00
parent d95131cb4d
commit 08f3e9e722

View file

@ -648,14 +648,14 @@ void movefx(void)
void movecrane(int i, int crane) void movecrane(int i, int crane)
{ {
auto t = &hittype[i].temp_data[0]; auto t = &hittype[i].temp_data[0];
auto s = &sprite[i]; auto spri = &sprite[i];
int sect = s->sectnum; int sect = spri->sectnum;
int x; int x;
//t[0] = state //t[0] = state
//t[1] = checking sector number //t[1] = checking sector number
if (s->xvel) getglobalz(i); if (spri->xvel) getglobalz(i);
if (t[0] == 0) //Waiting to check the sector if (t[0] == 0) //Waiting to check the sector
{ {
@ -669,7 +669,7 @@ void movecrane(int i, int crane)
case STAT_ZOMBIEACTOR: case STAT_ZOMBIEACTOR:
case STAT_STANDABLE: case STAT_STANDABLE:
case STAT_PLAYER: case STAT_PLAYER:
s->ang = getangle(msx[t[4] + 1] - s->x, msy[t[4] + 1] - s->y); spri->ang = getangle(msx[t[4] + 1] - spri->x, msy[t[4] + 1] - spri->y);
setsprite(j, msx[t[4] + 1], msy[t[4] + 1], sprite[j].z); setsprite(j, msx[t[4] + 1], msy[t[4] + 1], sprite[j].z);
t[0]++; t[0]++;
return; return;
@ -679,10 +679,10 @@ void movecrane(int i, int crane)
else if (t[0] == 1) else if (t[0] == 1)
{ {
if (s->xvel < 184) if (spri->xvel < 184)
{ {
s->picnum = crane + 1; spri->picnum = crane + 1;
s->xvel += 8; spri->xvel += 8;
} }
//IFMOVING; // JBF 20040825: see my rant above about this //IFMOVING; // JBF 20040825: see my rant above about this
ssp(i, CLIPMASK0); ssp(i, CLIPMASK0);
@ -691,48 +691,48 @@ void movecrane(int i, int crane)
} }
else if (t[0] == 2 || t[0] == 7) else if (t[0] == 2 || t[0] == 7)
{ {
s->z += (1024 + 512); spri->z += (1024 + 512);
if (t[0] == 2) if (t[0] == 2)
{ {
if ((sector[sect].floorz - s->z) < (64 << 8)) if ((sector[sect].floorz - spri->z) < (64 << 8))
if (s->picnum > crane) s->picnum--; if (spri->picnum > crane) spri->picnum--;
if ((sector[sect].floorz - s->z) < (4096 + 1024)) if ((sector[sect].floorz - spri->z) < (4096 + 1024))
t[0]++; t[0]++;
} }
if (t[0] == 7) if (t[0] == 7)
{ {
if ((sector[sect].floorz - s->z) < (64 << 8)) if ((sector[sect].floorz - spri->z) < (64 << 8))
{ {
if (s->picnum > crane) s->picnum--; if (spri->picnum > crane) spri->picnum--;
else else
{ {
if (s->owner == -2) if (spri->owner == -2)
{ {
auto p = findplayer(s, &x); auto p = findplayer(spri, &x);
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i); S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
if (ps[p].on_crane == &hittype[i]) if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = nullptr; ps[p].on_crane = nullptr;
} }
t[0]++; t[0]++;
s->owner = -1; spri->owner = -1;
} }
} }
} }
} }
else if (t[0] == 3) else if (t[0] == 3)
{ {
s->picnum++; spri->picnum++;
if (s->picnum == (crane + 2)) if (spri->picnum == (crane + 2))
{ {
auto p = checkcursectnums(t[1]); auto p = checkcursectnums(t[1]);
if (p >= 0 && ps[p].on_ground) if (p >= 0 && ps[p].on_ground)
{ {
s->owner = -2; spri->owner = -2;
ps[p].on_crane = &hittype[i]; ps[p].on_crane = &hittype[i];
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i); S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
ps[p].angle.addadjustment(s->ang + 1024); ps[p].angle.addadjustment(spri->ang + 1024);
} }
else else
{ {
@ -744,7 +744,7 @@ void movecrane(int i, int crane)
{ {
case 1: case 1:
case 6: case 6:
s->owner = j; spri->owner = j;
break; break;
} }
} }
@ -763,68 +763,68 @@ void movecrane(int i, int crane)
} }
else if (t[0] == 5 || t[0] == 8) else if (t[0] == 5 || t[0] == 8)
{ {
if (t[0] == 8 && s->picnum < (crane + 2)) if (t[0] == 8 && spri->picnum < (crane + 2))
if ((sector[sect].floorz - s->z) > 8192) if ((sector[sect].floorz - spri->z) > 8192)
s->picnum++; spri->picnum++;
if (s->z < msx[t[4] + 2]) if (spri->z < msx[t[4] + 2])
{ {
t[0]++; t[0]++;
s->xvel = 0; spri->xvel = 0;
} }
else else
s->z -= (1024 + 512); spri->z -= (1024 + 512);
} }
else if (t[0] == 6) else if (t[0] == 6)
{ {
if (s->xvel < 192) if (spri->xvel < 192)
s->xvel += 8; spri->xvel += 8;
s->ang = getangle(msx[t[4]] - s->x, msy[t[4]] - s->y); spri->ang = getangle(msx[t[4]] - spri->x, msy[t[4]] - spri->y);
//IFMOVING; // JBF 20040825: see my rant above about this //IFMOVING; // JBF 20040825: see my rant above about this
ssp(i, CLIPMASK0); ssp(i, CLIPMASK0);
if (((s->x - msx[t[4]]) * (s->x - msx[t[4]]) + (s->y - msy[t[4]]) * (s->y - msy[t[4]])) < (128 * 128)) if (((spri->x - msx[t[4]]) * (spri->x - msx[t[4]]) + (spri->y - msy[t[4]]) * (spri->y - msy[t[4]])) < (128 * 128))
t[0]++; t[0]++;
} }
else if (t[0] == 9) else if (t[0] == 9)
t[0] = 0; t[0] = 0;
setsprite(msy[t[4] + 2], s->x, s->y, s->z - (34 << 8)); setsprite(msy[t[4] + 2], spri->x, spri->y, spri->z - (34 << 8));
if (s->owner != -1) if (spri->owner != -1)
{ {
auto p = findplayer(s, &x); auto p = findplayer(spri, &x);
int j = fi.ifhitbyweapon(i); int j = fi.ifhitbyweapon(i);
if (j >= 0) if (j >= 0)
{ {
if (s->owner == -2) if (spri->owner == -2)
if (ps[p].on_crane == &hittype[i]) if (ps[p].on_crane == &hittype[i])
ps[p].on_crane = nullptr; ps[p].on_crane = nullptr;
s->owner = -1; spri->owner = -1;
s->picnum = crane; spri->picnum = crane;
return; return;
} }
if (s->owner >= 0) if (spri->owner >= 0)
{ {
setsprite(s->owner, s->x, s->y, s->z); setsprite(spri->owner, spri->x, spri->y, spri->z);
hittype[s->owner].bposx = s->x; hittype[spri->owner].bposx = spri->x;
hittype[s->owner].bposy = s->y; hittype[spri->owner].bposy = spri->y;
hittype[s->owner].bposz = s->z; hittype[spri->owner].bposz = spri->z;
s->zvel = 0; spri->zvel = 0;
} }
else if (s->owner == -2) else if (spri->owner == -2)
{ {
auto ang = ps[p].angle.ang.asbuild(); auto ang = ps[p].angle.ang.asbuild();
ps[p].oposx = ps[p].posx; ps[p].oposx = ps[p].posx;
ps[p].oposy = ps[p].posy; ps[p].oposy = ps[p].posy;
ps[p].oposz = ps[p].posz; ps[p].oposz = ps[p].posz;
ps[p].posx = s->x - (sintable[(ang + 512) & 2047] >> 6); ps[p].posx = spri->x - (sintable[(ang + 512) & 2047] >> 6);
ps[p].posy = s->y - (sintable[ang & 2047] >> 6); ps[p].posy = spri->y - (sintable[ang & 2047] >> 6);
ps[p].posz = s->z + (2 << 8); ps[p].posz = spri->z + (2 << 8);
setsprite(ps[p].i, ps[p].posx, ps[p].posy, ps[p].posz); setsprite(ps[p].i, ps[p].posx, ps[p].posy, ps[p].posz);
ps[p].cursectnum = sprite[ps[p].i].sectnum; ps[p].cursectnum = sprite[ps[p].i].sectnum;
} }