track previous weapon
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2460 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -628,6 +628,7 @@ int sub(int a, int b) { return a-b; } COMMANDN(-, sub, ARG_2EXP);
|
||||
int divi(int a, int b) { return b ? a/b : 0; } COMMANDN(div, divi, ARG_2EXP);
|
||||
int mod(int a, int b) { return b ? a%b : 0; } COMMAND(mod, ARG_2EXP);
|
||||
int equal(int a, int b) { return (int)(a==b); } COMMANDN(=, equal, ARG_2EXP);
|
||||
int notequal(int a, int b) { return (int)(a!=b); } COMMANDN(!=, notequal, ARG_2EXP);
|
||||
int lt(int a, int b) { return (int)(a<b); } COMMANDN(<, lt, ARG_2EXP);
|
||||
int gt(int a, int b) { return (int)(a>b); } COMMANDN(>, gt, ARG_2EXP);
|
||||
|
||||
|
||||
+5
-4
@@ -355,7 +355,7 @@ struct playerent : dynent, playerstate
|
||||
bool allowmove() { return state!=CS_DEAD || spectatemode==SM_FLY; }
|
||||
|
||||
weapon *weapons[NUMGUNS];
|
||||
weapon *weaponsel, *nextweaponsel, *primweap, *nextprimweap, *lastattackweapon;
|
||||
weapon *prevweaponsel, *weaponsel, *nextweaponsel, *primweap, *nextprimweap, *lastattackweapon;
|
||||
|
||||
poshist history; // Previous stored locations of this player
|
||||
|
||||
@@ -364,7 +364,7 @@ struct playerent : dynent, playerstate
|
||||
|
||||
playerent() : clientnum(-1), lastupdate(0), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), deaths(0), lastpain(0), lastvoicecom(0), clientrole(CR_DEFAULT),
|
||||
skin(0), nextskin(0), spectatemode(SM_NONE), followplayercn(-1), eardamagemillis(0), respawnoffset(0),
|
||||
weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL),
|
||||
prevweaponsel(NULL), weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL),
|
||||
smoothmillis(-1)
|
||||
{
|
||||
type = ENT_PLAYER;
|
||||
@@ -421,12 +421,12 @@ struct playerent : dynent, playerstate
|
||||
void spawnstate(int gamemode)
|
||||
{
|
||||
playerstate::spawnstate(gamemode);
|
||||
weaponsel = weapons[gunselect];
|
||||
prevweaponsel = weaponsel = weapons[gunselect];
|
||||
primweap = weapons[primary];
|
||||
nextprimweap = weapons[nextprimary];
|
||||
}
|
||||
|
||||
void selectweapon(int w) { weaponsel = weapons[(gunselect = w)]; }
|
||||
void selectweapon(int w) { prevweaponsel = weaponsel = weapons[(gunselect = w)]; }
|
||||
void setprimary(int w) { primweap = weapons[(primary = w)]; }
|
||||
void setnextprimary(int w) { nextprimweap = weapons[(nextprimary = w)]; }
|
||||
bool isspectating() { return state==CS_SPECTATE || (state==CS_DEAD && spectatemode > SM_NONE); }
|
||||
@@ -436,6 +436,7 @@ struct playerent : dynent, playerstate
|
||||
extern int lastmillis;
|
||||
weaponsel->ondeselecting();
|
||||
weaponchanging = lastmillis;
|
||||
prevweaponsel = weaponsel;
|
||||
nextweaponsel = w;
|
||||
w->onselecting();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,10 @@ void checkweaponswitch()
|
||||
addmsg(SV_WEAPCHANGE, "ri", player1->weaponsel->type);
|
||||
player1->weaponchanging = 0;
|
||||
}
|
||||
else if(timeprogress>weapon::weaponchangetime/2) player1->weaponsel = player1->nextweaponsel;
|
||||
else if(timeprogress>weapon::weaponchangetime/2)
|
||||
{
|
||||
player1->weaponsel = player1->nextweaponsel;
|
||||
}
|
||||
}
|
||||
|
||||
void selectweapon(weapon *w)
|
||||
@@ -94,6 +97,7 @@ void shiftweapon(int s)
|
||||
}
|
||||
|
||||
int currentprimary() { return player1->primweap->type; }
|
||||
int prevweapon() { return player1->prevweaponsel->type; }
|
||||
int curweapon() { return player1->weaponsel->type; }
|
||||
|
||||
int magcontent(int w) { if(w > 0 && w < NUMGUNS) return player1->weapons[w]->mag; else return -1;}
|
||||
@@ -102,6 +106,7 @@ int magreserve(int w) { if(w > 0 && w < NUMGUNS) return player1->weapons[w]->amm
|
||||
COMMANDN(weapon, selectweaponi, ARG_1INT);
|
||||
COMMAND(shiftweapon, ARG_1INT);
|
||||
COMMAND(currentprimary, ARG_IVAL);
|
||||
COMMAND(prevweapon, ARG_IVAL);
|
||||
COMMAND(curweapon, ARG_IVAL);
|
||||
COMMAND(magcontent, ARG_1EXP);
|
||||
COMMAND(magreserve, ARG_1EXP);
|
||||
|
||||
Reference in New Issue
Block a user