CVAR (sv_instantswitch, "0", "Instant Weapon Switching", CVARTYPE_BOOL, CVAR_SERVERINFO | CVAR_LATCH) // // P_BringUpWeapon // Starts bringing the pending weapon up // from the bottom of the screen. // Uses player // void P_BringUpWeapon (player_t *player) { statenum_t newstate; if (player->pendingweapon == wp_nochange) player->pendingweapon = player->readyweapon; if (player->pendingweapon == wp_chainsaw) A_FireSound(player, "weapons/sawup"); if (!sv_instantswitch) { newstate = weaponinfo[player->pendingweapon].upstate; player->pendingweapon = wp_nochange; player->psprites[ps_weapon].sy = WEAPONBOTTOM; weapon_ypos[player->id] = WEAPONBOTTOM; } else { newstate = weaponinfo[player->pendingweapon].readystate; player->pendingweapon = wp_nochange; player->psprites[ps_weapon].sy = WEAPONTOP; weapon_ypos[player->id] = WEAPONTOP; } P_SetPsprite (player, ps_weapon, newstate); } //-------------------------------------- // // A_Lower // Lowers current weapon, // and changes weapon at bottom. // void A_Lower (AActor *mo) { player_t *player = mo->player; struct pspdef_s *psp = &player->psprites[player->psprnum]; if(!sv_instantswitch) { psp->sy += LOWERSPEED; weapon_ypos[player->id] += LOWERSPEED; // Not yet lowered to the bottom if (weapon_ypos[player->id] < WEAPONBOTTOM) return; } // Player is dead. if (player->playerstate == PST_DEAD) { psp->sy = WEAPONBOTTOM; weapon_ypos[player->id] = WEAPONBOTTOM; // don't bring weapon back up return; } // The old weapon has been lowered off the screen, // so change the weapon and start raising it if (player->health <= 0) { // Player is dead, so keep the weapon off screen. P_SetPsprite (player, ps_weapon, S_NULL); return; } // haleyjd 03/28/10: do not assume pendingweapon is valid if (player->pendingweapon < NUMWEAPONS) player->readyweapon = player->pendingweapon; P_BringUpWeapon (player); }