Skip to content

Commit

Permalink
- use gs.playerheight consistently.
Browse files Browse the repository at this point in the history
There were still several cases using the game specific constants.
  • Loading branch information
coelckers committed Aug 9, 2022
1 parent ad72339 commit 8b8e0d8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/games/duke/src/animatesprites_d.cpp
Expand Up @@ -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(PHEIGHT_DUKE);
t->add_int_z(gs.playerheight);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
Expand Down Expand Up @@ -315,7 +315,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
{
t->x = interpolatedvalue(omyx, myx, smoothratio);
t->y = interpolatedvalue(omyy, myy, smoothratio);
t->z = interpolatedvalue(omyz, myz, smoothratio) + PHEIGHT_DUKE;
t->z = interpolatedvalue(omyz, myz, smoothratio) + gs_playerheight;
t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild();
t->sector = mycursectnum;
}
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/animatesprites_r.cpp
Expand Up @@ -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(PHEIGHT_RR);
t->add_int_z(gs.playerheight);
h->spr.xrepeat = 24;
h->spr.yrepeat = 17;
}
Expand Down Expand Up @@ -359,7 +359,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
{
t->x = interpolatedvalue(omyx, myx, smoothratio);
t->y = interpolatedvalue(omyy, myy, smoothratio);
t->z = interpolatedvalue(omyz, myz, smoothratio) + PHEIGHT_RR;
t->z = interpolatedvalue(omyz, myz, smoothratio) + gs.playerheight;
t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild();
t->sector = mycursectnum;
}
Expand Down
4 changes: 2 additions & 2 deletions source/games/duke/src/player.cpp
Expand Up @@ -171,7 +171,7 @@ int hits(DDukeActor* actor)
int zoff;
HitInfo hit{};

if (actor->isPlayer()) zoff = isRR() ? PHEIGHT_RR : PHEIGHT_DUKE;
if (actor->isPlayer()) zoff = gs.playerheight;
else zoff = 0;

auto pos = actor->int_pos();
Expand All @@ -192,7 +192,7 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)

if (badguy(actor))
zoff = (42 << 8);
else if (actor->spr.picnum == TILE_APLAYER) zoff = isRR() ? PHEIGHT_RR : PHEIGHT_DUKE;
else if (actor->spr.picnum == TILE_APLAYER) zoff = gs.playerheight;
else zoff = 0;

auto pos = actor->int_pos();
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/spawn.cpp
Expand Up @@ -301,7 +301,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() - (isRR() ? PHEIGHT_RR : PHEIGHT_DUKE));
act->set_int_z(actj->sector()->int_floorz() - gs.playerheight);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/spawn_d.cpp
Expand Up @@ -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(-PHEIGHT_DUKE);
act->add_int_z(-gs.playerheight);
act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4);
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/spawn_r.cpp
Expand Up @@ -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(-PHEIGHT_RR);
act->add_int_z(-gs.playerheight);
act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4);
Expand Down

0 comments on commit 8b8e0d8

Please sign in to comment.