X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fcl_client.qc;h=448fb8d33c525e38fecdeacf8a669eb280daa03d;hp=021cf9eaf8534c7bb8480ee145176e51242c6724;hb=645c441d589f9672bffb8fef9cc34a5c747cc9a8;hpb=de90efbc04e63ca3080b5f0051a385df6a12438f diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 021cf9ea..448fb8d3 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -13,10 +13,13 @@ void Announce(string snd) { } void AnnounceTo(entity e, string snd) { - msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_ANNOUNCE); - WriteString(MSG_ONE, snd); + if (clienttype(e) == CLIENTTYPE_REAL) + { + msg_entity = e; + WriteByte(MSG_ONE, SVC_TEMPENTITY); + WriteByte(MSG_ONE, TE_CSQC_ANNOUNCE); + WriteString(MSG_ONE, snd); + } } float ClientData_Send(entity to, float sf) @@ -426,12 +429,12 @@ string setmodel_state() // set the proper belly model depending on how full we are string newmodel_name, newmodel_extension, applymodel; - tokenizebyseparator(self.playermodel, "."); - newmodel_name = argv(0); - newmodel_extension = argv(1); + // 4 is the extension length + newmodel_name = substring(self.playermodel, 0, strlen(self.playermodel) - 4); + newmodel_extension = substring(self.playermodel, strlen(self.playermodel) - 4, 4); if(self.stomach_load) - applymodel = strcat(newmodel_name, "_state", ftos(floor(self.stomach_load)), ".", newmodel_extension); + applymodel = strcat(newmodel_name, "_state", ftos(floor(self.stomach_load)), newmodel_extension); else applymodel = self.playermodel; @@ -466,6 +469,7 @@ void Client_uncustomizeentityforclient() float Client_customizeentityforclient() { entity modelsource; + string applymodel; if(self.modelindex == 0) return TRUE; @@ -512,21 +516,21 @@ float Client_customizeentityforclient() if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug { Client_setmodel(setmodel_state()); - if not(self.predator.classname == "player") + if not(self.predator.classname == "player" || self.fakeprey) self.alpha = default_player_alpha; return TRUE; } if(other.spectatee_status) other = other.enemy; // also do this for the player we are spectating - if(other.predator == self) + if(other.predator == self || other.fakepredator == self) { - tokenizebyseparator(self.playermodel, "."); - Client_setmodel(strcat(argv(0), "_stomach.md3")); + applymodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length + Client_setmodel(applymodel); self.alpha = other.cvar_cl_vore_stomachmodel; return TRUE; } Client_setmodel(setmodel_state()); - if not(self.predator.classname == "player") + if not(self.predator.classname == "player" || self.fakeprey) self.alpha = default_player_alpha; return TRUE; } @@ -600,7 +604,8 @@ void PutObserverInServer (void) self.armorvalue = cvar("g_balance_armor_start"); self.pauserotarmor_finished = 0; self.pauserothealth_finished = 0; - self.pauseregen_finished = 0; + self.pauseregenhealth_finished = 0; + self.pauseregenarmor_finished = 0; self.damageforcescale = 0; self.death_time = 0; self.dead_frame = 0; @@ -827,11 +832,15 @@ void PutClientInServer (void) self.wasplayer = TRUE; self.iscreature = TRUE; self.movetype = MOVETYPE_WALK; - self.solid = SOLID_SLIDEBOX; - if(cvar("g_playerclip_collisions")) - self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP; + if(cvar("g_player_colisions")) + self.solid = SOLID_SLIDEBOX; else - self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; + self.solid = SOLID_CORPSE; + self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID; + if(cvar("g_playerclip_collisions")) + self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP; + if(clienttype(self) == CLIENTTYPE_BOT && cvar("g_botclip_collisions")) + self.dphitcontentsmask |= DPCONTENTS_BOTCLIP; self.frags = FRAGS_PLAYER; if(independent_players) MAKE_INDEPENDENT_PLAYER(self); @@ -865,13 +874,15 @@ void PutClientInServer (void) self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn"); self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn"); self.pauserotfuel_finished = time + cvar("g_balance_pause_fuel_rot_spawn"); - self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn"); + self.pauseregenhealth_finished = time + cvar("g_balance_pause_health_regen_spawn"); + self.pauseregenarmor_finished = time + cvar("g_balance_pause_armor_regen_spawn"); //extend the pause of rotting if client was reset at the beginning of the countdown if(!cvar("sv_ready_restart_after_countdown") && time < game_starttime) { // TODO why is this cvar NOTted? self.spawnshieldtime += game_starttime - time; self.pauserotarmor_finished += game_starttime - time; self.pauserothealth_finished += game_starttime - time; - self.pauseregen_finished += game_starttime - time; + self.pauseregenhealth_finished += game_starttime - time; + self.pauseregenarmor_finished += game_starttime - time; } self.damageforcescale = 2; self.death_time = 0; @@ -911,6 +922,8 @@ void PutClientInServer (void) SetCustomizer(self, Client_customizeentityforclient, Client_uncustomizeentityforclient); + Vore_DeadPrey_Detach(self); + self.model = ""; FixPlayermodel(); @@ -1006,11 +1019,12 @@ float ClientInit_SendEntity(entity to, float sf) WriteString(MSG_ENTITY, world.fog); else WriteString(MSG_ENTITY, ""); + WriteCoord(MSG_ENTITY, cvar("g_campaign")); WriteByte(MSG_ENTITY, cvar("g_balance_armor_blockpercent") * 255.0); WriteByte(MSG_ENTITY, cvar("g_balance_weaponswitchdelay") * 255.0); + WriteCoord(MSG_ENTITY, cvar("g_vore")); WriteCoord(MSG_ENTITY, cvar("g_balance_vore_swallow_limit")); - WriteCoord(MSG_ENTITY, cvar("g_vore_showpreyhealth")); return TRUE; } @@ -1589,7 +1603,7 @@ void ChatBubbleThink() remove(self); return; } - if ((self.owner.BUTTON_CHAT && !self.owner.deadflag && self.owner.predator.classname != "player") + if ((self.owner.BUTTON_CHAT && !self.owner.deadflag && self.owner.predator.classname != "player" && self.owner.fakepredator.classname != "player") #ifdef TETRIS || self.owner.tetris_on #endif @@ -1632,11 +1646,12 @@ void TeamBubbleThink() return; } // setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); // bandwidth hog. setattachment does this now - if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator || self.owner.predator.classname == "player") + if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator || self.owner.predator.classname == "player" || self.owner.fakepredator.classname == "player") self.model = ""; else { - if(cvar("g_balance_vore_teamheal") && self.owner.health < cvar("g_balance_vore_teamheal_stable")) + if(cvar("g_balance_vore_teamheal") && cvar("g_vore_teamvore")) + if(self.owner.health < cvar("g_balance_vore_teamheal_stable")) setmodel(self, "models/misc/teambubbleheal.spr"); // indicate that this player can be teamhealed else setmodel(self, "models/misc/teambubble.spr"); @@ -1841,7 +1856,8 @@ float CalcRot(float current, float stable, float rotfactor, float rotframetime) return max(stable, current + (stable - current) * rotfactor * rotframetime); } -float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit) +.float regen_soundtime; +float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit, string regensound) { if(current > rotstable) { @@ -1857,6 +1873,18 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re { current = CalcRegen(current, regenstable, regenfactor, regenframetime); current = min(regenstable, current + regenlinear * regenframetime); + + if(regensound != "") + if(regenfactor || regenlinear) + { + if(self.regen_soundtime < time) + { + msg_entity = self; + if(clienttype(msg_entity) == CLIENTTYPE_REAL) + soundto(MSG_ONE, self, CHAN_AUTO, regensound, VOL_BASE, ATTN_NONE); + } + self.regen_soundtime = time + 1; // only replay the sound if regen was paused for one second + } } } @@ -1896,8 +1924,8 @@ void player_regen (void) if (!g_ca && (!g_lms || cvar("g_lms_regenerate"))) { - self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita); - self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserothealth_finished), limith); + self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregenarmor_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita, "misc/armor_regen.ogg"); + self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserothealth_finished), limith, "misc/health_regen.ogg"); // if player rotted to death... die! if(self.health < 1) @@ -1905,7 +1933,7 @@ void player_regen (void) } if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf); + self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf, ""); } float zoomstate_set; @@ -1997,6 +2025,7 @@ void SpectateCopy(entity spectatee) { self.health = spectatee.health; self.impulse = 0; self.items = spectatee.items; + self.last_pickup = spectatee.last_pickup; self.strength_finished = spectatee.strength_finished; self.invincible_finished = spectatee.invincible_finished; self.pressedkeys = spectatee.pressedkeys; @@ -2605,8 +2634,24 @@ void PlayerPreThink (void) if(self.taunt_soundtime) if(time > self.taunt_soundtime) { + switch(self.taunt_soundtype) + { + case TAUNTTYPE_DEATH: + PlayerSound(self, playersound_taunt, CHAN_VOICE, VOICETYPE_AUTOTAUNT); + break; + case TAUNTTYPE_VOREPRED: + PlayerSound(self, playersound_pred, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly + break; + case TAUNTTYPE_VOREPREY: + PlayerSound(self, playersound_prey, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly + break; + default: + dprint("Incorrect autotaunt type\n"); + break; + } + self.taunt_soundtime = 0; - PlayerSound(self, playersound_taunt, CHAN_VOICE, VOICETYPE_AUTOTAUNT); + self.taunt_soundtype = 0; } target_voicescript_next(self);