fun changes
This commit is contained in:
+26
-4
@@ -91,7 +91,7 @@ extern int matchdeathradius, matchdeathpower;
|
||||
// the values, sends them to every client when they change and to everybody who joins (SV_MATCHSETTINGS).
|
||||
// Offline/bot games have no server, so there you simply set them yourself. Defined in server.cpp (which is part of the client too).
|
||||
struct matchsettingdef { const char *name; int *var; int min, def, max; };
|
||||
#define NUMMATCHSETTINGS 14
|
||||
#define NUMMATCHSETTINGS 20
|
||||
extern matchsettingdef matchsettings[NUMMATCHSETTINGS];
|
||||
extern int matchsynced[NUMMATCHSETTINGS]; // client side: the values the server last announced
|
||||
extern void matchsettings_reset(); // everything back to the defaults
|
||||
@@ -263,6 +263,9 @@ struct poshist
|
||||
}
|
||||
};
|
||||
|
||||
#define MEDKIT_MAX 2
|
||||
#define MEDKIT_HEAL 33
|
||||
|
||||
class playerstate
|
||||
{
|
||||
public:
|
||||
@@ -272,8 +275,9 @@ public:
|
||||
bool akimbo;
|
||||
int ammo[NUMGUNS], mag[NUMGUNS], gunwait[NUMGUNS];
|
||||
int pstatshots[NUMGUNS], pstatdamage[NUMGUNS];
|
||||
int medkits; // carryable health pickups when matchmedkit is on (3rd-slot style usable item)
|
||||
|
||||
playerstate() : armour(0), primary(GUN_ASSAULT), nextprimary(GUN_ASSAULT), akimbo(false) {}
|
||||
playerstate() : armour(0), primary(GUN_ASSAULT), nextprimary(GUN_ASSAULT), akimbo(false), medkits(0) {}
|
||||
virtual ~playerstate() {}
|
||||
|
||||
void resetstats() { loopi(NUMGUNS) pstatshots[i] = pstatdamage[i] = 0; }
|
||||
@@ -297,12 +301,13 @@ public:
|
||||
|
||||
bool canpickup(int type)
|
||||
{
|
||||
extern int matchmedkit;
|
||||
switch(type)
|
||||
{
|
||||
case I_CLIPS: return ammo[akimbo && ammo[GUN_AKIMBO]<ammostats[GUN_AKIMBO].max ? GUN_AKIMBO : GUN_PISTOL]<ammostats[akimbo && ammo[GUN_AKIMBO]<ammostats[GUN_AKIMBO].max ? GUN_AKIMBO : GUN_PISTOL].max;
|
||||
case I_AMMO: return ammo[primary]<ammostats[primary].max;
|
||||
case I_GRENADE: return mag[GUN_GRENADE]<ammostats[GUN_GRENADE].max;
|
||||
case I_HEALTH: return health<powerupstats[type-I_HEALTH].max;
|
||||
case I_HEALTH: return matchmedkit ? medkits<MEDKIT_MAX : health<powerupstats[type-I_HEALTH].max;
|
||||
case I_HELMET:
|
||||
case I_ARMOUR: return armour<powerupstats[type-I_HEALTH].max;
|
||||
case I_AKIMBO: return !akimbo;
|
||||
@@ -326,7 +331,13 @@ public:
|
||||
break;
|
||||
case I_AMMO: additem(ammostats[primary], ammo[primary]); break;
|
||||
case I_GRENADE: additem(ammostats[GUN_GRENADE], mag[GUN_GRENADE]); break;
|
||||
case I_HEALTH: additem(powerupstats[type-I_HEALTH], health); break;
|
||||
case I_HEALTH:
|
||||
{
|
||||
extern int matchmedkit;
|
||||
if(matchmedkit) { if(medkits < MEDKIT_MAX) medkits++; }
|
||||
else additem(powerupstats[type-I_HEALTH], health);
|
||||
break;
|
||||
}
|
||||
case I_HELMET:
|
||||
case I_ARMOUR:
|
||||
additem(powerupstats[type-I_HEALTH], armour); break;
|
||||
@@ -344,6 +355,7 @@ public:
|
||||
armour = 0;
|
||||
gunselect = GUN_PISTOL;
|
||||
akimbo = false;
|
||||
medkits = 0;
|
||||
loopi(NUMGUNS) ammo[i] = mag[i] = gunwait[i] = 0;
|
||||
ammo[GUN_KNIFE] = mag[GUN_KNIFE] = 1;
|
||||
}
|
||||
@@ -612,6 +624,16 @@ public:
|
||||
{
|
||||
if(!w) return;
|
||||
extern int lastmillis;
|
||||
extern int matchreloadcancel;
|
||||
// cancelling a reload by switching: drop the pending reload, new weapon gets a 0.2s ready delay
|
||||
if(weaponsel && weaponsel->reloading && matchreloadcancel)
|
||||
{
|
||||
weaponsel->reloading = 0;
|
||||
weaponsel->gunwait = 0;
|
||||
// the 0.2s ready delay only applies to reloadable guns, so it can never sit in the way of
|
||||
// grenade cooking (knife/grenade shots are not affected by reloading) - see grenades::attack()
|
||||
if(reloadable_gun(w->type)) w->gunwait = max(w->gunwait, 200);
|
||||
}
|
||||
weaponsel->ondeselecting();
|
||||
weaponchanging = lastmillis;
|
||||
nextweaponsel = w;
|
||||
|
||||
Reference in New Issue
Block a user