Skip to content

Commit

Permalink
- store class pointers in weaprecs.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent a538e06 commit 5a2bb1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 2 additions & 12 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -686,16 +686,6 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, ps[iPlayer].customexitsound, sActor, sPlayer);
break;

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

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

case PLAYER_INTERFACE_TOGGLE_FLAG:
if (bSet) ps[iPlayer].interface_toggle_flag = lValue;
else SetGameVarID(lVar2, ps[iPlayer].interface_toggle_flag, sActor, sPlayer);
Expand Down Expand Up @@ -1335,7 +1325,7 @@ int CheckWeapRec(player_struct* p, DDukeActor* g_ac, int testonly)
{
int j;
for (j = 0; j < p->weapreccnt; j++)
if (p->weaprecs[j] == g_ac->spr.picnum)
if (p->weaprecs[j] == g_ac->GetClass())
break;

if (testonly)
Expand All @@ -1344,7 +1334,7 @@ int CheckWeapRec(player_struct* p, DDukeActor* g_ac, int testonly)
}
else if (p->weapreccnt < 32)
{
p->weaprecs[p->weapreccnt++] = g_ac->spr.picnum;
p->weaprecs[p->weapreccnt++] = g_ac->GetClass();
return (g_ac->GetOwner() == g_ac);
}
return false;
Expand Down
3 changes: 2 additions & 1 deletion source/games/duke/src/types.h
Expand Up @@ -278,7 +278,8 @@ struct player_struct
short extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound;

short weaprecs[32], weapreccnt;
PClass* weaprecs[32];
int weapreccnt;
unsigned int interface_toggle_flag;

short dead_flag, show_empty_weapon;
Expand Down

0 comments on commit 5a2bb1d

Please sign in to comment.