X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_player.qc;h=a2943a76053e61e6e873e951594bfa7bd1898feb;hb=aaa3b7d4a08f8271df86b2aad2e88fa616b5e7e2;hp=d5064bdbdc5a5324f117135b96b2d341e08a672f;hpb=606b7d7b27c6ecd120f68730fc55dcc439dfeabb;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index d5064bdbd..a2943a760 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -111,6 +111,7 @@ void CopyBody(float keepvelocity) self.enemy = oldself; self.lip = oldself.lip; self.colormap = oldself.colormap; + self.glowmod = oldself.glowmod; self.iscreature = oldself.iscreature; self.angles = oldself.angles; self.avelocity = oldself.avelocity; @@ -142,6 +143,7 @@ void CopyBody(float keepvelocity) self.movetype = oldself.movetype; self.nextthink = oldself.nextthink; self.solid = oldself.solid; + self.ballistics_density = oldself.ballistics_density; self.takedamage = oldself.takedamage; self.think = oldself.think; self.customizeentityforclient = oldself.customizeentityforclient; @@ -165,55 +167,12 @@ void CopyBody(float keepvelocity) float player_getspecies() { - local float glob, i, j, fh, len, s, sk; - local string fn, l; - - s = -1; - - glob = search_begin("models/player/*.txt", TRUE, TRUE); - if(glob < 0) - return s; - for(j = 0; j <= 1; ++j) - { - for(i = 0; i < search_getsize(glob); ++i) - { - fn = search_getfilename(glob, i); - fh = fopen(fn, FILE_READ); - if(fh < 0) - continue; - fgets(fh); fgets(fh); - sk = stof(fgets(fh)); - if(sk == (j ? 0 : self.skinindex)) // 2nd pass skips the skin test - if(fgets(fh) == self.model) - { - l = fgets(fh); - len = tokenize_console(l); - if (len != 2) - goto nospecies; - if (argv(0) != "species") - goto nospecies; - switch(argv(1)) - { - case "human": s = SPECIES_HUMAN; break; - case "alien": s = SPECIES_ALIEN; break; - case "robot_shiny": s = SPECIES_ROBOT_SHINY; break; - case "robot_rusty": s = SPECIES_ROBOT_RUSTY; break; - case "robot_solid": s = SPECIES_ROBOT_SOLID; break; - case "animal": s = SPECIES_ANIMAL; break; - case "reserved": s = SPECIES_RESERVED; break; - } - } -:nospecies - fclose(fh); - } - if (s >= 0) - break; - } - search_end(glob); - - if (s < 0) - s = SPECIES_HUMAN; - + float s; + get_model_parameters(self.playermodel, self.skinindex); + s = get_model_parameters_species; + get_model_parameters(string_null, 0); + if(s < 0) + return SPECIES_HUMAN; return s; } @@ -475,7 +434,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); - if((g_arena && numspawned < 2) || (g_ca && player_cnt < 2) && !inWarmupStage) + if((g_arena && numspawned < 2) || (g_ca && ca_players < required_ca_players) && !inWarmupStage) return; if (!g_minstagib) @@ -490,6 +449,16 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht take = damage; } + frag_inflictor = inflictor; + frag_attacker = attacker; + frag_target = self; + damage_take = take; + damage_save = save; + damage_force = force; + MUTATOR_CALLHOOK(PlayerDamage); + take = bound(0, damage_take, self.health); + save = bound(0, damage_save, self.armorvalue); + if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) @@ -529,15 +498,18 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(sound_allowed(MSG_BROADCAST, attacker)) if(!DEATH_ISWEAPON(deathtype, WEP_LASER) || attacker != self || self.health < 2 * cvar("g_balance_laser_primary_damage") * cvar("g_balance_selfdamagepercent") + 1) + if(self.health > 1) // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two { - if(self.health > 75) // TODO make a "gentle" version? + if(deathtype == DEATH_FALL) + PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + else if(self.health > 75) // TODO make a "gentle" version? PlayerSound(playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 50) PlayerSound(playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 25) PlayerSound(playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - else if(self.health > 1) + else PlayerSound(playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND); } } @@ -636,6 +608,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht frag_attacker = attacker; frag_inflictor = inflictor; + frag_target = self; MUTATOR_CALLHOOK(PlayerDies); if(self.flagcarried) @@ -663,6 +636,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht self.movetype = MOVETYPE_TOSS; // shootable corpse self.solid = SOLID_CORPSE; + self.ballistics_density = cvar("g_ballistics_density_corpse"); // don't stick to the floor self.flags &~= FL_ONGROUND; // dying animation @@ -699,12 +673,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // call the corpse damage function just in case it wants to gib self.event_damage(inflictor, attacker, 0, deathtype, hitloc, force); // set up to fade out later - SUB_SetFade (self, time + 12 + random () * 4, 1); - - // remove laserdot - if(self.weaponentity) - if(self.weaponentity.lasertarget) - remove(self.weaponentity.lasertarget); + SUB_SetFade (self, time + 6 + random (), 1); if(clienttype(self) == CLIENTTYPE_REAL) { @@ -894,6 +863,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f { string msgstr, colorstr, cmsgstr, namestr, fullmsgstr, sourcemsgstr, fullcmsgstr, sourcecmsgstr, privatemsgprefix; float flood, privatemsgprefixlen; + var .float flood_field; entity head; float ret; @@ -975,7 +945,6 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f float flood_spl; float flood_burst; float flood_lmax; - var .float flood_field; float lines; if(privatesay) { @@ -1037,10 +1006,10 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f else flood = 1; } - } - if (timeoutStatus == 2) //when game is paused, no flood protection - source.flood_field = flood = 0; + if (timeoutStatus == 2) //when game is paused, no flood protection + source.flood_field = flood = 0; + } if(flood == 2) // cannot happen for empty msgstr { @@ -1243,7 +1212,10 @@ void LoadPlayerSounds(string f, float first) var .string field; fh = fopen(f, FILE_READ); if(fh < 0) + { + dprint("Player sound file not found: ", f, "\n"); return; + } while((s = fgets(fh))) { if(tokenize_console(s) != 3) @@ -1264,14 +1236,17 @@ void LoadPlayerSounds(string f, float first) } .float modelindex_for_playersound; +.float skinindex_for_playersound; void UpdatePlayerSounds() { if(self.modelindex == self.modelindex_for_playersound) + if(self.skinindex == self.skinindex_for_playersound) return; self.modelindex_for_playersound = self.modelindex; + self.skinindex_for_playersound = self.skinindex; ClearPlayerSounds(); LoadPlayerSounds("sound/player/default.sounds", 1); - LoadPlayerSounds(strcat(self.model, ".sounds"), 0); + LoadPlayerSounds(get_model_datafilename(self.playermodel, self.skinindex, "sounds"), 0); } void FakeGlobalSound(string sample, float chan, float voicetype)