mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Patch from Fox to access the player's subweapon member as a bitfield
"Add 'bsubweapon' player structure. Same as 'subweapon', except that it writes a bit for each weapon. For example, 'ife player[].bsubweapon GROW_WEAPON 1' has the same result as 'ifand player[].subweapon 2048'." git-svn-id: https://svn.eduke32.com/eduke32@7668 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
509febe25a
commit
f62d6c919c
2 changed files with 11 additions and 0 deletions
|
@ -450,6 +450,7 @@ enum PlayerLabel_t
|
|||
PLAYER_FRAGS,
|
||||
PLAYER_DEATHS,
|
||||
PLAYER_LAST_USED_WEAPON,
|
||||
PLAYER_BSUBWEAPON,
|
||||
PLAYER_END
|
||||
};
|
||||
|
||||
|
|
|
@ -542,6 +542,7 @@ const memberlabel_t PlayerLabels[]=
|
|||
{ "frags", PLAYER_FRAGS, LABEL_HASPARM2, MAXPLAYERS, -1 },
|
||||
{ "deaths", PLAYER_DEATHS, 0, 0, -1 },
|
||||
{ "last_used_weapon", PLAYER_LAST_USED_WEAPON, 0, 0, -1 },
|
||||
{ "bsubweapon", PLAYER_BSUBWEAPON, LABEL_HASPARM2, MAX_WEAPONS, -1 },
|
||||
};
|
||||
|
||||
int32_t __fastcall VM_GetPlayer(int const playerNum, int32_t labelNum, int const lParm2)
|
||||
|
@ -729,6 +730,8 @@ int32_t __fastcall VM_GetPlayer(int const playerNum, int32_t labelNum, int const
|
|||
labelNum = (playerNum == lParm2) ? ps.fraggedself : g_player[playerNum].frags[lParm2]; break;
|
||||
case PLAYER_DEATHS: labelNum = g_player[playerNum].frags[playerNum]; break;
|
||||
|
||||
case PLAYER_BSUBWEAPON: labelNum = (ps.subweapon & (1<<lParm2)) != 0; break;
|
||||
|
||||
default: EDUKE32_UNREACHABLE_SECTION(labelNum = -1; break);
|
||||
}
|
||||
|
||||
|
@ -941,6 +944,13 @@ void __fastcall VM_SetPlayer(int const playerNum, int const labelNum, int const
|
|||
break;
|
||||
|
||||
case PLAYER_DEATHS: g_player[playerNum].frags[playerNum] = newValue; break;
|
||||
|
||||
case PLAYER_BSUBWEAPON:
|
||||
if (newValue)
|
||||
ps.subweapon |= (1 << lParm2);
|
||||
else
|
||||
ps.subweapon &= ~(1 << lParm2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue