diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index e5d9f466..01df9acd 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -393,7 +393,7 @@ bool tryrespawn() player1->attacking = false; if(m_arena) { conoutf("waiting for new round to start..."); return false; } respawnself(); - weaponswitch(player1->primweap); + player1->weaponswitch(player1->primweap); player1->lastaction -= weapon::weaponchangetime/2; return true; } diff --git a/source/src/entity.h b/source/src/entity.h index 4bd453c5..68489d53 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -405,6 +405,15 @@ struct playerent : dynent, playerstate 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); } + void weaponswitch(weapon *w) + { + if(!w) return; + extern int lastmillis; + weaponsel->ondeselecting(); + weaponchanging = lastmillis; + nextweaponsel = w; + w->onselecting(); + } }; diff --git a/source/src/protos.h b/source/src/protos.h index 4db4a3a2..0d35e505 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -522,7 +522,6 @@ extern void addgib(playerent *d); extern playerent *playerincrosshair(); extern int magsize(int gun); extern void checkweaponswitch(); -extern void weaponswitch(weapon *w); extern void setscope(bool activate); extern bool intersect(dynent *d, const vec &from, const vec &to, vec *end = NULL); extern bool intersect(entity *e, const vec &from, const vec &to, vec *end = NULL); diff --git a/source/src/sound.cpp b/source/src/sound.cpp index da1a0951..e1ad35e7 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -570,7 +570,7 @@ void setmusicvol() extern int musicvol; gamemusic.setvolume(musicvol/255.0f); } -VARFP(musicvol, 0, 128, 255, setmusicvol()); +VARFP(musicvol, 0, 64, 255, setmusicvol()); char *musicdonecmd = NULL; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 5cfa790f..c79ee744 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -27,19 +27,10 @@ void checkweaponswitch() else if(timeprogress>weapon::weaponchangetime/2) player1->weaponsel = player1->nextweaponsel; } -void weaponswitch(weapon *w) -{ - if(!w) return; - player1->weaponsel->ondeselecting(); - player1->weaponchanging = lastmillis; - player1->nextweaponsel = w; - w->onselecting(); -} - void selectweapon(weapon *w) { if(w && w->selectable() && player1->weaponsel->deselectable()) - weaponswitch(w); + player1->weaponswitch(w); } void selectweaponi(int w) @@ -896,6 +887,11 @@ bool assaultrifle::selectable() { return weapon::selectable() && !m_noprimary && pistol::pistol(playerent *owner) : gun(owner, GUN_PISTOL) {} bool pistol::selectable() { return weapon::selectable() && !m_nopistol; } +void pistol::onselecting() +{ + // switch immediately to akimbo if present + if(owner->akimbo) owner->weaponswitch(owner->weapons[GUN_AKIMBO]); +} // akimbo @@ -921,7 +917,7 @@ void akimbo::onammopicked() akimbomillis = lastmillis + 30000; if(owner==player1) { - if(owner->weaponsel->type!=GUN_SNIPER && owner->weaponsel->type!=GUN_GRENADE) weaponswitch(this); + if(owner->weaponsel->type!=GUN_SNIPER && owner->weaponsel->type!=GUN_GRENADE) owner->weaponswitch(this); addmsg(SV_AKIMBO, "ri", lastmillis); } } @@ -1017,7 +1013,7 @@ void checkakimbo() // transfer ammo to pistol p.mag = min((int)p.info.magsize, max(a.mag, p.mag)); p.ammo = max(p.ammo, p.ammo); - if(player1->weaponsel->type==GUN_AKIMBO) weaponswitch(&p); + if(player1->weaponsel->type==GUN_AKIMBO) player1->weaponswitch(&p); playsoundc(S_AKIMBOOUT); } } diff --git a/source/src/weapon.h b/source/src/weapon.h index c5f4a756..6c30f91c 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -130,6 +130,7 @@ struct pistol : gun { pistol(playerent *owner); bool selectable(); + void onselecting(); };