- floatified player_struct::truecz/truefz.

This commit is contained in:
Christoph Oelckers 2022-02-04 17:49:48 +01:00
parent 7fce0ed7ae
commit 6bd854da88
10 changed files with 32 additions and 30 deletions

View file

@ -3826,10 +3826,10 @@ void handle_se17(DDukeActor* actor)
auto sc = actor->sector(); auto sc = actor->sector();
int sh = actor->spr.hitag; int sh = actor->spr.hitag;
int q = actor->temp_data[0] * (actor->spr.yvel << 2); double q = actor->temp_data[0] * actor->spr.yvel * (4 * zinttoworld);
sc->add_int_ceilingz(q); sc->addceilingz(q);
sc->add_int_floorz(q); sc->addfloorz(q);
DukeSectIterator it(actor->sector()); DukeSectIterator it(actor->sector());
while (auto act1 = it.Next()) while (auto act1 = it.Next())
@ -3838,15 +3838,15 @@ void handle_se17(DDukeActor* actor)
{ {
int p = act1->spr.yvel; int p = act1->spr.yvel;
if (numplayers < 2) ps[p].opos.Z = ps[p].pos.Z; if (numplayers < 2) ps[p].opos.Z = ps[p].pos.Z;
ps[p].pos.Z += q; ps[p].pos.Z += q * zworldtoint;
ps[p].__int_truefz += q; ps[p].truefz += q;
ps[p].__int_truecz += q; ps[p].truecz += q;
if (numplayers > 1) ps[p].opos.Z = ps[p].pos.Z; if (numplayers > 1) ps[p].opos.Z = ps[p].pos.Z;
} }
if (act1->spr.statnum != STAT_EFFECTOR) if (act1->spr.statnum != STAT_EFFECTOR)
{ {
act1->backupz(); act1->backupz();
act1->add_int_z(q); act1->spr.pos.Z += q;
} }
act1->floorz = sc->floorz; act1->floorz = sc->floorz;
@ -3900,8 +3900,8 @@ void handle_se17(DDukeActor* actor)
ps[p].bobpos.Y = ps[p].opos.Y = ps[p].pos.Y; ps[p].bobpos.Y = ps[p].opos.Y = ps[p].pos.Y;
ps[p].opos.Z = ps[p].pos.Z; ps[p].opos.Z = ps[p].pos.Z;
ps[p].__int_truefz = act3->actor_int_floorz(); ps[p].truefz = act3->floorz;
ps[p].__int_truecz = act3->actor_int_ceilingz(); ps[p].truecz = act3->ceilingz;
ps[p].bobcounter = 0; ps[p].bobcounter = 0;
ChangeActorSect(act3, act2->sector()); ChangeActorSect(act3, act2->sector());
@ -4420,7 +4420,7 @@ void handle_se24(DDukeActor *actor, bool scroll, int shift)
{ {
if (ps[p].cursector == actor->sector() && ps[p].on_ground) if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{ {
if (abs(ps[p].pos.Z - ps[p].__int_truefz) < gs.playerheight + (9 << 8)) if (abs(ps[p].pos.Z - ps[p].truefz * zworldtoint) < gs.playerheight + (9 << 8))
{ {
ps[p].fric.X += x << 3; ps[p].fric.X += x << 3;
ps[p].fric.Y += y << 3; ps[p].fric.Y += y << 3;

View file

@ -577,7 +577,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
else else
i = TILE_APLAYERTOP; i = TILE_APLAYERTOP;
j = abs(pp.__int_truefz - pp.pos.Z) >> 8; j = abs(int(pp.truefz * zworldtoint) - pp.pos.Z) >> 8;
j = czoom * (act->spr.yrepeat + j); j = czoom * (act->spr.yrepeat + j);
if (j < 22000) j = 22000; if (j < 22000) j = 22000;

View file

@ -423,13 +423,13 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break; break;
case PLAYER_TRUEFZ: case PLAYER_TRUEFZ:
if (bSet) ps[iPlayer].__int_truefz = lValue; if (bSet) ps[iPlayer].truefz = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].__int_truefz, sActor, sPlayer); else SetGameVarID(lVar2, ps[iPlayer].truefz * (1/zmaptoworld), sActor, sPlayer);
break; break;
case PLAYER_TRUECZ: case PLAYER_TRUECZ:
if (bSet) ps[iPlayer].__int_truecz = lValue; if (bSet) ps[iPlayer].truecz = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].__int_truecz, sActor, sPlayer); else SetGameVarID(lVar2, ps[iPlayer].truecz * (1 / zmaptoworld), sActor, sPlayer);
break; break;
case PLAYER_PLAYER_PAR: case PLAYER_PLAYER_PAR:

View file

@ -2740,8 +2740,8 @@ void processinput_d(int snum)
j = getflorzofslopeptr(psectp, p->pos.X, p->pos.Y); j = getflorzofslopeptr(psectp, p->pos.X, p->pos.Y);
p->__int_truefz = j; p->truefz = j * zinttoworld;
p->__int_truecz = getceilzofslopeptr(psectp, p->pos.X, p->pos.Y); p->truecz = getceilzofslopeptr(psectp, p->pos.X, p->pos.Y) * zinttoworld;
truefdist = abs(p->pos.Z - j); truefdist = abs(p->pos.Z - j);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8)) if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
@ -2761,7 +2761,7 @@ void processinput_d(int snum)
if (chz.actor()->spr.statnum == 1 && chz.actor()->spr.extra >= 0) if (chz.actor()->spr.statnum == 1 && chz.actor()->spr.extra >= 0)
{ {
chz.setNone(); chz.setNone();
cz = p->__int_truecz; cz = p->truecz * zworldtoint;
} }
} }

View file

@ -3410,8 +3410,8 @@ void processinput_r(int snum)
tempfz = getflorzofslopeptr(psectp, p->pos.X, p->pos.Y); tempfz = getflorzofslopeptr(psectp, p->pos.X, p->pos.Y);
} }
p->__int_truefz = tempfz; p->truefz = tempfz * zinttoworld;
p->__int_truecz = getceilzofslopeptr(psectp, p->pos.X, p->pos.Y); p->truecz = getceilzofslopeptr(psectp, p->pos.X, p->pos.Y) * zinttoworld;
truefdist = abs(p->pos.Z - tempfz); truefdist = abs(p->pos.Z - tempfz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8)) if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
@ -3431,7 +3431,7 @@ void processinput_r(int snum)
if (chz.actor()->spr.statnum == 1 && chz.actor()->spr.extra >= 0) if (chz.actor()->spr.statnum == 1 && chz.actor()->spr.extra >= 0)
{ {
chz.setNone(); chz.setNone();
cz = p->__int_truecz; cz = p->truecz * zworldtoint;
} }
else if (chz.actor()->spr.picnum == LADDER) else if (chz.actor()->spr.picnum == LADDER)
{ {
@ -3441,7 +3441,7 @@ void processinput_r(int snum)
if ((actions & SB_JUMP) && !p->OnMotorcycle) if ((actions & SB_JUMP) && !p->OnMotorcycle)
{ {
chz.setNone(); chz.setNone();
cz = p->__int_truecz; cz = p->truecz * zworldtoint;
} }
} }
else else

View file

@ -368,8 +368,8 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
else if (p->spritebridge == 0 && p->newOwner == nullptr) else if (p->spritebridge == 0 && p->newOwner == nullptr)
{ {
if (cposz < (p->__int_truecz + (4 << 8))) cposz = cz + (4 << 8); if (cposz < (p->truecz * zworldtoint + (4 << 8))) cposz = cz + (4 << 8);
else if (cposz > (p->__int_truefz - (4 << 8))) cposz = fz - (4 << 8); else if (cposz > (p->truefz * zworldtoint - (4 << 8))) cposz = fz - (4 << 8);
} }
if (sect) if (sect)

View file

@ -128,8 +128,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("posyv", w.vel.Y) ("posyv", w.vel.Y)
("poszv", w.vel.Z) ("poszv", w.vel.Z)
("last_pissed_time", w.last_pissed_time) ("last_pissed_time", w.last_pissed_time)
("truefz", w.__int_truefz) ("truefz", w.truefz)
("truecz", w.__int_truecz) ("truecz", w.truecz)
("player_par", w.player_par) ("player_par", w.player_par)
("visibility", w.visibility) ("visibility", w.visibility)
("bobcounter", w.bobcounter) ("bobcounter", w.bobcounter)

View file

@ -238,13 +238,14 @@ struct player_struct
int numloogs, oloogcnt, loogcnt; int numloogs, oloogcnt, loogcnt;
int invdisptime; int invdisptime;
int pyoff, opyoff; int pyoff, opyoff;
int last_pissed_time, __int_truefz, __int_truecz; int last_pissed_time;
int player_par, visibility; int player_par, visibility;
int bobcounter; int bobcounter;
int randomflamex, crack_time; int randomflamex, crack_time;
int aim_mode, ftt; int aim_mode, ftt;
double truefz, truecz;
sectortype* cursector; sectortype* cursector;
sectortype* one_parallax_sectnum; // wall + sector references. Make them pointers later? sectortype* one_parallax_sectnum; // wall + sector references. Make them pointers later?
walltype* access_wall; walltype* access_wall;

View file

@ -221,8 +221,8 @@ DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
//DEFINE_FIELD_X(DukePlayer, player_struct, posyv) //DEFINE_FIELD_X(DukePlayer, player_struct, posyv)
//DEFINE_FIELD_X(DukePlayer, player_struct, poszv) //DEFINE_FIELD_X(DukePlayer, player_struct, poszv)
DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time) DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time)
//DEFINE_FIELD_X(DukePlayer, player_struct, truefz) DEFINE_FIELD_X(DukePlayer, player_struct, truefz)
//DEFINE_FIELD_X(DukePlayer, player_struct, truecz) DEFINE_FIELD_X(DukePlayer, player_struct, truecz)
DEFINE_FIELD_X(DukePlayer, player_struct, player_par) DEFINE_FIELD_X(DukePlayer, player_struct, player_par)
DEFINE_FIELD_X(DukePlayer, player_struct, visibility) DEFINE_FIELD_X(DukePlayer, player_struct, visibility)
DEFINE_FIELD_X(DukePlayer, player_struct, bobcounter) DEFINE_FIELD_X(DukePlayer, player_struct, bobcounter)

View file

@ -160,7 +160,8 @@ struct DukePlayer
native int numloogs, loogcnt; native int numloogs, loogcnt;
native int invdisptime; native int invdisptime;
native int pyoff, opyoff; native int pyoff, opyoff;
native int last_pissed_time;//, truefz, truecz; native int last_pissed_time;
native double truefz, truecz;
native int player_par, visibility; native int player_par, visibility;
native int bobcounter; native int bobcounter;
native int randomflamex, crack_time; native int randomflamex, crack_time;