Skip to content

Commit

Permalink
- made one_parallax_sectnum a pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Nov 21, 2021
1 parent 2bbd306 commit 16bd329
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
6 changes: 3 additions & 3 deletions source/games/duke/src/actors.cpp
Expand Up @@ -3815,10 +3815,10 @@ void handle_se13(DDukeActor* actor)

sc->floorshade = s->shade;

if (ps[0].one_parallax_sectnum >= 0)
if (ps[0].one_parallax_sectnum != nullptr)
{
sc->ceilingpicnum = ps[0].one_parallax_sector()->ceilingpicnum;
sc->ceilingshade = ps[0].one_parallax_sector()->ceilingshade;
sc->ceilingpicnum = ps[0].one_parallax_sectnum->ceilingpicnum;
sc->ceilingshade = ps[0].one_parallax_sectnum->ceilingshade;
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -601,11 +601,6 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, ps[iPlayer].i, sActor, sPlayer);
break;

case PLAYER_ONE_PARALLAX_SECTNUM:
if (bSet) ps[iPlayer].one_parallax_sectnum = lValue;
else SetGameVarID(lVar2, ps[iPlayer].one_parallax_sectnum, sActor, sPlayer);
break;

case PLAYER_OVER_SHOULDER_ON:
if (bSet) ps[iPlayer].over_shoulder_on = lValue;
else SetGameVarID(lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer);
Expand Down
12 changes: 5 additions & 7 deletions source/games/duke/src/premap.cpp
Expand Up @@ -408,7 +408,7 @@ void resetprestat(int snum,int g)
p->holster_weapon = 0;
p->last_pissed_time = 0;

p->one_parallax_sectnum = -1;
p->one_parallax_sectnum = nullptr;
p->visibility = ud.const_visibility;

screenpeek = myconnectindex;
Expand Down Expand Up @@ -652,8 +652,6 @@ void lava_cleararrays();

void prelevel_common(int g)
{
int i;

auto p = &ps[screenpeek];
p->sea_sick_stat = 0;
ufospawnsminion = 0;
Expand Down Expand Up @@ -691,9 +689,9 @@ void prelevel_common(int g)
memset(ambienthitag, -1, sizeof(ambienthitag));
memset(ambientlotag, -1, sizeof(ambientlotag));

for (i = 0; i < numsectors; i++)
for(auto&sec : sectors())
{
auto sectp = &sector[i];
auto sectp = &sec;
sectp->extra = 256;

switch (sectp->lotag)
Expand All @@ -712,8 +710,8 @@ void prelevel_common(int g)
if (sectp->ceilingpicnum == TILE_CLOUDYSKIES && numclouds < 127)
clouds[numclouds++] = sectp;

if (ps[0].one_parallax_sectnum == -1)
ps[0].one_parallax_sectnum = i;
if (ps[0].one_parallax_sectnum == nullptr)
ps[0].one_parallax_sectnum = sectp;
}

if (sectp->lotag == 32767) //Found a secret room
Expand Down
8 changes: 2 additions & 6 deletions source/games/duke/src/types.h
Expand Up @@ -211,7 +211,8 @@ struct player_struct

int aim_mode, ftt;

int cursectnum, one_parallax_sectnum; // wall + sector references. Make them pointers later?
int cursectnum;
sectortype* one_parallax_sectnum; // wall + sector references. Make them pointers later?
walltype* access_wall;

short last_extra, subweapon;
Expand Down Expand Up @@ -311,11 +312,6 @@ struct player_struct
{
return &::sector[cursectnum];
}
sectortype* one_parallax_sector() const
{
return &::sector[one_parallax_sectnum];
}


};

Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/games/duke/dukegame.zs
Expand Up @@ -159,7 +159,7 @@ struct DukePlayer
native int randomflamex, crack_time;
native int aim_mode, ftt;

native int cursectnum, one_parallax_sectnum;
//native int cursectnum;// , one_parallax_sectnum
//native walltype access_wall; // can't do yet.

native int16 last_extra, subweapon;
Expand Down

0 comments on commit 16bd329

Please sign in to comment.