- Duke: eliminated all local short variables in actors*.cpp.

This commit is contained in:
Christoph Oelckers 2021-11-07 14:07:08 +01:00
parent 9b2b34a026
commit fd2764dc6e
7 changed files with 67 additions and 68 deletions

View file

@ -411,7 +411,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
int32_t inside(int32_t x, int32_t y, int sectnum);
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags = 0);
void dragpoint(int pointhighlight, int32_t dax, int32_t day, uint8_t flags = 0);
int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
int32_t vx, int32_t vy, int32_t vz,
vec3_t * const intp, int32_t strictly_smaller_than_p);

View file

@ -1177,7 +1177,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
// flags:
// 1: don't reset walbitmap[] (the bitmap of already dragged vertices)
// 2: In the editor, do wall[].cstat |= (1<<14) also for the lastwall().
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags)
void dragpoint(int pointhighlight, int32_t dax, int32_t day, uint8_t flags)
{
int32_t i, numyaxwalls=0;
static int16_t yaxwalls[MAXWALLS];

View file

@ -129,7 +129,7 @@ void checkavailinven(struct player_struct* player)
void checkavailweapon(struct player_struct* player)
{
short i, snum;
int i, snum;
int weap;
if (player->wantweaponfire >= 0)
@ -283,7 +283,7 @@ void ms(DDukeActor* const actor)
{
//T1,T2 and T3 are used for all the sector moving stuff!!!
short startwall, endwall, x;
int startwall, endwall, x;
int tx, ty;
auto s = actor->s;
@ -383,7 +383,7 @@ void movedummyplayers(void)
else
{
if (spri->sector()->lotag != 2) spri->z = spri->sector()->floorz;
spri->cstat = (short)32768;
spri->cstat = 32768;
}
}
@ -1662,7 +1662,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
{
if (actor_tog == 1)
{
s->cstat = (short)32768;
s->cstat = 32768;
return;
}
else if (actor_tog == 2) s->cstat = 257;
@ -1873,8 +1873,8 @@ void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int
{
if (sprj->lotag == 1)
{
sprj->lotag = (short)65535;
sprj->hitag = (short)65535;
sprj->lotag = -1;
sprj->hitag = -1;
}
}
else if (sprj->picnum == REACTOR)
@ -1887,7 +1887,7 @@ void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int
}
else if (sprj->picnum == REACTORSPARK || sprj->picnum == REACTOR2SPARK)
{
sprj->cstat = (short)32768;
sprj->cstat = 32768;
}
}
return;
@ -2006,7 +2006,7 @@ void camera(DDukeActor *actor)
if (j >= 0)
{
t[0] = 1; // static
s->cstat = (short)32768;
s->cstat = 32768;
for (int x = 0; x < 5; x++)
RANDOMSCRAP(actor);
return;
@ -2604,7 +2604,7 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
//
//---------------------------------------------------------------------------
void gutsdir(DDukeActor* actor, short gtype, short n, short p)
void gutsdir(DDukeActor* actor, int gtype, int n, int p)
{
int sx, sy;
@ -3452,8 +3452,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
if (ldist(Owner, actor) < 1024)
{
short ta;
ta = s->ang;
auto ta = s->ang;
s->ang = getangle(ps[p].pos.x - s->x, ps[p].pos.y - s->y);
s->ang = ta;
actor->SetOwner(nullptr);
@ -3526,7 +3525,7 @@ void handle_se08(DDukeActor *actor, bool checkhitag1)
if (j >= 0)
{
short sn;
int sn;
if ((sc->lotag & 0x8000) || actor->temp_data[4])
x = -t[3];
@ -4307,8 +4306,8 @@ void handle_se20(DDukeActor* actor)
}
}
dragpoint((short)t[1], wall[t[1]].x + x, wall[t[1]].y + l);
dragpoint((short)t[2], wall[t[2]].x + x, wall[t[2]].y + l);
dragpoint(t[1], wall[t[1]].x + x, wall[t[1]].y + l);
dragpoint(t[2], wall[t[2]].x + x, wall[t[2]].y + l);
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursectnum == s->sectnum && ps[p].on_ground)
@ -5178,7 +5177,7 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day
void alterang(int ang, DDukeActor* actor, int playernum)
{
auto s = actor->s;
short aang, angdif, goalang, j;
int aang, angdif, goalang, j;
int ticselapsed;
int* t = actor->temp_data;

View file

@ -342,10 +342,10 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
walltype* wal;
int d, q, x1, y1;
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
short p, x;
int p, x;
int sect;
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
int tempsect[128]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
auto spri = actor->s;
@ -353,14 +353,14 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if(spri->picnum != SHRINKSPARK)
{
tempshort[0] = spri->sectnum;
tempsect[0] = spri->sectnum;
dasect = spri->sectnum;
auto dasectp = spri->sector();
sectcnt = 0; sectend = 1;
do
{
dasect = tempshort[sectcnt++];
dasect = tempsect[sectcnt++];
if (((dasectp->ceilingz - spri->z) >> 8) < r)
{
d = abs(wall[dasectp->wallptr].x - spri->x) + abs(wall[dasectp->wallptr].y - spri->y);
@ -384,8 +384,8 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (nextsect >= 0)
{
for (dasect = sectend - 1; dasect >= 0; dasect--)
if (tempshort[dasect] == nextsect) break;
if (dasect < 0) tempshort[sectend++] = nextsect;
if (tempsect[dasect] == nextsect) break;
if (dasect < 0) tempsect[sectend++] = nextsect;
}
x1 = (((wal->x + wall[wal->point2].x) >> 1) + spri->x) >> 1;
y1 = (((wal->y + wall[wal->point2].y) >> 1) + spri->y) >> 1;
@ -393,7 +393,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
fi.checkhitwall(actor, x, wal->x, wal->y, spri->z, spri->picnum);
}
} while (sectcnt < sectend);
} while (sectcnt < sectend && sectcnt < countof(tempsect));
}
SKIPWALLCHECK:
@ -541,7 +541,7 @@ SKIPWALLCHECK:
int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision &result)
{
int daz, h, oldx, oldy;
short cd;
int clipdist;
int dasectnum;
auto spri = actor->s;
@ -574,13 +574,13 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
else
{
if (spri->picnum == LIZMAN)
cd = 292;
clipdist = 292;
else if (actorflag(actor, SFLAG_BADGUY))
cd = spri->clipdist << 2;
clipdist = spri->clipdist << 2;
else
cd = 192;
clipdist = 192;
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), cd, (4 << 8), (4 << 8), cliptype, result);
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), clipdist, (4 << 8), (4 << 8), cliptype, result);
}
// conditional code from hell...
@ -629,17 +629,17 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
//
//---------------------------------------------------------------------------
void lotsofmoney_d(DDukeActor *actor, short n)
void lotsofmoney_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, MONEY);
}
void lotsofmail_d(DDukeActor *actor, short n)
void lotsofmail_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, MAIL);
}
void lotsofpaper_d(DDukeActor *actor, short n)
void lotsofpaper_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, PAPER);
}
@ -650,7 +650,7 @@ void lotsofpaper_d(DDukeActor *actor, short n)
//
//---------------------------------------------------------------------------
void guts_d(DDukeActor* actor, short gtype, short n, short p)
void guts_d(DDukeActor* actor, int gtype, int n, int p)
{
auto s = actor->s;
int gutz, floorz;
@ -707,7 +707,7 @@ void guts_d(DDukeActor* actor, short gtype, short n, short p)
void movefta_d(void)
{
int x, px, py, sx, sy;
short p;
int p;
int psect, ssect;
int j;
@ -825,7 +825,7 @@ DDukeActor* ifhitsectors_d(int sectnum)
int ifhitbyweapon_d(DDukeActor *actor)
{
short p;
int p;
auto spri = actor->s;
auto hitowner = actor->GetHitOwner();
@ -2323,7 +2323,7 @@ static void greenslime(DDukeActor *actor)
{
if (actor_tog == 1)
{
s->cstat = (short)32768;
s->cstat = 32768;
return;
}
else if (actor_tog == 2) s->cstat = 257;
@ -2459,7 +2459,7 @@ static void greenslime(DDukeActor *actor)
if (t[3] > 0)
{
short frames[] = { 5,5,6,6,7,7,6,5 };
static const uint8_t frames[] = { 5,5,6,6,7,7,6,5 };
s->picnum = GREENSLIME + frames[t[3]];
@ -2977,7 +2977,7 @@ DETONATEB:
{
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->cstat = 32768;
s->yrepeat = 9;
return;
}
@ -3020,7 +3020,7 @@ DETONATEB:
{
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->cstat = 32768;
}
}
@ -3192,7 +3192,7 @@ void moveactors_d(void)
{
if (actor_tog == 1)
{
s->cstat = (short)32768;
s->cstat = 32768;
continue;
}
else if (actor_tog == 2) s->cstat = 257;
@ -3788,7 +3788,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
auto spr = actor->s;
auto t = actor->temp_data;
int l;
short goalang, angdif;
int goalang, angdif;
int daxvel;
int a = spr->hitag;

View file

@ -116,7 +116,7 @@ void check_fta_sounds_r(DDukeActor* actor)
void addweapon_r(struct player_struct* p, int weapon)
{
short cw = p->curr_weapon;
int cw = p->curr_weapon;
if (p->OnMotorcycle || p->OnBoat)
{
p->gotweapon[weapon] = true;;
@ -221,10 +221,10 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
sectortype* dasectp;
int d, q, x1, y1;
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
short p, x;
int p, x;
int sect;
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
int tempsect[128]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
auto spri = actor->s;
@ -233,14 +233,14 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (spri->picnum == RPG || ((isRRRA()) && spri->picnum == RPG2)) goto SKIPWALLCHECK;
}
tempshort[0] = spri->sectnum;
tempsect[0] = spri->sectnum;
dasect = spri->sectnum;
dasectp = spri->sector();
sectcnt = 0; sectend = 1;
do
{
dasect = tempshort[sectcnt++];
dasect = tempsect[sectcnt++];
if (((dasectp->ceilingz - spri->z) >> 8) < r)
{
d = abs(wall[dasectp->wallptr].x - spri->x) + abs(wall[dasectp->wallptr].y - spri->y);
@ -264,8 +264,8 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (nextsect >= 0)
{
for (dasect = sectend - 1; dasect >= 0; dasect--)
if (tempshort[dasect] == nextsect) break;
if (dasect < 0) tempshort[sectend++] = nextsect;
if (tempsect[dasect] == nextsect) break;
if (dasect < 0) tempsect[sectend++] = nextsect;
}
x1 = (((wal->x + wall[wal->point2].x) >> 1) + spri->x) >> 1;
y1 = (((wal->y + wall[wal->point2].y) >> 1) + spri->y) >> 1;
@ -273,7 +273,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
fi.checkhitwall(actor, x, wal->x, wal->y, spri->z, spri->picnum);
}
} while (sectcnt < sectend);
} while (sectcnt < sectend && sectcnt < countof(tempsect));
SKIPWALLCHECK:
@ -387,7 +387,7 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
{
int daz, h, oldx, oldy;
int dasectnum;
short cd;
int clipdist;
auto spri = actor->s;
int bg = badguy(actor);
@ -417,8 +417,8 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 1024L, (4 << 8), (4 << 8), cliptype, result);
else
{
cd = 192;
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), cd, (4 << 8), (4 << 8), cliptype, result);
clipdist = 192;
clipmove_ex(&spri->x, &spri->y, &daz, &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))
@ -461,7 +461,7 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
//
//---------------------------------------------------------------------------
void lotsoffeathers_r(DDukeActor *actor, short n)
void lotsoffeathers_r(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, MONEY);
}
@ -473,7 +473,7 @@ void lotsoffeathers_r(DDukeActor *actor, short n)
//
//---------------------------------------------------------------------------
void guts_r(DDukeActor* actor, short gtype, short n, short p)
void guts_r(DDukeActor* actor, int gtype, int n, int p)
{
auto s = actor->s;
int gutz, floorz;
@ -530,7 +530,7 @@ void guts_r(DDukeActor* actor, short gtype, short n, short p)
void movefta_r(void)
{
int x, px, py, sx, sy;
short j, p;
int j, p;
int psect, ssect;
DukeStatIterator it(STAT_ZOMBIEACTOR);
@ -2733,7 +2733,7 @@ DETONATEB:
{
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->cstat = 32768;
}
}
@ -3091,7 +3091,7 @@ void moveactors_r(void)
{
if( actor_tog == 1)
{
s->cstat = (short)32768;
s->cstat = 32768;
continue;
}
else if(actor_tog == 2) s->cstat = 257;
@ -3684,7 +3684,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
auto spr = actor->s;
auto t = actor->temp_data;
int l;
short goalang, angdif;
int goalang, angdif;
int daxvel;
int a = spr->hitag;

View file

@ -64,12 +64,12 @@ void addweapon_d(struct player_struct* p, int weapon);
void addweapon_r(struct player_struct* p, int weapon);
void hitradius_d(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
void hitradius_r(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
void lotsofmoney_d(DDukeActor* s, short n);
void lotsofmail_d(DDukeActor* s, short n);
void lotsofpaper_d(DDukeActor* s, short n);
void lotsoffeathers_r(DDukeActor* s, short n);
void guts_d(DDukeActor* s, short gtype, short n, short p);
void guts_r(DDukeActor* s, short gtype, short n, short p);
void lotsofmoney_d(DDukeActor* s, int n);
void lotsofmail_d(DDukeActor* s, int n);
void lotsofpaper_d(DDukeActor* s, int n);
void lotsoffeathers_r(DDukeActor* s, int n);
void guts_d(DDukeActor* s, int gtype, int n, int p);
void guts_r(DDukeActor* s, int gtype, int n, int p);
DDukeActor* ifhitsectors_d(int sectnum);
DDukeActor* ifhitsectors_r(int sectnum);
int ifhitbyweapon_r(DDukeActor* sn);

View file

@ -92,10 +92,10 @@ struct Dispatcher
bool (*floorspace)(sectortype* sectp);
void (*addweapon)(struct player_struct *p, int weapon);
void (*hitradius)(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
void (*lotsofmoney)(DDukeActor *s, short n);
void (*lotsofmail)(DDukeActor *s, short n);
void (*lotsofpaper)(DDukeActor *s, short n);
void (*guts)(DDukeActor* s, short gtype, short n, short p);
void (*lotsofmoney)(DDukeActor *s, int n);
void (*lotsofmail)(DDukeActor *s, int n);
void (*lotsofpaper)(DDukeActor *s, int n);
void (*guts)(DDukeActor* s, int gtype, int n, int p);
DDukeActor* (*ifhitsectors)(int sectnum);
int (*ifhitbyweapon)(DDukeActor* sectnum);
void (*fall)(DDukeActor* actor, int g_p);