From 9ce221f5d4cafc60aa78a8b1f1dc584a1e806c79 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 21 Dec 2001 18:37:39 +0000 Subject: More of the menus are dynamically sourced --- src/game/bg_misc.c | 185 +++++++++++++++++++++++++++++++++++++++++---------- src/game/bg_public.h | 22 +++++- src/game/g_cmds.c | 7 ++ src/ui/ui_local.h | 12 ++-- src/ui/ui_main.c | 169 ++++++++++++++++++++++------------------------ 5 files changed, 261 insertions(+), 134 deletions(-) (limited to 'src') diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 1e876b3c..2f8bd7a1 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -957,6 +957,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_SPAWN, //int buildNum; "bioegg", //char *buildName; + "Egg", //char *humanName; "team_droid_spawn", //char *entityName; { "models/buildables/bioegg/bioegg.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -985,6 +986,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_BARRICADE, //int buildNum; "barricade", //char *buildName; + "Barricade", //char *humanName; "team_droid_barricade",//char *entityName; { "models/buildables/barricade/barricade.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1013,6 +1015,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_BOOSTER, //int buildNum; "booster", //char *buildName; + "Booster", //char *humanName; "team_droid_booster", //char *entityName; { "models/buildables/booster/booster.md3", 0, 0, 0 }, { -26, -26, -9 }, //vec3_t mins; @@ -1041,6 +1044,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_ACIDTUBE, //int buildNum; "acid_tube", //char *buildName; + "Acid Tube", //char *humanName; "team_droid_acid_tube",//char *entityName; { "models/buildables/acid_tube/acid_tube.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1069,6 +1073,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_TRAPPER, //int buildNum; "trapper", //char *buildName; + "Trapper", //char *humanName; "team_droid_trapper", //char *entityName; { "models/buildables/trapper/trapper.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1097,6 +1102,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_D_HIVEMIND, //int buildNum; "hivemind", //char *buildName; + "Hivemind", //char *humanName; "team_droid_hivemind", //char *entityName; { "models/buildables/hivemind/hivemind.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1125,6 +1131,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_SPAWN, //int buildNum; "replicator", //char *buildName; + "Replicator", //char *humanName; "team_human_spawn", //char *entityName; { "models/buildables/replicator/replicator.md3", 0, 0, 0 }, { -40, -40, -4 }, //vec3_t mins; @@ -1153,6 +1160,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_MEDISTAT, //int buildNum; "medistat", //char *buildName; + "Medistation", //char *humanName; "team_human_medistat", //char *entityName; { "models/buildables/medistat/medistat.md3", 0, 0, 0 }, { -35, -35, -7 }, //vec3_t mins; @@ -1181,6 +1189,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_DEF1, //int buildNum; "plasmaturret", //char *buildName; + "Plasma Turret", //char *humanName; "team_human_def1", //char *entityName; { "models/buildables/plasmaturret/pturret_base.md3", "models/buildables/plasmaturret/pturret_top.md3", 0, 0 }, { -24, -24, -11 }, //vec3_t mins; @@ -1209,6 +1218,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_DEF2, //int buildNum; "mgturret", //char *buildName; + "Machinegun Turret", //char *humanName; "team_human_def2", //char *entityName; { "models/buildables/mgturret/turret_base.md3", "models/buildables/mgturret/turret_barrel.md3", @@ -1239,6 +1249,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_DEF3, //int buildNum; "tesla", //char *buildName; + "Tesla Generator", //char *humanName; "team_human_tesla", //char *entityName; { "models/buildables/tesla/tesla.md3", 0, 0, 0 }, { -22, -22, -40 }, //vec3_t mins; @@ -1267,6 +1278,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_DCC, //int buildNum; "dcc", //char *buildName; + "D.C.C.", //char *humanName; "team_human_dcc", //char *entityName; { "models/buildables/dcc/dcc.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1295,6 +1307,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_BANK, //int buildNum; "bank", //char *buildName; + "Bank", //char *humanName; "team_human_bank", //char *entityName; { "models/buildables/bank/bank.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1323,6 +1336,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_MCU, //int buildNum; "mcu", //char *buildName; + "M.C.U.", //char *humanName; "team_human_mcu", //char *entityName; { "models/buildables/mcu/mcu.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1351,6 +1365,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_REACTOR, //int buildNum; "reactor", //char *buildName; + "Reactor", //char *humanName; "team_human_reactor", //char *entityName; { "models/buildables/reactor/reactor.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1379,6 +1394,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_REPEATER, //int buildNum; "repeater", //char *buildName; + "Repeater", //char *humanName; "team_human_repeater", //char *entityName; { "models/buildables/repeater/repeater.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1407,6 +1423,7 @@ buildableAttributes_t bg_buildableList[ ] = { BA_H_FLOATMINE, //int buildNum; "floatmine", //char *buildName; + "Floatmine", //char *humanName; "team_human_floatmine",//char *entityName; { "models/buildables/floatmine/floatmine.md3", 0, 0, 0 }, { -15, -15, -15 }, //vec3_t mins; @@ -1493,6 +1510,25 @@ char *BG_FindNameForBuildable( int bclass ) return ""; } +/* +============== +BG_FindHumanNameForBuildNum +============== +*/ +char *BG_FindHumanNameForBuildable( int bclass ) +{ + int i; + + for( i = 0; i < bg_numBuildables; i++ ) + { + if( bg_buildableList[ i ].buildNum == bclass ) + return bg_buildableList[ i ].humanName; + } + + //wimp out + return ""; +} + /* ============== BG_FindEntityNameForBuildNum @@ -1967,7 +2003,8 @@ classAttributes_t bg_classList[ ] = { { PCL_D_B_BASE, //int classnum; - "Builder", //char *classname; + "Builder", //char *className; + "Builder", //char *humanName; "lucy", //char *modelname; "default", //char *skinname; { -15, -15, -20 }, //vec3_t mins; @@ -1992,6 +2029,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_B_LEV1, //int classnum; "BuilderLevel1", //char *classname; + "Advanced Builder", //char *humanname; "lucy", //char *modelname; "angel", //char *skinname; { -20, -20, -20 }, //vec3_t mins; @@ -2016,6 +2054,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_BASE, //int classnum; "Offensive", //char *classname; + "Offensive", //char *humanname; "klesk", //char *modelname; "default", //char *skinname; { -15, -15, -15 }, //vec3_t mins; @@ -2040,6 +2079,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV1, //int classnum; "OffensiveLevel1", //char *classname; + "Offensive Level 1", //char *humanname; "anarki", //char *modelname; "default", //char *skinname; { -24, -24, -24 }, //vec3_t mins; @@ -2064,6 +2104,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV1_UPG, //int classnum; "OffensiveLevel1-Upgrade", //char *classname; + "Offensive Level 1 Upgrade", //char *humanname; "anarki", //char *modelname; "default", //char *skinname; { -24, -24, -24 }, //vec3_t mins; @@ -2088,6 +2129,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV2, //int classnum; "OffensiveLevel2", //char *classname; + "Offensive Level 2", //char *humanname; "bones", //char *modelname; "default", //char *skinname; { -24, -24, -24 }, //vec3_t mins; @@ -2112,6 +2154,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV2_UPG, //int classnum; "OffensiveLevel2-Upgrade", //char *classname; + "Offensive Level 2 Upgrade", //char *humanname; "bones", //char *modelname; "default", //char *skinname; { -24, -24, -24 }, //vec3_t mins; @@ -2136,6 +2179,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV3, //int classnum; "OffensiveLevel3", //char *classname; + "Offensive Level 3", //char *humanname; "orbb", //char *modelname; "default", //char *skinname; { -15, -15, -15 }, //vec3_t mins; @@ -2160,6 +2204,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV3_UPG, //int classnum; "OffensiveLevel3-Upgrade", //char *classname; + "Offensive Level 3 Upgrade", //char *humanname; "orbb", //char *modelname; "default", //char *skinname; { -15, -15, -15 }, //vec3_t mins; @@ -2184,6 +2229,7 @@ classAttributes_t bg_classList[ ] = { PCL_D_O_LEV4, //int classnum; "OffensiveLevel4", //char *classname; + "Offensive Level 4", //char *humanname; "xaero", //char *modelname; "default", //char *skinname; { -15, -15, -15 }, //vec3_t mins; @@ -2208,6 +2254,7 @@ classAttributes_t bg_classList[ ] = { PCL_H_BASE, //int classnum; "Human", //char *classname; + "Human", //char *humanname; "sarge", //char *modelname; "default", //char *skinname; { -15, -15, -24 }, //vec3_t mins; @@ -2271,6 +2318,25 @@ char *BG_FindNameForClassNum( int pclass ) return ""; } +/* +============== +BG_FindHumanNameForClassNum +============== +*/ +char *BG_FindHumanNameForClassNum( int pclass ) +{ + int i; + + for( i = 0; i < bg_numPclasses; i++ ) + { + if( bg_classList[ i ].classNum == pclass ) + return bg_classList[ i ].humanName; + } + + //wimp out + return ""; +} + /* ============== BG_FindModelNameForClass @@ -2632,7 +2698,8 @@ weaponAttributes_t bg_weapons[ ] = 3, //int clips; 3, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_FLAMER, //int weaponNum; @@ -2644,7 +2711,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_CHAINGUN, //int weaponNum; @@ -2656,7 +2724,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_MASS_DRIVER, //int weaponNum; @@ -2668,7 +2737,8 @@ weaponAttributes_t bg_weapons[ ] = 2, //int clips; 3, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_PULSE_RIFLE, //int weaponNum; @@ -2680,7 +2750,8 @@ weaponAttributes_t bg_weapons[ ] = 3, //int clips; 3, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_HBUILD, //int weaponNum; @@ -2692,7 +2763,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_HBUILD2, //int weaponNum; @@ -2704,7 +2776,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_HUMANS //WUTeam_t team; }, { WP_DBUILD, //int weaponNum; @@ -2716,7 +2789,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_ALIENS //WUTeam_t team; }, { WP_DBUILD2, //int weaponNum; @@ -2728,7 +2802,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_ALIENS //WUTeam_t team; }, { WP_VENOM, //int weaponNum; @@ -2740,7 +2815,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_ALIENS //WUTeam_t team; }, { WP_GRABANDCSAW, //int weaponNum; @@ -2752,7 +2828,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qtrue, //qboolean hasAltMode; - qtrue //qboolean synced; + qtrue, //qboolean synced; + WUT_ALIENS //WUTeam_t team; }, { WP_POUNCE, //int weaponNum; @@ -2764,7 +2841,8 @@ weaponAttributes_t bg_weapons[ ] = 0, //int clips; 0, //int maxClips; qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; + qfalse, //qboolean synced; + WUT_ALIENS //WUTeam_t team; } }; @@ -2933,6 +3011,26 @@ qboolean BG_WeaponModesAreSynced( int weapon ) return qfalse; } +/* +============== +BG_FindTeamForWeapon +============== +*/ +WUTeam_t BG_FindTeamForWeapon( int weapon ) +{ + int i; + + for( i = 0; i < bg_numWeapons; i++ ) + { + if( bg_weapons[ i ].weaponNum == weapon ) + { + return bg_weapons[ i ].team; + } + } + + return WUT_NONE; +} + //////////////////////////////////////////////////////////////////////////////// upgradeAttributes_t bg_upgrades[ ] = @@ -2942,77 +3040,72 @@ upgradeAttributes_t bg_upgrades[ ] = 100, //int price; SLOT_NONE, //int slots; "torch", //char *upgradeName; - "Torch" //char *upgradeHumanName; + "Torch", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_NVG, //int upgradeNum; 100, //int price; SLOT_HEAD, //int slots; "nvg", //char *upgradeName; - "NVG" //char *upgradeHumanName; + "NVG", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_CHESTARMOUR, //int upgradeNum; 100, //int price; SLOT_TORSO, //int slots; "carmour", //char *upgradeName; - "Chest Armour" //char *upgradeHumanName; + "Chest Armour", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_LIMBARMOUR, //int upgradeNum; 100, //int price; SLOT_ARMS|SLOT_LEGS, //int slots; "larmour", //char *upgradeName; - "Limb Armour" //char *upgradeHumanName; + "Limb Armour", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_HELMET, //int upgradeNum; 100, //int price; SLOT_HEAD, //int slots; "helmet", //char *upgradeName; - "Helmet" //char *upgradeHumanName; + "Helmet", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_ANTITOXIN, //int upgradeNum; 100, //int price; SLOT_NONE, //int slots; "atoxin", //char *upgradeName; - "Anti-toxin" //char *upgradeHumanName; + "Anti-toxin", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_BATTPACK, //int upgradeNum; 100, //int price; SLOT_BACKPACK, //int slots; "battpack", //char *upgradeName; - "Battery Pack" //char *upgradeHumanName; + "Battery Pack", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_JETPACK, //int upgradeNum; 100, //int price; SLOT_BACKPACK, //int slots; "jetpack", //char *upgradeName; - "Jet Pack" //char *upgradeHumanName; - }, - { - UP_THREATHELMET, //int upgradeNum; - 100, //int price; - SLOT_HEAD, //int slots; - "thelmet", //char *upgradeName; - "Threat Helmet" //char *upgradeHumanName; + "Jet Pack", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; }, { UP_BATTLESUIT, //int upgradeNum; 100, //int price; SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS, //int slots; "bsuit", //char *upgradeName; - "Battlesuit" //char *upgradeHumanName; - }, - { - UP_IMPANTKIT, //int upgradeNum; - 100, //int price; - SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS, //int slots; - "ikit", //char *upgradeName; - "Implant Kit" //char *upgradeHumanName; + "Battlesuit", //char *upgradeHumanName; + WUT_HUMANS //WUTeam_t team; } }; @@ -3115,6 +3208,26 @@ char *BG_FindHumanNameForUpgrade( int upgrade ) return ""; } +/* +============== +BG_FindTeamForUpgrade +============== +*/ +WUTeam_t BG_FindTeamForUpgrade( int upgrade ) +{ + int i; + + for( i = 0; i < bg_numUpgrades; i++ ) + { + if( bg_upgrades[ i ].upgradeNum == upgrade ) + { + return bg_upgrades[ i ].team; + } + } + + return WUT_NONE; +} + //////////////////////////////////////////////////////////////////////////////// /* diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 2e2108e5..86d47a84 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -368,13 +368,21 @@ typedef enum UP_ANTITOXIN, UP_BATTPACK, UP_JETPACK, - UP_THREATHELMET, UP_BATTLESUIT, - UP_IMPANTKIT, UP_NUM_UPGRADES } upgrade_t; +typedef enum +{ + WUT_NONE, + + WUT_ALIENS, + WUT_HUMANS, + + WUT_NUM_TEAMS +} WUTeam_t; + //TA: bitmasks for upgrade slots #define SLOT_NONE 0 #define SLOT_HEAD 1 @@ -809,6 +817,7 @@ typedef struct int classNum; char *className; + char *humanName; char *modelName; char *skinName; @@ -846,6 +855,7 @@ typedef struct int buildNum; char *buildName; + char *humanName; char *entityName; char *models[ MAX_ITEM_MODELS ]; @@ -904,6 +914,8 @@ typedef struct qboolean hasAltMode; qboolean synced; + + WUTeam_t team; } weaponAttributes_t; //TA: upgrade record @@ -917,6 +929,8 @@ typedef struct char *upgradeName; char *upgradeHumanName; + + WUTeam_t team; } upgradeAttributes_t; // included in both the game dll and the client @@ -933,6 +947,7 @@ gitem_t *BG_FindItemForHoldable( holdable_t pw ); int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); char *BG_FindNameForBuildable( int bclass ); +char *BG_FindHumanNameForBuildable( int bclass ); char *BG_FindEntityNameForBuildable( int bclass ); char *BG_FindModelsForBuildable( int bclass, int modelNum ); void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs ); @@ -959,6 +974,7 @@ int BG_FindUniqueTestForBuildable( int bclass ); int BG_FindClassNumForName( char *name ); char *BG_FindNameForClassNum( int pclass ); +char *BG_FindHumanNameForClassNum( int pclass ); char *BG_FindModelNameForClass( int pclass ); void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs ); void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight ); @@ -983,12 +999,14 @@ char *BG_FindHumanNameForWeapon( int weapon ); void BG_FindAmmoForWeapon( int weapon, int *quan, int *clips, int *maxClips ); qboolean BG_WeaponHasAltMode( int weapon ); qboolean BG_WeaponModesAreSynced( int weapon ); +WUTeam_t BG_FindTeamForWeapon( int weapon ); int BG_FindPriceForUpgrade( int upgrade ); int BG_FindSlotsForUpgrade( int upgrade ); char *BG_FindNameForUpgrade( int upgrade ); int BG_FindUpgradeNumForName( char *name ); char *BG_FindHumanNameForUpgrade( int upgrade ); +WUTeam_t BG_FindTeamForUpgrade( int upgrade ); #define ITEM_INDEX(x) ((x)-bg_itemlist) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 2aeada05..a9ac286f 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1860,6 +1860,13 @@ void Cmd_Buy_f( gentity_t *ent ) return; } + if( BG_FindTeamForWeapon( weapon ) != WUT_HUMANS ) + { + //shouldn't need a fancy dialog + trap_SendServerCommand( ent-g_entities, va("print \"You can't buy alien items\n\"" ) ); + return; + } + //add to inventory BG_packWeapon( weapon, ent->client->ps.stats ); BG_FindAmmoForWeapon( weapon, &quan, &clips, &maxClips ); diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index ee8c2b54..75d81f77 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -824,27 +824,27 @@ typedef struct { int tremAlienClassCount; int tremAlienClassIndex; - tremMenuItem_t tremHumanItemList[ 2 ]; + tremMenuItem_t tremHumanItemList[ 3 ]; int tremHumanItemCount; int tremHumanItemIndex; - tremMenuItem_t tremHumanMCUBuyList[ 11 ]; + tremMenuItem_t tremHumanMCUBuyList[ 32 ]; int tremHumanMCUBuyCount; int tremHumanMCUBuyIndex; - tremMenuItem_t tremHumanMCUSellList[ 11 ]; + tremMenuItem_t tremHumanMCUSellList[ 32 ]; int tremHumanMCUSellCount; int tremHumanMCUSellIndex; - tremMenuItem_t tremAlienUpgradeList[ 2 ]; + tremMenuItem_t tremAlienUpgradeList[ 3 ]; int tremAlienUpgradeCount; int tremAlienUpgradeIndex; - tremMenuItem_t tremAlienBuildList[ 6 ]; + tremMenuItem_t tremAlienBuildList[ 32 ]; int tremAlienBuildCount; int tremAlienBuildIndex; - tremMenuItem_t tremHumanBuildList[ 11 ]; + tremMenuItem_t tremHumanBuildList[ 32 ]; int tremHumanBuildCount; int tremHumanBuildIndex; //TA: tremulous menus diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index cab77c78..03840d00 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -2837,14 +2837,21 @@ UI_LoadTremAlienClasses static void UI_LoadTremAlienClasses( ) { uiInfo.tremAlienClassCount = 3; - uiInfo.tremAlienClassList[ 0 ].text = String_Alloc( "Builder" ); - uiInfo.tremAlienClassList[ 0 ].cmd = String_Alloc( "cmd class builder" ); - uiInfo.tremAlienClassList[ 1 ].text = String_Alloc( "Advanced Builder" ); - uiInfo.tremAlienClassList[ 1 ].cmd = String_Alloc( "cmd class builderlevel1" ); + uiInfo.tremAlienClassList[ 0 ].text = + String_Alloc( BG_FindHumanNameForClassNum( PCL_D_B_BASE ) ); + uiInfo.tremAlienClassList[ 0 ].cmd = + String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( PCL_D_B_BASE ) ) ); - uiInfo.tremAlienClassList[ 2 ].text = String_Alloc( "Offensive" ); - uiInfo.tremAlienClassList[ 2 ].cmd = String_Alloc( "cmd class offensive" ); + uiInfo.tremAlienClassList[ 1 ].text = + String_Alloc( BG_FindHumanNameForClassNum( PCL_D_B_LEV1 ) ); + uiInfo.tremAlienClassList[ 1 ].cmd = + String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( PCL_D_B_LEV1 ) ) ); + + uiInfo.tremAlienClassList[ 2 ].text = + String_Alloc( BG_FindHumanNameForClassNum( PCL_D_O_BASE ) ); + uiInfo.tremAlienClassList[ 2 ].cmd = + String_Alloc( va( "cmd class %s", BG_FindNameForClassNum( PCL_D_O_BASE ) ) ); } /* @@ -2855,11 +2862,16 @@ UI_LoadTremHumanItems static void UI_LoadTremHumanItems( ) { uiInfo.tremHumanItemCount = 2; - uiInfo.tremHumanItemList[ 0 ].text = String_Alloc( "Rifle" ); - uiInfo.tremHumanItemList[ 0 ].cmd = String_Alloc( "cmd class rifle" ); + + uiInfo.tremHumanItemList[ 0 ].text = + String_Alloc( BG_FindHumanNameForWeapon( WP_MACHINEGUN ) ); + uiInfo.tremHumanItemList[ 0 ].cmd = + String_Alloc( va( "cmd class %s", BG_FindNameForWeapon( WP_MACHINEGUN ) ) ); - uiInfo.tremHumanItemList[ 1 ].text = String_Alloc( "Construction Kit" ); - uiInfo.tremHumanItemList[ 1 ].cmd = String_Alloc( "cmd class ckit" ); + uiInfo.tremHumanItemList[ 1 ].text = + String_Alloc( BG_FindHumanNameForWeapon( WP_HBUILD ) ); + uiInfo.tremHumanItemList[ 1 ].cmd = + String_Alloc( va( "cmd class %s", BG_FindNameForWeapon( WP_HBUILD ) ) ); } /* @@ -2869,39 +2881,35 @@ UI_LoadTremHumanMCUBuys */ static void UI_LoadTremHumanMCUBuys( ) { - uiInfo.tremHumanMCUBuyCount = 11; - uiInfo.tremHumanMCUBuyList[ 0 ].text = String_Alloc( "Rifle" ); - uiInfo.tremHumanMCUBuyList[ 0 ].cmd = String_Alloc( "cmd buy rifle" ); - - uiInfo.tremHumanMCUBuyList[ 1 ].text = String_Alloc( "Chaingun" ); - uiInfo.tremHumanMCUBuyList[ 1 ].cmd = String_Alloc( "cmd buy chaingun" ); - - uiInfo.tremHumanMCUBuyList[ 2 ].text = String_Alloc( "Flamer" ); - uiInfo.tremHumanMCUBuyList[ 2 ].cmd = String_Alloc( "cmd buy flamer" ); - - uiInfo.tremHumanMCUBuyList[ 3 ].text = String_Alloc( "Mass Driver" ); - uiInfo.tremHumanMCUBuyList[ 3 ].cmd = String_Alloc( "cmd buy mdriver" ); - - uiInfo.tremHumanMCUBuyList[ 4 ].text = String_Alloc( "Pulse Rifle" ); - uiInfo.tremHumanMCUBuyList[ 4 ].cmd = String_Alloc( "cmd buy prifle" ); - - uiInfo.tremHumanMCUBuyList[ 5 ].text = String_Alloc( "NVG" ); - uiInfo.tremHumanMCUBuyList[ 5 ].cmd = String_Alloc( "cmd buy nvg" ); - - uiInfo.tremHumanMCUBuyList[ 6 ].text = String_Alloc( "Torch" ); - uiInfo.tremHumanMCUBuyList[ 6 ].cmd = String_Alloc( "cmd buy torch" ); - - uiInfo.tremHumanMCUBuyList[ 7 ].text = String_Alloc( "Chest Armour" ); - uiInfo.tremHumanMCUBuyList[ 7 ].cmd = String_Alloc( "cmd buy carmour" ); - - uiInfo.tremHumanMCUBuyList[ 8 ].text = String_Alloc( "Limb Armour" ); - uiInfo.tremHumanMCUBuyList[ 8 ].cmd = String_Alloc( "cmd buy larmour" ); + int i, j = 0; + + uiInfo.tremHumanMCUBuyCount = 0; - uiInfo.tremHumanMCUBuyList[ 9 ].text = String_Alloc( "Helmet" ); - uiInfo.tremHumanMCUBuyList[ 9 ].cmd = String_Alloc( "cmd buy helmet" ); + for( i = WP_NONE +1; i < WP_NUM_WEAPONS; i++ ) + { + if( BG_FindTeamForWeapon( i ) == WUT_HUMANS ) + { + uiInfo.tremHumanMCUBuyList[ j ].text = + String_Alloc( BG_FindHumanNameForWeapon( i ) ); + uiInfo.tremHumanMCUBuyList[ j++ ].cmd = + String_Alloc( va( "cmd buy %s", BG_FindNameForWeapon( i ) ) ); + + uiInfo.tremHumanMCUBuyCount++; + } + } - uiInfo.tremHumanMCUBuyList[ 10 ].text = String_Alloc( "Battlesuit" ); - uiInfo.tremHumanMCUBuyList[ 10 ].cmd = String_Alloc( "cmd buy bsuit" ); + for( i = UP_NONE +1; i < UP_NUM_UPGRADES; i++ ) + { + if( BG_FindTeamForUpgrade( i ) == WUT_HUMANS ) + { + uiInfo.tremHumanMCUBuyList[ j ].text = + String_Alloc( BG_FindHumanNameForUpgrade( i ) ); + uiInfo.tremHumanMCUBuyList[ j++ ].cmd = + String_Alloc( va( "cmd buy %s", BG_FindNameForUpgrade( i ) ) ); + + uiInfo.tremHumanMCUBuyCount++; + } + } } /* @@ -2995,24 +3003,22 @@ UI_LoadTremAlienBuilds */ static void UI_LoadTremAlienBuilds( ) { - uiInfo.tremAlienBuildCount = 6; - uiInfo.tremAlienBuildList[ 0 ].text = String_Alloc( "Egg" ); - uiInfo.tremAlienBuildList[ 0 ].cmd = String_Alloc( "cmd build bioegg" ); - - uiInfo.tremAlienBuildList[ 1 ].text = String_Alloc( "Barricade" ); - uiInfo.tremAlienBuildList[ 1 ].cmd = String_Alloc( "cmd build barricade" ); - - uiInfo.tremAlienBuildList[ 2 ].text = String_Alloc( "Acid Tube" ); - uiInfo.tremAlienBuildList[ 2 ].cmd = String_Alloc( "cmd build acid_tube" ); - - uiInfo.tremAlienBuildList[ 3 ].text = String_Alloc( "Trapper" ); - uiInfo.tremAlienBuildList[ 3 ].cmd = String_Alloc( "cmd build trapper" ); - - uiInfo.tremAlienBuildList[ 4 ].text = String_Alloc( "Hivemind" ); - uiInfo.tremAlienBuildList[ 4 ].cmd = String_Alloc( "cmd build hivemind" ); + int i, j = 0; + + uiInfo.tremAlienBuildCount = 0; - uiInfo.tremAlienBuildList[ 5 ].text = String_Alloc( "Booster" ); - uiInfo.tremAlienBuildList[ 5 ].cmd = String_Alloc( "cmd build booster" ); + for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) + { + if( BG_FindTeamForBuildable( i ) == BIT_DROIDS ) + { + uiInfo.tremAlienBuildList[ j ].text = + String_Alloc( BG_FindHumanNameForBuildable( i ) ); + uiInfo.tremAlienBuildList[ j++ ].cmd = + String_Alloc( va( "cmd build %s", BG_FindNameForBuildable( i ) ) ); + + uiInfo.tremAlienBuildCount++; + } + } } /* @@ -3022,39 +3028,22 @@ UI_LoadTremHumanBuilds */ static void UI_LoadTremHumanBuilds( ) { - uiInfo.tremHumanBuildCount = 11; - uiInfo.tremHumanBuildList[ 0 ].text = String_Alloc( "Replicator" ); - uiInfo.tremHumanBuildList[ 0 ].cmd = String_Alloc( "cmd build replicator" ); - - uiInfo.tremHumanBuildList[ 1 ].text = String_Alloc( "M.C.U." ); - uiInfo.tremHumanBuildList[ 1 ].cmd = String_Alloc( "cmd build mcu" ); - - uiInfo.tremHumanBuildList[ 2 ].text = String_Alloc( "Computer" ); - uiInfo.tremHumanBuildList[ 2 ].cmd = String_Alloc( "cmd build computer" ); - - uiInfo.tremHumanBuildList[ 3 ].text = String_Alloc( "Medistation" ); - uiInfo.tremHumanBuildList[ 3 ].cmd = String_Alloc( "cmd build medistat" ); - - uiInfo.tremHumanBuildList[ 4 ].text = String_Alloc( "Bank" ); - uiInfo.tremHumanBuildList[ 4 ].cmd = String_Alloc( "cmd build bank" ); - - uiInfo.tremHumanBuildList[ 5 ].text = String_Alloc( "Machinegun Turret" ); - uiInfo.tremHumanBuildList[ 5 ].cmd = String_Alloc( "cmd build mgturret" ); - - uiInfo.tremHumanBuildList[ 6 ].text = String_Alloc( "Plasma Turret" ); - uiInfo.tremHumanBuildList[ 6 ].cmd = String_Alloc( "cmd build plasmaturret" ); - - uiInfo.tremHumanBuildList[ 7 ].text = String_Alloc( "Tesla Generator" ); - uiInfo.tremHumanBuildList[ 7 ].cmd = String_Alloc( "cmd build tesla" ); - - uiInfo.tremHumanBuildList[ 8 ].text = String_Alloc( "Floatmine" ); - uiInfo.tremHumanBuildList[ 8 ].cmd = String_Alloc( "cmd build floatmine" ); - - uiInfo.tremHumanBuildList[ 9 ].text = String_Alloc( "Reactor" ); - uiInfo.tremHumanBuildList[ 9 ].cmd = String_Alloc( "cmd build reactor" ); + int i, j = 0; + + uiInfo.tremHumanBuildCount = 0; - uiInfo.tremHumanBuildList[ 10 ].text = String_Alloc( "Repeater" ); - uiInfo.tremHumanBuildList[ 10 ].cmd = String_Alloc( "cmd build repeater" ); + for( i = BA_NONE +1; i < BA_NUM_BUILDABLES; i++ ) + { + if( BG_FindTeamForBuildable( i ) == BIT_HUMANS ) + { + uiInfo.tremHumanBuildList[ j ].text = + String_Alloc( BG_FindHumanNameForBuildable( i ) ); + uiInfo.tremHumanBuildList[ j++ ].cmd = + String_Alloc( va( "cmd build %s", BG_FindNameForBuildable( i ) ) ); + + uiInfo.tremHumanBuildCount++; + } + } } /* -- cgit