Half-Life: Get rid of ::ammo_shotgun/gauss/egon_state, we'll use tempstate
instead
This commit is contained in:
parent
0eeb27a65a
commit
d798c0539e
8 changed files with 49 additions and 69 deletions
|
@ -87,10 +87,10 @@ w_chaingun_deathmsg(void)
|
|||
void
|
||||
w_chaingun_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_tfac.mdl");
|
||||
Weapons_ViewAnimation(CHAINGUN_DRAW);
|
||||
#endif
|
||||
|
|
|
@ -83,10 +83,10 @@ w_sniper_deathmsg(void)
|
|||
void
|
||||
w_sniper_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_tfc_sniper.mdl");
|
||||
Weapons_ViewAnimation(SNIPER_DRAW);
|
||||
#endif
|
||||
|
|
|
@ -119,10 +119,10 @@ void w_tnt_throw(void)
|
|||
|
||||
void w_tnt_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_tnt.mdl");
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#endif
|
||||
|
|
|
@ -125,14 +125,8 @@ class player:base_player
|
|||
|
||||
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;
|
||||
|
@ -278,10 +272,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();
|
||||
}
|
||||
|
@ -323,10 +314,7 @@ player::PredictPreFrame(void)
|
|||
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;
|
||||
}
|
||||
|
@ -362,10 +350,7 @@ player::PredictPostFrame(void)
|
|||
ammo_hornet = ammo_hornet_net;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -497,18 +482,9 @@ player::EvaluateEntity(void)
|
|||
if (ammo_m203_grenade != ammo_m203_grenade_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_shotgun_state != ammo_shotgun_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_state != ammo_gauss_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_volume != ammo_gauss_volume_net) {
|
||||
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;
|
||||
}
|
||||
|
@ -554,10 +530,7 @@ player::EvaluateEntity(void)
|
|||
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;
|
||||
}
|
||||
|
@ -659,10 +632,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);
|
||||
}
|
||||
|
|
|
@ -146,12 +146,13 @@ int w_egon_pickup(int new, int startammo)
|
|||
void w_egon_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_egon.mdl");
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
pl.w_idle_next = 1.0f;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
/* link the FX class */
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_egon.mdl");
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
|
||||
entity eold = self;
|
||||
self = pSeat->m_pWeaponFX;
|
||||
spawnfunc_FXEgon();
|
||||
|
@ -163,6 +164,7 @@ void w_egon_holster(void)
|
|||
{
|
||||
Weapons_ViewAnimation(EGON_HOLSTER);
|
||||
}
|
||||
|
||||
void w_egon_release(void);
|
||||
|
||||
void w_egon_primary(void)
|
||||
|
@ -198,20 +200,20 @@ void w_egon_primary(void)
|
|||
|
||||
pl.ammo_uranium--;
|
||||
|
||||
if (pl.ammo_egon_state == 0) {
|
||||
if (pl.mode_tempstate == 0) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_windup2.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.ammo_egon_state = 1;
|
||||
pl.mode_tempstate = 1;
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
pl.w_idle_next = 3.0f;
|
||||
} else if not (pl.w_idle_next > 0.0f) {
|
||||
/* wait 3 seconds (idle next) */
|
||||
if (pl.ammo_egon_state == 1) {
|
||||
if (pl.mode_tempstate == 1) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100);
|
||||
#endif
|
||||
pl.ammo_egon_state = 2;
|
||||
pl.mode_tempstate = 2;
|
||||
}
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
|
@ -235,11 +237,11 @@ void w_egon_release(void)
|
|||
p.alpha = 0.0f;
|
||||
#endif
|
||||
|
||||
if (pl.ammo_egon_state != 0) {
|
||||
if (pl.mode_tempstate != 0) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.ammo_egon_state = 0;
|
||||
pl.mode_tempstate = 0;
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,11 +171,14 @@ int w_gauss_pickup(int new, int startammo)
|
|||
|
||||
void w_gauss_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_gauss.mdl");
|
||||
Weapons_ViewAnimation(GAUSS_DRAW);
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
/* link the FX class */
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_gauss.mdl");
|
||||
Weapons_ViewAnimation(GAUSS_DRAW);
|
||||
|
||||
entity eold = self;
|
||||
self = pSeat->m_pWeaponFX;
|
||||
spawnfunc_FXGauss();
|
||||
|
@ -287,7 +290,7 @@ void w_gauss_secondary(void)
|
|||
player pl = (player)self;
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.ammo_gauss_state)
|
||||
if (pl.mode_tempstate)
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.ammo_gauss_volume/255)), 0, 0);
|
||||
#endif
|
||||
|
||||
|
@ -299,14 +302,14 @@ void w_gauss_secondary(void)
|
|||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_gauss_state > 0) {
|
||||
if (pl.mode_tempstate > 0) {
|
||||
w_gauss_release();
|
||||
}
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_uranium <= 0) {
|
||||
if (pl.ammo_gauss_state > 0) {
|
||||
if (pl.mode_tempstate > 0) {
|
||||
w_gauss_release();
|
||||
}
|
||||
return;
|
||||
|
@ -327,16 +330,16 @@ void w_gauss_secondary(void)
|
|||
pl.ammo_gauss_volume = 255;
|
||||
}
|
||||
|
||||
if (pl.ammo_gauss_state == 1) {
|
||||
if (pl.mode_tempstate == 1) {
|
||||
Weapons_ViewAnimation(GAUSS_SPIN);
|
||||
pl.ammo_gauss_state = 2;
|
||||
pl.mode_tempstate = 2;
|
||||
pl.w_idle_next = 0.0f;
|
||||
} else if (!pl.ammo_gauss_state) {
|
||||
} else if (!pl.mode_tempstate) {
|
||||
Weapons_ViewAnimation(GAUSS_SPINUP);
|
||||
#ifdef CLIENT
|
||||
sound(pl, CHAN_WEAPON, "ambience/pulsemachine.wav", 2, ATTN_NORM);
|
||||
#endif
|
||||
pl.ammo_gauss_state = 1;
|
||||
pl.mode_tempstate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,13 +353,13 @@ void w_gauss_release(void)
|
|||
/* Reset the pitch sound shift */
|
||||
pl.ammo_gauss_volume = 0;
|
||||
|
||||
if (pl.ammo_gauss_state == 1) {
|
||||
if (pl.mode_tempstate == 1) {
|
||||
pl.w_attack_next = 0.0f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
w_gauss_primary();
|
||||
pl.ammo_gauss_state = 0;
|
||||
pl.mode_tempstate = 0;
|
||||
return;
|
||||
} else if (pl.ammo_gauss_state == 2) {
|
||||
} else if (pl.mode_tempstate == 2) {
|
||||
Weapons_ViewAnimation(GAUSS_FIRE1);
|
||||
#ifdef CLIENT
|
||||
FXGauss p = (FXGauss)pSeat->m_pWeaponFX;
|
||||
|
@ -371,7 +374,7 @@ void w_gauss_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
pl.ammo_gauss_state = 0;
|
||||
pl.mode_tempstate = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,10 +133,10 @@ void w_handgrenade_throw(void)
|
|||
|
||||
void w_handgrenade_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_grenade.mdl");
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#endif
|
||||
|
|
|
@ -95,8 +95,13 @@ int w_shotgun_pickup(int new, int startammo)
|
|||
|
||||
void w_shotgun_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_shotgun.mdl");
|
||||
Weapons_ViewAnimation(SHOTGUN_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_shotgun_holster(void)
|
||||
|
@ -110,7 +115,7 @@ void w_shotgun_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,7 +150,7 @@ void w_shotgun_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -184,10 +189,10 @@ void w_shotgun_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD_START;
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -197,7 +202,7 @@ void w_shotgun_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.ammo_shotgun_state == SHOTTY_IDLE && pl.shotgun_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
if (pl.mode_tempstate == SHOTTY_IDLE && pl.shotgun_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -206,7 +211,7 @@ void w_shotgun_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.ammo_shotgun_state == SHOTTY_IDLE) {
|
||||
if (pl.mode_tempstate == SHOTTY_IDLE) {
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 1:
|
||||
|
@ -222,11 +227,11 @@ void w_shotgun_release(void)
|
|||
pl.w_idle_next = 2.222222f;
|
||||
break;
|
||||
}
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD_START) {
|
||||
} else if (pl.mode_tempstate == SHOTTY_RELOAD_START) {
|
||||
Weapons_ViewAnimation(SHOTGUN_START_RELOAD);
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD;
|
||||
pl.mode_tempstate = SHOTTY_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD) {
|
||||
} else if (pl.mode_tempstate == SHOTTY_RELOAD) {
|
||||
Weapons_ViewAnimation(SHOTGUN_RELOAD);
|
||||
pl.shotgun_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
|
@ -234,16 +239,16 @@ void w_shotgun_release(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.reload");
|
||||
#endif
|
||||
if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) {
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD_END;
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_END;
|
||||
}
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.ammo_shotgun_state);
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.mode_tempstate);
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD_END) {
|
||||
} else if (pl.mode_tempstate == SHOTTY_RELOAD_END) {
|
||||
Weapons_ViewAnimation(SHOTGUN_PUMP);
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.cock");
|
||||
#endif
|
||||
pl.ammo_shotgun_state = SHOTTY_IDLE;
|
||||
pl.mode_tempstate = SHOTTY_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue