Permalink
Browse files

game: rework SetWolfSpawnWeapons, AddWeaponToPlayer and AddExtraSpawn…

…Ammo

Add secondary weapon in player classes to be used for checking weapon
validity when spawning. Get equivalent weapon in case the weapon team is
not correct (mp40 <--> thompson, ...).
Remove return value from AddWeaponToPlayer because it is always true and
avoid every check for this return.
Move in AddExtraSpawnAmmo extra *2 clip for Sten and SMG for soldiers.
Tiny optimisation in case weapon don't use ammo so don't need extra.
  • Loading branch information...
Aranud committed Nov 8, 2017
1 parent 7952bb9 commit 8402f33d268e51189666b8c6f26a516ea79715b5
Showing with 215 additions and 346 deletions.
  1. +94 −52 src/game/bg_classes.c
  2. +1 −0 src/game/bg_public.h
  3. +117 −289 src/game/g_client.c
  4. +3 −5 src/game/g_stats.c
View
@@ -49,6 +49,11 @@ bg_playerclass_t bg_allies_playerclasses[NUM_PLAYER_CLASSES] =
WP_BAZOOKA,
WP_MORTAR
},
{
WP_COLT,
WP_AKIMBO_COLT,
WP_THOMPSON,
},
0,
0,
},
@@ -61,6 +66,10 @@ bg_playerclass_t bg_allies_playerclasses[NUM_PLAYER_CLASSES] =
{
WP_THOMPSON,
},
{
WP_COLT,
WP_AKIMBO_COLT,
},
0,
0,
},
@@ -74,6 +83,10 @@ bg_playerclass_t bg_allies_playerclasses[NUM_PLAYER_CLASSES] =
WP_THOMPSON,
WP_CARBINE,
},
{
WP_COLT,
WP_AKIMBO_COLT,
},
0,
0,
},
@@ -86,6 +99,10 @@ bg_playerclass_t bg_allies_playerclasses[NUM_PLAYER_CLASSES] =
{
WP_THOMPSON,
},
{
WP_COLT,
WP_AKIMBO_COLT,
},
0,
0,
},
@@ -100,6 +117,10 @@ bg_playerclass_t bg_allies_playerclasses[NUM_PLAYER_CLASSES] =
WP_FG42,
WP_GARAND,
},
{
WP_SILENCED_COLT,
WP_AKIMBO_SILENCEDCOLT,
},
0,
0,
},
@@ -119,6 +140,11 @@ bg_playerclass_t bg_axis_playerclasses[NUM_PLAYER_CLASSES] =
WP_PANZERFAUST,
WP_MORTAR2
},
{
WP_LUGER,
WP_AKIMBO_LUGER,
WP_MP40,
},
0,
0,
},
@@ -131,6 +157,10 @@ bg_playerclass_t bg_axis_playerclasses[NUM_PLAYER_CLASSES] =
{
WP_MP40,
},
{
WP_LUGER,
WP_AKIMBO_LUGER,
},
0,
0,
},
@@ -144,6 +174,10 @@ bg_playerclass_t bg_axis_playerclasses[NUM_PLAYER_CLASSES] =
WP_MP40,
WP_KAR98,
},
{
WP_LUGER,
WP_AKIMBO_LUGER,
},
0,
0,
},
@@ -156,6 +190,10 @@ bg_playerclass_t bg_axis_playerclasses[NUM_PLAYER_CLASSES] =
{
WP_MP40,
},
{
WP_LUGER,
WP_AKIMBO_LUGER,
},
0,
0,
},
@@ -170,6 +208,10 @@ bg_playerclass_t bg_axis_playerclasses[NUM_PLAYER_CLASSES] =
WP_FG42,
WP_K43,
},
{
WP_SILENCER,
WP_AKIMBO_SILENCEDLUGER,
},
0,
0,
},
@@ -280,21 +322,21 @@ qboolean BG_WeaponIsPrimaryForClassAndTeam(int classnum, team_t team, weapon_t w
* @note Unused
const char *BG_ShortClassnameForNumber(int classNum)
{
switch (classNum)
{
case PC_SOLDIER:
return "Soldr";
case PC_MEDIC:
return "Medic";
case PC_ENGINEER:
return "Engr";
case PC_FIELDOPS:
return "FdOps";
case PC_COVERTOPS:
return "CvOps";
default:
return "^1ERROR";
}
switch (classNum)
{
case PC_SOLDIER:
return "Soldr";
case PC_MEDIC:
return "Medic";
case PC_ENGINEER:
return "Engr";
case PC_FIELDOPS:
return "FdOps";
case PC_COVERTOPS:
return "CvOps";
default:
return "^1ERROR";
}
}
*/
@@ -354,21 +396,21 @@ const char *BG_ClassnameForNumberFilename(int classNum)
* @note Unused
const char *BG_ClassLetterForNumber(int classNum)
{
switch (classNum)
{
case PC_SOLDIER:
return "S";
case PC_MEDIC:
return "M";
case PC_ENGINEER:
return "E";
case PC_FIELDOPS:
return "F";
case PC_COVERTOPS:
return "C";
default:
return "^1E";
}
switch (classNum)
{
case PC_SOLDIER:
return "S";
case PC_MEDIC:
return "M";
case PC_ENGINEER:
return "E";
case PC_FIELDOPS:
return "F";
case PC_COVERTOPS:
return "C";
default:
return "^1E";
}
}
*/
@@ -380,28 +422,28 @@ const char *BG_ClassLetterForNumber(int classNum)
* @note Unused
int BG_ClassTextToClass(const char *token)
{
if (!Q_stricmp(token, "soldier"))
{
return PC_SOLDIER;
}
else if (!Q_stricmp(token, "medic"))
{
return PC_MEDIC;
}
else if (!Q_stricmp(token, "fieldops"))
{
return PC_FIELDOPS;
}
else if (!Q_stricmp(token, "engineer"))
{
return PC_ENGINEER;
}
else if (!Q_stricmp(token, "covertops"))
{
return PC_COVERTOPS;
}
return -1;
if (!Q_stricmp(token, "soldier"))
{
return PC_SOLDIER;
}
else if (!Q_stricmp(token, "medic"))
{
return PC_MEDIC;
}
else if (!Q_stricmp(token, "fieldops"))
{
return PC_FIELDOPS;
}
else if (!Q_stricmp(token, "engineer"))
{
return PC_ENGINEER;
}
else if (!Q_stricmp(token, "covertops"))
{
return PC_COVERTOPS;
}
return -1;
}
*/
View
@@ -2364,6 +2364,7 @@ typedef struct
const char *iconArrow;
weapon_t classWeapons[MAX_WEAPS_PER_CLASS];
weapon_t classSecondaryWeapons[MAX_WEAPS_PER_CLASS];
qhandle_t icon;
qhandle_t arrow;
Oops, something went wrong.

0 comments on commit 8402f33

Please sign in to comment.