bug fix: quick nade throw
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4989 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+9
-1
@@ -86,12 +86,20 @@ alias ktf [ votemap 15 $arg1 ]
|
||||
alias primary [ weapon (currentprimary) ]
|
||||
alias secondary [ weapon 1 ]
|
||||
alias melee [ weapon 0 ]
|
||||
alias grenades [ weapon 6 ]
|
||||
alias grenades [ weapon 7 ]
|
||||
|
||||
alias altaction [
|
||||
(concatword altaction_ (curweapon))
|
||||
]
|
||||
|
||||
alias quicknadethrow_old [
|
||||
if (> (magcontent 7) 0) [
|
||||
if (!= (curweapon) 7) [grenades]
|
||||
attack
|
||||
]
|
||||
onrelease [ sleep 1 [ if (= (curweapon) 7) [weapon (prevweapon)] ] ]
|
||||
]
|
||||
|
||||
loop i 9 [ alias (concatword altaction_ $i) quicknadethrow ] // Quick nade throw is default
|
||||
alias altaction_5 [ zoom 1; onrelease [ zoom 0 ] ] // Sniper
|
||||
//alias altaction_7 [ attack ] // Grenade // with this comment, you throw the nade and the nade is unselected : Brahma
|
||||
|
||||
+2
-1
@@ -349,7 +349,7 @@ public:
|
||||
int frags, flagscore, deaths;
|
||||
int lastaction, lastmove, lastpain, lastvoicecom;
|
||||
int clientrole;
|
||||
bool attacking;
|
||||
bool attacking, quicknade;
|
||||
string name;
|
||||
int team;
|
||||
int weaponchanging;
|
||||
@@ -379,6 +379,7 @@ public:
|
||||
smoothmillis(-1),
|
||||
head(-1, -1, -1), ignored(false), muted(false)
|
||||
{
|
||||
quicknade = false;
|
||||
type = ENT_PLAYER;
|
||||
name[0] = 0;
|
||||
maxeyeheight = 4.5f;
|
||||
|
||||
@@ -110,7 +110,8 @@ void quicknadethrow(bool on)
|
||||
else
|
||||
{
|
||||
attack(false);
|
||||
if(player1->weaponsel->type == GUN_GRENADE) selectweapon(player1->prevweaponsel);
|
||||
player1->quicknade = true;
|
||||
// if(player1->weaponsel->type == GUN_GRENADE) selectweapon(player1->prevweaponsel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,7 +833,8 @@ bool grenades::attack(vec &targ)
|
||||
int attackmillis = lastmillis-owner->lastaction;
|
||||
vec &to = targ;
|
||||
|
||||
bool waitdone = attackmillis>=gunwait && !(m_arena && m_teammode && arenaintermission);
|
||||
bool quickwait = attackmillis*3>=gunwait && !(m_arena && m_teammode && arenaintermission);
|
||||
bool waitdone = attackmillis>=gunwait && quickwait;
|
||||
if(waitdone) gunwait = reloading = 0;
|
||||
|
||||
switch(state)
|
||||
@@ -842,7 +844,7 @@ bool grenades::attack(vec &targ)
|
||||
break;
|
||||
|
||||
case GST_INHAND:
|
||||
if(waitdone)
|
||||
if(waitdone || ( owner->quicknade && quickwait ) )
|
||||
{
|
||||
if(!owner->attacking || this!=owner->weaponsel) thrownade(); // throw
|
||||
else if(!inhandnade->isalive(lastmillis)) dropnade(); // drop & have fun
|
||||
@@ -906,6 +908,8 @@ void grenades::activatenade(const vec &to)
|
||||
|
||||
void grenades::thrownade()
|
||||
{
|
||||
if (owner->quicknade && owner->weaponsel->type == GUN_GRENADE) selectweapon(owner->prevweaponsel);
|
||||
owner->quicknade = false;
|
||||
if(!inhandnade) return;
|
||||
const float speed = cosf(RAD*owner->pitch);
|
||||
vec vel(sinf(RAD*owner->yaw)*speed, -cosf(RAD*owner->yaw)*speed, sinf(RAD*owner->pitch));
|
||||
|
||||
Reference in New Issue
Block a user