X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=7d26e4f7bad0da78b257faa78966b6fe4da40beb;hp=4994c193652cd65b8266ae53c6262768bf669773;hb=64b8409b2d6fb93dc51ba24a82d219c8cd56a907;hpb=910d5295d631181792d354f44a80b63dc3e629eb diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 4994c19365..7d26e4f7ba 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -3,7 +3,6 @@ #include "anticheat.qh" #include "cl_impulse.qh" #include "cl_player.qh" -#include "ent_cs.qh" #include "ipban.qh" #include "miscfunctions.qh" #include "portals.qh" @@ -23,6 +22,7 @@ #include "bot/bot.qh" #include "bot/navigation.qh" +#include "../common/ent_cs.qh" #include "../common/vehicles/all.qh" #include "../common/triggers/teleporters.qh" @@ -175,7 +175,6 @@ void setplayermodel(entity e, string modelname) precache_model(modelname); _setmodel(e, modelname); player_setupanimsformodel(); - UpdatePlayerSounds(); } /* @@ -319,6 +318,15 @@ void PutObserverInServer() self.event_damage = func_null; } +int player_getspecies(entity this) +{ + get_model_parameters(this.model, this.skin); + int s = get_model_parameters_species; + get_model_parameters(string_null, 0); + if (s < 0) return SPECIES_HUMAN; + return s; +} + .float model_randomizer; void FixPlayermodel(entity player) { @@ -395,8 +403,7 @@ void FixPlayermodel(entity player) if(chmdl || oldskin != player.skin) // model or skin has changed { - player.species = player_getspecies(); // update species - UpdatePlayerSounds(); // update skin sounds + player.species = player_getspecies(player); // update species } if(!teamplay) @@ -563,8 +570,6 @@ void PutClientInServer() this.bot_attack = true; this.monster_attack = true; - this.spider_slowness = 0; - this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = false; if (this.killcount == FRAGS_SPECTATOR) { @@ -958,6 +963,8 @@ void FixClientCvars(entity e) stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n"); if(autocvar_sv_gentle) stuffcmd(e, "cl_cmd settemp cl_gentle 1\n"); + + MUTATOR_CALLHOOK(FixClientCvars, e); } float PlayerInIDList(entity p, string idlist) @@ -1171,7 +1178,7 @@ void ClientConnect () else stuffcmd(self, "set _teams_available 0\n"); - attach_entcs(self); + entcs_attach(self); bot_relinkplayerlist(); @@ -1192,7 +1199,7 @@ void ClientConnect () Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage()); } - if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET(TUBA))) + if(g_weaponarena_weapons == WEPSET(TUBA)) stuffcmd(self, "cl_cmd settemp chase_active 1\n"); } @@ -1211,7 +1218,7 @@ void ClientConnect () self.model_randomizer = random(); if(IS_REAL_CLIENT(self)) - sv_notice_join(); + sv_notice_join(self); for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) { WITH(entity, self, e, e.init_for_player(this)); @@ -1257,7 +1264,7 @@ void ClientDisconnect () bot_clientdisconnect(); - detach_entcs(self); + entcs_detach(self); if(autocvar_sv_eventlog) GameLogEcho(strcat(":part:", ftos(self.playerid))); @@ -1298,8 +1305,6 @@ void ClientDisconnect () if(self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse); - ClearPlayerSounds(); - if(self.personal) remove(self.personal); @@ -1661,8 +1666,8 @@ spectate mode routines ====================== */ -void SpectateCopy(entity spectatee) -{SELFPARAM(); +void SpectateCopy(entity this, entity spectatee) +{ MUTATOR_CALLHOOK(SpectateCopy, spectatee, self); self.armortype = spectatee.armortype; self.armorvalue = spectatee.armorvalue; @@ -1747,7 +1752,7 @@ bool SpectateUpdate() return false; } - SpectateCopy(self.enemy); + SpectateCopy(this, this.enemy); return true; } @@ -2009,7 +2014,7 @@ void ObserverThink() {SELFPARAM(); if ( self.impulse ) { - MinigameImpulse(self.impulse); + MinigameImpulse(self, self.impulse); self.impulse = 0; } float prefered_movetype; @@ -2044,7 +2049,7 @@ void SpectatorThink() {SELFPARAM(); if ( self.impulse ) { - if(MinigameImpulse(self.impulse)) + if(MinigameImpulse(self, self.impulse)) self.impulse = 0; } if (self.flags & FL_JUMPRELEASED) { @@ -2319,22 +2324,6 @@ void PlayerPreThink () if(frametime) { - 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)); - self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit)); - - if(self.vortex_charge > WEP_CVAR(vortex, charge_animlimit)) - { - self.weaponentity_glowmod_x = self.weaponentity_glowmod.x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); - self.weaponentity_glowmod_y = self.weaponentity_glowmod.y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); - self.weaponentity_glowmod_z = self.weaponentity_glowmod.z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); - } - } - else - self.weaponentity_glowmod = colormapPaletteColor(self.clientcolors & 0x0F, true) * 2; - player_powerups(); } @@ -2424,8 +2413,8 @@ void PlayerPreThink () if (!self.crouch) { self.crouch = true; - self.view_ofs = self.stat_pl_crouch_view_ofs; - setsize (self, self.stat_pl_crouch_min, self.stat_pl_crouch_max); + self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self); + setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self)); // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway } } @@ -2433,12 +2422,12 @@ void PlayerPreThink () { if (self.crouch) { - tracebox(self.origin, self.stat_pl_min, self.stat_pl_max, self.origin, false, self); + tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self); if (!trace_startsolid) { self.crouch = false; - self.view_ofs = self.stat_pl_view_ofs; - setsize (self, self.stat_pl_min, self.stat_pl_max); + self.view_ofs = STAT(PL_VIEW_OFS, self); + setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self)); } } } @@ -2504,6 +2493,8 @@ void PlayerPreThink () if(self.spectatee_status != oldspectatee_status) { ClientData_Touch(self); + if(g_race || g_cts) + race_InitSpectator(); } if(self.teamkill_soundtime) @@ -2511,21 +2502,18 @@ void PlayerPreThink () { self.teamkill_soundtime = 0; - setself(self.teamkill_soundsource); - entity oldpusher = self.pusher; - self.pusher = this; - - PlayerSound(playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY); - - self.pusher = oldpusher; - setself(this); + entity e = self.teamkill_soundsource; + entity oldpusher = e.pusher; + e.pusher = this; + PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY); + e.pusher = oldpusher; } if(self.taunt_soundtime) if(time > self.taunt_soundtime) { self.taunt_soundtime = 0; - PlayerSound(playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT); + PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT); } target_voicescript_next(self); @@ -2536,6 +2524,28 @@ void PlayerPreThink () self.clip_load = self.clip_size = 0; } +void DrownPlayer(entity this) +{ + if(this.deadflag != DEAD_NO) + return; + + if (this.waterlevel != WATERLEVEL_SUBMERGED) + { + if(this.air_finished < time) + PlayerSound(this, playersound_gasp, CH_PLAYER, VOICETYPE_PLAYERSOUND); + this.air_finished = time + autocvar_g_balance_contents_drowndelay; + this.dmg = 2; + } + else if (this.air_finished < time) + { // drown! + if (this.pain_finished < time) + { + Damage (this, world, world, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, this.origin, '0 0 0'); + this.pain_finished = time + 0.5; + } + } +} + /* ============= PlayerPostThink @@ -2587,10 +2597,11 @@ void PlayerPostThink () //CheckPlayerJump(); if(IS_PLAYER(self)) { + DrownPlayer(self); CheckRules_Player(); UpdateChatBubble(); if (self.impulse) - ImpulseCommands(); + ImpulseCommands(self); if (intermission_running) return; // intermission or finale GetPressedKeys();