#include <client/draw.qh>
#include <client/hud/_mod.qh>
#include <client/hud/panel/centerprint.qh>
+ #include <client/hud/panel/chat.qh>
#include <client/hud/panel/quickmenu.qh>
#include <client/hud/panel/scoreboard.qh>
#include <client/items/items.qh>
maxclients = i;
}
- ReplicateVars_Send_All();
+ ReplicateVars(REPLICATEVARS_SEND_ALL);
// needs to be done so early because of the constants they create
static_init();
deactivate_minigame();
HUD_MinigameMenu_Close(NULL, NULL, NULL);
- ReplicateVars_Destroy();
+ ReplicateVars(REPLICATEVARS_DESTROY);
}
void AuditLists()
{
TC(int, bInputType);
bool override = false;
+
override |= HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary);
if (override)
return true;
+ override |= HUD_Panel_Chat_InputEvent(bInputType, nPrimary, nSecondary);
+
override |= QuickMenu_InputEvent(bInputType, nPrimary, nSecondary);
override |= HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary);
{
// accumulate damage with each stat update
static float damage_total_prev = 0;
- float damage_total = STAT(DAMAGE_DEALT_TOTAL);
+ float damage_total = STAT(HITSOUND_DAMAGE_DEALT_TOTAL);
float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev);
damage_total_prev = damage_total;
stats_get();
hud = STAT(HUD);
- ReplicateVars_Check();
+ ReplicateVars(REPLICATEVARS_CHECK);
HUD_Scale_Disable();
REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small)
#ifdef GAMEQC
+
REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
#endif
}
- if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
+ if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
{
- entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
+ entity show_tint = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
STAT(ENTRAP_ORB, show_tint) = time + 0.1;
float tint_alpha = 0.75;
}
- if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) )
+ if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
{
- entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
+ entity show_red = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
STAT(HEALING_ORB, show_red) = time+0.1;
STAT(HEALING_ORB_ALPHA, show_red) = 0.75 * (this.ltime - time) / this.orb_lifetime;
}
void nade_veil_touch(entity this, entity toucher)
{
- if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
+ if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
{
- entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
+ entity show_tint = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
float tint_alpha = 0.75;
if(SAME_TEAM(toucher, this.realowner))
#include <server/world.qh>
#endif
+
+#ifdef GAMEQC
+REPLICATE(cvar_cl_allow_uid2name, int, "cl_allow_uid2name");
+REPLICATE(cvar_cl_allow_uidranking, bool, "cl_allow_uidranking");
+REPLICATE(cvar_cl_allow_uidtracking, int, "cl_allow_uidtracking");
+#endif
+
+#ifdef SVQC
+REPLICATE_APPLYCHANGE("cl_allow_uidtracking", { PlayerStats_GameReport_AddPlayer(this); });
+#endif
+
#ifdef SVQC
void PlayerStats_Prematch()
{
PlayerStats_GameReport_DelayMapVote = true;
serverflags |= SERVERFLAG_PLAYERSTATS;
+ if(autocvar_g_playerstats_gamereport_uri != cvar_defstring("g_playerstats_gamereport_uri"))
+ {
+ serverflags |= SERVERFLAG_PLAYERSTATS_CUSTOM;
+ }
PlayerStats_GameReport_AddEvent(PLAYERSTATS_ALIVETIME);
PlayerStats_GameReport_AddEvent(PLAYERSTATS_AVGLATENCY);
return result;
}
- string GetAmmoPicture(int ammotype)
+ // TODO: registry handles for below functions
+ string GetAmmoPicture(Resource ammotype)
{
switch (ammotype)
{
}
}
- string GetAmmoName(int ammotype)
+ string GetAmmoName(Resource ammotype)
{
switch (ammotype)
{
}
}
- entity GetAmmoItem(int ammotype)
+ entity GetAmmoItem(Resource ammotype)
{
switch (ammotype)
{
case RES_PLASMA: return ITEM_Plasma;
case RES_FUEL: return ITEM_JetpackFuel;
}
- LOG_WARNF("Invalid ammo type %d ", ammotype);
+ LOG_WARNF("Invalid ammo type %d ", ammotype.m_id);
return NULL;
// WEAPONTODO: use this generic func to reduce duplication ?
// GetAmmoPicture GetAmmoName notif_arg_item_wepammo ammo_pickupevalfunc ?
}
#ifdef CSQC
- int GetAmmoTypeFromNum(int i)
+ Resource GetAmmoTypeFromNum(int i)
{
switch (i)
{
}
}
- int GetAmmoStat(int ammotype)
+ int GetAmmoStat(Resource ammotype)
{
switch (ammotype)
{
#endif
#endif
+
+#ifdef SVQC
+string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
+{
+ string o = W_FixWeaponOrder_ForceComplete(wo);
+ strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
+ return o;
+}
+#endif
+
+#ifdef CSQC
+REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
+REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
+#endif
+
+#ifdef GAMEQC
+REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
+REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload");
+REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse");
+REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
+REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
+REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
+#endif
#include <common/notifications/all.qh>
#include <common/physics/player.qh>
#include <common/playerstats.qh>
+ #include <common/resources/sv_resources.qh>
#include <common/state.qh>
#include <common/stats.qh>
#include <common/vehicles/all.qh>
#include <server/player.qh>
#include <server/portals.qh>
#include <server/race.qh>
- #include <server/resources.qh>
#include <server/scores.qh>
#include <server/scores_rules.qh>
#include <server/spawnpoints.qh>
void FixClientCvars(entity e)
{
// send prediction settings to the client
- stuffcmd(e, "\nin_bindmap 0 0\n");
if(autocvar_g_antilag == 3) // client side hitscan
stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n");
if(autocvar_sv_gentle)
return max(stable, current + (stable - current) * rotfactor * rotframetime);
}
- void RotRegen(entity this, int res, float limit_mod,
+ void RotRegen(entity this, Resource res, float limit_mod,
float regenstable, float regenfactor, float regenlinear, float regenframetime,
float rotstable, float rotfactor, float rotlinear, float rotframetime)
{
this.last_vehiclecheck = time + 1;
}
- if(!CS_CVAR(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
- {
- if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
- PlayerUseKey(this);
- CS(this).usekeypressed = PHYS_INPUT_BUTTON_USE(this);
- }
+ if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
+ PlayerUseKey(this);
+ CS(this).usekeypressed = PHYS_INPUT_BUTTON_USE(this);
if (IS_REAL_CLIENT(this))
PrintWelcomeMessage(this);
#include "utils.qh"
#include <server/intermission.qh>
+ //#include <common/resources/resources.qh>
#include <common/replicate.qh>
#include <common/sounds/all.qh>
ATTRIB(Client, cvar_cl_clippedspectating, bool, this.cvar_cl_clippedspectating);
ATTRIB(Client, cvar_cl_autoscreenshot, int, this.cvar_cl_autoscreenshot);
ATTRIB(Client, cvar_cl_jetpack_jump, bool, this.cvar_cl_jetpack_jump);
- ATTRIB(Client, cvar_cl_newusekeysupported, bool, this.cvar_cl_newusekeysupported);
ATTRIB(Client, cvar_cl_noantilag, bool, this.cvar_cl_noantilag);
ATTRIB(Client, cvar_cl_movement_track_canjump, bool, this.cvar_cl_movement_track_canjump);
ATTRIB(Client, cvar_cl_weaponimpulsemode, int, this.cvar_cl_weaponimpulsemode);
ATTRIB(Client, cvar_g_xonoticversion, string, this.cvar_g_xonoticversion);
- ATTRIB(Client, autoswitch, bool, this.autoswitch);
+ ATTRIB(Client, cvar_cl_autoswitch, bool, this.cvar_cl_autoswitch);
ATTRIB(Client, cvar_cl_casings, bool, this.cvar_cl_casings);
ATTRIB(Client, cvar_r_drawviewmodel, bool, this.cvar_r_drawviewmodel);
ATTRIB(Client, cvar_cl_dodging_timeout, float, this.cvar_cl_dodging_timeout);
void play_countdown(entity this, float finished, Sound samp);
void player_powerups_remove_all(entity this);
- void RotRegen(entity this, float current, float limit_mod,
+ // NOTE: current type is Resource (avoiding circular includes!)
+ void RotRegen(entity this, entity current, float limit_mod,
float regenstable, float regenfactor, float regenlinear, float regenframetime,
float rotstable, float rotfactor, float rotlinear, float rotframetime);
#include <common/mutators/mutator/powerups/_mod.qh>
#include <common/mutators/mutator/status_effects/_mod.qh>
#include <common/notifications/all.qh>
+ #include <common/resources/resources.qh>
#include <common/util.qh>
#include <common/weapons/_all.qh>
#include <common/wepent.qh>
}
}
- bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax)
+ bool Item_GiveAmmoTo(entity item, entity player, Resource res_type, float ammomax)
{
float amount = GetResource(item, res_type);
if (amount == 0)
// if the player is using their best weapon before items are given, they
// probably want to switch to an even better weapon after items are given
- if(CS_CVAR(player).autoswitch)
+ if(CS_CVAR(player).cvar_cl_autoswitch)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
else if(v0 > v1)
e.(regenfield) = max(e.(regenfield), time + regentime);
}
- bool GiveResourceValue(entity e, int res_type, int op, int val)
+ bool GiveResourceValue(entity e, Resource res_type, int op, int val)
{
int v0 = GetResource(e, res_type);
float new_val = 0;
int _switchweapon = 0;
- if(CS_CVAR(e).autoswitch)
+ if(CS_CVAR(e).cvar_cl_autoswitch)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
/**/
MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
-/** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
-// NOTE: requesting cvar values (get_cvars_f 0) is deprecated
+/**
+ * is meant to call GetCvars_handle* for cvars this mutator needs from the client, e.g.:
+ MUTATOR_HOOKFUNCTION(mymutator, GetCvars)
+ {
+ GetCvars_handleFloat(this, store, s, f, cvar_mycvar, "mycvar");
+ return false;
+ }
+ * Usually you can just use REPLICATE instead of this hook, e.g.:
+ REPLICATE(cvar_mycvar, int, "mycvar");
+ * NOTE: requesting cvar values (get_cvars_f 0) is deprecated
+ */
#define EV_GetCvars(i, o) \
/**/ i(float, get_cvars_f) \
/**/ i(string, get_cvars_s) \
resource limit. */
#define EV_GetResourceLimit(i, o) \
/** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
/** limit */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/**/
constants for resource types. Return true to forbid the change. */
#define EV_SetResource(i, o) \
/** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
- /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/**/
above resource limit so it was not given. */
#define EV_ResourceAmountChanged(i, o) \
/** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/
MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
of resource that is above resource limit so it was not given. */
#define EV_ResourceWasted(i, o) \
/** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
/** amount wasted */ i(float, MUTATOR_ARGV_2_float) \
/**/
MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
NOTE: This hook is also called by GiveResourceWithLimit */
#define EV_GiveResource(i, o) \
/** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
- /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/**/
RES_* constants for resource types. Return true to forbid giving. */
#define EV_GiveResourceWithLimit(i, o) \
/** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
- /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/** limit */ i(float, MUTATOR_ARGV_3_float) \
NOTE: This hook is also called by TakeResourceWithLimit */
#define EV_TakeResource(i, o) \
/** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
- /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/**/
RES_* constants for resource types. Return true to forbid giving. */
#define EV_TakeResourceWithLimit(i, o) \
/** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
- /** resource type */ i(int, MUTATOR_ARGV_1_int) \
- /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** resource type */ i(entity, MUTATOR_ARGV_1_entity) \
+ /**/ o(entity, MUTATOR_ARGV_1_entity) \
/** amount */ i(float, MUTATOR_ARGV_2_float) \
/**/ o(float, MUTATOR_ARGV_2_float) \
/** limit */ i(float, MUTATOR_ARGV_3_float) \