X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=09d57986fd5085022a8da36aa0af435c1143d0d0;hp=d2af1f03026e3990125a7591a0dd1dde0c070e0b;hb=ae2c1407ec9a05e4f501a6604a7cce8e1030df9f;hpb=ad415a3b4e5ec559b143c81080dd705875533449 diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d2af1f0302..09d57986fd 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -33,6 +33,8 @@ #include "../common/net_notice.qh" #include "../common/physics.qh" +#include "../common/items/all.qc" + #include "../common/triggers/subs.qh" #include "../common/triggers/triggers.qh" #include "../common/triggers/trigger/secret.qh" @@ -186,7 +188,7 @@ void PutObserverInServer (void) entity spot; self.hud = HUD_NORMAL; - if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); } + if(IS_PLAYER(self)) { Send_Effect("spawn_event_neutral", self.origin, '0 0 0', 1); } spot = SelectSpawnPoint (true); if(!spot) @@ -195,6 +197,7 @@ void PutObserverInServer (void) if(IS_REAL_CLIENT(self)) { + Item_ItemsTime_SetTimesForPlayer(self); msg_entity = self; WriteByte(MSG_ONE, SVC_SETVIEW); WriteEntity(MSG_ONE, self); @@ -226,7 +229,8 @@ void PutObserverInServer (void) if(self.killcount != -666) { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname); - if(autocvar_g_chat_nospectators == 1 || (cvar("g_warmup") && !(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2)) + if(!intermission_running) + if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2)) Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS); if(self.just_joined == false) { @@ -420,7 +424,7 @@ void PutClientInServer (void) // reset player keys self.itemkeys = 0; - MUTATOR_CALLHOOK(PutClientInServer); + MUTATOR_CALLHOOK(PutClientInServer, self); if(gameover) self.classname = "observer"; @@ -503,6 +507,9 @@ void PutClientInServer (void) else self.superweapons_finished = 0; + if(!warmup_stage) + Item_ItemsTime_ResetTimesForPlayer(self); + if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { if(g_weaponarena_random_with_blaster) @@ -636,8 +643,7 @@ void PutClientInServer (void) Unfreeze(self); - spawn_spot = spot; - MUTATOR_CALLHOOK(PlayerSpawn); + MUTATOR_CALLHOOK(PlayerSpawn, spot); if(autocvar_spawn_debug) { @@ -1272,7 +1278,7 @@ void ClientConnect (void) self = oldself; } - MUTATOR_CALLHOOK(ClientConnect); + MUTATOR_CALLHOOK(ClientConnect, self); } /* ============= @@ -1296,7 +1302,7 @@ void ClientDisconnect (void) PlayerStats_GameReport_FinalizePlayer(self); - if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); } + if(IS_PLAYER(self)) { Send_Effect("spawn_event_neutral", self.origin, '0 0 0', 1); } CheatShutdownClient(); @@ -1433,7 +1439,7 @@ void respawn(void) self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed; self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3; self.effects |= CSQCMODEL_EF_RESPAWNGHOST; - pointparticles(particleeffectnum("respawn_ghost"), self.origin, '0 0 0', 1); + Send_Effect("respawn_ghost", self.origin, '0 0 0', 1); if(autocvar_g_respawn_ghosts_maxtime) SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5); } @@ -1455,7 +1461,7 @@ void play_countdown(float finished, string samp) void player_powerups (void) { // add a way to see what the items were BEFORE all of these checks for the mutator hook - olditems = self.items; + int items_prev = self.items; if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover) self.modelflags |= MF_ROCKET; @@ -1472,13 +1478,13 @@ void player_powerups (void) if (!g_instagib) { - if (self.items & IT_STRENGTH) + if (self.items & ITEM_Strength.m_itemid) { play_countdown(self.strength_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.strength_finished) { - self.items = self.items - (self.items & IT_STRENGTH); + self.items = self.items - (self.items & ITEM_Strength.m_itemid); //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH); } @@ -1487,18 +1493,18 @@ void player_powerups (void) { if (time < self.strength_finished) { - self.items = self.items | IT_STRENGTH; + self.items = self.items | ITEM_Strength.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH); } } - if (self.items & IT_INVINCIBLE) + if (self.items & ITEM_Shield.m_itemid) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.invincible_finished) { - self.items = self.items - (self.items & IT_INVINCIBLE); + self.items = self.items - (self.items & ITEM_Shield.m_itemid); //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD); } @@ -1507,7 +1513,7 @@ void player_powerups (void) { if (time < self.invincible_finished) { - self.items = self.items | IT_INVINCIBLE; + self.items = self.items | ITEM_Shield.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD); } @@ -1567,7 +1573,7 @@ void player_powerups (void) if (time < self.spawnshieldtime) self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); - MUTATOR_CALLHOOK(PlayerPowerups); + MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev); } float CalcRegen(float current, float stable, float regenfactor, float regenframetime) @@ -1619,11 +1625,7 @@ void player_regen (void) { float max_mod, regen_mod, rot_mod, limit_mod; max_mod = regen_mod = rot_mod = limit_mod = 1; - regen_mod_max = max_mod; - regen_mod_regen = regen_mod; - regen_mod_rot = rot_mod; - regen_mod_limit = limit_mod; - if(!MUTATOR_CALLHOOK(PlayerRegen)) + if(!MUTATOR_CALLHOOK(PlayerRegen, max_mod, regen_mod, rot_mod, limit_mod)) if(!self.frozen) { float minh, mina, maxh, maxa, limith, limita; @@ -1665,7 +1667,7 @@ void player_regen (void) minf = autocvar_g_balance_fuel_regenstable; limitf = autocvar_g_balance_fuel_limit; - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); + self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); } } @@ -1702,8 +1704,7 @@ spectate mode routines */ void SpectateCopy(entity spectatee) { - other = spectatee; - MUTATOR_CALLHOOK(SpectateCopy); + MUTATOR_CALLHOOK(SpectateCopy, spectatee, self); self.armortype = spectatee.armortype; self.armorvalue = spectatee.armorvalue; self.ammo_cells = spectatee.ammo_cells; @@ -2262,6 +2263,8 @@ void PlayerPreThink (void) self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam; self.stat_leadlimit = autocvar_leadlimit; + self.weaponsinmap = weaponsInMap; + if(frametime) { // physics frames: update anticheat stuff @@ -2420,7 +2423,7 @@ void PlayerPreThink (void) if(frametime) { - if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge)) + if(self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge)) { self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit)); self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit)); @@ -2516,7 +2519,7 @@ void PlayerPreThink (void) // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY // It cannot be predicted by the engine! - if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink) + if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink) do_crouch = 0; if (do_crouch) @@ -2555,8 +2558,8 @@ void PlayerPreThink (void) W_WeaponFrame(); self.items_added = 0; - if(self.items & IT_JETPACK) - if(self.items & IT_FUEL_REGEN || self.ammo_fuel >= 0.01) + if(self.items & ITEM_Jetpack.m_itemid) + if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01) self.items_added |= IT_FUEL; self.items |= self.items_added; @@ -2593,7 +2596,7 @@ void PlayerPreThink (void) // WEAPONTODO: Add weapon request for this if(!zoomstate_set) - SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO + SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX.m_id) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE.m_id && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO float oldspectatee_status; oldspectatee_status = self.spectatee_status;