X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fcl_player.qc;h=70ff9b24347965547619ca22a32fda562db2b348;hb=c5af4a5c8f8ad3ac8368ddeb812143ac8ed01be7;hp=ea3a9797194c58fe35f0bb1f2ac7d886176a6631;hpb=405055c8b7a511f99c34e34aa0da3964cc04de48;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index ea3a9797..70ff9b24 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -104,8 +104,6 @@ void WeaponStats_LogKill(float awep, float vwep) void CopyBody(float keepvelocity) { local entity oldself; - if (self.fakeprey) - return; if (self.effects & EF_NODRAW || self.alpha < 0) return; oldself = self; @@ -114,6 +112,7 @@ void CopyBody(float keepvelocity) self.lip = oldself.lip; self.colormap = oldself.colormap; self.colormod = oldself.colormod; + self.glowmod = oldself.glowmod; self.iscreature = oldself.iscreature; self.angles = oldself.angles; self.avelocity = oldself.avelocity; @@ -143,6 +142,7 @@ void CopyBody(float keepvelocity) self.solid = oldself.solid; self.takedamage = oldself.takedamage; self.think = oldself.think; + self.scale = oldself.scale; self.customizeentityforclient = oldself.customizeentityforclient; self.uncustomizeentityforclient = oldself.uncustomizeentityforclient; self.uncustomizeentityforclient_set = oldself.uncustomizeentityforclient_set; @@ -245,7 +245,7 @@ void player_setupanimsformodel() self.anim_backright = '21 1 1'; self.anim_backleft = '22 1 1'; animparseerror = FALSE; - animfilename = strcat(self.model, ".animinfo"); + animfilename = strcat(self.playermodel, ".animinfo"); // only the normal player model may contain animation info animfile = fopen(animfilename, FILE_READ); if (animfile >= 0) { @@ -282,12 +282,8 @@ void player_setupanimsformodel() else dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n"); - // the line below is disabled due to issues with the stomach model, which cannot be animated. - // customizeentityforclient cannot let this part of the code know whether it's the stomach model or normal - // player model we're using. Attempting to animate the stomach model causes BIG issues, and must not be allowed. - // reset animstate now - //setanim(self, self.anim_idle, TRUE, FALSE, TRUE); + setanim(self, self.anim_idle, TRUE, FALSE, TRUE); }; void player_anim (void) @@ -312,7 +308,18 @@ void player_anim (void) if (!self.animstate_override) { - if (!(self.flags & FL_ONGROUND)) + if(self.swallow_progress_pred) + setanim(self, self.anim_duckjump, TRUE, FALSE, FALSE); // looks good for predators who are swallowing + else if(self.swallow_progress_prey) + setanim(self, self.anim_die2, FALSE, FALSE, FALSE); // looks good for prey who's getting swallowed + else if(self.stat_eaten) + { + if(self.BUTTON_ATCK || self.predator.digesting) + setanim(self, self.anim_pain2, FALSE, TRUE, FALSE); // looks good for prey attacking the stomach or being digested + else + setanim(self, self.anim_jump, FALSE, TRUE, FALSE); // looks good for prey idling inside the stomach + } + else if (!(self.flags & FL_ONGROUND)) { if (self.crouch) setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump); @@ -354,12 +361,21 @@ void player_anim (void) if (self.weaponentity) if (!self.weaponentity.animstate_override) - setanim(self.weaponentity, self.weaponentity.anim_idle, TRUE, FALSE, FALSE); + { + if(self.swallow_progress_pred) + setanim(self.weaponentity, self.weaponentity.anim_fire2, TRUE, FALSE, FALSE); // looks good for predators who are swallowing + else if(self.swallow_progress_prey) + setanim(self.weaponentity, self.weaponentity.anim_reload, TRUE, FALSE, FALSE); // looks good for prey who's getting swallowed + else if(self.stat_eaten && self.BUTTON_ATCK) + setanim(self.weaponentity, self.weaponentity.anim_fire1, TRUE, FALSE, FALSE); // looks good for prey attacking the stomach + else + setanim(self.weaponentity, self.weaponentity.anim_idle, TRUE, FALSE, FALSE); + } } -void SpawnThrownWeapon (vector org, float w) +void SpawnThrownWeapon (vector org, float w, float doreduce) { - W_ThrowWeapon(randomvec() * 125 + '0 0 200', org - self.origin, FALSE); + W_ThrowWeapon(randomvec() * 125 + '0 0 200', org - self.origin, doreduce); } void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) @@ -402,18 +418,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float self.dmg_take = self.dmg_take + take;//max(take - 10, 0); self.dmg_inflictor = inflictor; - if (self.health <= -75 && self.modelindex != 0) - { - // don't use any animations as a gib - self.frame = 0; - self.dead_frame = 0; - // view just above the floor - self.view_ofs = '0 0 4'; - - Violence_GibSplash(self, 1, 1, attacker); - self.modelindex = 0; // restore later - self.solid = SOLID_NOT; // restore later - } + PlayerGib(self, attacker); } void ClientKill_Now_TeamChange(); @@ -593,7 +598,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // clear selected player display ClearSelectedPlayer(); // throw a weapon - SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon); + SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon, FALSE); // print an obituary message Obituary (attacker, inflictor, self, deathtype); race_PreDie(); @@ -614,19 +619,25 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht } // clear waypoints WaypointSprite_PlayerDead(); - // make the corpse upright (not tilted) - self.angles_x = 0; - self.angles_z = 0; - // don't spin - self.avelocity = '0 0 0'; - // view from the floor - self.view_ofs = '0 0 -8'; - // toss the corpse - self.movetype = MOVETYPE_TOSS; - // shootable corpse - self.solid = SOLID_CORPSE; - // don't stick to the floor - self.flags &~= FL_ONGROUND; + + // configure these properties if the dead body is not a prey + if(!self.stat_eaten) + { + // make the corpse upright (not tilted) + self.angles_x = 0; + self.angles_z = 0; + // don't spin + self.avelocity = '0 0 0'; + // view from the floor + self.view_ofs = '0 0 -8'; + // toss the corpse + self.movetype = MOVETYPE_TOSS; + // shootable corpse + self.solid = SOLID_CORPSE; + // don't stick to the floor + self.flags &~= FL_ONGROUND; + } + // dying animation self.deadflag = DEAD_DYING; // when to allow respawn @@ -745,7 +756,6 @@ void ClearSelectedPlayer() } } -.float dropweapon_check; void UpdateSelectedPlayer() { entity selected; @@ -753,12 +763,12 @@ void UpdateSelectedPlayer() selected = world; selected_score = 0.95; // 18 degrees - if(self.predator.classname == "player") + if(self.stat_eaten) { if(!self.dropweapon_check) if(self.predator.team != self.team) // don't disarm team mates when swallowing them if(random() < cvar("g_balance_vore_swallow_dropweapon")) - SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon); + SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon, TRUE); self.dropweapon_check = TRUE; } else @@ -1211,12 +1221,12 @@ void UpdatePlayerSounds() LoadPlayerSounds(strcat(self.model, ".sounds"), 0); } -.float soundtimefilter; -.entity soundownerfilter; -void GlobalSound(string sample, float chan, float voicetype) +void GlobalSound(string sample, float chan, float voicetype, float vol) { float n; float tauntrand; + float vol_scale, vol_prey, vol_apply; + float pitch; if(sample == "") return; @@ -1228,6 +1238,17 @@ void GlobalSound(string sample, float chan, float voicetype) else sample = strcat(argv(0), ".wav"); // randomization + // modified volume, used for attenuated (non-radio) voices + vol_scale = vol_prey = 1; + if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player + vol_scale *= bound(0, pow(self.scale, cvar("g_healthsize_soundfactor")), 1); + if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling + vol_prey *= bound(0, cvar("g_vore_soundocclusion"), 1); + + // modified sound pitch, based on player scale + if(cvar("g_healthsize") && cvar("g_healthsize_pitch")) + pitch = pow(self.scale, -cvar("g_healthsize_pitch")); + switch(voicetype) { case VOICETYPE_LASTATTACKER_ONLY: @@ -1239,13 +1260,12 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - if(self.predator.classname == "player") - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } } break; @@ -1258,17 +1278,16 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - if(self.predator.classname == "player") - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } msg_entity = self; if(clienttype(msg_entity) == CLIENTTYPE_REAL) - soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE, pitch); } break; case VOICETYPE_TEAMRADIO: @@ -1277,13 +1296,12 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - if(self.predator.classname == "player") - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } break; case VOICETYPE_AUTOTAUNT: @@ -1295,25 +1313,17 @@ void GlobalSound(string sample, float chan, float voicetype) break; tauntrand = random(); FOR_EACH_REALCLIENT(msg_entity) - { - msg_entity.soundownerfilter = self; if (tauntrand < msg_entity.cvar_cl_autotaunt) - if not (self.taunt_soundtimefiltered && msg_entity.soundownerfilter.soundtimefilter > time) { if (msg_entity.cvar_cl_voice_directional >= 1) { - if(self.predator.classname == "player") - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); - - if(self.taunt_soundtimefiltered) - msg_entity.soundownerfilter.soundtimefilter = time + msg_entity.cvar_cl_autotaunt_repeat; + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } - } break; case VOICETYPE_TAUNT: if(self.classname == "player") @@ -1327,23 +1337,25 @@ void GlobalSound(string sample, float chan, float voicetype) { if (msg_entity.cvar_cl_voice_directional >= 1) { - if(self.predator.classname == "player") - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } case VOICETYPE_PLAYERSOUND: - if(self.predator.classname == "player") - sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM); - else - sound(self, chan, sample, VOL_BASE, ATTN_NORM); + FOR_EACH_REALCLIENT(msg_entity) + { + vol_apply = vol; + vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM, pitch); + } break; case VOICETYPE_GURGLE: + // since players can't be prey and predators at the same time, we don't use the prey modifier for the gurgle sound volume if(self.stomach_load) - sound(self, chan, sample, VOL_BASE * self.stomach_load / cvar("g_balance_vore_swallow_limit"), ATTN_NORM); + sound7(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM, pitch, 0); else stopsound(self, chan); break; @@ -1361,7 +1373,7 @@ void PlayerSound(entity player, .string samplefield, float chan, float voicetype oldself = self; self = player; sample = self.samplefield; - GlobalSound(sample, chan, voicetype); + GlobalSound(sample, chan, voicetype, VOL_BASEVOICE); self = oldself; }