]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into martin-t/defaults
authorMartin Taibr <taibr.martin@gmail.com>
Mon, 17 Jul 2017 15:01:21 +0000 (17:01 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Mon, 17 Jul 2017 15:01:21 +0000 (17:01 +0200)
35 files changed:
balance-mario.cfg
balance-nexuiz25.cfg
balance-overkill.cfg
balance-samual.cfg
balance-xdf.cfg
balance-xonotic.cfg
balance-xpm.cfg
defaultClient.cfg
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/stats.qh
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/trigger/keylock.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/ecs/systems/sv_physics.qc
qcsrc/server/autocvars.qh
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/item_key.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/player.qc
qcsrc/server/race.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index d290be01265d0280de9b1f06955478a641911aa5..42cf31196553096d8e7a3e6df76db560f99cdc29 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 39405f399881c31eecdc243527b81eec5e3628f5..4967fa7e47936208ca64c9e719e5e41fa373b968 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1500 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 381eb51d7ba3d19948ad83cd5d3acfbb838fd828..fc99616f94eaff821e575442fcdfca74d0de6052 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index ad7192227eb4abcf842a2b02f57b1025de46ff27..4357eff7646aad75e967bfbd9de0f32b697b104b 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 5eda67ba945a7f66f4d178a8f80622828c792280..a7d6b43740de047372c391bb438c70919ffd87b4 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index f317d2e6b422d1225078fe3fa4d58de4ee128ce4..5bd1536feab823df7b40dbd50df1133d194222ef 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index f5ec29240e97d8b8646c7ba8aabb535037049acd..5c14aa36206256e19c240ecf105815a8c7fc8e41 100644 (file)
@@ -207,7 +207,6 @@ set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (n
 set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
 set g_jetpack_fuel 8 "fuel per second for jetpack"
-set g_jetpack_attenuation 2 "jetpack sound attenuation"
 set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack"
 
 set g_grappling_hook_tarzan 2 // 2: can also pull players
index 55e6583eb287b290937d9c13e8ff2a8af5e2eb3e..6492dcf89a5b2cd7028f411a8123ee86abe11abf 100644 (file)
@@ -613,6 +613,8 @@ seta cl_gentle_gibs 0               "client side gentle mode (only replaces gibs); when set t
 seta cl_gentle_messages 0      "client side gentle mode (only replaces frag messages/centerprints)"
 seta cl_gentle_damage 0        "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomly colored flash is used instead"
 
+set cl_jetpack_attenuation 2 "jetpack sound attenuation"
+
 set cl_warpzone_usetrace 1 "do not touch"
 
 set cl_effects_lightningarc_simple 0
index c9e3f1674f1fe2a926295e489da9253d1d6b0fa5..6d3fb626771723a0d86af77ab2e775f7a24364f7 100644 (file)
@@ -152,7 +152,6 @@ float autocvar_crosshair_ring_reload_size;
 float autocvar_crosshair_size;
 int autocvar_ekg;
 float autocvar_fov;
-float autocvar_g_balance_damagepush_speedfactor; // FIXME check this
 bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
 bool autocvar_hud_configure_checkcollisions;
@@ -441,9 +440,9 @@ int autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
 float autocvar_cl_deathglow;
 bool autocvar_developer_csqcentities;
-float autocvar_g_jetpack_attenuation; // FIXME check this
+float autocvar_cl_jetpack_attenuation = 2;
 bool autocvar_cl_showspectators;
 int autocvar_cl_nade_timer;
 bool autocvar_r_drawviewmodel;
 bool autocvar_cl_race_cptimes_onlyself;
-bool autocvar_cl_race_cptimes_showself = true;
+bool autocvar_cl_race_cptimes_showself = false;
index 104465360770beaddc14298f06d2872f0d2d6d1f..d2b28e9b08f2a9b4cacd3a49bc0f45076a52de8e 100644 (file)
@@ -561,7 +561,7 @@ void CSQCModel_Effects_Apply(entity this)
        {
                if(!this.snd_looping)
                {
-                       sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation);
+                       sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_cl_jetpack_attenuation);
                        this.snd_looping = CH_TRIGGER_SINGLE;
                }
        }
@@ -569,7 +569,7 @@ void CSQCModel_Effects_Apply(entity this)
        {
                if(this.snd_looping)
                {
-                       sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
+                       sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
                        this.snd_looping = 0;
                }
        }
index b6f3fb58f40c4c869c95c11f9515b604a2c013e0..b107a40c0378b95c62ea046030e6dc03d99209d9 100644 (file)
@@ -68,7 +68,7 @@ string MakeRaceString(int cp, float mytime, float theirtime, float othertime, fl
                        othertimestr = strcat("+", ftos_decimals(mytime - othertime, TIME_DECIMALS));
                else
                        othertimestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(othertime));
-               othercol = "^3";
+               othercol = "^7";
        }
 
        if(cp == 254)
index 1467a99ccf880fecdec7275fe565702c37372938..539461187e6fadf95f05a31adb55337016e56325 100644 (file)
@@ -854,7 +854,7 @@ void Ent_Remove(entity this)
 
        if(this.snd_looping > 0)
        {
-               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
+               sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
                this.snd_looping = 0;
        }
 
@@ -976,6 +976,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        forcefog = strzone(ReadString());
 
        armorblockpercent = ReadByte() / 255.0;
+       damagepush_speedfactor = ReadByte() / 255.0;
 
        serverflags = ReadByte();
 
index bbf69d28d1bcd39586a78041babc247bc2166cea..a2f4d18bba97e2ef4070fe83ac362d83dd462404 100644 (file)
@@ -86,6 +86,7 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
 const float ALPHA_MIN_VISIBLE = 0.003;
 
 float armorblockpercent;
+float damagepush_speedfactor;
 
 //hooks
 int calledhooks;
index 71e1e2a7bcdd96dcf3f72629d7e147d4db03aab3..c62bbd6b68cd5b08c5108a9b0c0dd9ac77598693 100644 (file)
@@ -244,7 +244,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                if(it.damageforcescale)
                        if(vdist(thisforce, !=, 0))
                        {
-                               it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, autocvar_g_balance_damagepush_speedfactor);
+                               it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, damagepush_speedfactor);
                                UNSET_ONGROUND(it);
                        }
 
index 41f538b7a52f02e018c364ef1aec9b123e9a7383..52fc52466d5f93ec8203f3b104ac2b72e295dba1 100644 (file)
@@ -9,6 +9,8 @@ REGISTER_MUTATOR(campcheck, cvar("g_campcheck"));
 .float campcheck_nextcheck;
 .float campcheck_traveled_distance;
 
+.vector campcheck_prevorigin;
+
 MUTATOR_HOOKFUNCTION(campcheck, PlayerDies)
 {
        entity frag_target = M_ARGV(2, entity);
@@ -33,23 +35,19 @@ MUTATOR_HOOKFUNCTION(campcheck, Damage_Calculate)
 MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
+       bool checked = false;
 
-       if(!game_stopped)
-       if(!warmup_stage) // don't consider it camping during warmup?
-       if(time >= game_starttime)
+       if(autocvar_g_campcheck_interval)
+       if(!game_stopped && !warmup_stage && time >= game_starttime)
        if(IS_PLAYER(player))
-       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
        if(!IS_DEAD(player))
-       if(!forbidWeaponUse(player))
        if(!STAT(FROZEN, player))
        if(!PHYS_INPUT_BUTTON_CHAT(player))
-       if(autocvar_g_campcheck_interval)
+       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
+       if(!forbidWeaponUse(player))
        {
-               vector dist;
-
                // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
-               dist = player.prevorigin - player.origin;
-               dist.z = 0;
+               vector dist = vec2(player.campcheck_prevorigin - player.origin);
                player.campcheck_traveled_distance += fabs(vlen(dist));
 
                if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
@@ -72,10 +70,21 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
                        player.campcheck_traveled_distance = 0;
                }
 
-               return;
+               checked = true;
        }
 
-       player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
+       if(!checked)
+               player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; // one of the above checks failed, so keep the timer up to date
+
+       player.campcheck_prevorigin = player.origin;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck, CopyBody)
+{
+       entity player = M_ARGV(0, entity);
+       entity clone = M_ARGV(1, entity);
+
+       clone.campcheck_prevorigin = player.campcheck_prevorigin;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
index 47249356bb564fb42504b4e0d6047fe71eec1512..ec255c8d3c66defdcee629cbfcd8f903529ffe44 100644 (file)
@@ -30,8 +30,14 @@ float Physics_ClientOption(entity this, string option, float defaultval)
        return defaultval;
 }
 
-void Physics_UpdateStats(entity this, float maxspd_mod)
+void Physics_UpdateStats(entity this)
 {
+       // update this first, as it's used on all stats (wouldn't want to update them all manually from a mutator hook now, would we?)
+       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
+
+       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this);
+       float maxspd_mod = PHYS_HIGHSPEED(this);
+
        STAT(MOVEVARS_AIRACCEL_QW, this) = AdjustAirAccelQW(Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw), maxspd_mod);
        STAT(MOVEVARS_AIRSTRAFEACCEL_QW, this) = (Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw))
                ? AdjustAirAccelQW(Physics_ClientOption(this, "airstrafeaccel_qw", autocvar_sv_airstrafeaccel_qw), maxspd_mod)
index 5f43c2a5bec9fda0bf3c23966432a47dc4a8137f..a77a03b5860042b2100bca0b82fc49ab281350b3 100644 (file)
@@ -247,7 +247,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 
        bool Physics_Valid(string thecvar);
 
-       void Physics_UpdateStats(entity this, float maxspd_mod);
+       void Physics_UpdateStats(entity this);
 
        void PM_UpdateButtons(entity this, entity store);
 
index 2cb353361eb0867750cbbfc2a9ee47e26086dca7..bfed4390de6395dc857719e0e7a9108864c36e37 100644 (file)
@@ -41,8 +41,11 @@ const int MAX_CL_STATS = 256;
     #define stat_VIEWHEIGHT view_ofs_z
 #endif
 
+#ifdef SVQC
+vector weaponsInMap;
+#endif
 REGISTER_STAT(WEAPONS, vectori)
-REGISTER_STAT(WEAPONSINMAP, vectori)
+REGISTER_STAT(WEAPONSINMAP, vectori, weaponsInMap)
 
 REGISTER_STAT(PL_VIEW_OFS, vector)
 REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector)
@@ -58,22 +61,26 @@ REGISTER_STAT(KH_KEYS, int)
 #ifdef SVQC
 float W_WeaponRateFactor(entity this);
 float game_stopped;
+float game_starttime;
+float round_starttime;
+bool autocvar_g_allow_oldvortexbeam;
+int autocvar_leadlimit;
 #endif
 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
 REGISTER_STAT(GAME_STOPPED, int, game_stopped)
-REGISTER_STAT(GAMESTARTTIME, float)
+REGISTER_STAT(GAMESTARTTIME, float, game_starttime)
 REGISTER_STAT(STRENGTH_FINISHED, float)
 REGISTER_STAT(INVINCIBLE_FINISHED, float)
 /** arc heat in [0,1] */
 REGISTER_STAT(ARC_HEAT, float)
 REGISTER_STAT(PRESSED_KEYS, int)
 /** this stat could later contain some other bits of info, like, more server-side particle config */
-REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool)
+REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool, autocvar_g_allow_oldvortexbeam)
 REGISTER_STAT(FUEL, int)
 REGISTER_STAT(NB_METERSTART, float)
 /** compressShotOrigin */
 REGISTER_STAT(SHOTORG, int)
-REGISTER_STAT(LEADLIMIT, float)
+REGISTER_STAT(LEADLIMIT, float, autocvar_leadlimit)
 REGISTER_STAT(WEAPON_CLIPLOAD, int)
 REGISTER_STAT(WEAPON_CLIPSIZE, int)
 
@@ -99,7 +106,7 @@ REGISTER_STAT(NADE_TIMER, float)
 REGISTER_STAT(SECRETS_TOTAL, float)
 REGISTER_STAT(SECRETS_FOUND, float)
 REGISTER_STAT(RESPAWN_TIME, float)
-REGISTER_STAT(ROUNDSTARTTIME, float)
+REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
 REGISTER_STAT(MONSTERS_TOTAL, int)
 REGISTER_STAT(MONSTERS_KILLED, int)
 REGISTER_STAT(BUFFS, int)
index 01250e0aae6ab3baba60262094db79c95d43fff2..dc0be6ae24a9822b67865e2c4a2cb0c6b0b32c6b 100644 (file)
@@ -169,7 +169,11 @@ bool door_check_keys(entity door, entity player)
        if(!IS_PLAYER(player))
                return false;
 
-       int valid = (door.itemkeys & player.itemkeys);
+       entity store = player;
+#ifdef SVQC
+       store = PS(player);
+#endif
+       int valid = (door.itemkeys & store.itemkeys);
        door.itemkeys &= ~valid; // only some of the needed keys were given
 
        if(!door.itemkeys)
index 756d3b25a5c861867fc8f0b525836d40c21f5671..904c3fa3d4a7404d5d4c0535fbc59858b2d6cc42 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef CSQC
 bool item_keys_usekey(entity l, entity p)
 {
-       int valid = (l.itemkeys & p.itemkeys);
+       int valid = (l.itemkeys & p.itemkeys); // TODO: itemkeys isn't networked or anything!
        l.itemkeys &= ~valid; // only some of the needed keys were given
        return valid != 0;
 }
index 94deed55197c21056d7f8a56b03bbed4af1aa14f..9efbb29a2615aab18f98eaddd1a0359620455086 100644 (file)
@@ -192,14 +192,11 @@ string W_FixWeaponOrder_ForceComplete(string order)
        return W_FixWeaponOrder(order, 1);
 }
 
-void W_RandomWeapons(entity e, float n)
+void W_RandomWeapons(entity e, int n)
 {
-       int i;
-       WepSet remaining;
-       WepSet result;
-       remaining = e.weapons;
-       result = '0 0 0';
-       for (i = 0; i < n; ++i)
+       WepSet remaining = e.weapons;
+       WepSet result = '0 0 0';
+       for (int j = 0; j < n; ++j)
        {
                RandomSelection_Init();
                FOREACH(Weapons, it != WEP_Null, {
index 634fbf812cc8133ef060ec68c697eeeefd034ae5..16332634352f966d7f49f2923c1ff5a09c20901e 100644 (file)
@@ -208,7 +208,7 @@ string W_NumberWeaponOrder(string order);
 string W_FixWeaponOrder_BuildImpulseList(string o);
 string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
 string W_FixWeaponOrder_ForceComplete(string order);
-void W_RandomWeapons(entity e, float n);
+void W_RandomWeapons(entity e, int n);
 
 string GetAmmoPicture(.int ammotype);
 
index 1a69c75fc9a4ce45eed864caa15e8da243756ce4..87982b5d55f8ac0a8073c2b48cce992ff4fddf30 100644 (file)
@@ -3,9 +3,7 @@
 void sys_phys_fix(entity this, float dt)
 {
        WarpZone_PlayerPhysics_FixVAngle(this);
-       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
-       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed!
-       Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
+       Physics_UpdateStats(this);
 }
 
 bool sys_phys_override(entity this, float dt)
index 0c2c1ed4feb90f96b025792af4737a1b715f967e..f585a9a2c33db3eafb7b72168b2b3d8a50de8afd 100644 (file)
@@ -13,7 +13,7 @@ int autocvar_captureleadlimit_override;
 float autocvar_ekg;
 #define autocvar_fraglimit cvar("fraglimit")
 #define autocvar_fraglimit_override cvar("fraglimit_override")
-bool autocvar_g_allow_oldvortexbeam;
+//bool autocvar_g_allow_oldvortexbeam;
 int autocvar_g_antilag;
 float autocvar_g_antilag_nudge;
 float autocvar_g_balance_armor_blockpercent;
@@ -258,7 +258,7 @@ float autocvar_gameversion_min;
 float autocvar_gameversion_max;
 string autocvar_hostname;
 bool autocvar_lastlevel;
-int autocvar_leadlimit;
+//int autocvar_leadlimit;
 int autocvar_leadlimit_and_fraglimit;
 int autocvar_leadlimit_override;
 int autocvar_loddebug;
index ec6d292d9f9de701c43360c370b662a1aceaa02a..abb5693a340481980f363730e2af91eb7f4b59ed 100644 (file)
@@ -110,7 +110,7 @@ bool ClientData_Send(entity this, entity to, int sf)
        if (IS_SPEC(e)) e = e.enemy;
 
        sf = 0;
-       if (e.race_completed)       sf |= 1; // forced scoreboard
+       if (CS(e).race_completed)       sf |= 1; // forced scoreboard
        if (CS(to).spectatee_status)    sf |= 2; // spectator ent number follows
        if (CS(e).zoomstate)            sf |= 4; // zoomed
        if (autocvar_sv_showspectators) sf |= 16; // show spectators
@@ -225,12 +225,10 @@ void PutObserverInServer(entity this)
     {
         entity spot = SelectSpawnPoint(this, true);
         if (!spot) LOG_FATAL("No spawnpoints for observers?!?");
-        this.angles = spot.angles;
-        this.angles_z = 0;
+        this.angles = vec2(spot.angles);
         this.fixangle = true;
         // offset it so that the spectator spawns higher off the ground, looks better this way
         setorigin(this, spot.origin + STAT(PL_VIEW_OFS, this));
-        this.prevorigin = this.origin;
         if (IS_REAL_CLIENT(this))
         {
             msg_entity = this;
@@ -281,10 +279,10 @@ void PutObserverInServer(entity this)
                if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2))
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
-               if(this.just_joined == false) {
+               if(!CS(this).just_joined)
                        LogTeamchange(this.playerid, -1, 4);
-               else
-                       this.just_joined = false;
+               else
+                       CS(this).just_joined = false;
        }
 
        accuracy_resend(this);
@@ -336,7 +334,6 @@ void PutObserverInServer(entity this)
 
        this.items = 0;
        this.weapons = '0 0 0';
-       this.dual_weapons = '0 0 0';
        this.drawonlytoclient = this;
 
        this.weaponmodel = "";
@@ -549,7 +546,7 @@ void PutPlayerInServer(entity this)
        }
        SetSpectatee_status(this, 0);
 
-       this.dual_weapons = '0 0 0';
+       PS(this).dual_weapons = '0 0 0';
 
        this.superweapons_finished = (this.weapons & WEPSET_SUPERWEAPONS) ? time + autocvar_g_balance_superweapons_time : 0;
 
@@ -622,7 +619,6 @@ void PutPlayerInServer(entity this)
        setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24));
        // don't reset back to last position, even if new position is stuck in solid
        this.oldorigin = this.origin;
-       this.prevorigin = this.origin;
        this.lastteleporttime = time; // prevent insane speeds due to changing origin
        if(this.conveyor)
                IL_REMOVE(g_conveyed, this);
@@ -729,7 +725,8 @@ void PutClientInServer(entity this)
        SetSpectatee(this, NULL);
 
        // reset player keys
-       this.itemkeys = 0;
+       if(PS(this))
+               PS(this).itemkeys = 0;
 
        MUTATOR_CALLHOOK(PutClientInServer, this);
 
@@ -775,6 +772,7 @@ void ClientInit_misc(entity this)
        else
                WriteString(channel, "");
        WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
+       WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor
        WriteByte(channel, serverflags);
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
@@ -787,6 +785,11 @@ void ClientInit_CheckUpdate(entity this)
                this.count = autocvar_g_balance_armor_blockpercent;
                this.SendFlags |= 1;
        }
+       if(this.cnt != autocvar_g_balance_damagepush_speedfactor)
+       {
+               this.cnt = autocvar_g_balance_damagepush_speedfactor;
+               this.SendFlags |= 1;
+       }
 }
 
 void ClientInit_Spawn()
@@ -1190,7 +1193,7 @@ void ClientConnect(entity this)
 
        LogTeamchange(this.playerid, this.team, 1);
 
-       this.just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
+       CS(this).just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
        CS(this).netname_previous = strzone(this.netname);
 
@@ -1255,9 +1258,7 @@ void ClientConnect(entity this)
                sv_notice_join(this);
 
        // update physics stats (players can spawn before physics runs)
-       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
-       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed!
-       Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
+       Physics_UpdateStats(this);
 
        IL_EACH(g_initforplayer, it.init_for_player, {
                it.init_for_player(it, this);
@@ -1721,7 +1722,6 @@ void SpectateCopy(entity this, entity spectatee)
        this.superweapons_finished = spectatee.superweapons_finished;
        STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
        this.weapons = spectatee.weapons;
-       this.dual_weapons = spectatee.dual_weapons;
        this.vortex_charge = spectatee.vortex_charge;
        this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
        this.hagar_load = spectatee.hagar_load;
@@ -2203,8 +2203,6 @@ bool PlayerThink(entity this)
                return false;
        }
 
-       this.prevorigin = this.origin;
-
        bool have_hook = false;
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -2450,13 +2448,6 @@ void PlayerPreThink (entity this)
 {
        WarpZone_PlayerPhysics_FixVAngle(this);
 
-    STAT(GAMESTARTTIME, this) = game_starttime;
-       STAT(ROUNDSTARTTIME, this) = round_starttime;
-       STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
-       STAT(LEADLIMIT, this) = autocvar_leadlimit;
-
-       STAT(WEAPONSINMAP, this) = weaponsInMap;
-
        if (frametime) {
                // physics frames: update anticheat stuff
                anticheat_prethink(this);
@@ -2508,29 +2499,32 @@ void PlayerPreThink (entity this)
                this.max_armorvalue = 0;
        }
 
-       if (STAT(FROZEN, this) == 2)
-       {
-               this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
-               this.health = max(1, this.revive_progress * start_health);
-               this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
-
-               if (this.revive_progress >= 1)
-                       Unfreeze(this);
-       }
-       else if (STAT(FROZEN, this) == 3)
+       if(IS_PLAYER(this))
        {
-               this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
-               this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
+               if (STAT(FROZEN, this) == 2)
+               {
+                       this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+                       this.health = max(1, this.revive_progress * start_health);
+                       this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
 
-               if (this.health < 1)
+                       if (this.revive_progress >= 1)
+                               Unfreeze(this);
+               }
+               else if (STAT(FROZEN, this) == 3)
                {
-                       if (this.vehicle)
-                               vehicles_exit(this.vehicle, VHEF_RELEASE);
-                       if(this.event_damage)
-                               this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
+                       this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+                       this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
+
+                       if (this.health < 1)
+                       {
+                               if (this.vehicle)
+                                       vehicles_exit(this.vehicle, VHEF_RELEASE);
+                               if(this.event_damage)
+                                       this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
+                       }
+                       else if (this.revive_progress <= 0)
+                               Unfreeze(this);
                }
-               else if (this.revive_progress <= 0)
-                       Unfreeze(this);
        }
 
        MUTATOR_CALLHOOK(PlayerPreThink, this);
index ae4a08f90f6c7f11b4b5373ccfbf9ab0cd104ad9..32fa2f0f30c06275fd25205be487e7cee4ae17b8 100644 (file)
@@ -93,6 +93,8 @@ CLASS(Client, Object)
     ATTRIB(Client, version, int, this.version);
     ATTRIB(Client, spectatee_status, int, this.spectatee_status);
     ATTRIB(Client, zoomstate, bool, this.zoomstate);
+    ATTRIB(Client, just_joined, bool, this.just_joined);
+    ATTRIB(Client, race_completed, bool, this.race_completed);
 
     METHOD(Client, m_unwind, bool(Client this));
 
@@ -133,6 +135,12 @@ CLASS(Spectator, Client)
 ENDCLASS(Spectator)
 
 CLASS(Player, Client)
+    
+    // custom
+
+    ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
+    ATTRIB(Player, itemkeys, int, this.itemkeys);
+
     INIT(Player) {
         this.classname = STR_PLAYER;
         IL_PUSH(g_players, this);
index 827f3940f7c28f2326a532d390da6fd22c444a0b..a18e54d2abf6574933d362d361eb0c68d8855ad6 100644 (file)
@@ -186,7 +186,7 @@ void FixIntermissionClient(entity e);
 void FixClientCvars(entity e);
 
 // WEAPONTODO: remove this
-WepSet weaponsInMap;
+//WepSet weaponsInMap;
 
 #define weapons _STAT(WEAPONS)
 
@@ -256,8 +256,8 @@ string cvar_changes;
 string cvar_purechanges;
 float cvar_purechanges_count;
 
-float game_starttime; //point in time when the countdown to game start is over
-float round_starttime; //point in time when the countdown to round start is over
+//float game_starttime; //point in time when the countdown to game start is over
+//float round_starttime; //point in time when the countdown to round start is over
 
 void W_Porto_Remove (entity p);
 
@@ -289,8 +289,6 @@ float servertime, serverprevtime, serverframetime;
 
 .float ammo_fuel;
 
-.vector prevorigin;
-
 //flood fields
 .float nickspamtime; // time of last nick change
 .float nickspamcount;
index eb03769285197e1af591e1a9c6f5dc67d21026d3..83911eeafec9aa0b5d16120444a74b465acefbb8 100644 (file)
@@ -785,7 +785,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                setorigin(targ, spot.origin + '0 0 1' * (1 - targ.mins.z - 24));
                                // don't reset back to last position, even if new position is stuck in solid
                                targ.oldorigin = targ.origin;
-                               targ.prevorigin = targ.origin;
 
                                Send_Effect(EFFECT_TELEPORT, targ.origin, '0 0 0', 1);
                        }
index d33fe87c2e1a477189000119b501b52c6f69c88e..c645c7facdce7515e3021c441bb586fdbfd1375a 100644 (file)
@@ -17,10 +17,10 @@ TODO:
 
 bool item_keys_usekey(entity l, entity p)
 {
-       float valid = l.itemkeys & p.itemkeys;
+       int valid = l.itemkeys & PS(p).itemkeys;
 
        if (!valid) {
-               // other has none of the needed keys
+               // player has none of the needed keys
                return false;
        } else if (l.itemkeys == valid) {
                // ALL needed keys were given
@@ -74,10 +74,10 @@ void item_key_touch(entity this, entity toucher)
                return;
 
        // player already picked up this key
-       if (toucher.itemkeys & this.itemkeys)
+       if (PS(toucher).itemkeys & this.itemkeys)
                return;
 
-       toucher.itemkeys |= this.itemkeys;
+       PS(toucher).itemkeys |= this.itemkeys;
        play2(toucher, this.noise);
 
        centerprint(toucher, this.message);
index 357ed226f4e96a7254c17de2d6606cafc68ede04..b1759fb6a62c2b2daafa47aed9532838ddd5d4bd 100644 (file)
@@ -73,7 +73,7 @@ float WinningCondition_Race(float fraglimit)
        c = 0;
        FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
                ++n;
-               if(it.race_completed)
+               if(CS(it).race_completed)
                        ++c;
        ));
        if(n && (n == c))
index e3201c4e50769dcc5f949320ee52a57f43ec629d..e34826cabcad0966b03af6d1b58a2a4774a343c2 100644 (file)
@@ -111,7 +111,6 @@ void CopyBody(entity this, float keepvelocity)
        //clone.weapon = this.weapon;
        setorigin(clone, this.origin);
        setsize(clone, this.mins, this.maxs);
-       clone.prevorigin = this.origin;
        clone.reset = SUB_Remove;
        clone._ps = this._ps;
 
index 1481c384da6bbd8b397b1653b19800ccabca3bd9..03c4fa828c9e2732b61c0d301516878fd2f446ab 100644 (file)
@@ -10,6 +10,7 @@
 #include "../common/notifications/all.qh"
 #include "../common/mapinfo.qh"
 #include <common/net_linked.qh>
+#include <common/state.qh>
 #include "../common/triggers/subs.qh"
 #include "../lib/warpzone/util_server.qh"
 #include "../lib/warpzone/common.qh"
@@ -378,7 +379,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
        if(tvalid)
        if(cp == race_timed_checkpoint) // finish line
-       if (!e.race_completed)
+       if (!CS(e).race_completed)
        {
                float s;
                if(g_race_qualifying)
@@ -404,7 +405,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
                        if(race_completing)
                        {
-                               e.race_completed = 1;
+                               CS(e).race_completed = 1;
                                MAKE_INDEPENDENT_PLAYER(e);
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_RACE_FINISHED, e.netname);
                                ClientData_Touch(e);
@@ -432,6 +433,9 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                        race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e, true);
                                        MUTATOR_CALLHOOK(Race_FinalCheckpoint, e);
                                }
+                               if(t < myrecordtime || myrecordtime == 0)
+                                       e.race_checkpoint_record[cp] = t; // resending done below
+
                                if(t < recordtime || recordtime == 0)
                                {
                                        race_checkpoint_records[cp] = t;
@@ -442,8 +446,6 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                                FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, LAMBDA(race_SendNextCheckpoint(it, 0)));
                                }
 
-                               if(t < myrecordtime || myrecordtime == 0)
-                                       e.race_checkpoint_record[cp] = t; // resending done below
                        }
                }
                else
@@ -456,17 +458,21 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
                if(IS_REAL_CLIENT(e))
                {
-                       msg_entity = e;
                        if(g_race_qualifying)
                        {
-                               WRITESPECTATABLE_MSG_ONE(e, {
-                                       WriteHeader(MSG_ONE, TE_CSQC_RACE);
-                                       WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
-                                       WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
-                                       WriteInt24_t(MSG_ONE, t); // time to that intermediate
-                                       WriteInt24_t(MSG_ONE, recordtime); // previously best time
-                                       WriteInt24_t(MSG_ONE, ((tvalid) ? it.race_checkpoint_record[cp] : 0)); // previously best time
-                                       WriteString(MSG_ONE, recordholder); // record holder
+                               FOREACH_CLIENT(IS_REAL_CLIENT(it),
+                               {
+                                       if(it == e || (IS_SPEC(it) && it.enemy == e))
+                                       {
+                                               msg_entity = it;
+                                               WriteHeader(MSG_ONE, TE_CSQC_RACE);
+                                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
+                                               WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
+                                               WriteInt24_t(MSG_ONE, t); // time to that intermediate
+                                               WriteInt24_t(MSG_ONE, recordtime); // previously best time
+                                               WriteInt24_t(MSG_ONE, ((tvalid) ? it.race_checkpoint_record[cp] : 0)); // previously best time
+                                               WriteString(MSG_ONE, recordholder); // record holder
+                                       }
                                });
                        }
                }
@@ -1025,9 +1031,9 @@ spawnfunc(target_stopTimer) { spawnfunc_target_checkpoint(this); }
 
 void race_AbandonRaceCheck(entity p)
 {
-       if(race_completing && !p.race_completed)
+       if(race_completing && !CS(p).race_completed)
        {
-               p.race_completed = 1;
+               CS(p).race_completed = 1;
                MAKE_INDEPENDENT_PLAYER(p);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_RACE_ABANDONED, p.netname);
                ClientData_Touch(p);
@@ -1072,14 +1078,12 @@ spawnfunc(info_player_race)
 
 void race_ClearRecords()
 {
-       float i;
-
-       for(i = 0; i < MAX_CHECKPOINTS; ++i)
+       for(int j = 0; j < MAX_CHECKPOINTS; ++j)
        {
-               race_checkpoint_records[i] = 0;
-               if(race_checkpoint_recordholders[i])
-                       strunzone(race_checkpoint_recordholders[i]);
-               race_checkpoint_recordholders[i] = string_null;
+               race_checkpoint_records[j] = 0;
+               if(race_checkpoint_recordholders[j])
+                       strunzone(race_checkpoint_recordholders[j]);
+               race_checkpoint_recordholders[j] = string_null;
        }
 
        FOREACH_CLIENT(true, LAMBDA(
@@ -1167,7 +1171,7 @@ float race_GetFractionalLapCount(entity e)
 
        float l;
        l = PlayerScore_Add(e, SP_RACE_LAPS, 0);
-       if(e.race_completed)
+       if(CS(e).race_completed)
                return l; // not fractional
 
        vector o0, o1;
index 1cc9db2b970eb0357db1ab57c7f61480c539451c..d991794b75b69e9107c48577fe89602821a291bd 100644 (file)
@@ -351,7 +351,7 @@ void GetTeamCounts(entity ignore)
                                        cb1 = cb1 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_2)
+                       else if(t == NUM_TEAM_2)
                        {
                                if(c2 >= 0)
                                {
@@ -359,7 +359,7 @@ void GetTeamCounts(entity ignore)
                                        cb2 = cb2 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_3)
+                       else if(t == NUM_TEAM_3)
                        {
                                if(c3 >= 0)
                                {
@@ -367,7 +367,7 @@ void GetTeamCounts(entity ignore)
                                        cb3 = cb3 + bvalue;
                                }
                        }
-                       if(t == NUM_TEAM_4)
+                       else if(t == NUM_TEAM_4)
                        {
                                if(c4 >= 0)
                                {
index 895c65ae29b0ab7def236c753c9fce930c3288b4..17ba0dc9dfafb4f1063e0f20f14b292f11856b56 100644 (file)
@@ -61,7 +61,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                        sprint(this, "Invalid weapon\n");
                return false;
        }
-       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(this.dual_weapons & wpn.m_wepset))
+       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(PS(this).dual_weapons & wpn.m_wepset))
                return false; // no complaints needed
        if (this.weapons & WepSet_FromWeapon(wpn))
        {
index 2e4e160b3e16f1727a810cf3418a8d41b1a81b1e..cbde7d360c61544c8ea3b4d48596c11ac2330435 100644 (file)
@@ -457,7 +457,8 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                .entity wepe1 = weaponentities[0];
                entity wep1 = actor.(wepe1);
                this.m_switchweapon = wep1.m_switchweapon;
-               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(actor.dual_weapons & wep1.m_switchweapon.m_wepset))
+               entity store = IS_PLAYER(actor) ? PS(actor) : actor;
+               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(store.dual_weapons & wep1.m_switchweapon.m_wepset))
                {
                        this.m_weapon = WEP_Null;
                        this.m_switchingweapon = WEP_Null;