diff --git a/src/server/ammo_op4.qc b/src/server/ammo_op4.qc index 0829deb..0adf11d 100644 --- a/src/server/ammo_op4.qc +++ b/src/server/ammo_op4.qc @@ -117,7 +117,8 @@ ammo_spore::Death(void) nextthink = time + 10.0f; } -void ammo_spore::Respawn(void) +void +ammo_spore::Respawn(void) { frame = 1; m_iBody = 2; diff --git a/src/shared/player.qc b/src/shared/player.qc index 29fe772..bc77644 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -42,123 +42,59 @@ enumflags PLAYER_UNUSED2 }; -/* ammo 1 type updates */ -enumflags -{ - AMMO1_GLOCK, - AMMO1_MP5, - AMMO1_PYTHON, - AMMO1_SHOTGUN, - AMMO1_CROSSBOW, - AMMO1_RPG, - AMMO1_SATCHEL -}; - -/* ammo 2 type updates */ -enumflags -{ - AMMO2_9MM, - AMMO2_357, - AMMO2_BUCKSHOT, - AMMO2_BOLT, - AMMO2_ROCKET, - AMMO2_URANIUM, - AMMO2_HANDGRENADE, - AMMO2_SATCHEL, - AMMO2_TRIPMINE, - AMMO2_SNARK, - AMMO2_HORNET, -}; - -enumflags -{ - AMMO3_M203_GRENADE, - AMMO3_SHOTGUN_STATE, - AMMO3_GAUSS_STATE, - AMMO3_GAUSS_VOLUME, - AMMO3_EGON_STATE, - AMMO3_RPG_STATE, - AMMO3_HANDGRENADE_STATE -}; - noref int input_sequence; class player:base_player { - /* Weapon specific */ - int glock_mag; - int glock_mag_net; - int mp5_mag; - int mp5_mag_net; - int python_mag; - int python_mag_net; - int shotgun_mag; - int shotgun_mag_net; - int crossbow_mag; - int crossbow_mag_net; - int rpg_mag; - int rpg_mag_net; - int satchel_chg; - int satchel_chg_net; + /* animation */ + PREDICTED_INT(anim_top); + PREDICTED_FLOAT(anim_top_time); + PREDICTED_FLOAT(anim_top_delay); + PREDICTED_INT(anim_bottom); + PREDICTED_FLOAT(anim_bottom_time); - int ammo_9mm; - int ammo_9mm_net; - int ammo_357; - int ammo_357_net; - int ammo_buckshot; - int ammo_buckshot_net; - int ammo_bolt; - int ammo_bolt_net; - int ammo_rocket; - int ammo_rocket_net; - int ammo_uranium; - int ammo_uranium_net; - int ammo_handgrenade; - int ammo_handgrenade_net; - int ammo_satchel; - int ammo_satchel_net; - int ammo_tripmine; - int ammo_tripmine_net; - int ammo_snark; - int ammo_snark_net; - int ammo_hornet; - int ammo_hornet_net; + /* ammo 1 */ + PREDICTED_INT(glock_mag); + PREDICTED_INT(mp5_mag); + PREDICTED_INT(python_mag); + PREDICTED_INT(shotgun_mag); + PREDICTED_INT(crossbow_mag); + PREDICTED_INT(rpg_mag); + PREDICTED_INT(satchel_chg); - int ammo_m203_grenade; - int ammo_m203_grenade_net; - int ammo_shotgun_state; - int ammo_shotgun_state_net; - int ammo_gauss_state; - int ammo_gauss_state_net; - int ammo_gauss_volume; - int ammo_gauss_volume_net; - int ammo_egon_state; - int ammo_egon_state_net; - int ammo_rpg_state; - int ammo_rpg_state_net; - int mode_tempstate; - int mode_tempstate_net; + /* ammo 2 */ + PREDICTED_INT(ammo_9mm); + PREDICTED_INT(ammo_357); + PREDICTED_INT(ammo_buckshot); + PREDICTED_INT(ammo_bolt); + PREDICTED_INT(ammo_rocket); + PREDICTED_INT(ammo_uranium); + PREDICTED_INT(ammo_handgrenade); + PREDICTED_INT(ammo_satchel); + PREDICTED_INT(ammo_tripmine); + PREDICTED_INT(ammo_snark); + PREDICTED_INT(ammo_hornet); + + /* ammo 3 */ + PREDICTED_INT(ammo_m203_grenade); + PREDICTED_INT(ammo_gauss_volume); + PREDICTED_INT(ammo_rpg_state); + PREDICTED_INT(mode_tempstate); /* gearbox */ - int eagle_mag; int eagle_mag_net; - int sniper_mag; int sniper_mag_net; - int m249_mag; int m249_mag_net; - int sporelauncher_mag; int sporelauncher_mag_net; - int ammo_556; int ammo_556_net; - int ammo_762; int ammo_762_net; - int ammo_spore; int ammo_spore_net; - int ammo_shock; int ammo_shock_net; - int ammo_penguin; int ammo_penguin_net; - int mode_displacer; int mode_displacer_net; - int mode_eagle; int mode_eagle_net; - int mode_wrench; int mode_wrench_net; - int mode_sporelauncher; int mode_sporelauncher_net; - int mode_m249; int mode_m249_net; - - float anim_top; float anim_top_net; - float anim_top_time; float anim_top_time_net; - float anim_top_delay; float anim_top_delay_net; - float anim_bottom; float anim_bottom_net; - float anim_bottom_time; float anim_bottom_time_net; + PREDICTED_INT(eagle_mag); + PREDICTED_INT(sniper_mag); + PREDICTED_INT(m249_mag); + PREDICTED_INT(sporelauncher_mag); + PREDICTED_INT(ammo_556); + PREDICTED_INT(ammo_762); + PREDICTED_INT(ammo_spore); + PREDICTED_INT(ammo_shock); + PREDICTED_INT(ammo_penguin); + PREDICTED_INT(mode_displacer); + PREDICTED_INT(mode_eagle); + PREDICTED_INT(mode_wrench); + PREDICTED_INT(mode_sporelauncher); + PREDICTED_INT(mode_m249); #ifdef CLIENT /* External model */ @@ -170,7 +106,7 @@ class player:base_player virtual void(void) draw; virtual float() predraw; virtual void(void) postdraw; - virtual void(float) ReceiveEntity; + virtual void(float,float) ReceiveEntity; virtual void(void) PredictPreFrame; virtual void(void) PredictPostFrame; #else @@ -187,61 +123,9 @@ player::ReceiveEntity ================= */ void -player::ReceiveEntity(float new) +player::ReceiveEntity(float new, float fl) { - float fl; - - /* seed for our prediction table */ - sequence = servercommandframe; - - fl = readfloat(); - - /* HACK: we need to make this more reliable */ - if (fl == UPDATE_ALL) { - /* we respawned */ - gravity = __NULL__; - } - - if (fl & PLAYER_MODELINDEX) - modelindex = readshort(); - - if (fl & PLAYER_ORIGIN) { - origin[0] = readcoord(); - origin[1] = readcoord(); - } - - if (fl & PLAYER_ORIGIN_Z) - origin[2] = readcoord(); - if (fl & PLAYER_ANGLES_X) - pitch = readfloat(); - if (fl & PLAYER_ANGLES_Y) - angles[1] = readfloat(); - if (fl & PLAYER_ANGLES_Z) - angles[2] = readfloat(); - - if (fl & PLAYER_VELOCITY) { - velocity[0] = readcoord(); - velocity[1] = readcoord(); - } - - if (fl & PLAYER_VELOCITY_Z) - velocity[2] = readcoord(); - if (fl & PLAYER_FLAGS) { - flags = readfloat(); - gflags = readfloat(); - } - if (fl & PLAYER_WEAPON) - activeweapon = readbyte(); - if (fl & PLAYER_ITEMS) - g_items = (__variant)readfloat(); - if (fl & PLAYER_HEALTH) - health = readbyte(); - if (fl & PLAYER_ARMOR) - armor = readbyte(); - if (fl & PLAYER_MOVETYPE) - movetype = readbyte(); - if (fl & PLAYER_VIEWOFS) - view_ofs[2] = readfloat(); + base_player::ReceiveEntity(new, fl); /* animation */ if (fl & PLAYER_TOPFRAME) { @@ -293,10 +177,7 @@ player::ReceiveEntity(float new) if (fl & PLAYER_AMMO3) { ammo_m203_grenade = readbyte(); - ammo_shotgun_state = readbyte(); - ammo_gauss_state = readbyte(); ammo_gauss_volume = readbyte(); - ammo_egon_state = readbyte(); ammo_rpg_state = readbyte(); mode_tempstate = readbyte(); @@ -325,54 +206,54 @@ so we can roll them back later. void player::PredictPreFrame(void) { - glock_mag_net = glock_mag; - mp5_mag_net = mp5_mag; - python_mag_net = python_mag; - shotgun_mag_net = shotgun_mag; - crossbow_mag_net = crossbow_mag; - rpg_mag_net = rpg_mag; - satchel_chg_net = satchel_chg; - ammo_9mm_net = ammo_9mm; - ammo_357_net = ammo_357; - ammo_buckshot_net = ammo_buckshot; - ammo_bolt_net = ammo_bolt; - ammo_rocket_net = ammo_rocket; - ammo_uranium_net = ammo_uranium; - ammo_handgrenade_net = ammo_handgrenade; - ammo_satchel_net = ammo_satchel; - ammo_tripmine_net = ammo_tripmine; - ammo_snark_net = ammo_snark; - ammo_hornet_net = ammo_hornet; + base_player::PredictPreFrame(); - ammo_m203_grenade_net = ammo_m203_grenade; - ammo_shotgun_state_net = ammo_shotgun_state; - ammo_gauss_state_net = ammo_gauss_state; - ammo_gauss_volume_net = ammo_gauss_volume; - ammo_egon_state_net = ammo_egon_state; - ammo_rpg_state_net = ammo_rpg_state; - mode_tempstate_net = mode_tempstate; + SAVE_STATE(anim_top); + SAVE_STATE(anim_top_delay); + SAVE_STATE(anim_top_time); + SAVE_STATE(anim_bottom); + SAVE_STATE(anim_bottom_time); + + SAVE_STATE(glock_mag); + SAVE_STATE(mp5_mag); + SAVE_STATE(python_mag); + SAVE_STATE(shotgun_mag); + SAVE_STATE(crossbow_mag); + SAVE_STATE(rpg_mag); + SAVE_STATE(satchel_chg); + + SAVE_STATE(ammo_9mm); + SAVE_STATE(ammo_357); + SAVE_STATE(ammo_buckshot); + SAVE_STATE(ammo_bolt); + SAVE_STATE(ammo_rocket); + SAVE_STATE(ammo_uranium); + SAVE_STATE(ammo_handgrenade); + SAVE_STATE(ammo_satchel); + SAVE_STATE(ammo_tripmine); + SAVE_STATE(ammo_snark); + SAVE_STATE(ammo_hornet); + + SAVE_STATE(ammo_m203_grenade); + SAVE_STATE(ammo_gauss_volume); + SAVE_STATE(ammo_rpg_state); + SAVE_STATE(mode_tempstate); /* gearbox */ - eagle_mag_net = eagle_mag; - sniper_mag_net = sniper_mag; - m249_mag_net = m249_mag; - sporelauncher_mag_net = sporelauncher_mag; - ammo_556_net = ammo_556; - ammo_762_net = ammo_762; - ammo_spore_net = ammo_spore; - ammo_shock_net = ammo_shock; - ammo_penguin_net = ammo_penguin; - mode_displacer_net = mode_displacer; - mode_eagle_net = mode_eagle; - mode_wrench_net = mode_wrench; - mode_sporelauncher_net = mode_sporelauncher; - mode_m249_net = mode_m249; - - anim_top_net = anim_top; - anim_top_delay_net = anim_top_delay; - anim_top_time_net = anim_top_time; - anim_bottom_net = anim_bottom; - anim_bottom_time_net = anim_bottom_time; + SAVE_STATE(eagle_mag); + SAVE_STATE(sniper_mag); + SAVE_STATE(m249_mag); + SAVE_STATE(sporelauncher_mag); + SAVE_STATE(ammo_556); + SAVE_STATE(ammo_762); + SAVE_STATE(ammo_spore); + SAVE_STATE(ammo_shock); + SAVE_STATE(ammo_penguin); + SAVE_STATE(mode_displacer); + SAVE_STATE(mode_eagle); + SAVE_STATE(mode_wrench); + SAVE_STATE(mode_sporelauncher); + SAVE_STATE(mode_m249); } /* @@ -385,247 +266,146 @@ Where we roll back our values to the ones last sent/verified by the server. void player::PredictPostFrame(void) { - glock_mag = glock_mag_net; - mp5_mag = mp5_mag_net; - python_mag = python_mag_net; - shotgun_mag = shotgun_mag_net; - crossbow_mag = crossbow_mag_net; - rpg_mag = rpg_mag_net; - satchel_chg = satchel_chg_net; - ammo_9mm = ammo_9mm_net; - ammo_357 = ammo_357_net; - ammo_buckshot = ammo_buckshot_net; - ammo_m203_grenade = ammo_m203_grenade_net; - ammo_bolt = ammo_bolt_net; - ammo_rocket = ammo_rocket_net; - ammo_uranium = ammo_uranium_net; - ammo_handgrenade = ammo_handgrenade_net; - ammo_satchel = ammo_satchel_net; - ammo_tripmine = ammo_tripmine_net; - ammo_snark = ammo_snark_net; - ammo_hornet = ammo_hornet_net; + base_player::PredictPostFrame(); - ammo_m203_grenade = ammo_m203_grenade_net; - ammo_shotgun_state = ammo_shotgun_state_net; - ammo_gauss_state = ammo_gauss_state_net; - ammo_gauss_volume = ammo_gauss_volume_net; - ammo_egon_state = ammo_egon_state_net; - ammo_rpg_state = ammo_rpg_state_net; - mode_tempstate = mode_tempstate_net; + ROLL_BACK(anim_top); + ROLL_BACK(anim_top_delay); + ROLL_BACK(anim_top_time); + ROLL_BACK(anim_bottom); + ROLL_BACK(anim_bottom_time); + + ROLL_BACK(glock_mag); + ROLL_BACK(mp5_mag); + ROLL_BACK(python_mag); + ROLL_BACK(shotgun_mag); + ROLL_BACK(crossbow_mag); + ROLL_BACK(rpg_mag); + ROLL_BACK(satchel_chg); + + ROLL_BACK(ammo_9mm); + ROLL_BACK(ammo_357); + ROLL_BACK(ammo_buckshot); + ROLL_BACK(ammo_bolt); + ROLL_BACK(ammo_rocket); + ROLL_BACK(ammo_uranium); + ROLL_BACK(ammo_handgrenade); + ROLL_BACK(ammo_satchel); + ROLL_BACK(ammo_tripmine); + ROLL_BACK(ammo_snark); + ROLL_BACK(ammo_hornet); + + ROLL_BACK(ammo_m203_grenade); + ROLL_BACK(ammo_gauss_volume); + ROLL_BACK(ammo_rpg_state); + ROLL_BACK(mode_tempstate); /* gearbox */ - eagle_mag = eagle_mag_net; - sniper_mag = sniper_mag_net; - m249_mag = m249_mag_net; - sporelauncher_mag = sporelauncher_mag_net; - ammo_556 = ammo_556_net; - ammo_762 = ammo_762_net; - ammo_spore = ammo_spore_net; - ammo_shock = ammo_shock_net; - ammo_penguin = ammo_penguin_net; - mode_displacer = mode_displacer_net; - mode_eagle = mode_eagle_net; - mode_wrench = mode_wrench_net; - mode_sporelauncher = mode_sporelauncher_net; - mode_m249 = mode_m249_net; - - anim_top = anim_top_net; - anim_top_delay = anim_top_delay_net; - anim_top_time = anim_top_time_net; - anim_bottom = anim_bottom_net; - anim_bottom_time = anim_bottom_time_net; + ROLL_BACK(eagle_mag); + ROLL_BACK(sniper_mag); + ROLL_BACK(m249_mag); + ROLL_BACK(sporelauncher_mag); + ROLL_BACK(ammo_556); + ROLL_BACK(ammo_762); + ROLL_BACK(ammo_spore); + ROLL_BACK(ammo_shock); + ROLL_BACK(ammo_penguin); + ROLL_BACK(mode_displacer); + ROLL_BACK(mode_eagle); + ROLL_BACK(mode_wrench); + ROLL_BACK(mode_sporelauncher); + ROLL_BACK(mode_m249); } #else void player::EvaluateEntity(void) { - SendFlags |= PLAYER_KEEPALIVE; - - if (old_modelindex != modelindex) - SendFlags |= PLAYER_MODELINDEX; - - if (old_origin[0] != origin[0]) - SendFlags |= PLAYER_ORIGIN; - - if (old_origin[1] != origin[1]) - SendFlags |= PLAYER_ORIGIN; - - if (old_origin[2] != origin[2]) - SendFlags |= PLAYER_ORIGIN_Z; - - if (old_angles[0] != v_angle[0]) - SendFlags |= PLAYER_ANGLES_X; - - if (old_angles[1] != angles[1]) - SendFlags |= PLAYER_ANGLES_Y; - - if (old_angles[2] != angles[2]) - SendFlags |= PLAYER_ANGLES_Z; - - if (old_velocity[0] != velocity[0]) - SendFlags |= PLAYER_VELOCITY; - - if (old_velocity[1] != velocity[1]) - SendFlags |= PLAYER_VELOCITY; - - if (old_velocity[2] != velocity[2]) - SendFlags |= PLAYER_VELOCITY_Z; - - if (old_flags != flags) - SendFlags |= PLAYER_FLAGS; - - if (old_gflags != gflags) - SendFlags |= PLAYER_FLAGS; - - if (old_activeweapon != activeweapon) - SendFlags |= PLAYER_WEAPON; - - if (old_items != g_items) - SendFlags |= PLAYER_ITEMS; - - if (old_health != health) - SendFlags |= PLAYER_HEALTH; - - if (old_armor != armor) - SendFlags |= PLAYER_ARMOR; - - if (old_movetype != movetype) - SendFlags |= PLAYER_MOVETYPE; - - if (old_viewofs != view_ofs[2]) - SendFlags |= PLAYER_VIEWOFS; + base_player::EvaluateEntity(); /* animation */ - if (anim_bottom_net != anim_bottom || anim_bottom_time != anim_bottom_time_net) + if (ATTR_CHANGED(anim_bottom) || ATTR_CHANGED(anim_bottom_time)) SendFlags |= PLAYER_BOTTOMFRAME; - if (anim_top_net != anim_top || anim_top_time != anim_top_time_net || anim_top_delay != anim_top_delay_net) + if (ATTR_CHANGED(anim_top) || ATTR_CHANGED(anim_top_time) || ATTR_CHANGED(anim_top_delay)) SendFlags |= PLAYER_TOPFRAME; /* ammo 1 type updates */ - if (glock_mag != glock_mag_net) { + if (ATTR_CHANGED(glock_mag)) SendFlags |= PLAYER_AMMO1; - } - if (mp5_mag != mp5_mag_net) { + if (ATTR_CHANGED(mp5_mag)) SendFlags |= PLAYER_AMMO1; - } - if (python_mag != python_mag_net) { + if (ATTR_CHANGED(python_mag)) SendFlags |= PLAYER_AMMO1; - } - if (shotgun_mag != shotgun_mag_net) { + if (ATTR_CHANGED(shotgun_mag)) SendFlags |= PLAYER_AMMO1; - } - if (crossbow_mag != crossbow_mag_net) { + if (ATTR_CHANGED(crossbow_mag)) SendFlags |= PLAYER_AMMO1; - } - if (rpg_mag != rpg_mag_net) { + if (ATTR_CHANGED(rpg_mag)) SendFlags |= PLAYER_AMMO1; - } - if (satchel_chg != satchel_chg_net) { + if (ATTR_CHANGED(satchel_chg)) SendFlags |= PLAYER_AMMO1; - } /* ammo 2 type updates */ - if (ammo_9mm != ammo_9mm_net) { + if (ATTR_CHANGED(ammo_9mm)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_357 != ammo_357_net) { + if (ATTR_CHANGED(ammo_357)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_buckshot != ammo_buckshot_net) { + if (ATTR_CHANGED(ammo_buckshot)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_bolt != ammo_bolt_net) { + if (ATTR_CHANGED(ammo_bolt)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_rocket != ammo_rocket_net) { + if (ATTR_CHANGED(ammo_rocket)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_uranium != ammo_uranium_net) { + if (ATTR_CHANGED(ammo_uranium)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_handgrenade != ammo_handgrenade_net) { + if (ATTR_CHANGED(ammo_handgrenade)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_satchel != ammo_satchel_net) { + if (ATTR_CHANGED(ammo_satchel)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_tripmine != ammo_tripmine_net) { + if (ATTR_CHANGED(ammo_tripmine)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_snark != ammo_snark_net) { + if (ATTR_CHANGED(ammo_snark)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_hornet != ammo_hornet_net) { + if (ATTR_CHANGED(ammo_hornet)) SendFlags |= PLAYER_AMMO2; - } - if (ammo_m203_grenade != ammo_m203_grenade_net) { + if (ATTR_CHANGED(ammo_m203_grenade)) SendFlags |= PLAYER_AMMO3; - } - if (ammo_shotgun_state != ammo_shotgun_state_net) { + if (ATTR_CHANGED(ammo_gauss_volume)) SendFlags |= PLAYER_AMMO3; - } - if (ammo_gauss_state != ammo_gauss_state_net) { + if (ATTR_CHANGED(ammo_rpg_state)) SendFlags |= PLAYER_AMMO3; - } - if (ammo_gauss_volume != ammo_gauss_volume_net) { + if (ATTR_CHANGED(mode_tempstate)) SendFlags |= PLAYER_AMMO3; - } - if (ammo_egon_state != ammo_egon_state_net) { - SendFlags |= PLAYER_AMMO3; - } - if (ammo_rpg_state != ammo_rpg_state_net) { - SendFlags |= PLAYER_AMMO3; - } - if (mode_tempstate != mode_tempstate_net) { - SendFlags |= PLAYER_AMMO3; - } - old_modelindex = modelindex; - old_origin = origin; - old_angles = angles; - old_angles[0] = v_angle[0]; - old_velocity = velocity; - old_flags = flags; - old_gflags = gflags; - old_activeweapon = activeweapon; - old_items = g_items; - old_health = health; - old_armor = armor; - old_movetype = movetype; - old_viewofs = view_ofs[2]; - old_baseframe = baseframe; - old_frame = frame; + SAVE_STATE(glock_mag); + SAVE_STATE(mp5_mag); + SAVE_STATE(python_mag); + SAVE_STATE(shotgun_mag); + SAVE_STATE(crossbow_mag); + SAVE_STATE(rpg_mag); + SAVE_STATE(satchel_chg); + SAVE_STATE(ammo_9mm); + SAVE_STATE(ammo_357); + SAVE_STATE(ammo_buckshot); + SAVE_STATE(ammo_bolt); + SAVE_STATE(ammo_rocket); + SAVE_STATE(ammo_uranium); + SAVE_STATE(ammo_handgrenade); + SAVE_STATE(ammo_satchel); + SAVE_STATE(ammo_tripmine); + SAVE_STATE(ammo_snark); + SAVE_STATE(ammo_hornet); - glock_mag_net = glock_mag; - mp5_mag_net = mp5_mag; - python_mag_net = python_mag; - shotgun_mag_net = shotgun_mag; - crossbow_mag_net = crossbow_mag; - rpg_mag_net = rpg_mag; - satchel_chg_net = satchel_chg; + SAVE_STATE(ammo_m203_grenade); + SAVE_STATE(ammo_gauss_volume); + SAVE_STATE(ammo_rpg_state); + SAVE_STATE(mode_tempstate); - ammo_9mm_net = ammo_9mm; - ammo_357_net = ammo_357; - ammo_buckshot_net = ammo_buckshot; - ammo_m203_grenade_net = ammo_m203_grenade; - ammo_bolt_net = ammo_bolt; - ammo_rocket_net = ammo_rocket; - ammo_uranium_net = ammo_uranium; - ammo_handgrenade_net = ammo_handgrenade; - ammo_satchel_net = ammo_satchel; - ammo_tripmine_net = ammo_tripmine; - ammo_snark_net = ammo_snark; - ammo_hornet_net = ammo_hornet; - - ammo_m203_grenade_net = ammo_m203_grenade; - ammo_shotgun_state_net = ammo_shotgun_state; - ammo_gauss_state_net = ammo_gauss_state; - ammo_gauss_volume_net = ammo_gauss_volume; - ammo_egon_state_net = ammo_egon_state; - ammo_rpg_state_net = ammo_rpg_state; - mode_tempstate_net = mode_tempstate; + SAVE_STATE(anim_top); + SAVE_STATE(anim_top_delay); + SAVE_STATE(anim_top_time); + SAVE_STATE(anim_bottom); + SAVE_STATE(anim_bottom_time); /* gearbox */ if (eagle_mag_net != eagle_mag) @@ -657,26 +437,21 @@ player::EvaluateEntity(void) if (mode_sporelauncher_net != mode_sporelauncher) SendFlags |= PLAYER_AMMO3; - eagle_mag_net = eagle_mag; - sniper_mag_net = sniper_mag; - m249_mag_net = m249_mag; - sporelauncher_mag_net = sporelauncher_mag; - ammo_556_net = ammo_556; - ammo_762_net = ammo_762; - ammo_spore_net = ammo_spore; - ammo_shock_net = ammo_shock; - ammo_penguin_net = ammo_penguin; - mode_displacer_net = mode_displacer; - mode_eagle_net = mode_eagle; - mode_wrench_net = mode_wrench; - mode_sporelauncher_net = mode_sporelauncher; - mode_m249_net = mode_m249; - - anim_top_net = anim_top; - anim_top_delay_net = anim_top_delay; - anim_top_time_net = anim_top_time; - anim_bottom_net = anim_bottom; - anim_bottom_time_net = anim_bottom_time; + /* gearbox */ + SAVE_STATE(eagle_mag); + SAVE_STATE(sniper_mag); + SAVE_STATE(m249_mag); + SAVE_STATE(sporelauncher_mag); + SAVE_STATE(ammo_556); + SAVE_STATE(ammo_762); + SAVE_STATE(ammo_spore); + SAVE_STATE(ammo_shock); + SAVE_STATE(ammo_penguin); + SAVE_STATE(mode_displacer); + SAVE_STATE(mode_eagle); + SAVE_STATE(mode_wrench); + SAVE_STATE(mode_sporelauncher); + SAVE_STATE(mode_m249); } /* @@ -708,43 +483,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, ENT_PLAYER); WriteFloat(MSG_ENTITY, fChanged); - /* really trying to get our moneys worth with 23 bits of mantissa */ - if (fChanged & PLAYER_MODELINDEX) - WriteShort(MSG_ENTITY, modelindex); - if (fChanged & PLAYER_ORIGIN) { - WriteCoord(MSG_ENTITY, origin[0]); - WriteCoord(MSG_ENTITY, origin[1]); - } - if (fChanged & PLAYER_ORIGIN_Z) - WriteCoord(MSG_ENTITY, origin[2]); - if (fChanged & PLAYER_ANGLES_X) - WriteFloat(MSG_ENTITY, v_angle[0]); - if (fChanged & PLAYER_ANGLES_Y) - WriteFloat(MSG_ENTITY, angles[1]); - if (fChanged & PLAYER_ANGLES_Z) - WriteFloat(MSG_ENTITY, angles[2]); - if (fChanged & PLAYER_VELOCITY) { - WriteCoord(MSG_ENTITY, velocity[0]); - WriteCoord(MSG_ENTITY, velocity[1]); - } - if (fChanged & PLAYER_VELOCITY_Z) - WriteCoord(MSG_ENTITY, velocity[2]); - if (fChanged & PLAYER_FLAGS) { - WriteFloat(MSG_ENTITY, flags); - WriteFloat(MSG_ENTITY, gflags); - } - if (fChanged & PLAYER_WEAPON) - WriteByte(MSG_ENTITY, activeweapon); - if (fChanged & PLAYER_ITEMS) - WriteFloat(MSG_ENTITY, (__variant)g_items); - if (fChanged & PLAYER_HEALTH) - WriteByte(MSG_ENTITY, bound(0, health, 255)); - if (fChanged & PLAYER_ARMOR) - WriteByte(MSG_ENTITY, armor); - if (fChanged & PLAYER_MOVETYPE) - WriteByte(MSG_ENTITY, movetype); - if (fChanged & PLAYER_VIEWOFS) - WriteFloat(MSG_ENTITY, view_ofs[2]); + base_player::SendEntity(ePEnt, fChanged); if (fChanged & PLAYER_TOPFRAME) { WriteByte(MSG_ENTITY, anim_top); @@ -795,10 +534,7 @@ player::SendEntity(entity ePEnt, float fChanged) if (fChanged & PLAYER_AMMO3) { WriteByte(MSG_ENTITY, ammo_m203_grenade); - WriteByte(MSG_ENTITY, ammo_shotgun_state); - WriteByte(MSG_ENTITY, ammo_gauss_state); WriteByte(MSG_ENTITY, ammo_gauss_volume); - WriteByte(MSG_ENTITY, ammo_egon_state); WriteByte(MSG_ENTITY, ammo_rpg_state); WriteByte(MSG_ENTITY, mode_tempstate); diff --git a/src/shared/w_displacer.qc b/src/shared/w_displacer.qc index d7a9956..da53b6d 100644 --- a/src/shared/w_displacer.qc +++ b/src/shared/w_displacer.qc @@ -100,18 +100,14 @@ w_displacer_pickup(int new, int startammo) void w_displacer_draw(void) { -#ifdef CLIENT Weapons_SetModel("models/v_displacer.mdl"); Weapons_ViewAnimation(DISP_DRAW); -#endif } void w_displacer_holster(void) { -#ifdef CLIENT Weapons_ViewAnimation(DISP_HOLSTER); -#endif } void @@ -232,9 +228,9 @@ w_displacer_primary(void) pl.mode_displacer = 1; -#ifdef CLIENT Weapons_ViewAnimation(DISP_SPINUP); -#else + +#ifdef SERVER sound(pl, CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM); #endif pl.w_idle_next = pl.w_attack_next = 1.0f; @@ -260,10 +256,9 @@ w_displacer_secondary(void) } pl.mode_displacer = 2; - -#ifdef CLIENT Weapons_ViewAnimation(DISP_SPINUP); -#else + +#ifdef SERVER sound(pl, CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM); #endif pl.w_idle_next = pl.w_attack_next = 1.0f; diff --git a/src/shared/w_eagle.qc b/src/shared/w_eagle.qc index 2be4939..3bc9224 100644 --- a/src/shared/w_eagle.qc +++ b/src/shared/w_eagle.qc @@ -96,13 +96,8 @@ w_eagle_deathmsg(void) void w_eagle_draw(void) { -#ifdef CLIENT Weapons_SetModel("models/v_desert_eagle.mdl"); Weapons_ViewAnimation(EAGLE_DRAW); -#else - player pl = (player)self; - Weapons_UpdateAmmo(pl, pl.eagle_mag, pl.ammo_357, -1); -#endif } void @@ -127,16 +122,9 @@ w_eagle_release(void) return; } - /* these idles don't support the 'empty' animation style */ -#ifdef CLIENT if (pl.eagle_mag <= 0) { return; } -#else - if (pl.eagle_mag <= 0) { - return; - } -#endif int r = (float)input_sequence % 4; switch (r) { @@ -166,16 +154,9 @@ w_eagle_primary(void) return; } - /* Ammo check */ -#ifdef CLIENT if (pl.eagle_mag <= 0) { return; } -#else - if (pl.eagle_mag <= 0) { - return; - } -#endif /* Actual firing */ if (pl.mode_eagle == 1) { @@ -190,13 +171,7 @@ w_eagle_primary(void) pl.w_attack_next = 0.2f; } -#ifdef SERVER - sound(pl, CHAN_WEAPON, "weapons/desert_eagle_fire.wav", 1, ATTN_NORM); pl.eagle_mag--; - Weapons_UpdateAmmo(pl, pl.eagle_mag, pl.ammo_357, -1); -#else - pl.eagle_mag--; - View_SetMuzzleflash(MUZZLE_SMALL); Weapons_ViewPunchAngle([-10,0,0]); if (pl.eagle_mag <= 0) { @@ -204,6 +179,11 @@ w_eagle_primary(void) } else { Weapons_ViewAnimation(EAGLE_SHOOT); } + +#ifdef SERVER + sound(pl, CHAN_WEAPON, "weapons/desert_eagle_fire.wav", 1, ATTN_NORM); +#else + View_SetMuzzleflash(MUZZLE_SMALL); #endif } @@ -235,37 +215,28 @@ void w_eagle_reload(void) { player pl = (player)self; + if (pl.w_attack_next > 0.0) { return; } /* Ammo check */ -#ifdef CLIENT if (pl.eagle_mag >= 7) { return; } if (pl.ammo_357 <= 0) { return; } -#else - if (pl.eagle_mag >= 7) { - return; - } - if (pl.ammo_357 <= 0) { - return; - } -#endif - /* Audio-Visual bit */ -#ifdef CLIENT if (pl.eagle_mag <= 0) { Weapons_ViewAnimation(EAGLE_RELOAD); } else { Weapons_ViewAnimation(EAGLE_RELOAD_NOSHOT); } -#else + + /* Audio-Visual bit */ +#ifdef SERVER Weapons_ReloadWeapon(pl, player::eagle_mag, player::ammo_357, 7); - Weapons_UpdateAmmo(pl, pl.eagle_mag, pl.ammo_357, -1); #endif pl.w_attack_next = 1.64f; diff --git a/src/shared/w_grapple.qc b/src/shared/w_grapple.qc index eaddf15..34579f9 100644 --- a/src/shared/w_grapple.qc +++ b/src/shared/w_grapple.qc @@ -101,7 +101,8 @@ w_grapple_holster(void) } /* called once the tongue hits a wall */ -void Grapple_Touch(void) +void +Grapple_Touch(void) { player pl = (player)self.owner; pl.hook.movetype = MOVETYPE_NONE; diff --git a/src/shared/w_knife.qc b/src/shared/w_knife.qc index c7b1138..5c3a12c 100644 --- a/src/shared/w_knife.qc +++ b/src/shared/w_knife.qc @@ -56,7 +56,7 @@ w_knife_precache(void) #endif } -void +void w_knife_updateammo(player pl) { Weapons_UpdateAmmo(pl, -1, -1, -1); @@ -246,7 +246,7 @@ w_knife_hudpic(int selected, vector pos, float a) weapon_t w_knife = { .name = "knife", - .id = ITEM_KNIFE, + .id = ITEM_KNIFE, .slot = 0, .slot_pos = 2, .draw = w_knife_draw, @@ -268,7 +268,8 @@ weapon_t w_knife = /* entity definitions for pickups */ #ifdef SERVER -void weapon_knife(void) +void +weapon_knife(void) { Weapons_InitItem(WEAPON_KNIFE); } diff --git a/src/shared/w_m249.qc b/src/shared/w_m249.qc index ba51c52..2648083 100644 --- a/src/shared/w_m249.qc +++ b/src/shared/w_m249.qc @@ -97,10 +97,8 @@ w_m249_deathmsg(void) void w_m249_draw(void) { -#ifdef CLIENT Weapons_SetModel("models/v_saw.mdl"); Weapons_ViewAnimation(M249_DRAW); -#endif } void @@ -133,7 +131,8 @@ w_m249_release(void) return; } - if (random() < 0.5) { + int r = (float)input_sequence % 2; + if (r < 1) { Weapons_ViewAnimation(M249_IDLE1); } else { Weapons_ViewAnimation(M249_IDLE2); @@ -158,27 +157,21 @@ w_m249_primary(void) } /* ammo check */ -#ifdef CLIENT if (pl.m249_mag <= 0) { return; } -#else - if (pl.m249_mag <= 0) { - return; - } -#endif + Weapons_ViewPunchAngle([-5,0,0]); Weapons_ViewAnimation(M249_FIRE); push = v_forward * -64; push[2] *= 0.25f; /* gravity duh */ pl.velocity += push; + pl.m249_mag--; /* actual firing */ #ifdef CLIENT - pl.m249_mag--; View_SetMuzzleflash(MUZZLE_RIFLE); - Weapons_ViewPunchAngle([-5,0,0]); #else TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.052,0.052], WEAPON_M249); @@ -193,8 +186,6 @@ w_m249_primary(void) default: sound(pl, CHAN_WEAPON, "weapons/saw_fire3.wav", 1, ATTN_NORM); } - - pl.m249_mag--; #endif pl.w_attack_next = 0.075f; @@ -211,23 +202,15 @@ w_m249_reload(void) return; } -#ifdef CLIENT - if (pl.m249_mag >= 50) { + if (pl.m249_mag >= 50) return; - } - if (pl.ammo_556 <= 0) { + if (pl.ammo_556 <= 0) return; - } + Weapons_ViewAnimation(M249_RELOAD1); -#else - if (pl.m249_mag >= 50) { - return; - } - if (pl.ammo_556 <= 0) { - return; - } + +#ifdef SERVER Weapons_ReloadWeapon(pl, player::m249_mag, player::ammo_556, 50); - Weapons_UpdateAmmo(pl, pl.m249_mag, pl.ammo_556, __NULL__); #endif pl.mode_m249 = 1; @@ -322,7 +305,7 @@ w_m249_hudpic(int selected, vector pos, float a) weapon_t w_m249 = { .name = "m249", - .id = ITEM_M249, + .id = ITEM_M249, .slot = 5, .slot_pos = 0, .draw = w_m249_draw, @@ -349,4 +332,3 @@ weapon_m249(void) Weapons_InitItem(WEAPON_M249); } #endif - diff --git a/src/shared/w_penguin.qc b/src/shared/w_penguin.qc index f4e1304..b5a42e3 100644 --- a/src/shared/w_penguin.qc +++ b/src/shared/w_penguin.qc @@ -62,7 +62,8 @@ w_penguin_holster(void) } #ifdef SERVER -void penguin_squeak(entity p) +void +penguin_squeak(entity p) { int r = floor(random(1,4)); @@ -186,30 +187,21 @@ void w_penguin_primary(void) { player pl = (player)self; + if (pl.w_attack_next > 0.0) { return; } - /* Ammo check */ -#ifdef CLIENT if (pl.ammo_penguin <= 0) { return; } -#else - if (pl.ammo_penguin <= 0) { - return; - } -#endif + pl.ammo_penguin--; Weapons_ViewAnimation(PENGUIN_THROW); /* Audio-Visual Bit */ -#ifdef CLIENT - pl.ammo_penguin--; -#else +#ifdef SERVER w_penguin_deploy(); - pl.ammo_penguin--; - Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_penguin, __NULL__); if (pl.ammo_penguin <= 0) { Weapons_RemoveItem(pl, WEAPON_SNARK); @@ -346,7 +338,7 @@ w_penguin_hudpic(int s, vector pos, float a) weapon_t w_penguin = { .name = "penguin", - .id = ITEM_PENGUIN, + .id = ITEM_PENGUIN, .slot = 4, .slot_pos = 4, .draw = w_penguin_draw, diff --git a/src/shared/w_shockrifle.qc b/src/shared/w_shockrifle.qc index 3771ad7..6029c4d 100644 --- a/src/shared/w_shockrifle.qc +++ b/src/shared/w_shockrifle.qc @@ -97,10 +97,6 @@ w_shockrifle_draw(void) { Weapons_SetModel("models/v_shock.mdl"); Weapons_ViewAnimation(SHOCKRIFLE_DRAW); -#ifdef SERVER - player pl = (player)self; - Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1); -#endif } void @@ -159,7 +155,8 @@ w_shockrifle_release(void) return; } - if (random() < 0.5) { + int r = (float)input_sequence % 2; + if (r < 1) { Weapons_ViewAnimation(SHOCKRIFLE_IDLE1); } else { Weapons_ViewAnimation(SHOCKRIFLE_IDLE2); @@ -176,27 +173,23 @@ w_shockrifle_primary(void) return; } - /* Ammo check */ if (pl.ammo_shock <= 0) { w_shockrifle_release(); return; } - + pl.ammo_shock--; + Weapons_ViewAnimation(SHOCKRIFLE_SHOOT); + #ifdef SERVER w_shockrifle_shoothornet(); sound(pl, CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM); - - pl.ammo_shock--; - Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1); #else Weapons_MakeVectors(); vector src = Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8); pointparticles(PART_SHOCKPIECE, src, v_forward * 1000, 1); - pl.ammo_shock--; #endif - Weapons_ViewAnimation(SHOCKRIFLE_SHOOT); pl.w_attack_next = 0.1f; pl.w_idle_next = 0.5f; } diff --git a/src/shared/w_sniperrifle.qc b/src/shared/w_sniperrifle.qc index 42f0601..ed0b643 100644 --- a/src/shared/w_sniperrifle.qc +++ b/src/shared/w_sniperrifle.qc @@ -97,10 +97,6 @@ w_sniperrifle_draw(void) { Weapons_SetModel("models/v_m40a1.mdl"); Weapons_ViewAnimation(SNIPER_DRAW); -#ifdef SERVER - player pl = (player)self; - Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, -1); -#endif } void @@ -113,31 +109,13 @@ void w_sniperrifle_primary(void) { player pl = (player)self; - if (pl.w_attack_next > 0.0) { - return; - } - /* Ammo check */ -#ifdef CLIENT - if (pl.sniper_mag <= 0) { + if (pl.w_attack_next > 0.0) return; - } -#else - if (pl.sniper_mag <= 0) { + if (pl.sniper_mag <= 0) return; - } -#endif - - /* Actual firing */ -#ifdef SERVER - TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873], WEAPON_SNIPERRIFLE); - sound(pl, CHAN_WEAPON, "weapons/sniper_fire.wav", 1, ATTN_NORM); pl.sniper_mag--; - Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__); -#else - pl.sniper_mag--; - View_SetMuzzleflash(MUZZLE_SMALL); Weapons_ViewPunchAngle([-10,0,0]); if (pl.sniper_mag) { @@ -145,6 +123,12 @@ w_sniperrifle_primary(void) } else { Weapons_ViewAnimation(SNIPER_FIRE2); } + +#ifdef SERVER + TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873], WEAPON_SNIPERRIFLE); + sound(pl, CHAN_WEAPON, "weapons/sniper_fire.wav", 1, ATTN_NORM); +#else + View_SetMuzzleflash(MUZZLE_SMALL); #endif pl.w_attack_next = 1.75f; @@ -175,29 +159,19 @@ w_sniperrifle_reload(void) return; } - /* Ammo check */ -#ifdef CLIENT if (pl.sniper_mag >= 5) { return; } if (pl.ammo_762 <= 0) { return; } -#else - if (pl.sniper_mag >= 5) { - return; - } - if (pl.ammo_762 <= 0) { - return; - } -#endif /* Audio-Visual bit */ /* TODO has a couple reloading states */ Weapons_ViewAnimation(SNIPER_RELOAD1); + #ifdef SERVER Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_762, 5); - Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__); #endif pl.w_attack_next = 2.3f; pl.w_idle_next = 10.0f; @@ -226,6 +200,7 @@ w_sniperrifle_release(void) } pl.w_idle_next = 15.0f; } + void w_sniperrifle_crosshair(void) { @@ -298,7 +273,7 @@ w_sniperrifle_hudpic(int s, vector pos, float a) weapon_t w_sniperrifle = { .name = "sniperrifle", - .id = ITEM_SNIPERRIFLE, + .id = ITEM_SNIPERRIFLE, .slot = 5, .slot_pos = 2, .draw = w_sniperrifle_draw, diff --git a/src/shared/w_sporelauncher.qc b/src/shared/w_sporelauncher.qc index 09841fd..2dc062a 100644 --- a/src/shared/w_sporelauncher.qc +++ b/src/shared/w_sporelauncher.qc @@ -45,7 +45,8 @@ enum }; #ifdef SERVER -void Sporelauncher_Fire(entity spawner, vector org, vector dir) +void +Sporelauncher_Fire(entity spawner, vector org, vector dir) { static void Spore_Touch(void) { int r; @@ -87,7 +88,9 @@ void Sporelauncher_Fire(entity spawner, vector org, vector dir) sound(spawner, CHAN_WEAPON, "weapons/splauncher_fire.wav", 1, ATTN_NORM); } -void Sporelauncher_AltFire(entity spawner, vector org, vector dir) + +void +Sporelauncher_AltFire(entity spawner, vector org, vector dir) { static void Spore_Explode(void) { int r; @@ -156,8 +159,8 @@ w_sporelauncher_precache(void) precache_model("models/v_spore_launcher.mdl"); precache_model("models/p_spore_launcher.mdl"); #endif - } + void w_sporelauncher_updateammo(player pl) { @@ -175,6 +178,7 @@ w_sporelauncher_pmodel(void) { return "models/p_spore_launcher.mdl"; } + string w_sporelauncher_deathmsg(void) { @@ -203,13 +207,8 @@ w_sporelauncher_pickup(int new, int startammo) void w_sporelauncher_draw(void) { -#ifdef CLIENT Weapons_SetModel("models/v_spore_launcher.mdl"); Weapons_ViewAnimation(SPORE_DRAW); -#else - player pl = (player)self; - Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1); -#endif } void @@ -223,27 +222,18 @@ w_sporelauncher_primary(void) { player pl = (player)self; - if (pl.w_attack_next > 0.0) { + if (pl.w_attack_next > 0.0) return; - } - -#ifdef SERVER - if (pl.sporelauncher_mag <= 0) { + if (pl.sporelauncher_mag <= 0) return; - } - - Weapons_MakeVectors(); - Sporelauncher_Fire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward); pl.sporelauncher_mag--; - Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1); -#else - if (pl.sporelauncher_mag <= 0) { - return; - } - Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewAnimation(SPORE_FIRE); + +#ifdef SERVER + Weapons_MakeVectors(); + Sporelauncher_Fire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward); #endif pl.w_attack_next = 0.75f; @@ -255,34 +245,27 @@ w_sporelauncher_secondary(void) { player pl = (player)self; - if (pl.w_attack_next > 0.0) { + if (pl.w_attack_next > 0.0) return; - } - -#ifdef SERVER - if (pl.sporelauncher_mag <= 0) { + if (pl.sporelauncher_mag <= 0) return; - } - - Weapons_MakeVectors(); - Sporelauncher_AltFire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward); pl.sporelauncher_mag--; - Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1); -#else - if (pl.sporelauncher_mag <= 0) { - return; - } Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewAnimation(SPORE_FIRE); + +#ifdef SERVER + Weapons_MakeVectors(); + Sporelauncher_AltFire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward); #endif pl.w_attack_next = 0.75f; pl.w_idle_next = 10.0f; } -void w_sporelauncher_release(void) +void +w_sporelauncher_release(void) { player pl = (player)self; @@ -319,21 +302,14 @@ void w_sporelauncher_release(void) pl.w_idle_next = 0.65f; } else if (pl.mode_sporelauncher == SLSTATE_RELOAD) { Weapons_ViewAnimation(SPORE_RELOAD2); -#ifdef CLIENT + pl.sporelauncher_mag++; pl.ammo_spore--; if (pl.ammo_spore <= 0 || pl.sporelauncher_mag >= 5) { pl.mode_sporelauncher = SLSTATE_RELOAD_END; } -#else - pl.sporelauncher_mag++; - pl.ammo_spore--; - if (pl.ammo_spore <= 0 || pl.sporelauncher_mag >= 5) { - pl.mode_sporelauncher = SLSTATE_RELOAD_END; - } -#endif pl.w_idle_next = 1.0f; } else if (pl.mode_sporelauncher == SLSTATE_RELOAD_END) { Weapons_ViewAnimation(SPORE_RELOAD3); @@ -349,25 +325,12 @@ w_sporelauncher_reload(void) { player pl = (player)self; -#ifdef CLIENT - if (pl.sporelauncher_mag >= 5) { + if (pl.sporelauncher_mag >= 5) return; - } - if (pl.ammo_spore <= 0) { + if (pl.ammo_spore <= 0) return; - } -#else - if (pl.sporelauncher_mag >= 5) { + if (pl.mode_sporelauncher > SLSTATE_IDLE) return; - } - if (pl.ammo_spore <= 0) { - return; - } -#endif - - if (pl.mode_sporelauncher > SLSTATE_IDLE) { - return; - } pl.mode_sporelauncher = SLSTATE_RELOAD_START; pl.w_idle_next = 0.0f; @@ -488,4 +451,3 @@ weapon_sporelauncher(void) Weapons_InitItem(WEAPON_SPORELAUNCHER); } #endif -