diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_misc.c | 110 | ||||
-rw-r--r-- | src/game/bg_public.h | 27 |
2 files changed, 137 insertions, 0 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index ca39fcef..58fe1d07 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1858,6 +1858,116 @@ int BG_FindEvolveTimeForClass( int pclass ) /////////////////////////////////////////////////////////////////////////////////////////// +weaponAttributes_t bg_weapons[ ] = +{ + { + WP_MACHINEGUN, + SLOT_WEAPON + }, + { + WP_FLAMER, + SLOT_WEAPON + }, + { + WP_CHAINGUN, + SLOT_WEAPON + }, + { + WP_HBUILD, + SLOT_WEAPON + }, + { + WP_ABUILD, + SLOT_WEAPON + }, + { + WP_SCANNER, + SLOT_WEAPON + } +}; + +int BG_FindSlotsForWeapon( int weapon ) +{ + int i; + + for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) + { + if( bg_weapons[ i ].weaponNum == weapon ) + { + return bg_weapons[ i ].slots; + } + } + + return SLOT_WEAPON; +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +upgradeAttributes_t bg_upgrades[ ] = +{ + { + UP_TORCH, + SLOT_NONE + }, + { + UP_NVG, + SLOT_HEAD + }, + { + UP_CHESTARMOUR, + SLOT_TORSO + }, + { + UP_LIMBARMOUR, + SLOT_ARMS|SLOT_LEGS + }, + { + UP_HELMET, + SLOT_HEAD + }, + { + UP_ANTITOXIN, + SLOT_NONE + }, + { + UP_BATTPACK, + SLOT_BACKPACK + }, + { + UP_JETPACK, + SLOT_BACKPACK + }, + { + UP_THREATHELMET, + SLOT_HEAD + }, + { + UP_BATTLESUIT, + SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS + }, + { + UP_IMPANTKIT, + SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS + } +}; + +int BG_FindSlotsForUpgrade( int upgrade ) +{ + int i; + + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + { + if( bg_upgrades[ i ].upgradeNum == upgrade ) + { + return bg_upgrades[ i ].slots; + } + } + + return SLOT_NONE; +} + +/////////////////////////////////////////////////////////////////////////////////////////// + /* ============== BG_FindItemForPowerup diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 73e0699c..b79f1c0d 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -230,6 +230,7 @@ void Pmove (pmove_t *pmove); typedef enum { STAT_HEALTH, STAT_ITEMS, + STAT_SLOTS, //TA: tracks the amount of stuff human players are carrying STAT_ACTIVEITEMS, STAT_WEAPONS, // 16 bit fields STAT_WEAPONS2, //TA: another 16 bits to push the max weapon count up @@ -369,6 +370,16 @@ typedef enum { UP_NUM_UPGRADES } upgrade_t; +//TA: bitmasks for upgrade slots +#define SLOT_NONE 0 +#define SLOT_HEAD 1 +#define SLOT_TORSO 2 +#define SLOT_ARMS 4 +#define SLOT_LEGS 8 +#define SLOT_BACKPACK 16 +#define SLOT_WEAPON 32 +#define SLOT_SIDEARM 64 + typedef enum { BA_NONE, @@ -793,6 +804,22 @@ typedef struct qboolean reactorTest; } buildableAttributes_t; +//TA: weapon record +typedef struct +{ + int weaponNum; + + int slots; +} weaponAttributes_t; + +//TA: upgrade record +typedef struct +{ + int upgradeNum; + + int slots; +} upgradeAttributes_t; + // included in both the game dll and the client extern gitem_t bg_itemlist[]; extern int bg_numItems; |