- grouped all of Duke's constant per-session state in a single struct.

Mainly done so later the script export can be done more easily.
This also renames a few of the affected variables for clarity.
This commit is contained in:
Christoph Oelckers 2020-11-29 13:54:58 +01:00
parent a34f5debe8
commit 7ad0750839
27 changed files with 372 additions and 389 deletions

View file

@ -91,8 +91,8 @@ void addammo(int weapon, struct player_struct* player, int amount)
{
player->ammo_amount[weapon] += amount;
if (player->ammo_amount[weapon] > max_ammo_amount[weapon])
player->ammo_amount[weapon] = max_ammo_amount[weapon];
if (player->ammo_amount[weapon] > gs.max_ammo_amount[weapon])
player->ammo_amount[weapon] = gs.max_ammo_amount[weapon];
}
//---------------------------------------------------------------------------
@ -420,7 +420,7 @@ void moveplayers(void)
{
spri->x = p->oposx;
spri->y = p->oposy;
act->bposz = spri->z = p->oposz + PHEIGHT;
act->bposz = spri->z = p->oposz + gs.playerheight;
spri->ang = p->angle.oang.asbuild();
setsprite(act, spri->pos);
}
@ -454,7 +454,7 @@ void moveplayers(void)
}
if (ud.god)
{
spri->extra = max_player_health;
spri->extra = gs.max_player_health;
spri->cstat = 257;
if (!isWW2GI() && !isRR())
p->jetpack_amount = 1599;
@ -959,7 +959,7 @@ void detonate(DDukeActor *actor, int explosion)
{
int x = spri->extra;
spawn(actor, explosion);
fi.hitradius(actor, seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
fi.hitradius(actor, gs.seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
}
@ -1421,12 +1421,12 @@ void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, i
if (s->xrepeat >= 10)
{
int x = s->extra;
fi.hitradius(actor, rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
fi.hitradius(actor, gs.rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
}
else
{
int x = s->extra + (global_random & 3);
fi.hitradius(actor, (rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
fi.hitradius(actor, (gs.rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
}
}
@ -1439,14 +1439,14 @@ void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, i
bool respawnmarker(DDukeActor *actor, int yellow, int green)
{
actor->temp_data[0]++;
if (actor->temp_data[0] > respawnitemtime)
if (actor->temp_data[0] > gs.respawnitemtime)
{
deletesprite(actor);
return false;
}
if (actor->temp_data[0] >= (respawnitemtime >> 1) && actor->temp_data[0] < ((respawnitemtime >> 1) + (respawnitemtime >> 2)))
if (actor->temp_data[0] >= (gs.respawnitemtime >> 1) && actor->temp_data[0] < ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
actor->s.picnum = yellow;
else if (actor->temp_data[0] > ((respawnitemtime >> 1) + (respawnitemtime >> 2)))
else if (actor->temp_data[0] > ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2)))
actor->s.picnum = green;
makeitfall(actor);
return true;
@ -1999,7 +1999,7 @@ void camera(DDukeActor *actor)
int* t = &actor->temp_data[0];
if (t[0] == 0)
{
if (camerashitable)
if (gs.camerashitable)
{
int j = fi.ifhitbyweapon(actor);
if (j >= 0)
@ -2181,11 +2181,11 @@ bool money(DDukeActor* actor, int BLOODPOOL)
if (sector[sect].lotag == 2)
{
if (s->zvel < 64)
s->zvel += (gc >> 5) + (krand() & 7);
s->zvel += (gs.gravity >> 5) + (krand() & 7);
}
else
if (s->zvel < 144)
s->zvel += (gc >> 5) + (krand() & 7);
s->zvel += (gs.gravity >> 5) + (krand() & 7);
}
ssp(actor, CLIPMASK0);
@ -2290,7 +2290,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
s->zvel += 48;
else s->zvel = 1024;
}
else s->zvel += gc - 50;
else s->zvel += gs.gravity - 50;
}
s->x += mulscale14(s->xvel, bcos(s->ang));
@ -2460,7 +2460,7 @@ void shell(DDukeActor* actor, bool morecheck)
t[0]++;
t[0] &= 3;
}
if (s->zvel < 128) s->zvel += (gc / 13); // 8
if (s->zvel < 128) s->zvel += (gs.gravity / 13); // 8
else s->zvel -= 64;
if (s->xvel > 0)
s->xvel -= 4;
@ -2475,7 +2475,7 @@ void shell(DDukeActor* actor, bool morecheck)
t[0]++;
t[0] &= 3;
}
if (s->zvel < 512) s->zvel += (gc / 3); // 52;
if (s->zvel < 512) s->zvel += (gs.gravity / 3); // 52;
if (s->xvel > 0)
s->xvel--;
else
@ -2575,7 +2575,7 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
else t[0]++;
}
}
if (s->zvel < 4096) s->zvel += gc - 50;
if (s->zvel < 4096) s->zvel += gs.gravity - 50;
s->x += mulscale14(s->xvel, bcos(s->ang));
s->y += mulscale14(s->xvel, bsin(s->ang));
s->z += s->zvel;
@ -2613,7 +2613,7 @@ void gutsdir(DDukeActor* actor, short gtype, short n, short p)
if (gutz > (floorz - (8 << 8)))
gutz = floorz - (8 << 8);
gutz += actorinfo[actor->s.picnum].gutsoffset;
gutz += gs.actorinfo[actor->s.picnum].gutsoffset;
for (int j = 0; j < n; j++)
{
@ -4332,7 +4332,7 @@ void handle_se20(DDukeActor* actor)
ps[p].oposx = ps[p].posx;
ps[p].oposy = ps[p].posy;
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + gs.playerheight);
}
sc->addfloorxpan(-x / 8.f);
@ -4594,7 +4594,7 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, int TRIPBOMB
{
if (ps[p].cursectnum == actor->s.sectnum && ps[p].on_ground)
{
if (abs(ps[p].pos.z - ps[p].truefz) < PHEIGHT + (9 << 8))
if (abs(ps[p].pos.z - ps[p].truefz) < gs.playerheight + (9 << 8))
{
ps[p].fric.x += x << 3;
ps[p].fric.y += l << 3;
@ -5037,8 +5037,8 @@ void makeitfall(DDukeActor* actor)
else
{
if( fi.ceilingspace(s->sectnum) || sector[s->sectnum].lotag == ST_2_UNDERWATER)
c = gc/6;
else c = gc;
c = gs.gravity/6;
else c = gs.gravity;
}
if (isRRRA())
@ -5288,8 +5288,8 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
else
{
if (fi.ceilingspace(s->sectnum) || sector[s->sectnum].lotag == 2)
c = gc / 6;
else c = gc;
c = gs.gravity / 6;
else c = gs.gravity;
}
if (actor->cgg <= 0 || (sector[s->sectnum].floorstat & 2))
@ -5352,7 +5352,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
}
}
if (sector[s->sectnum].lotag == 1)
s->z += actorinfo[s->picnum].falladjustz;
s->z += gs.actorinfo[s->picnum].falladjustz;
else s->zvel = 0;
}
}

View file

@ -438,9 +438,9 @@ SKIPWALLCHECK:
continue;
}
if (spri2->picnum == APLAYER) spri2->z -= PHEIGHT;
if (spri2->picnum == APLAYER) spri2->z -= gs.playerheight;
d = dist(actor, act2);
if (spri2->picnum == APLAYER) spri2->z += PHEIGHT;
if (spri2->picnum == APLAYER) spri2->z += gs.playerheight;
if (d < r && cansee(spri2->x, spri2->y, spri2->z - (8 << 8), spri2->sectnum, spri->x, spri->y, spri->z - (12 << 8), spri->sectnum))
{
@ -665,7 +665,7 @@ void guts_d(DDukeActor* actor, short gtype, short n, short p)
if (gutz > (floorz - (8 << 8)))
gutz = floorz - (8 << 8);
gutz += actorinfo[s->picnum].gutsoffset;
gutz += gs.actorinfo[s->picnum].gutsoffset;
if (badguy(actor) && s->pal == 6)
pal = 6;
@ -1004,9 +1004,9 @@ void movefallers_d(void)
else
{
if (fi.ceilingspace(s->sectnum))
x = gc / 6;
x = gs.gravity / 6;
else
x = gc;
x = gs.gravity;
}
if (s->z < (sector[sect].floorz - FOURSLEIGHT))
@ -1066,7 +1066,7 @@ static void movetripbomb(DDukeActor *actor)
S_PlayActorSound(LASERTRIP_EXPLODE, actor);
for (j = 0; j < 5; j++) RANDOMSCRAP(actor);
x = s->extra;
fi.hitradius(actor, tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x);
fi.hitradius(actor, gs.tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x);
auto spawned = spawn(actor, EXPLOSION2);
spawned->s.ang = s->ang;
@ -1268,13 +1268,13 @@ static void movefireext(DDukeActor* actor)
int x = actor->s.extra;
spawn(actor, EXPLOSION2);
fi.hitradius(actor, pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
fi.hitradius(actor, gs.pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
detonate(actor, EXPLOSION2);
}
else
{
fi.hitradius(actor, seenineblastradius, 10, 15, 20, 25);
fi.hitradius(actor, gs.seenineblastradius, 10, 15, 20, 25);
deletesprite(actor);
}
}
@ -1846,7 +1846,7 @@ static void weaponcommon_d(DDukeActor* proj)
}
}
else if (s->picnum == SPIT) if (s->zvel < 6144)
s->zvel += gc - 112;
s->zvel += gs.gravity - 112;
if (coll.type != 0)
{
@ -1886,7 +1886,7 @@ static void weaponcommon_d(DDukeActor* proj)
{
spawn(proj, SHRINKEREXPLOSION);
S_PlayActorSound(SHRINKER_HIT, proj);
fi.hitradius(proj, shrinkerblastradius, 0, 0, 0, 0);
fi.hitradius(proj, gs.shrinkerblastradius, 0, 0, 0, 0);
}
else if (s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER && (!isWorldTour() || s->picnum != FIREBALL))
{
@ -2058,7 +2058,7 @@ void movetransports_d(void)
ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x;
ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y;
ps[p].oposz = ps[p].posz = Owner->s.z - PHEIGHT;
ps[p].oposz = ps[p].posz = Owner->s.z - gs.playerheight;
changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spr2->sectnum;
@ -2144,7 +2144,7 @@ void movetransports_d(void)
ps[p].cursectnum = Owner->s.sectnum;
changespritesect(act2, Owner->s.sectnum);
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + gs.playerheight);
if ((krand() & 255) < 32)
spawn(act2, WATERSPLASH2);
@ -2610,7 +2610,7 @@ static void greenslime(DDukeActor *actor)
DukeSectIterator it(sect);
while (auto a2 = it.Next())
{
if (actorinfo[a2->s.picnum].flags & SFLAG_GREENSLIMEFOOD)
if (gs.actorinfo[a2->s.picnum].flags & SFLAG_GREENSLIMEFOOD)
{
if (ldist(actor, a2) < 768 && (abs(s->z - a2->s.z) < 8192)) //Gulp them
{
@ -2814,12 +2814,12 @@ static void flamethrowerflame(DDukeActor *actor)
if (s->xrepeat >= 10)
{
x = s->extra;
fi.hitradius(actor, rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
fi.hitradius(actor, gs.rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
}
else
{
x = s->extra + (global_random & 3);
fi.hitradius(actor, (rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
fi.hitradius(actor, (gs.rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
}
}
}
@ -2963,9 +2963,9 @@ DETONATEB:
int m = 0;
switch (s->picnum)
{
case HEAVYHBOMB: m = pipebombblastradius; break;
case MORTER: m = morterblastradius; break;
case BOUNCEMINE: m = bouncemineblastradius; break;
case HEAVYHBOMB: m = gs.pipebombblastradius; break;
case MORTER: m = gs.morterblastradius; break;
case BOUNCEMINE: m = gs.bouncemineblastradius; break;
}
fi.hitradius(actor, m, x >> 2, x >> 1, x - (x >> 2), x);
@ -2991,7 +2991,7 @@ DETONATEB:
}
else
{
t[2] = respawnitemtime;
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->yrepeat = 9;
@ -3001,7 +3001,7 @@ DETONATEB:
}
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON])
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON])
{
if (ud.coop >= 1 && Owner == actor)
{
@ -3034,7 +3034,7 @@ DETONATEB:
}
else
{
t[2] = respawnitemtime;
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
}
@ -3970,8 +3970,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
}
else
{
ps[playernum].posxv = mulscale(ps[playernum].posxv, dukefriction - 0x2000, 16);
ps[playernum].posyv = mulscale(ps[playernum].posyv, dukefriction - 0x2000, 16);
ps[playernum].posxv = mulscale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16);
ps[playernum].posyv = mulscale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16);
}
}
else if (spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != COMMANDER)

View file

@ -305,9 +305,9 @@ SKIPWALLCHECK:
continue;
}
if (spri2->picnum == APLAYER) spri2->z -= PHEIGHT;
if (spri2->picnum == APLAYER) spri2->z -= gs.playerheight;
d = dist(actor, act2);
if (spri2->picnum == APLAYER) spri2->z += PHEIGHT;
if (spri2->picnum == APLAYER) spri2->z += gs.playerheight;
if (d < r && cansee(spri2->x, spri2->y, spri2->z - (8 << 8), spri2->sectnum, spri->x, spri->y, spri->z - (12 << 8), spri->sectnum))
{
@ -487,7 +487,7 @@ void guts_r(DDukeActor* actor, short gtype, short n, short p)
if (gutz > (floorz - (8 << 8)))
gutz = floorz - (8 << 8);
gutz += actorinfo[s->picnum].gutsoffset;
gutz += gs.actorinfo[s->picnum].gutsoffset;
if (badguy(actor) && s->pal == 6)
pal = 6;
@ -859,9 +859,9 @@ void movefallers_r(void)
else
{
if (fi.ceilingspace(s->sectnum))
x = gc / 6;
x = gs.gravity / 6;
else
x = gc;
x = gs.gravity;
}
if (s->z < (sector[sect].floorz - FOURSLEIGHT))
@ -1459,7 +1459,7 @@ static void weaponcommon_r(DDukeActor *proj)
}
}
else if (s->picnum == SPIT) if (s->zvel < 6144)
s->zvel += gc - 112;
s->zvel += gs.gravity - 112;
if (coll.type != 0)
{
@ -1639,7 +1639,7 @@ void movetransports_r(void)
ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x;
ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y;
ps[p].oposz = ps[p].posz = Owner->s.z - (PHEIGHT - (4 << 8));
ps[p].oposz = ps[p].posz = Owner->s.z - (gs.playerheight - (4 << 8));
changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = spr2->sectnum;
@ -2674,11 +2674,11 @@ DETONATEB:
int m = 0;
switch (s->picnum)
{
case TRIPBOMBSPRITE: m = tripbombblastradius; break; // powder keg
case HEAVYHBOMB: m = pipebombblastradius; break;
case HBOMBAMMO: m = pipebombblastradius; break;
case MORTER: m = morterblastradius; break;
case CHEERBOMB: m = morterblastradius; break;
case TRIPBOMBSPRITE: m = gs.tripbombblastradius; break; // powder keg
case HEAVYHBOMB: m = gs.pipebombblastradius; break;
case HBOMBAMMO: m = gs.pipebombblastradius; break;
case MORTER: m = gs.morterblastradius; break;
case CHEERBOMB: m = gs.morterblastradius; break;
}
if (sector[s->sectnum].lotag != 800)
@ -2713,7 +2713,7 @@ DETONATEB:
}
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < max_ammo_amount[DYNAMITE_WEAPON])
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON])
if (s->pal == 0)
{
if (ud.coop >= 1)
@ -2747,7 +2747,7 @@ DETONATEB:
}
else
{
t[2] = respawnitemtime;
t[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
s->cstat = (short)32768;
}
@ -3692,10 +3692,10 @@ void moveeffectors_r(void) //STATNUM 3
int adjustfall(DDukeActor *actor, int c)
{
if ((actor->s.picnum == BIKERB || actor->s.picnum == CHEERB) && c == gc)
c = gc>>2;
else if (actor->s.picnum == BIKERBV2 && c == gc)
c = gc>>3;
if ((actor->s.picnum == BIKERB || actor->s.picnum == CHEERB) && c == gs.gravity)
c = gs.gravity>>2;
else if (actor->s.picnum == BIKERBV2 && c == gs.gravity)
c = gs.gravity>>3;
return c;
}
@ -3934,8 +3934,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
else
{
ps[pnum].posxv = mulscale(ps[pnum].posxv, dukefriction - 0x2000, 16);
ps[pnum].posyv = mulscale(ps[pnum].posyv, dukefriction - 0x2000, 16);
ps[pnum].posxv = mulscale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16);
ps[pnum].posyv = mulscale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16);
}
}
else if ((isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RRRA) ||

View file

@ -419,9 +419,9 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (ps[p].newOwner != nullptr)
{
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
t4 = ScriptCode[gs.actorinfo[APLAYER].scriptaddress + 1];
t3 = 0;
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
t1 = ScriptCode[gs.actorinfo[APLAYER].scriptaddress + 2];
}
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
@ -498,7 +498,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
break;
}
if (actorinfo[s->picnum].scriptaddress)
if (gs.actorinfo[s->picnum].scriptaddress)
{
if (t4)
{
@ -637,7 +637,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (!Owner) break;
if (sector[t->sectnum].lotag == 2) t->pal = 8;
t->z = Owner->z - (3 << 8);
if (lasermode == 2 && ps[screenpeek].heat_on == 0)
if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0)
t->yrepeat = 0;
case EXPLOSION2:
case EXPLOSION2BOT:

View file

@ -470,9 +470,9 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (ps[p].newOwner != nullptr)
{
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
t4 = ScriptCode[gs.actorinfo[APLAYER].scriptaddress + 1];
t3 = 0;
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
t1 = ScriptCode[gs.actorinfo[APLAYER].scriptaddress + 2];
}
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
@ -636,7 +636,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
break;
}
if (actorinfo[s->picnum].scriptaddress && (t->cstat & 48) != 48)
if (gs.actorinfo[s->picnum].scriptaddress && (t->cstat & 48) != 48)
{
if (t4)
{

View file

@ -67,7 +67,7 @@ static const char *cheatGod(int myconnectindex, int state)
auto act = p->GetActor();
p->dead_flag = 0;
act->s.extra = max_player_health;
act->s.extra = gs.max_player_health;
act->extra = 0;
if (ud.god)
{
@ -91,9 +91,9 @@ static const char *cheatGod(int myconnectindex, int state)
else
{
ud.god = 0;
act->s.extra = max_player_health;
act->s.extra = gs.max_player_health;
act->extra = -1;
ps[myconnectindex].last_extra = max_player_health;
ps[myconnectindex].last_extra = gs.max_player_health;
return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_OFF);
}
}
@ -176,12 +176,12 @@ const char* GameInterface::GenericCheat(int player, int cheat)
case CHT_BIKE:
OnMotorcycle(&ps[player], nullptr);
ps[player].ammo_amount[MOTORCYCLE_WEAPON] = max_ammo_amount[MOTORCYCLE_WEAPON];
ps[player].ammo_amount[MOTORCYCLE_WEAPON] = gs.max_ammo_amount[MOTORCYCLE_WEAPON];
return quoteMgr.GetQuote(QUOTE_ON_BIKE);
case CHT_BOAT:
OnBoat(&ps[player], 0);
ps[player].ammo_amount[BOAT_WEAPON] = max_ammo_amount[BOAT_WEAPON];
ps[player].ammo_amount[BOAT_WEAPON] = gs.max_ammo_amount[BOAT_WEAPON];
return quoteMgr.GetQuote(QUOTE_ON_BOAT);
case CHT_TONY:
@ -230,7 +230,7 @@ static bool cheatWeapons(int player)
for (int weapon = PISTOL_WEAPON; weapon < weaponLimit; weapon++ )
{
addammo( weapon, &ps[player], max_ammo_amount[weapon] );
addammo( weapon, &ps[player], gs.max_ammo_amount[weapon] );
ps[player].gotweapon.Set(weapon);
}
if (isRRRA())
@ -258,7 +258,7 @@ static bool cheatInventory(int player)
invGet(6400, EVENT_CHEATGETSCUBA, ps[player].scuba_amount);
invGet(2400, EVENT_CHEATGETHOLODUKE, ps[player].holoduke_amount);
invGet(isRR() ? 600 : 1600, EVENT_CHEATGETJETPACK, ps[player].jetpack_amount);
invGet(max_player_health, EVENT_CHEATGETFIRSTAID, ps[player].firstaid_amount);
invGet(gs.max_player_health, EVENT_CHEATGETFIRSTAID, ps[player].firstaid_amount);
return true;
}
@ -487,7 +487,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
break;
case GIVE_HEALTH:
ps[player].GetActor()->s.extra = max_player_health << 1;
ps[player].GetActor()->s.extra = gs.max_player_health << 1;
break;
case GIVE_WEAPONS:
@ -499,7 +499,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
{
int maxw = isShareware() ? SHRINKER_WEAPON : MAX_WEAPONS;
for (int i = maxw; i >= PISTOL_WEAPON; i--)
addammo(i, &ps[player], max_ammo_amount[i]);
addammo(i, &ps[player], gs.max_ammo_amount[i]);
break;
}

View file

@ -40,13 +40,13 @@ BEGIN_DUKE_NS
void initactorflags_d()
{
actorinfo[COMMANDER].gutsoffset = -(24 << 8);
gs.actorinfo[COMMANDER].gutsoffset = -(24 << 8);
for (auto &fa : actorinfo)
for (auto &fa : gs.actorinfo)
{
fa.falladjustz = 24 << 8;
}
actorinfo[OCTABRAIN].falladjustz = actorinfo[COMMANDER].falladjustz = actorinfo[DRONE].falladjustz = 0;
gs.actorinfo[OCTABRAIN].falladjustz = gs.actorinfo[COMMANDER].falladjustz = gs.actorinfo[DRONE].falladjustz = 0;
setflag(SFLAG_INTERNAL_BADGUY, {
SHARK,
@ -223,24 +223,24 @@ void initactorflags_d()
GREENSLIME + 7,
});
actorinfo[ORGANTIC].aimoffset = 32 << 8;
actorinfo[ROTATEGUN].aimoffset = 32 << 8;
gs.actorinfo[ORGANTIC].aimoffset = 32 << 8;
gs.actorinfo[ROTATEGUN].aimoffset = 32 << 8;
weaponsandammosprites[0] = RPGSPRITE;
weaponsandammosprites[1] = CHAINGUNSPRITE;
weaponsandammosprites[2] = DEVISTATORAMMO;
weaponsandammosprites[3] = RPGAMMO;
weaponsandammosprites[4] = RPGAMMO;
weaponsandammosprites[5] = JETPACK;
weaponsandammosprites[6] = SHIELD;
weaponsandammosprites[7] = FIRSTAID;
weaponsandammosprites[8] = STEROIDS;
weaponsandammosprites[9] = RPGAMMO;
weaponsandammosprites[10] = RPGAMMO;
weaponsandammosprites[11] = RPGSPRITE;
weaponsandammosprites[12] = RPGAMMO;
weaponsandammosprites[13] = FREEZESPRITE;
weaponsandammosprites[14] = FREEZEAMMO;
gs.weaponsandammosprites[0] = RPGSPRITE;
gs.weaponsandammosprites[1] = CHAINGUNSPRITE;
gs.weaponsandammosprites[2] = DEVISTATORAMMO;
gs.weaponsandammosprites[3] = RPGAMMO;
gs.weaponsandammosprites[4] = RPGAMMO;
gs.weaponsandammosprites[5] = JETPACK;
gs.weaponsandammosprites[6] = SHIELD;
gs.weaponsandammosprites[7] = FIRSTAID;
gs.weaponsandammosprites[8] = STEROIDS;
gs.weaponsandammosprites[9] = RPGAMMO;
gs.weaponsandammosprites[10] = RPGAMMO;
gs.weaponsandammosprites[11] = RPGSPRITE;
gs.weaponsandammosprites[12] = RPGAMMO;
gs.weaponsandammosprites[13] = FREEZESPRITE;
gs.weaponsandammosprites[14] = FREEZEAMMO;
TILE_BOX = BOX;
TILE_TREE1 = TREE1;

View file

@ -34,17 +34,17 @@ BEGIN_DUKE_NS
void initactorflags_r()
{
for (auto &fa : actorinfo)
for (auto &fa : gs.actorinfo)
{
fa.falladjustz = 24 << 8;
}
if (isRRRA())
{
actorinfo[HULKBOAT].falladjustz = 12 << 8;
actorinfo[MINIONBOAT].falladjustz = 3 << 8;
actorinfo[CHEERBOAT].falladjustz = actorinfo[EMPTYBOAT].falladjustz = 6 << 8;
gs.actorinfo[HULKBOAT].falladjustz = 12 << 8;
gs.actorinfo[MINIONBOAT].falladjustz = 3 << 8;
gs.actorinfo[CHEERBOAT].falladjustz = gs.actorinfo[EMPTYBOAT].falladjustz = 6 << 8;
}
actorinfo[DRONE].falladjustz = 0;
gs.actorinfo[DRONE].falladjustz = 0;
setflag(SFLAG_INTERNAL_BADGUY|SFLAG_KILLCOUNT, {
@ -100,11 +100,11 @@ void initactorflags_r()
UFO5});
// Why does the pig count as kill? Let's undo that.
actorinfo[PIG].flags &= ~SFLAG_KILLCOUNT;
actorinfo[HEN].flags &= ~SFLAG_KILLCOUNT;
gs.actorinfo[PIG].flags &= ~SFLAG_KILLCOUNT;
gs.actorinfo[HEN].flags &= ~SFLAG_KILLCOUNT;
actorinfo[DRONE].flags |= SFLAG_NOWATERDIP;
actorinfo[VIXEN].flags |= SFLAG_NOCANSEECHECK;
gs.actorinfo[DRONE].flags |= SFLAG_NOWATERDIP;
gs.actorinfo[VIXEN].flags |= SFLAG_NOCANSEECHECK;
if (isRRRA())
{
setflag(SFLAG_KILLCOUNT, { ROCK, ROCK2 }); //???
@ -198,23 +198,23 @@ void initactorflags_r()
DOLPHIN2,
TOUGHGAL });
actorinfo[RPG2].flags |= SFLAG_FORCEAUTOAIM;
gs.actorinfo[RPG2].flags |= SFLAG_FORCEAUTOAIM;
weaponsandammosprites[0] = RPGSPRITE;
weaponsandammosprites[1] = CHAINGUNSPRITE;
weaponsandammosprites[2] = DEVISTATORAMMO;
weaponsandammosprites[3] = RPGAMMO;
weaponsandammosprites[4] = RPGAMMO;
weaponsandammosprites[5] = JETPACK;
weaponsandammosprites[6] = SHIELD;
weaponsandammosprites[7] = FIRSTAID;
weaponsandammosprites[8] = STEROIDS;
weaponsandammosprites[9] = RPGAMMO;
weaponsandammosprites[10] = RPGAMMO;
weaponsandammosprites[11] = RPGSPRITE;
weaponsandammosprites[12] = RPGAMMO;
weaponsandammosprites[13] = FREEZESPRITE;
weaponsandammosprites[14] = FREEZEAMMO;
gs.weaponsandammosprites[0] = RPGSPRITE;
gs.weaponsandammosprites[1] = CHAINGUNSPRITE;
gs.weaponsandammosprites[2] = DEVISTATORAMMO;
gs.weaponsandammosprites[3] = RPGAMMO;
gs.weaponsandammosprites[4] = RPGAMMO;
gs.weaponsandammosprites[5] = JETPACK;
gs.weaponsandammosprites[6] = SHIELD;
gs.weaponsandammosprites[7] = FIRSTAID;
gs.weaponsandammosprites[8] = STEROIDS;
gs.weaponsandammosprites[9] = RPGAMMO;
gs.weaponsandammosprites[10] = RPGAMMO;
gs.weaponsandammosprites[11] = RPGSPRITE;
gs.weaponsandammosprites[12] = RPGAMMO;
gs.weaponsandammosprites[13] = FREEZESPRITE;
gs.weaponsandammosprites[14] = FREEZEAMMO;
TILE_BOX = BOX;
TILE_TREE1 = TREE1;
@ -267,7 +267,7 @@ void initactorflags_r()
TILE_FLOORPLASMA = FLOORPLASMA;
TILE_EGG = EGG;
PHEIGHT = PHEIGHT_RR;
gs.playerheight = PHEIGHT_RR;
}
END_DUKE_NS

View file

@ -1181,14 +1181,14 @@ int ConCompiler::parsecommand()
transnum(LABEL_DEFINE);
lnum = popscriptvalue();
actorinfo[lnum].scriptaddress = parsing_actor; // TRANSITIONAL should only store an index
gs.actorinfo[lnum].scriptaddress = parsing_actor; // TRANSITIONAL should only store an index
if (tw == concmd_useractor)
{
if (j & 1)
actorinfo[lnum].flags |= SFLAG_BADGUY;
gs.actorinfo[lnum].flags |= SFLAG_BADGUY;
if (j & 2)
actorinfo[lnum].flags |= (SFLAG_BADGUY | SFLAG_BADGUYSTAYPUT);
gs.actorinfo[lnum].flags |= (SFLAG_BADGUY | SFLAG_BADGUYSTAYPUT);
}
for (j = 0; j < 4; j++)
@ -1888,45 +1888,45 @@ int ConCompiler::parsecommand()
ud.const_visibility = parseone();
impact_damage = parseone();
max_player_health = parseone();
max_armour_amount = parseone();
respawnactortime = parseone();
respawnitemtime = parseone();
dukefriction = parseone();
if (isPlutoPak() || isRR()) gc = parseone();
rpgblastradius = parseone();
pipebombblastradius = parseone();
shrinkerblastradius = parseone();
tripbombblastradius = parseone();
morterblastradius = parseone();
bouncemineblastradius = parseone();
seenineblastradius = parseone();
gs.max_player_health = parseone();
gs.max_armour_amount = parseone();
gs.respawnactortime = parseone();
gs.respawnitemtime = parseone();
gs.playerfriction = parseone();
if (isPlutoPak() || isRR()) gs.gravity = parseone();
gs.rpgblastradius = parseone();
gs.pipebombblastradius = parseone();
gs.shrinkerblastradius = parseone();
gs.tripbombblastradius = parseone();
gs.morterblastradius = parseone();
gs.bouncemineblastradius = parseone();
gs.seenineblastradius = parseone();
max_ammo_amount[1] = parseone();
max_ammo_amount[2] = parseone();
max_ammo_amount[3] = parseone();
max_ammo_amount[4] = parseone();
max_ammo_amount[5] = parseone();
max_ammo_amount[6] = parseone();
max_ammo_amount[7] = parseone();
max_ammo_amount[8] = parseone();
max_ammo_amount[9] = parseone();
if (isPlutoPak() || isRR()) max_ammo_amount[11] = parseone();
if (isRR()) max_ammo_amount[12] = parseone();
camerashitable = parseone();
numfreezebounces = parseone();
gs.max_ammo_amount[1] = parseone();
gs.max_ammo_amount[2] = parseone();
gs.max_ammo_amount[3] = parseone();
gs.max_ammo_amount[4] = parseone();
gs.max_ammo_amount[5] = parseone();
gs.max_ammo_amount[6] = parseone();
gs.max_ammo_amount[7] = parseone();
gs.max_ammo_amount[8] = parseone();
gs.max_ammo_amount[9] = parseone();
if (isPlutoPak() || isRR()) gs.max_ammo_amount[11] = parseone();
if (isRR()) gs.max_ammo_amount[12] = parseone();
gs.camerashitable = parseone();
gs.numfreezebounces = parseone();
freezerhurtowner = parseone();
if (isPlutoPak() || isRR())
{
spriteqamount = clamp(parseone(), 0, 1024);
lasermode = parseone();
gs.lasermode = parseone();
}
if (isWorldTour()) max_ammo_amount[12] = parseone();
if (isWorldTour()) gs.max_ammo_amount[12] = parseone();
if (isRRRA())
{
max_ammo_amount[13] = parseone();
max_ammo_amount[14] = parseone();
max_ammo_amount[16] = parseone();
gs.max_ammo_amount[13] = parseone();
gs.max_ammo_amount[14] = parseone();
gs.max_ammo_amount[16] = parseone();
}
return 0;
}
@ -1951,7 +1951,7 @@ int ConCompiler::parsecommand()
transnum(LABEL_DEFINE);
int n = popscriptvalue();
tileinfo[n].loadeventscriptptr = parsing_actor;
gs.tileinfo[n].loadeventscriptptr = parsing_actor;
checking_ifelse = 0;
return 0;
}
@ -3146,7 +3146,7 @@ void ConCompiler::setmusic()
void loadcons()
{
memset(&actorinfo, 0, sizeof(actorinfo));
memset(&gs.actorinfo, 0, sizeof(gs.actorinfo));
ScriptCode.Clear();
labels.Clear();

View file

@ -1862,7 +1862,7 @@ int ParseState::parse(void)
return 1;
case concmd_addammo:
insptr++;
if( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] )
if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
{
killit_flag = 2;
break;
@ -1919,7 +1919,7 @@ int ParseState::parse(void)
case concmd_addweapon:
insptr++;
if( ps[g_p].gotweapon[*insptr] == 0 ) fi.addweapon( &ps[g_p], *insptr );
else if( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] )
else if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
{
killit_flag = 2;
break;
@ -1949,8 +1949,8 @@ int ParseState::parse(void)
j = ps[g_p].GetActor()->s.extra;
if (j > 0)
j += *insptr;
if (j > max_player_health * 2)
j = max_player_health * 2;
if (j > gs.max_player_health * 2)
j = gs.max_player_health * 2;
if (j < 0)
j = 0;
@ -1958,8 +1958,8 @@ int ParseState::parse(void)
{
if (*insptr > 0)
{
if ((j - *insptr) < (max_player_health >> 2) &&
j >= (max_player_health >> 2))
if ((j - *insptr) < (gs.max_player_health >> 2) &&
j >= (gs.max_player_health >> 2))
S_PlayActorSound(DUKE_GOTHEALTHATLOW, ps[g_p].GetActor());
ps[g_p].last_extra = j;
@ -1970,10 +1970,10 @@ int ParseState::parse(void)
if (ps[g_p].drink_amt > 100)
ps[g_p].drink_amt = 100;
if (ps[g_p].GetActor()->s.extra >= max_player_health)
if (ps[g_p].GetActor()->s.extra >= gs.max_player_health)
{
ps[g_p].GetActor()->s.extra = max_player_health;
ps[g_p].last_extra = max_player_health;
ps[g_p].GetActor()->s.extra = gs.max_player_health;
ps[g_p].last_extra = gs.max_player_health;
}
insptr++;
break;
@ -2007,7 +2007,7 @@ int ParseState::parse(void)
j = ps[g_p].GetActor()->s.extra;
if (g_sp->picnum != TILE_ATOMICHEALTH)
{
if (j > max_player_health && *insptr > 0)
if (j > gs.max_player_health && *insptr > 0)
{
insptr++;
break;
@ -2016,16 +2016,16 @@ int ParseState::parse(void)
{
if (j > 0)
j += (*insptr) * 3;
if (j > max_player_health && *insptr > 0)
j = max_player_health;
if (j > gs.max_player_health && *insptr > 0)
j = gs.max_player_health;
}
}
else
{
if (j > 0)
j += *insptr;
if (j > (max_player_health << 1))
j = (max_player_health << 1);
if (j > (gs.max_player_health << 1))
j = (gs.max_player_health << 1);
}
if (j < 0) j = 0;
@ -2034,8 +2034,8 @@ int ParseState::parse(void)
{
if (*insptr > 0)
{
if ((j - *insptr) < (max_player_health >> 2) &&
j >= (max_player_health >> 2))
if ((j - *insptr) < (gs.max_player_health >> 2) &&
j >= (gs.max_player_health >> 2))
S_PlayActorSound(229, ps[g_p].GetActor());
ps[g_p].last_extra = j;
@ -2071,7 +2071,7 @@ int ParseState::parse(void)
if(g_sp->picnum != TILE_ATOMICHEALTH)
{
if( j > max_player_health && *insptr > 0 )
if( j > gs.max_player_health && *insptr > 0 )
{
insptr++;
break;
@ -2080,16 +2080,16 @@ int ParseState::parse(void)
{
if(j > 0)
j += *insptr;
if ( j > max_player_health && *insptr > 0 )
j = max_player_health;
if ( j > gs.max_player_health && *insptr > 0 )
j = gs.max_player_health;
}
}
else
{
if( j > 0 )
j += *insptr;
if ( j > (max_player_health<<1) )
j = (max_player_health<<1);
if ( j > (gs.max_player_health<<1) )
j = (gs.max_player_health<<1);
}
if(j < 0) j = 0;
@ -2098,8 +2098,8 @@ int ParseState::parse(void)
{
if(*insptr > 0)
{
if( ( j - *insptr ) < (max_player_health>>2) &&
j >= (max_player_health>>2) )
if( ( j - *insptr ) < (gs.max_player_health>>2) &&
j >= (gs.max_player_health>>2) )
S_PlayActorSound(isRR()? 229 : DUKE_GOTHEALTHATLOW,ps[g_p].GetActor());
ps[g_p].last_extra = j;
@ -2181,7 +2181,7 @@ int ParseState::parse(void)
dnum + s, g_sp->shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
if(weap)
l->s.yvel = weaponsandammosprites[j%14];
l->s.yvel = gs.weaponsandammosprites[j%14];
else l->s.yvel = -1;
l->s.pal = g_sp->pal;
}
@ -2233,7 +2233,7 @@ int ParseState::parse(void)
g_sp->y = g_ac->bposy = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].posy;
g_sp->z = g_ac->bposy = ps[g_p].oposz = ps[g_p].posz;
updatesector(ps[g_p].posx, ps[g_p].posy, &ps[g_p].cursectnum);
setsprite(ps[g_p].GetActor(), ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + PHEIGHT);
setsprite(ps[g_p].GetActor(), ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + gs.playerheight);
g_sp->cstat = 257;
g_sp->shade = -12;
@ -2244,7 +2244,7 @@ int ParseState::parse(void)
g_sp->xoffset = 0;
g_sp->pal = ps[g_p].palookup;
ps[g_p].last_extra = g_sp->extra = max_player_health;
ps[g_p].last_extra = g_sp->extra = gs.max_player_health;
ps[g_p].wantweaponfire = -1;
ps[g_p].horizon.ohoriz = ps[g_p].horizon.horiz = q16horiz(0);
ps[g_p].on_crane = nullptr;
@ -2252,7 +2252,7 @@ int ParseState::parse(void)
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(0);
ps[g_p].opyoff = 0;
ps[g_p].wackedbyactor = nullptr;
ps[g_p].shield_amount = max_armour_amount;
ps[g_p].shield_amount = gs.max_armour_amount;
ps[g_p].dead_flag = 0;
ps[g_p].pals.a = 0;
ps[g_p].footprintcount = 0;
@ -2329,8 +2329,8 @@ int ParseState::parse(void)
break;
case 1:
ps[g_p].shield_amount += *insptr;// 100;
if(ps[g_p].shield_amount > max_player_health)
ps[g_p].shield_amount = max_player_health;
if(ps[g_p].shield_amount > gs.max_player_health)
ps[g_p].shield_amount = gs.max_player_health;
break;
case 2:
ps[g_p].scuba_amount = *insptr;// 1600;
@ -2729,7 +2729,7 @@ int ParseState::parse(void)
case 0:if( ps[g_p].steroids_amount != *insptr)
j = 1;
break;
case 1:if(ps[g_p].shield_amount != max_player_health )
case 1:if(ps[g_p].shield_amount != gs.max_player_health )
j = 1;
break;
case 2:if(ps[g_p].scuba_amount != *insptr) j = 1;break;
@ -3266,7 +3266,7 @@ int ParseState::parse(void)
i = *(insptr++); // ID of def
l1 = GetGameVarID(i, g_ac, g_p);
l2 = GetGameVarID(*insptr, g_ac, g_p); // l2 not used in this one
lResult = max_ammo_amount[l1];
lResult = gs.max_ammo_amount[l1];
SetGameVarID(*insptr, lResult, g_ac, g_p);
insptr++;
break;
@ -3279,7 +3279,7 @@ int ParseState::parse(void)
i = *(insptr++); // ID of def
l1 = GetGameVarID(i, g_ac, g_p);
l2 = GetGameVarID(*insptr, g_ac, g_p);
max_ammo_amount[l1] = l2;
gs.max_ammo_amount[l1] = l2;
insptr++;
break;
@ -3651,7 +3651,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
s.g_ac = actor;
s.g_t = &s.g_ac->temp_data[0]; // Sprite's 'extra' data
auto addr = tileinfo[actor->s.picnum].loadeventscriptptr;
auto addr = gs.tileinfo[actor->s.picnum].loadeventscriptptr;
if (addr == 0) return;
int *insptr = &ScriptCode[addr + 1];
@ -3732,7 +3732,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
void execute(DDukeActor *actor,int p,int x)
{
if (actorinfo[actor->s.picnum].scriptaddress == 0) return;
if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return;
int done;
@ -3742,8 +3742,8 @@ void execute(DDukeActor *actor,int p,int x)
s.g_ac = actor;
s.g_t = &actor->temp_data[0]; // Sprite's 'extra' data
if (actorinfo[actor->s.picnum].scriptaddress == 0) return;
s.insptr = &ScriptCode[4 + (actorinfo[actor->s.picnum].scriptaddress)];
if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return;
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->s.picnum].scriptaddress)];
s.killit_flag = 0;

View file

@ -187,7 +187,7 @@ void GameInterface::NextLevel(MapRecord* map, int skill)
void GameInterface::NewGame(MapRecord* map, int skill)
{
// Hmm... What about the other players?
ps[0].last_extra = max_player_health;
ps[0].last_extra = gs.max_player_health;
resetweapons(0);
resetinventory(0);
if (skill != -1) skill = skill + 1;

View file

@ -35,33 +35,11 @@ BEGIN_DUKE_NS
user_defs ud;
// Variables that do not need to be saved.
int respawnactortime = 768;
int bouncemineblastradius = 2500;
int respawnitemtime = 768;
int morterblastradius = 2500;
int numfreezebounces = 3;
int pipebombblastradius = 2500;
int dukefriction = 0xCFD0;
int rpgblastradius = 1780;
int seenineblastradius = 2048;
int shrinkerblastradius = 650;
int gc = 176;
int tripbombblastradius = 3880;
int camerashitable;
int max_player_health;
int max_armour_amount;
int lasermode;
DukeGameInfo gs;
int cameradist = 0, cameraclock = 0;
int otherp;
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
ActorInfo actorinfo[MAXTILES];
int actor_tog;
int16_t max_ammo_amount[MAX_WEAPONS];
int16_t weaponsandammosprites[15];
int PHEIGHT = PHEIGHT_DUKE;
int duke3d_globalflags;
int playerswhenstarted;
int show_shareware;
int screenpeek;

View file

@ -14,36 +14,41 @@ BEGIN_DUKE_NS
extern user_defs ud;
// Variables that do not need to be saved.
extern int respawnactortime;
extern int bouncemineblastradius;
extern int respawnitemtime;
extern int morterblastradius;
extern int numfreezebounces;
extern int pipebombblastradius;
extern int dukefriction;
extern int rpgblastradius;
extern int seenineblastradius;
extern int shrinkerblastradius;
extern int gc;
extern int tripbombblastradius;
extern int camerashitable;
extern int max_player_health;
extern int max_armour_amount;
extern int lasermode;
struct DukeGameInfo
{
// Static constant global state
int respawnactortime = 768;
int bouncemineblastradius = 2500;
int respawnitemtime = 768;
int morterblastradius = 2500;
int numfreezebounces = 3;
int pipebombblastradius = 2500;
int playerfriction = 0xCFD0;
int rpgblastradius = 1780;
int seenineblastradius = 2048;
int shrinkerblastradius = 650;
int gravity = 176;
int tripbombblastradius = 3880;
int camerashitable = 0;
int max_player_health = 0;
int max_armour_amount = 0;
int lasermode = 0;
TileInfo tileinfo[MAXTILES] = {}; // This is not from EDuke32.
ActorInfo actorinfo[MAXTILES] = {};
int16_t max_ammo_amount[MAX_WEAPONS] = {};
int16_t weaponsandammosprites[15] = {};
int playerheight = PHEIGHT_DUKE;
int displayflags = 0;
};
extern DukeGameInfo gs;
extern int cameraclock;
extern int cameradist;
extern int otherp; // transient helper, MP only
extern TileInfo tileinfo[MAXTILES]; // static state
extern ActorInfo actorinfo[MAXTILES]; // static state
extern int actor_tog; // cheat state
extern intptr_t apScriptGameEvent[];
extern TArray<int> ScriptCode;
extern int16_t max_ammo_amount[MAX_WEAPONS];
extern int16_t weaponsandammosprites[15];
extern int32_t PHEIGHT;
extern int duke3d_globalflags;
extern int playerswhenstarted;
extern int show_shareware;
extern int screenpeek;

View file

@ -19,7 +19,7 @@ inline bool AFLAMABLE(int X)
inline int badguypic(int const tileNum)
{
return ((actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0);
return ((gs.actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0);
}
inline int badguy(spritetype const * const pSprite)
@ -29,7 +29,7 @@ inline int badguy(spritetype const * const pSprite)
inline int bossguypic(int const tileNum)
{
return ((actorinfo[tileNum].flags & (SFLAG_BOSS)) != 0);
return ((gs.actorinfo[tileNum].flags & (SFLAG_BOSS)) != 0);
}
inline int bossguy(spritetype const* const pSprite)
@ -39,7 +39,7 @@ inline int bossguy(spritetype const* const pSprite)
inline int actorflag(DDukeActor * actor, int mask)
{
return (((actorinfo[actor->s.picnum].flags) & mask) != 0);
return (((gs.actorinfo[actor->s.picnum].flags) & mask) != 0);
}
inline int actorfella(DDukeActor* actor)
@ -51,26 +51,26 @@ inline void setflag(int flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
actorinfo[val].flags |= flag;
gs.actorinfo[val].flags |= flag;
}
}
inline bool inventory(spritetype* S)
{
return !!(actorinfo[S->picnum].flags & SFLAG_INVENTORY);
return !!(gs.actorinfo[S->picnum].flags & SFLAG_INVENTORY);
}
inline void settileflag(int flag, const std::initializer_list<short>& types)
{
for (auto val : types)
{
tileinfo[val].flags |= flag;
gs.tileinfo[val].flags |= flag;
}
}
inline bool wallswitchcheck(DDukeActor* s)
{
return !!(tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH);
return !!(gs.tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH);
}
inline int checkcursectnums(int se)

View file

@ -82,13 +82,13 @@ void hud_input(int plnum)
{
p->last_pissed_time = 4000;
S_PlayActorSound(437, pact);
if (p->GetActor()->s.extra <= max_player_health - max_player_health / 10)
if (p->GetActor()->s.extra <= gs.max_player_health - gs.max_player_health / 10)
{
p->GetActor()->s.extra += 2;
p->last_extra = p->GetActor()->s.extra;
}
else if (p->GetActor()->s.extra < max_player_health)
p->GetActor()->s.extra = max_player_health;
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
}
}
}
@ -307,12 +307,12 @@ void hud_input(int plnum)
}
else // In RR this means drinking whiskey.
{
if (p->holoduke_amount > 0 && p->GetActor()->s.extra < max_player_health)
if (p->holoduke_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
{
p->holoduke_amount -= 400;
p->GetActor()->s.extra += 5;
if (p->GetActor()->s.extra > max_player_health)
p->GetActor()->s.extra = max_player_health;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->drink_amt += 5;
p->inven_icon = 3;
@ -340,16 +340,16 @@ void hud_input(int plnum)
madenoise(plnum);
if (sector[p->cursectnum].lotag == 857)
{
if (p->GetActor()->s.extra <= max_player_health)
if (p->GetActor()->s.extra <= gs.max_player_health)
{
p->GetActor()->s.extra += 10;
if (p->GetActor()->s.extra >= max_player_health)
p->GetActor()->s.extra = max_player_health;
if (p->GetActor()->s.extra >= gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
}
}
else
{
if (p->GetActor()->s.extra + 1 <= max_player_health)
if (p->GetActor()->s.extra + 1 <= gs.max_player_health)
{
p->GetActor()->s.extra++;
}
@ -364,16 +364,16 @@ void hud_input(int plnum)
OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1);
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
{
if (p->firstaid_amount > 0 && p->GetActor()->s.extra < max_player_health)
if (p->firstaid_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
{
if (!isRR())
{
int j = max_player_health - p->GetActor()->s.extra;
int j = gs.max_player_health - p->GetActor()->s.extra;
if ((unsigned int)p->firstaid_amount > j)
{
p->firstaid_amount -= j;
p->GetActor()->s.extra = max_player_health;
p->GetActor()->s.extra = gs.max_player_health;
p->inven_icon = 1;
}
else
@ -391,8 +391,8 @@ void hud_input(int plnum)
{
p->firstaid_amount -= j;
p->GetActor()->s.extra += j;
if (p->GetActor()->s.extra > max_player_health)
p->GetActor()->s.extra = max_player_health;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->inven_icon = 1;
}
else
@ -401,8 +401,8 @@ void hud_input(int plnum)
p->firstaid_amount = 0;
checkavailinven(p);
}
if (p->GetActor()->s.extra > max_player_health)
p->GetActor()->s.extra = max_player_health;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->drink_amt += 10;
if (p->drink_amt <= 100 && !S_CheckActorSoundPlaying(pact, DUKE_USEMEDKIT))
S_PlayActorSound(DUKE_USEMEDKIT, pact);
@ -445,7 +445,7 @@ void hud_input(int plnum)
else
{
// eat cow pie
if (p->jetpack_amount > 0 && p->GetActor()->s.extra < max_player_health)
if (p->jetpack_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
{
if (!S_CheckActorSoundPlaying(pact, 429))
S_PlayActorSound(429, pact);
@ -469,8 +469,8 @@ void hud_input(int plnum)
p->inven_icon = 4;
if (p->GetActor()->s.extra > max_player_health)
p->GetActor()->s.extra = max_player_health;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
if (p->jetpack_amount <= 0)
checkavailinven(p);

View file

@ -358,7 +358,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
s != sp)
continue;
if (gotshrinker && sp->xrepeat < 30 && !(actorinfo[sp->picnum].flags & SFLAG_SHRINKAUTOAIM)) continue;
if (gotshrinker && sp->xrepeat < 30 && !(gs.actorinfo[sp->picnum].flags & SFLAG_SHRINKAUTOAIM)) continue;
if (gotfreezer && sp->pal == 1) continue;
}
@ -375,7 +375,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
a = (abs(scale(sp->z - s->z, 10, sdist) - ps[s->yvel].horizon.sum().asbuild()) < 100);
else a = 1;
cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + actorinfo[sp->picnum].aimoffset, sp->sectnum, s->x, s->y, s->z - (32 << 8), s->sectnum);
cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + gs.actorinfo[sp->picnum].aimoffset, sp->sectnum, s->x, s->y, s->z - (32 << 8), s->sectnum);
if (a && cans)
{
@ -644,7 +644,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
{
if (p->on_warping_sector == 0)
{
if (abs(p->posz - fz) > (PHEIGHT >> 1))
if (abs(p->posz - fz) > (gs.playerheight >> 1))
p->posz += 348;
}
else

View file

@ -272,7 +272,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
}
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
knee->s.extra += (max_player_health >> 2);
knee->s.extra += (gs.max_player_health >> 2);
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
{
@ -419,7 +419,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (p >= 0)
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s.extra += (krand() % 6);
if (hitwall == -1 && hitact == nullptr)
@ -532,7 +532,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
else
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
if (hitact)
{
@ -738,7 +738,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
spawned->temp_actor = aimed;
else
{
spj->yvel = numfreezebounces;
spj->yvel = gs.numfreezebounces;
spj->xrepeat >>= 1;
spj->yrepeat >>= 1;
spj->zvel -= (2 << 4);
@ -1564,7 +1564,7 @@ int doincrements_d(struct player_struct* p)
else
{
p->extra_extra8 += 32;
if (p->last_extra < (max_player_health >> 1) && (p->last_extra & 3) == 0)
if (p->last_extra < (gs.max_player_health >> 1) && (p->last_extra & 3) == 0)
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
}
}
@ -1745,7 +1745,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
}
else i = 12;
if (shrunk == 0 && truefdist <= PHEIGHT)
if (shrunk == 0 && truefdist <= gs.playerheight)
{
if (p->on_ground == 1)
{
@ -1774,7 +1774,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
else
{
p->on_ground = 0;
p->poszv += (gc + 80); // (TICSPERFRAME<<6);
p->poszv += (gs.gravity + 80); // (TICSPERFRAME<<6);
if (p->poszv >= (4096 + 2048)) p->poszv = (4096 + 2048);
if (p->poszv > 2400 && p->falling_counter < 255)
{
@ -2620,19 +2620,19 @@ static void processweapon(int snum, ESyncBits actions, int psect)
if (p->ammo_amount[PISTOL_WEAPON] > PISTOL_MAXDEFAULT)
p->ammo_amount[PISTOL_WEAPON] = PISTOL_MAXDEFAULT;
if (max_ammo_amount[PISTOL_WEAPON] != PISTOL_MAXDEFAULT)
max_ammo_amount[PISTOL_WEAPON] = PISTOL_MAXDEFAULT;
if (gs.max_ammo_amount[PISTOL_WEAPON] != PISTOL_MAXDEFAULT)
gs.max_ammo_amount[PISTOL_WEAPON] = PISTOL_MAXDEFAULT;
}
else
{
short pistolAddition = 4;
short pistolNewMaximum = PISTOL_MAXDEFAULT + pistolAddition;
if (p->ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT && max_ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT)
if (p->ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT && gs.max_ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT)
p->ammo_amount[PISTOL_WEAPON] += pistolAddition;
if (max_ammo_amount[PISTOL_WEAPON] != pistolNewMaximum)
max_ammo_amount[PISTOL_WEAPON] = pistolNewMaximum;
if (gs.max_ammo_amount[PISTOL_WEAPON] != pistolNewMaximum)
gs.max_ammo_amount[PISTOL_WEAPON] = pistolNewMaximum;
}
if (isNamWW2GI() && (actions & SB_HOLSTER)) // 'Holster Weapon
@ -2754,7 +2754,7 @@ void processinput_d(int snum)
p->truecz = getceilzofslope(psect, p->posx, p->posy);
truefdist = abs(p->posz - j);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > PHEIGHT + (16 << 8))
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
psectlotag = 0;
pact->floorz = fz;
@ -2917,7 +2917,7 @@ void processinput_d(int snum)
k = 0;
if (p->on_ground && truefdist <= PHEIGHT + (16 << 8))
if (p->on_ground && truefdist <= gs.playerheight + (16 << 8))
{
int whichsound = j == HURTRAIL ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : -1;
if (j >= 0) k = makepainsounds(snum, whichsound);
@ -2938,7 +2938,7 @@ void processinput_d(int snum)
k = bsin(p->bobcounter, -12);
if (truefdist < PHEIGHT + (8 << 8) && (k == 1 || k == 3))
if (truefdist < gs.playerheight + (8 << 8) && (k == 1 || k == 3))
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
@ -2983,20 +2983,20 @@ void processinput_d(int snum)
else check = ((aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)));
if (check)
{
p->posxv = mulscale(p->posxv, dukefriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x2000, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->posxv = mulscale(p->posxv, dukefriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x1400, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16);
}
else
{
p->posxv = mulscale(p->posxv, dukefriction, 16);
p->posyv = mulscale(p->posyv, dukefriction, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
}
}
@ -3006,9 +3006,9 @@ void processinput_d(int snum)
if (shrunk)
{
p->posxv =
mulscale16(p->posxv, dukefriction - (dukefriction >> 1) + (dukefriction >> 2));
mulscale16(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
p->posyv =
mulscale16(p->posyv, dukefriction - (dukefriction >> 1) + (dukefriction >> 2));
mulscale16(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
}
}
@ -3055,7 +3055,7 @@ HORIZONLY:
}
// RBG***
setsprite(pact, p->posx, p->posy, p->posz + PHEIGHT);
setsprite(pact, p->posx, p->posy, p->posz + gs.playerheight);
if (psectlotag < 3)
{
@ -3071,7 +3071,7 @@ HORIZONLY:
}
}
if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
S_PlayActorSound(DUKE_ONWATER, pact);

View file

@ -170,7 +170,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
}
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
wpn->s.extra += (max_player_health >> 2);
wpn->s.extra += (gs.max_player_health >> 2);
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
{
@ -317,7 +317,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (p >= 0)
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s.extra += (krand() % 6);
if (hitwall == -1 && hitsprt == nullptr)
@ -437,7 +437,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
else
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
if (hitsprt)
{
@ -700,7 +700,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
spawned->temp_actor = aimed;
else
{
spawned->s.yvel = numfreezebounces;
spawned->s.yvel = gs.numfreezebounces;
spawned->s.xrepeat >>= 1;
spawned->s.yrepeat >>= 1;
spawned->s.zvel -= (2 << 4);
@ -1413,7 +1413,7 @@ int doincrements_r(struct player_struct* p)
else
{
p->extra_extra8 += 32;
if (p->last_extra < (max_player_health >> 1) && (p->last_extra & 3) == 0)
if (p->last_extra < (gs.max_player_health >> 1) && (p->last_extra & 3) == 0)
S_PlayActorSound(DUKE_LONGTERM_PAIN, pact);
}
}
@ -2085,7 +2085,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
}
else i = 12;
if (shrunk == 0 && truefdist <= PHEIGHT)
if (shrunk == 0 && truefdist <= gs.playerheight)
{
if (p->on_ground == 1)
{
@ -2130,7 +2130,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
{
p->VBumpTarget = 80;
p->moto_bump_fast = 1;
p->poszv -= xs_CRoundToInt(gc * (p->MotoSpeed / 16.));
p->poszv -= xs_CRoundToInt(gs.gravity * (p->MotoSpeed / 16.));
p->MotoOnGround = 0;
if (S_CheckActorSoundPlaying(pact, 188))
S_StopSound(188, pact);
@ -2138,13 +2138,13 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
}
else
{
p->poszv += gc - 80 + (120 - p->MotoSpeed);
p->poszv += gs.gravity - 80 + (120 - p->MotoSpeed);
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 190))
S_PlayActorSound(190, pact);
}
}
else
p->poszv += (gc + 80); // (TICSPERFRAME<<6);
p->poszv += (gs.gravity + 80); // (TICSPERFRAME<<6);
if (p->poszv >= (4096 + 2048)) p->poszv = (4096 + 2048);
if (p->poszv > 2400 && p->falling_counter < 255)
@ -3423,7 +3423,7 @@ void processinput_r(int snum)
p->truecz = getceilzofslope(psect, p->posx, p->posy);
truefdist = abs(p->posz - tempfz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > PHEIGHT + (16 << 8))
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
psectlotag = 0;
pact->floorz = fz;
@ -3639,7 +3639,7 @@ void processinput_r(int snum)
int j = sector[s->sectnum].floorpicnum;
k = 0;
if (p->on_ground && truefdist <= PHEIGHT + (16 << 8))
if (p->on_ground && truefdist <= gs.playerheight + (16 << 8))
{
int whichsound = j == HURTRAIL ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 :
(isRRRA() && (j == RRTILE7768 || j == RRTILE7820) ? 3 : -1);
@ -3676,7 +3676,7 @@ void processinput_r(int snum)
p->NotOnWater = 1;
}
if (truefdist < PHEIGHT + (8 << 8) && (k == 1 || k == 3))
if (truefdist < gs.playerheight + (8 << 8) && (k == 1 || k == 3))
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
@ -3709,20 +3709,20 @@ void processinput_r(int snum)
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
{
p->posxv = mulscale(p->posxv, dukefriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x2000, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->posxv = mulscale(p->posxv, dukefriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x1400, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16);
}
else
{
p->posxv = mulscale(p->posxv, dukefriction, 16);
p->posyv = mulscale(p->posyv, dukefriction, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
}
}
@ -3743,8 +3743,8 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->posxv = mulscale(p->posxv, dukefriction, 16);
p->posyv = mulscale(p->posyv, dukefriction, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
}
}
else
@ -3755,8 +3755,8 @@ void processinput_r(int snum)
{
if (p->on_ground)
{
p->posxv = mulscale(p->posxv, dukefriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x1800, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16);
}
}
else
@ -3764,8 +3764,8 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->posxv = mulscale(p->posxv, dukefriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, dukefriction - 0x1800, 16);
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16);
}
}
@ -3775,9 +3775,9 @@ void processinput_r(int snum)
if (shrunk)
{
p->posxv =
mulscale16(p->posxv, dukefriction - (dukefriction >> 1) + (dukefriction >> 2));
mulscale16(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
p->posyv =
mulscale16(p->posyv, dukefriction - (dukefriction >> 1) + (dukefriction >> 2));
mulscale16(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
}
}
@ -3876,7 +3876,7 @@ HORIZONLY:
{
clip.actor->s.pal = 0;
p->DrugMode = 5;
ps[snum].GetActor()->s.extra = max_player_health;
ps[snum].GetActor()->s.extra = gs.max_player_health;
}
}
}
@ -3898,7 +3898,7 @@ HORIZONLY:
}
// RBG***
setsprite(pact, p->posx, p->posy, p->posz + PHEIGHT);
setsprite(pact, p->posx, p->posy, p->posz + gs.playerheight);
if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill))
{
@ -3921,7 +3921,7 @@ HORIZONLY:
}
}
if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && sector[p->cursectnum].hitag != 321))
S_PlayActorSound(DUKE_ONWATER, pact);

View file

@ -143,7 +143,7 @@ void fakedomovethings(void)
j = getflorzofslope(psect,myx,myy);
if(clz.type == kHitSector && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
if(clz.type == kHitSector && psectlotag == 1 && klabs(myz-j) > gs.playerheight+(16<<8) )
psectlotag = 0;
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) )
@ -194,7 +194,7 @@ void fakedomovethings(void)
{
if(p->on_warping_sector == 0)
{
if( klabs(myz-fz) > (PHEIGHT>>1))
if( klabs(myz-fz) > (gs.playerheight>>1))
myz += 348;
}
clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
@ -303,7 +303,7 @@ void fakedomovethings(void)
{
myonground = 0;
myzvel += (gc+80);
myzvel += (gs.gravity+80);
if(myzvel >= (4096+2048)) myzvel = (4096+2048);
}
@ -421,20 +421,20 @@ void fakedomovethings(void)
if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) )
{
myxvel = mulscale16(myxvel,dukefriction-0x2000);
myyvel = mulscale16(myyvel,dukefriction-0x2000);
myxvel = mulscale16(myxvel,gs.playerfriction-0x2000);
myyvel = mulscale16(myyvel,gs.playerfriction-0x2000);
}
else
{
if(psectlotag == 2)
{
myxvel = mulscale16(myxvel,dukefriction-0x1400);
myyvel = mulscale16(myyvel,dukefriction-0x1400);
myxvel = mulscale16(myxvel,gs.playerfriction-0x1400);
myyvel = mulscale16(myyvel,gs.playerfriction-0x1400);
}
else
{
myxvel = mulscale16(myxvel,dukefriction);
myyvel = mulscale16(myyvel,dukefriction);
myxvel = mulscale16(myxvel,gs.playerfriction);
myyvel = mulscale16(myyvel,gs.playerfriction);
}
}
@ -444,9 +444,9 @@ void fakedomovethings(void)
if( shrunk )
{
myxvel =
mulscale16(myxvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2));
mulscale16(myxvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2));
myyvel =
mulscale16(myyvel,(dukefriction)-(dukefriction>>1)+(dukefriction>>2));
mulscale16(myyvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2));
}
}

View file

@ -275,7 +275,7 @@ void resetweapons(int snum)
p->curr_weapon = PISTOL_WEAPON;
p->gotweapon.Set(PISTOL_WEAPON);
p->gotweapon.Set(KNEE_WEAPON);
p->ammo_amount[PISTOL_WEAPON] = std::min<int16_t>(max_ammo_amount[PISTOL_WEAPON], 48);
p->ammo_amount[PISTOL_WEAPON] = std::min<int16_t>(gs.max_ammo_amount[PISTOL_WEAPON], 48);
p->gotweapon.Set(HANDREMOTE_WEAPON);
p->last_weapon = -1;
@ -319,7 +319,7 @@ void resetinventory(int snum)
p->heat_on = 0;
p->jetpack_on = 0;
p->jetpack_amount = 0;
p->shield_amount = max_armour_amount;
p->shield_amount = gs.max_armour_amount;
p->holoduke_on = nullptr;
p->holoduke_amount = 0;
p->firstaid_amount = 0;
@ -599,8 +599,8 @@ void resetpspritevars(int g)
if (ps[j].last_extra == 0)
{
ps[j].last_extra = max_player_health;
s->extra = max_player_health;
ps[j].last_extra = gs.max_player_health;
s->extra = gs.max_player_health;
}
else s->extra = ps[j].last_extra;

View file

@ -133,10 +133,10 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > max_player_health)
if (althud_flashing && p->last_extra > gs.max_player_health)
s += bsin(I_GetBuildTime() << 5) / 768;
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
@ -182,7 +182,7 @@ public:
imgX += (imgX * 0.6) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (max_ammo_amount[weapon] / 10)))
if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{
SBar_DrawString(this, numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
}
@ -363,18 +363,18 @@ public:
return (((!p->ammo_amount[weapon]) | (!p->gotweapon[weapon])) * 9) + 12 - 18 * ((cw == weapon) || (optweapon != -1 && cw == optweapon));
};
DrawWeaponNum(2, x, y, p->ammo_amount[PISTOL_WEAPON], max_ammo_amount[PISTOL_WEAPON], 12 - 20 * (cw == PISTOL_WEAPON), 3);
DrawWeaponNum(3, x, y + 6, p->ammo_amount[SHOTGUN_WEAPON], max_ammo_amount[SHOTGUN_WEAPON], ShadeForWeapon(SHOTGUN_WEAPON), 3);
DrawWeaponNum(4, x, y + 12, p->ammo_amount[CHAINGUN_WEAPON], max_ammo_amount[CHAINGUN_WEAPON], ShadeForWeapon(CHAINGUN_WEAPON), 3);
DrawWeaponNum(5, x + 39, y, p->ammo_amount[RPG_WEAPON], max_ammo_amount[RPG_WEAPON], ShadeForWeapon(RPG_WEAPON), 2);
DrawWeaponNum(6, x + 39, y + 6, p->ammo_amount[HANDBOMB_WEAPON], max_ammo_amount[HANDBOMB_WEAPON], ShadeForWeapon(HANDBOMB_WEAPON, HANDREMOTE_WEAPON), 2);
DrawWeaponNum(2, x, y, p->ammo_amount[PISTOL_WEAPON], gs.max_ammo_amount[PISTOL_WEAPON], 12 - 20 * (cw == PISTOL_WEAPON), 3);
DrawWeaponNum(3, x, y + 6, p->ammo_amount[SHOTGUN_WEAPON], gs.max_ammo_amount[SHOTGUN_WEAPON], ShadeForWeapon(SHOTGUN_WEAPON), 3);
DrawWeaponNum(4, x, y + 12, p->ammo_amount[CHAINGUN_WEAPON], gs.max_ammo_amount[CHAINGUN_WEAPON], ShadeForWeapon(CHAINGUN_WEAPON), 3);
DrawWeaponNum(5, x + 39, y, p->ammo_amount[RPG_WEAPON], gs.max_ammo_amount[RPG_WEAPON], ShadeForWeapon(RPG_WEAPON), 2);
DrawWeaponNum(6, x + 39, y + 6, p->ammo_amount[HANDBOMB_WEAPON], gs.max_ammo_amount[HANDBOMB_WEAPON], ShadeForWeapon(HANDBOMB_WEAPON, HANDREMOTE_WEAPON), 2);
if (p->subweapon & (1 << GROW_WEAPON)) // original code says: if(!p->ammo_amount[SHRINKER_WEAPON] || cw == GROW_WEAPON)
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2);
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], gs.max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2);
else
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2);
DrawWeaponNum(8, x + 70, y, p->ammo_amount[DEVISTATOR_WEAPON], max_ammo_amount[DEVISTATOR_WEAPON], ShadeForWeapon(DEVISTATOR_WEAPON), 2);
DrawWeaponNum(9, x + 70, y + 6, p->ammo_amount[TRIPBOMB_WEAPON], max_ammo_amount[TRIPBOMB_WEAPON], ShadeForWeapon(TRIPBOMB_WEAPON), 2);
DrawWeaponNum(0, x + 70, y + 12, p->ammo_amount[FREEZE_WEAPON], max_ammo_amount[FREEZE_WEAPON], ShadeForWeapon(FREEZE_WEAPON), 2);
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], gs.max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2);
DrawWeaponNum(8, x + 70, y, p->ammo_amount[DEVISTATOR_WEAPON], gs.max_ammo_amount[DEVISTATOR_WEAPON], ShadeForWeapon(DEVISTATOR_WEAPON), 2);
DrawWeaponNum(9, x + 70, y + 6, p->ammo_amount[TRIPBOMB_WEAPON], gs.max_ammo_amount[TRIPBOMB_WEAPON], ShadeForWeapon(TRIPBOMB_WEAPON), 2);
DrawWeaponNum(0, x + 70, y + 12, p->ammo_amount[FREEZE_WEAPON], gs.max_ammo_amount[FREEZE_WEAPON], ShadeForWeapon(FREEZE_WEAPON), 2);
}
//==========================================================================

View file

@ -108,10 +108,10 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > max_player_health)
if (althud_flashing && p->last_extra > gs.max_player_health)
s += bsin(I_GetBuildTime() << 5) / 768;
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
@ -175,7 +175,7 @@ public:
imgX += (imgX * 0.755) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (max_ammo_amount[weapon] / 10)))
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{
SBar_DrawString(this, numberFont, format, -1, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}

View file

@ -1145,7 +1145,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case FUELPOD:
case SOLARPANNEL:
case ANTENNA:
if (actorinfo[SHOTSPARK1].scriptaddress && pspr->extra != ScriptCode[actorinfo[SHOTSPARK1].scriptaddress])
if (gs.actorinfo[SHOTSPARK1].scriptaddress && pspr->extra != ScriptCode[gs.actorinfo[SHOTSPARK1].scriptaddress])
{
for (j = 0; j < 15; j++)
EGS(s->sectnum, s->x, s->y, sector[s->sectnum].floorz - (12 << 8) - (j << 9), SCRAP1 + (krand() & 15), -8, 64, 64,
@ -1651,13 +1651,13 @@ void checksectors_d(int snum)
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (p->GetActor()->s.extra <= (max_player_health - (max_player_health / 10)))
if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10)))
{
p->GetActor()->s.extra += max_player_health / 10;
p->GetActor()->s.extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s.extra;
}
else if (p->GetActor()->s.extra < max_player_health)
p->GetActor()->s.extra = max_player_health;
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
}
else if (S_CheckActorSoundPlaying(neartagsprite, FLUSH_TOILET) == 0)
S_PlayActorSound(FLUSH_TOILET, neartagsprite);
@ -1683,7 +1683,7 @@ void checksectors_d(int snum)
neartagsprite->temp_data[0] = 1;
neartagsprite->SetOwner(p->GetActor());
if (p->GetActor()->s.extra < max_player_health)
if (p->GetActor()->s.extra < gs.max_player_health)
{
p->GetActor()->s.extra++;
S_PlayActorSound(DUKE_DRINKING, p->GetActor());

View file

@ -2188,7 +2188,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case FUELPOD:
case SOLARPANNEL:
case ANTENNA:
if (actorinfo[SHOTSPARK1].scriptaddress && pspr->extra != ScriptCode[actorinfo[SHOTSPARK1].scriptaddress])
if (gs.actorinfo[SHOTSPARK1].scriptaddress && pspr->extra != ScriptCode[gs.actorinfo[SHOTSPARK1].scriptaddress])
{
for (j = 0; j < 15; j++)
EGS(s->sectnum, s->x, s->y, sector[s->sectnum].floorz - (12 << 8) - (j << 9), SCRAP1 + (krand() & 15), -8, 64, 64,
@ -2674,13 +2674,13 @@ void checksectors_r(int snum)
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (p->GetActor()->s.extra <= (max_player_health - (max_player_health / 10)))
if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10)))
{
p->GetActor()->s.extra += max_player_health / 10;
p->GetActor()->s.extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s.extra;
}
else if (p->GetActor()->s.extra < max_player_health)
p->GetActor()->s.extra = max_player_health;
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
}
else if (S_CheckActorSoundPlaying(pact, DUKE_GRUNT) == 0)
S_PlayActorSound(DUKE_GRUNT, pact);
@ -2691,7 +2691,7 @@ void checksectors_r(int snum)
neartagsprite->temp_data[0] = 1;
neartagsprite->SetOwner(p->GetActor());
if (p->GetActor()->s.extra < max_player_health)
if (p->GetActor()->s.extra < gs.max_player_health)
{
p->GetActor()->s.extra++;
S_PlayActorSound(DUKE_DRINKING, pact);

View file

@ -107,9 +107,9 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
}
memset(act->temp_data, 0, sizeof(act->temp_data));
if (actorinfo[s_pn].scriptaddress)
if (gs.actorinfo[s_pn].scriptaddress)
{
auto sa = &ScriptCode[actorinfo[s_pn].scriptaddress];
auto sa = &ScriptCode[gs.actorinfo[s_pn].scriptaddress];
s->extra = sa[0];
act->temp_data[4] = sa[1];
act->temp_data[1] = sa[2];
@ -216,12 +216,12 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
if (sp->cstat & 1) sp->cstat |= 256;
if (actorinfo[s].scriptaddress)
if (gs.actorinfo[s].scriptaddress)
{
sp->extra = ScriptCode[actorinfo[s].scriptaddress];
t[4] = ScriptCode[actorinfo[s].scriptaddress+1];
t[1] = ScriptCode[actorinfo[s].scriptaddress+2];
int s3 = ScriptCode[actorinfo[s].scriptaddress+3];
sp->extra = ScriptCode[gs.actorinfo[s].scriptaddress];
t[4] = ScriptCode[gs.actorinfo[s].scriptaddress+1];
t[1] = ScriptCode[gs.actorinfo[s].scriptaddress+2];
int s3 = ScriptCode[gs.actorinfo[s].scriptaddress+3];
if (s3 && sp->hitag == 0)
sp->hitag = s3;
}
@ -241,7 +241,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
auto sp = &act->s;
auto sect = sp->sectnum;
if (actorinfo[sp->picnum].scriptaddress)
if (gs.actorinfo[sp->picnum].scriptaddress)
{
if (actj == nullptr && sp->lotag > ud.player_skill)
{
@ -454,7 +454,7 @@ void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
else
{
a = sp->ang;
sp->z = spj->z - PHEIGHT + (3 << 8);
sp->z = spj->z - gs.playerheight + (3 << 8);
}
sp->x = spj->x + bcos(a, -7);

View file

@ -241,9 +241,9 @@ int spawn_d(int j, int pn)
sp->yrepeat = 6;
sp->xrepeat = 32;
if(lasermode == 1)
if(gs.lasermode == 1)
sp->cstat = 16 + 2;
else if(lasermode == 0 || lasermode == 2)
else if(gs.lasermode == 0 || gs.lasermode == 2)
sp->cstat = 16;
else
{
@ -1069,7 +1069,7 @@ int spawn_d(int j, int pn)
case CAMERAPOLE:
sp->extra = 1;
if(camerashitable) sp->cstat = 257;
if(gs.camerashitable) sp->cstat = 257;
else sp->cstat = 0;
case GENERICPOLE:

View file

@ -1334,7 +1334,7 @@ int spawn_r(int j, int pn)
case CAMERAPOLE:
sp->extra = 1;
if(camerashitable) sp->cstat = 257;
if(gs.camerashitable) sp->cstat = 257;
else sp->cstat = 0;
if( ud.multimode < 2 && sp->pal != 0 )