Weapon wep = switchweapon;
int i;
- bool infinite_ammo = (getstati(STAT_ITEMS, 0, 24) & IT_UNLIMITED_WEAPON_AMMO);
+ bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO);
row = column = 0;
if(autocvar_hud_panel_ammo_onlycurrent)
{
if(hud != HUD_NORMAL) return;
if(spectatee_status == -1) return;
- health = getstati(STAT_HEALTH);
+ health = STAT(HEALTH);
if(health <= 0)
{
prev_health = -1;
return;
}
- armor = getstati(STAT_ARMOR);
+ armor = STAT(ARMOR);
// code to check for spectatee_status changes is in Ent_ClientData()
// prev_p_health and prev_health can be set to -1 there
float BLINK_FREQ = 5;
float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
- int stat_items = getstati(STAT_ITEMS, 0, 24);
+ int stat_items = STAT(ITEMS);
int kaball = (stat_items/IT_KEY1) & 1;
if(kaball != kaball_prevstatus)
float nb_pb_starttime, dt, p;
int stat_items;
- stat_items = getstati(STAT_ITEMS, 0, 24);
+ stat_items = STAT(ITEMS);
nb_pb_starttime = STAT(NB_METERSTART);
if (stat_items & IT_KEY1)
void HUD_Powerups()
{
- int allItems = getstati(STAT_ITEMS, 0, 24);
+ int allItems = STAT(ITEMS);
int allBuffs = STAT(BUFFS);
int strengthTime, shieldTime, superTime;
{
if(!autocvar_hud_panel_powerups) return;
if(spectatee_status == -1) return;
- if(getstati(STAT_HEALTH) <= 0) return;
+ if(STAT(HEALTH) <= 0) return;
if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
return false;
}
- if ( getstati(STAT_HEALTH) <= 0 )
+ if ( STAT(HEALTH) <= 0 )
{
// Show scoreboard
if ( bInputType < 2 )
{
string message = "Click to select teleport destination";
- if ( getstati(STAT_HEALTH) <= 0 )
+ if ( STAT(HEALTH) <= 0 )
{
message = "Click to select spawn location";
}
return 1;
else if (intermission == 2)
return 0;
- else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
+ else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
return 1;
else if (scoreboard_showscores_force)
return 1;
prevtime = time;
if (autocvar_chase_active) return;
- if (getstati(STAT_HEALTH) <= 0) return;
+ if (STAT(HEALTH) <= 0) return;
entity view = CSQCModel_server2csqc(player_localentnum - 1);
void viewmodel_draw(entity this)
{
- int mask = (intermission || (getstati(STAT_HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
+ int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
float a = this.alpha;
int c = stof(getplayerkeyvalue(current_player, "colors"));
vector g;
return;
if(intermission == 2)
return;
- if (getstati(STAT_HEALTH) <= 0)
+ if (STAT(HEALTH) <= 0)
return;
dir = view_forward;
break;
}
- vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * getstati(STAT_VIEWHEIGHT));
+ vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * STAT(VIEWHEIGHT));
vecs = decompressShotOrigin(STAT(SHOTORG));
return true;
if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
return true;
- if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+ if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
{
if(autocvar_cl_eventchase_death == 2)
{
case 2: // crosshair_color_by_health
{
- float x = getstati(STAT_HEALTH);
+ float x = STAT(HEALTH);
//x = red
//y = green
ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
- float is_dead = (getstati(STAT_HEALTH) <= 0);
+ float is_dead = (STAT(HEALTH) <= 0);
// FIXME do we need this hack?
if(isdemo())
switchingweapon = Weapons_from(STAT(SWITCHINGWEAPON));
// actually active weapon (for zoom)
- activeweapon = Weapons_from(getstati(STAT_ACTIVEWEAPON));
+ activeweapon = Weapons_from(STAT(ACTIVEWEAPON));
switchweapon = Weapons_from(STAT(SWITCHWEAPON));
splash_pos.y = (vid_conheight - splash_size.y) / 2;
float myhealth_flash_temp;
- myhealth = getstati(STAT_HEALTH);
+ myhealth = STAT(HEALTH);
// fade out
myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
- sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
+ sharpen_intensity = bound(0, ((STAT(HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
if(autocvar_hud_powerup && sharpen_intensity > 0)
{
{
int buttons = PHYS_INPUT_BUTTON_MASK(this);
#ifdef CSQC
- this.items = getstati(STAT_ITEMS, 0, 24);
+ this.items = STAT(ITEMS);
this.movement = PHYS_INPUT_MOVEVALUES(this);
// 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
const int MAX_CL_STATS = 256;
-#ifndef CSQC
-const int STAT_HEALTH = 0; // .health
-const int STAT_ARMOR = 4; // .armorvalue
-const int STAT_SHELLS = 6; // .ammo_shells
-const int STAT_NAILS = 7; // .ammo_nails
-const int STAT_ROCKETS = 8; // .ammo_rockets
-const int STAT_CELLS = 9; // .ammo_cells
-const int STAT_ACTIVEWEAPON = 10; // .weapon
-const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
-const int STAT_VIEWHEIGHT = 16; // .view_ofs_z
+
+// const int STAT_HEALTH = 0;
+// const int STAT_ARMOR = 4;
+// const int STAT_SHELLS = 6;
+// const int STAT_NAILS = 7;
+// const int STAT_ROCKETS = 8;
+// const int STAT_CELLS = 9;
+// const int STAT_ACTIVEWEAPON = 10;
+// const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
+// const int STAT_VIEWHEIGHT = 16;
+
+#if defined(CSQC)
+ #define g_stat_HEALTH getstat_int(STAT_HEALTH)
+ #define g_stat_ARMOR getstat_int(STAT_ARMOR)
+ #define g_stat_SHELLS getstat_int(STAT_SHELLS)
+ #define g_stat_NAILS getstat_int(STAT_NAILS)
+ #define g_stat_ROCKETS getstat_int(STAT_ROCKETS)
+ #define g_stat_CELLS getstat_int(STAT_CELLS)
+ #define g_stat_ACTIVEWEAPON getstat_int(STAT_ACTIVEWEAPON)
+ #define g_stat_ITEMS getstat_int(STAT_ITEMS)
+ #define g_stat_VIEWHEIGHT getstat_int(STAT_VIEWHEIGHT)
+#elif defined(SVQC)
+ #define stat_HEALTH health
+ #define stat_ARMOR armorvalue
+ #define stat_SHELLS ammo_shells
+ #define stat_NAILS ammo_nails
+ #define stat_ROCKETS ammo_rockets
+ #define stat_CELLS ammo_cells
+ #define stat_ACTIVEWEAPON weapon
+ #define stat_ITEMS items
+ #define stat_VIEWHEIGHT view_ofs_z
#endif
REGISTER_STAT(WEAPONS, vectori)
self.lastpushtime = time;
if(!pushdeltatime) return;
- tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * getstatf(STAT_VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
+ tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
- vector df = self.move_velocity * -getstatf(STAT_VEH_RACER_FRICTION);
- df_z += (1 - trace_fraction) * getstatf(STAT_VEH_RACER_HOVERPOWER) + sin(time * 2) * (getstatf(STAT_VEH_RACER_SPRINGLENGTH) * 2);
+ vector df = self.move_velocity * -STAT(VEH_RACER_FRICTION);
+ df_z += (1 - trace_fraction) * STAT(VEH_RACER_HOVERPOWER) + sin(time * 2) * (STAT(VEH_RACER_SPRINGLENGTH) * 2);
- float forced = getstatf(STAT_VEH_RACER_UPFORCEDAMPER);
+ float forced = STAT(VEH_RACER_UPFORCEDAMPER);
int cont = pointcontents(self.move_origin - '0 0 64');
if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
- forced = getstatf(STAT_VEH_RACER_WATER_UPFORCEDAMPER);
+ forced = STAT(VEH_RACER_WATER_UPFORCEDAMPER);
self.move_velocity_z += 200;
}
if(self.move_velocity_z > 0)
self.move_velocity_z *= 1 - forced * pushdeltatime;
- self.move_angles_x *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
- self.move_angles_z *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+ self.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+ self.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
Movetype_Physics_MatchServer(false);
}
else
{
// use player origin so that third person display still works
- self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
+ self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
}
}
Draw_VaporizerBeam_trace_callback_tex = string_null;
/*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
- if(autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
+ if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
else
WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
#if 0
// we don't need this
// darkplaces makes servercommandframe == 0 in these cases anyway
- if (getstatf(STAT_HEALTH) <= 0)
+ if (STAT(HEALTH) <= 0)
{
csqcplayer_moveframe = clientcommandframe;
getinputstate(csqcplayer_moveframe-1);
void CSQCPlayer_SetCamera()
{
const vector v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
- const float vh = getstati(STAT_VIEWHEIGHT);
+ const float vh = STAT(VIEWHEIGHT);
const vector pl_viewofs = PL_VIEW_OFS;
const vector pl_viewofs_crouch = PL_CROUCH_VIEW_OFS;
const entity e = csqcplayer;
if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
// note: these two only work in WIP2, but are harmless in WIP1
- if (getstati(STAT_HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
+ if (STAT(HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
V_CalcRefdef(view, refdefflags);
}