From f62d6c919c16685ddfa7f47c86e0ebd6112dd22e Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 19 May 2019 03:55:44 +0000 Subject: [PATCH] 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 --- source/duke3d/src/gamedef.h | 1 + source/duke3d/src/gamestructures.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 2a3785300..828222306 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -450,6 +450,7 @@ enum PlayerLabel_t PLAYER_FRAGS, PLAYER_DEATHS, PLAYER_LAST_USED_WEAPON, + PLAYER_BSUBWEAPON, PLAYER_END }; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 94a7eb383..3ae53ec1a 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -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<