Clean up our player enumflags.

This commit is contained in:
Marco Cawthorne 2022-08-07 14:14:16 -07:00
parent b0dbd92aca
commit 8eb5a1fbc6
Signed by: eukara
GPG key ID: CE2032F0A2882A22
9 changed files with 28 additions and 37 deletions

View file

@ -1,4 +1,4 @@
#pragma target fte #pragma target fte_6301
#pragma progs_dat "../../csprogs.dat" #pragma progs_dat "../../csprogs.dat"
#define CSQC #define CSQC

View file

@ -1,4 +1,4 @@
#pragma target fte_5768 #pragma target fte_6301
#pragma progs_dat "../../menu.dat" #pragma progs_dat "../../menu.dat"
#define MENU #define MENU
#define GAME_DIR "valve" #define GAME_DIR "valve"

View file

@ -1,4 +1,4 @@
CC=fteqcc CC=fteqcc
all: all:
$(CC) progs.src $(CC) -fwasm progs.src

View file

@ -14,8 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
var string autocvar_mp_teamlist = "robo;hgrunt";
const string mp_teamlist_fallback = "robo;hgrunt"; const string mp_teamlist_fallback = "robo;hgrunt";
var string autocvar_mp_teamlist = mp_teamlist_fallback;
bool bool
HLMultiplayerRules::IsMultiplayer(void) HLMultiplayerRules::IsMultiplayer(void)

View file

@ -17,29 +17,14 @@
/* all potential SendFlags bits we can possibly send */ /* all potential SendFlags bits we can possibly send */
enumflags enumflags
{ {
PLAYER_KEEPALIVE, PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
PLAYER_MODELINDEX,
PLAYER_ORIGIN,
PLAYER_ORIGIN_Z,
PLAYER_ANGLES_X,
PLAYER_ANGLES_Y,
PLAYER_COLORMAP,
PLAYER_VELOCITY,
PLAYER_VELOCITY_Z,
PLAYER_FLAGS,
PLAYER_WEAPON,
PLAYER_ITEMS,
PLAYER_HEALTH,
PLAYER_ARMOR,
PLAYER_MOVETYPE,
PLAYER_VIEWOFS,
PLAYER_TOPFRAME,
PLAYER_BOTTOMFRAME, PLAYER_BOTTOMFRAME,
PLAYER_AMMO1, PLAYER_AMMO1,
PLAYER_AMMO2, PLAYER_AMMO2,
PLAYER_AMMO3, PLAYER_AMMO3,
PLAYER_UNUSED1, PLAYER_UNUSED5,
PLAYER_UNUSED2 PLAYER_UNUSED6,
PLAYER_UNUSED7
}; };
class player:NSClientPlayer class player:NSClientPlayer
@ -171,7 +156,7 @@ player::ReceiveEntity(float new, float fl)
HUD_AmmoNotify_Check(this); HUD_AmmoNotify_Check(this);
} }
if (fl & PLAYER_ITEMS || fl & PLAYER_HEALTH || fl & PLAYER_ARMOR) if (fl & PLAYER_ITEMS || fl & PLAYER_HEALTH)
HUD_ItemNotify_Check(this); HUD_ItemNotify_Check(this);
} }
@ -511,11 +496,14 @@ player::SendEntity(entity ePEnt, float fChanged)
if (ePEnt != self && ePEnt.classname != "spectator") { if (ePEnt != self && ePEnt.classname != "spectator") {
fChanged &= ~PLAYER_ITEMS; fChanged &= ~PLAYER_ITEMS;
fChanged &= ~PLAYER_HEALTH; fChanged &= ~PLAYER_HEALTH;
fChanged &= ~PLAYER_ARMOR; fChanged &= ~PLAYER_TIMINGS;
fChanged &= ~PLAYER_VIEWOFS;
fChanged &= ~PLAYER_AMMO1; fChanged &= ~PLAYER_AMMO1;
fChanged &= ~PLAYER_AMMO2; fChanged &= ~PLAYER_AMMO2;
fChanged &= ~PLAYER_AMMO3; fChanged &= ~PLAYER_AMMO3;
fChanged &= ~PLAYER_FLAGS;
fChanged &= ~PLAYER_PUNCHANGLE;
fChanged &= ~PLAYER_VIEWZOOM;
fChanged &= ~PLAYER_SPECTATE;
} }
WriteByte(MSG_ENTITY, ENT_PLAYER); WriteByte(MSG_ENTITY, ENT_PLAYER);

View file

@ -68,18 +68,22 @@ void w_egon_precache(void)
w_egon_sparkframes[i] = spriteframe("sprites/xspark1.spr", i, 0.0f); w_egon_sparkframes[i] = spriteframe("sprites/xspark1.spr", i, 0.0f);
#endif #endif
} }
void w_egon_updateammo(player pl) void w_egon_updateammo(player pl)
{ {
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1); Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
} }
string w_egon_wmodel(void) string w_egon_wmodel(void)
{ {
return "models/w_egon.mdl"; return "models/w_egon.mdl";
} }
string w_egon_pmodel(player pl) string w_egon_pmodel(player pl)
{ {
return "models/p_egon.mdl"; return "models/p_egon.mdl";
} }
string w_egon_deathmsg(void) string w_egon_deathmsg(void)
{ {
return ""; return "";
@ -88,7 +92,6 @@ string w_egon_deathmsg(void)
int w_egon_pickup(player pl, int new, int startammo) int w_egon_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
if (pl.ammo_uranium < MAX_A_URANIUM) { if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM); pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM);
} else { } else {
@ -125,7 +128,8 @@ void w_egon_primary(player pl)
} }
/* Ammo check */ /* Ammo check */
if ((pl.ammo_uranium <= 0i) ? true : false || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) { bool out_of_ammo = (pl.ammo_uranium <= 0i) ? true : false;
if (out_of_ammo || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) {
#ifdef SERVER #ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_egon.empty"); Sound_Play(pl, CHAN_WEAPON, "weapon_egon.empty");
#endif #endif
@ -186,7 +190,6 @@ void w_egon_reload(player pl)
void w_egon_release(player pl) void w_egon_release(player pl)
{ {
if (pl.mode_tempstate != 0 && pl.mode_tempstate < 3) { if (pl.mode_tempstate != 0 && pl.mode_tempstate < 3) {
#ifdef SERVER #ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0); sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0);
@ -223,7 +226,6 @@ void
w_egon_postdraw(player pl, int thirdperson) w_egon_postdraw(player pl, int thirdperson)
{ {
#ifdef CLIENT #ifdef CLIENT
if (!(pl.gflags & GF_EGONBEAM)) if (!(pl.gflags & GF_EGONBEAM))
return; return;
@ -304,7 +306,6 @@ void w_egon_hudpic(player pl, int selected, vector pos, float a)
int int
w_egon_isempty(player pl) w_egon_isempty(player pl)
{ {
if (pl.ammo_uranium <= 0) if (pl.ammo_uranium <= 0)
return 1; return 1;

View file

@ -123,7 +123,6 @@ int
w_glock_pickup(player pl, int new, int startammo) w_glock_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
if (new) { if (new) {
pl.glock_mag = 18; pl.glock_mag = 18;
return (1); return (1);
@ -244,7 +243,6 @@ w_glock_secondary(player pl)
void void
w_glock_reload(player pl) w_glock_reload(player pl)
{ {
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
} }
@ -394,7 +392,6 @@ w_glock_hudpic(player pl, int selected, vector pos, float a)
int int
w_glock_isempty(player pl) w_glock_isempty(player pl)
{ {
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0) if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
return 1; return 1;

View file

@ -45,18 +45,22 @@ void w_handgrenade_precache(void)
precache_model("models/p_grenade.mdl"); precache_model("models/p_grenade.mdl");
#endif #endif
} }
void w_handgrenade_updateammo(player pl) void w_handgrenade_updateammo(player pl)
{ {
Weapons_UpdateAmmo(pl, -1, pl.ammo_handgrenade, -1); Weapons_UpdateAmmo(pl, -1, pl.ammo_handgrenade, -1);
} }
string w_handgrenade_wmodel(void) string w_handgrenade_wmodel(void)
{ {
return "models/w_grenade.mdl"; return "models/w_grenade.mdl";
} }
string w_handgrenade_pmodel(player pl) string w_handgrenade_pmodel(player pl)
{ {
return "models/p_grenade.mdl"; return "models/p_grenade.mdl";
} }
string w_handgrenade_deathmsg(void) string w_handgrenade_deathmsg(void)
{ {
return ""; return "";

View file

@ -103,7 +103,6 @@ int
w_mp5_pickup(player pl, int new, int startammo) w_mp5_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
if (new) { if (new) {
#ifdef GEARBOX #ifdef GEARBOX
pl.mp5_mag = 50; pl.mp5_mag = 50;
@ -169,7 +168,8 @@ w_mp5_primary(player pl)
return; return;
/* Ammo check */ /* Ammo check */
if ((pl.mp5_mag <= 0i) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) { bool out_of_ammo = (pl.mp5_mag <= 0i) ? true : false;
if (out_of_ammo || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER #ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty"); Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif #endif
@ -227,7 +227,8 @@ w_mp5_secondary(player pl)
return; return;
/* Ammo check */ /* Ammo check */
if ((pl.ammo_m203_grenade <= 0i) ? true : false || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) { bool out_of_ammo = (pl.ammo_m203_grenade <= 0i) ? true : false;
if (out_of_ammo || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) {
#ifdef SERVER #ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty"); Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif #endif