- added a float version of gs.playerheight.

This commit is contained in:
Christoph Oelckers 2022-02-04 18:06:08 +01:00
parent 1e1188ae73
commit 591dcc995a
16 changed files with 38 additions and 35 deletions

View file

@ -397,7 +397,7 @@ void moveplayers(void)
{
if (p->newOwner != nullptr) //Looking thru the camera
{
act->set_int_pos({ p->__int_opos.X, p->__int_opos.Y, p->__int_opos.Z + gs.playerheight });
act->set_int_pos({ p->__int_opos.X, p->__int_opos.Y, p->__int_opos.Z + gs.int_playerheight });
act->backupz();
act->spr.ang = p->angle.oang.asbuild();
SetActor(act, act->int_pos());
@ -4187,7 +4187,7 @@ void handle_se20(DDukeActor* actor)
ps[p].__int_opos.X = ps[p].__int_pos.X;
ps[p].__int_opos.Y = ps[p].__int_pos.Y;
SetActor(ps[p].GetActor(), { ps[p].__int_pos.X, ps[p].__int_pos.Y, ps[p].__int_pos.Z + gs.playerheight });
SetActor(ps[p].GetActor(), { ps[p].__int_pos.X, ps[p].__int_pos.Y, ps[p].__int_pos.Z + gs.int_playerheight });
}
sc->addfloorxpan(-x / 8.f);
@ -4418,7 +4418,7 @@ void handle_se24(DDukeActor *actor, bool scroll, int shift)
{
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
if (abs(ps[p].__int_pos.Z - ps[p].truefz * zworldtoint) < gs.playerheight + (9 << 8))
if (abs(ps[p].__int_pos.Z - ps[p].truefz * zworldtoint) < gs.int_playerheight + (9 << 8))
{
ps[p].fric.X += x << 3;
ps[p].fric.Y += y << 3;

View file

@ -343,9 +343,9 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue;
}
if (act2->spr.picnum == APLAYER) act2->add_int_z(-gs.playerheight);
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z -= gs.playerheight;
int d = dist(actor, act2);
if (act2->spr.picnum == APLAYER) act2->add_int_z(gs.playerheight);
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
if (d < r && cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z - (8 << 8), act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (12 << 8), actor->sector()))
{
@ -1808,7 +1808,7 @@ void movetransports_d(void)
ps[p].bobpos.X = ps[p].__int_opos.X = ps[p].__int_pos.X = Owner->int_pos().X;
ps[p].bobpos.Y = ps[p].__int_opos.Y = ps[p].__int_pos.Y = Owner->int_pos().Y;
ps[p].__int_opos.Z = ps[p].__int_pos.Z = Owner->int_pos().Z - gs.playerheight;
ps[p].__int_opos.Z = ps[p].__int_pos.Z = Owner->int_pos().Z - gs.int_playerheight;
ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(act2->sector());
@ -1892,7 +1892,7 @@ void movetransports_d(void)
ps[p].setCursector(Owner->sector());
ChangeActorSect(act2, Owner->sector());
SetActor(ps[p].GetActor(), { ps[p].__int_pos.X, ps[p].__int_pos.Y, ps[p].__int_pos.Z + gs.playerheight });
SetActor(ps[p].GetActor(), { ps[p].__int_pos.X, ps[p].__int_pos.Y, ps[p].__int_pos.Z + gs.int_playerheight });
if ((krand() & 255) < 32)
spawn(act2, WATERSPLASH2);

View file

@ -290,9 +290,9 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue;
}
if (act2->spr.picnum == APLAYER) act2->add_int_z(-gs.playerheight);
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z -= gs.playerheight;
int d = dist(actor, act2);
if (act2->spr.picnum == APLAYER) act2->add_int_z(gs.playerheight);
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
if (d < r && cansee(act2->int_pos().X, act2->int_pos().Y, act2->int_pos().Z - (8 << 8), act2->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (12 << 8), actor->sector()))
{
@ -1458,7 +1458,7 @@ void movetransports_r(void)
ps[p].bobpos.X = ps[p].__int_opos.X = ps[p].__int_pos.X = Owner->int_pos().X;
ps[p].bobpos.Y = ps[p].__int_opos.Y = ps[p].__int_pos.Y = Owner->int_pos().Y;
ps[p].__int_opos.Z = ps[p].__int_pos.Z = Owner->int_pos().Z - (gs.playerheight - (4 << 8));
ps[p].__int_opos.Z = ps[p].__int_pos.Z = Owner->int_pos().Z - (gs.int_playerheight - (4 << 8));
ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(act2->sector());

View file

@ -168,7 +168,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
t->add_int_x(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].__int_pos.X - ps[h->spr.yvel].__int_opos.X, 16));
t->add_int_y(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].__int_pos.Y - ps[h->spr.yvel].__int_opos.Y, 16));
t->set_int_z(interpolatedvalue(ps[h->spr.yvel].__int_opos.Z, ps[h->spr.yvel].__int_pos.Z, smoothratio));
t->add_int_z(gs.playerheight);
t->pos.Z += gs.playerheight;
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{

View file

@ -148,7 +148,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
t->add_int_x(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].__int_pos.X - ps[h->spr.yvel].__int_opos.X, 16));
t->add_int_y(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].__int_pos.Y - ps[h->spr.yvel].__int_opos.Y, 16));
t->set_int_z(interpolatedvalue(ps[h->spr.yvel].__int_opos.Z, ps[h->spr.yvel].__int_pos.Z, smoothratio));
t->add_int_z(gs.playerheight);
t->pos.Z += gs.playerheight;
h->spr.xrepeat = 24;
h->spr.yrepeat = 17;
}

View file

@ -419,8 +419,8 @@ enum miscConstants
MOVEFIFOSIZ =256,
AUTO_AIM_ANGLE =48,
PHEIGHT_DUKE =(38<<8),
PHEIGHT_RR =(40<<8),
PHEIGHT_DUKE =38,
PHEIGHT_RR =40,
MAXMINECARTS = 16,
MAXJAILDOORS = 32,

View file

@ -323,6 +323,7 @@ void initactorflags_r()
TILE_BIGORBIT1 = BIGORBIT1;
TILE_EGG = EGG;
gs.int_playerheight = PHEIGHT_RR << 8;
gs.playerheight = PHEIGHT_RR;
}

View file

@ -3187,6 +3187,7 @@ void loadcons()
gs.shrinkerblastradius = 650;
gs.gravity = 176;
gs.tripbombblastradius = 3880;
gs.int_playerheight = PHEIGHT_DUKE << 8;
gs.playerheight = PHEIGHT_DUKE;
gs.displayflags = DUKE3D_NO_WIDESCREEN_PINNING;

View file

@ -2229,7 +2229,7 @@ int ParseState::parse(void)
g_ac->set_int_pos({ ps[g_p].bobpos.X = ps[g_p].__int_opos.X = ps[g_p].__int_pos.X, ps[g_p].bobpos.Y = ps[g_p].__int_opos.Y = ps[g_p].__int_pos.Y, ps[g_p].__int_opos.Z = ps[g_p].__int_pos.Z });
g_ac->backuppos();
updatesector(ps[g_p].__int_pos.X, ps[g_p].__int_pos.Y, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), { ps[g_p].__int_pos.X, ps[g_p].__int_pos.Y, ps[g_p].__int_pos.Z + gs.playerheight });
SetActor(ps[g_p].GetActor(), { ps[g_p].__int_pos.X, ps[g_p].__int_pos.Y, ps[g_p].__int_pos.Z + gs.int_playerheight });
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
g_ac->spr.shade = -12;

View file

@ -39,7 +39,8 @@ struct DukeGameInfo
ActorInfo actorinfo[MAXTILES];
int16_t max_ammo_amount[MAX_WEAPONS];
int16_t weaponsandammosprites[15];
int playerheight;
int int_playerheight;
double playerheight;
int displayflags;
};

View file

@ -171,7 +171,7 @@ int hits(DDukeActor* actor)
int zoff;
HitInfo hit{};
if (actor->isPlayer()) zoff = gs.playerheight;
if (actor->isPlayer()) zoff = gs.int_playerheight;
else zoff = 0;
auto pos = actor->int_pos();
@ -192,7 +192,7 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
if (badguy(actor))
zoff = (42 << 8);
else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.playerheight;
else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.int_playerheight;
else zoff = 0;
auto pos = actor->int_pos();
@ -612,7 +612,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
{
if (p->on_warping_sector == 0)
{
if (abs(p->__int_pos.Z - fz) > (gs.playerheight >> 1))
if (abs(p->__int_pos.Z - fz) > (gs.int_playerheight >> 1))
p->__int_pos.Z += 348;
}
else

View file

@ -1763,7 +1763,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
}
else i = 12;
if (shrunk == 0 && truefdist <= gs.playerheight)
if (shrunk == 0 && truefdist <= gs.int_playerheight)
{
if (p->on_ground == 1)
{
@ -2744,7 +2744,7 @@ void processinput_d(int snum)
p->truecz = getceilzofslopeptr(psectp, p->__int_pos.X, p->__int_pos.Y) * zinttoworld;
truefdist = abs(p->__int_pos.Z - j);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.int_playerheight + (16 << 8))
psectlotag = 0;
pact->floorz = fz * zinttoworld;
@ -2920,7 +2920,7 @@ void processinput_d(int snum)
k = 0;
if (p->on_ground && truefdist <= gs.playerheight + (16 << 8))
if (p->on_ground && truefdist <= gs.int_playerheight + (16 << 8))
{
int whichsound = (gs.tileinfo[j].flags & TFLAG_ELECTRIC) ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 : -1;
if (j >= 0) k = makepainsounds(snum, whichsound);
@ -2941,7 +2941,7 @@ void processinput_d(int snum)
k = bsin(p->bobcounter, -12);
if (truefdist < gs.playerheight + (8 << 8) && (k == 1 || k == 3))
if (truefdist < gs.int_playerheight + (8 << 8) && (k == 1 || k == 3))
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
@ -3056,7 +3056,7 @@ HORIZONLY:
}
// RBG***
SetActor(pact, { p->__int_pos.X, p->__int_pos.Y, p->__int_pos.Z + gs.playerheight });
SetActor(pact, { p->__int_pos.X, p->__int_pos.Y, p->__int_pos.Z + gs.int_playerheight });
if (psectlotag < 3)
{
@ -3072,7 +3072,7 @@ HORIZONLY:
}
}
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->insector() && p->cursector->lotag == 1)
if (truefdist < gs.int_playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->insector() && p->cursector->lotag == 1)
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
S_PlayActorSound(DUKE_ONWATER, pact);

View file

@ -2084,7 +2084,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
}
else i = 12;
if (shrunk == 0 && truefdist <= gs.playerheight)
if (shrunk == 0 && truefdist <= gs.int_playerheight)
{
if (p->on_ground == 1)
{
@ -3414,7 +3414,7 @@ void processinput_r(int snum)
p->truecz = getceilzofslopeptr(psectp, p->__int_pos.X, p->__int_pos.Y) * zinttoworld;
truefdist = abs(p->__int_pos.Z - tempfz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.int_playerheight + (16 << 8))
psectlotag = 0;
pact->floorz = fz * zinttoworld;
@ -3642,7 +3642,7 @@ void processinput_r(int snum)
int j = pact->sector()->floorpicnum;
k = 0;
if (p->on_ground && truefdist <= gs.playerheight + (16 << 8))
if (p->on_ground && truefdist <= gs.int_playerheight + (16 << 8))
{
int whichsound = (gs.tileinfo[j].flags & TFLAG_ELECTRIC) ? 0 : j == FLOORSLIME ? 1 : j == FLOORPLASMA ? 2 :
(isRRRA() && (j == RRTILE7768 || j == RRTILE7820) ? 3 : -1);
@ -3679,7 +3679,7 @@ void processinput_r(int snum)
p->NotOnWater = 1;
}
if (truefdist < gs.playerheight + (8 << 8) && (k == 1 || k == 3))
if (truefdist < gs.int_playerheight + (8 << 8) && (k == 1 || k == 3))
{
if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground)
{
@ -3898,7 +3898,7 @@ HORIZONLY:
}
// RBG***
SetActor(pact, { p->__int_pos.X, p->__int_pos.Y, p->__int_pos.Z + gs.playerheight });
SetActor(pact, { p->__int_pos.X, p->__int_pos.Y, p->__int_pos.Z + gs.int_playerheight });
if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill))
{
@ -3921,7 +3921,7 @@ HORIZONLY:
}
}
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->insector() && p->cursector->lotag == 1)
if (truefdist < gs.int_playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->insector() && p->cursector->lotag == 1)
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector->hitag != 321))
S_PlayActorSound(DUKE_ONWATER, pact);

View file

@ -303,7 +303,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
{
act->spr.xrepeat = 31;
act->spr.yrepeat = 1;
act->set_int_z(actj->sector()->int_floorz() - gs.playerheight);
act->set_int_z(actj->sector()->int_floorz() - gs.int_playerheight);
}
else
{
@ -441,7 +441,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
else
{
a = act->spr.ang;
act->set_int_z(actj->int_pos().Z - gs.playerheight + (3 << 8));
act->set_int_z(actj->int_pos().Z - gs.int_playerheight + (3 << 8));
}
act->set_int_xy(actj->int_pos().X + bcos(a, -7), actj->int_pos().Y + bsin(a, -7));

View file

@ -202,7 +202,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TONGUE:
if (actj)
act->spr.ang = actj->spr.ang;
act->add_int_z(-gs.playerheight);
act->add_int_z(-gs.int_playerheight);
act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4);

View file

@ -284,7 +284,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TONGUE:
if (actj)
act->spr.ang = actj->spr.ang;
act->add_int_z(-gs.playerheight);
act->add_int_z(-gs.int_playerheight);
act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4);