Merge branch 'main' into workflow_cleanup

This commit is contained in:
cypress 2024-06-16 08:38:05 -07:00
commit 25d109cc8b
23 changed files with 144 additions and 89 deletions

View file

@ -150,7 +150,7 @@ void() crawler_da10 =[ 9, crawler_da1 ] {crawler_attack_choose(0); self.frame
//37-39 //37-39
void() crawler_die1 =[ 0, crawler_die2] {SetZombieHitBox(CRAWLER_BBOX);self.frame = 37;}; void() crawler_die1 =[ 0, crawler_die2] {SetZombieHitBox(CRAWLER_BBOX);self.frame = 37;};
void() crawler_die2 =[ 1, crawler_die3] {self.frame = 38;}; void() crawler_die2 =[ 1, crawler_die3] {self.frame = 38;};
void() crawler_die3 =[ 2, SUB_Null] {self.iszomb = 0; self.frame = 39;self.nextthink = time + 3;self.think = removeZombie; addmoney(other, 60, true); if (crawler_num > 0) {crawler_num = crawler_num - 1;}}; void() crawler_die3 =[ 2, SUB_Null] {self.iszomb = 0; self.frame = 39;self.nextthink = time + 3;self.think = removeZombie; if (crawler_num > 0) {crawler_num = crawler_num - 1;}};
//====================== Crawler Tesla Death ============================ //====================== Crawler Tesla Death ============================
void() crawler_death_wunder1 =[ 72, crawler_death_wunder2 ] {tesla_arc(); play_sound_z(4); }; void() crawler_death_wunder1 =[ 72, crawler_death_wunder2 ] {tesla_arc(); play_sound_z(4); };

View file

@ -596,23 +596,6 @@ float() crandom =
return 2*(random() - 0.5); return 2*(random() - 0.5);
} }
void(entity person, float expamt, float doublepoint) addmoney =
{
if (person.classname != "player" || person.downed)
return;
if (expamt > 0 && doublepoint == TRUE && x2_finished > time) {
expamt *= 2;
person.score += expamt;
}
// Combine the positive score with the powerup score tally
if (expamt > 0)
total_powerup_points += expamt;
person.points += expamt;
};
float(entity them, entity me) PlayerIsLooking = float(entity them, entity me) PlayerIsLooking =
{ {
float ret = false; float ret = false;

View file

@ -144,8 +144,8 @@ void() EndGameSetup =
NotifyGameEnd(); NotifyGameEnd();
} }
game_over = true; game_over = true;
addmoney(self, -self.points, 0); Player_RemoveScore(self, self.points);
addmoney(self, self.score, 0); Player_AddScore(self, self.score, false);
return; return;
} }
@ -212,7 +212,8 @@ void() GetDown =
float point_difference; float point_difference;
point_difference = self.points; point_difference = self.points;
point_difference -= 10*rint((self.points*0.95)/10); point_difference -= 10*rint((self.points*0.95)/10);
addmoney(self, point_difference * -1, false); Player_RemoveScore(self, point_difference);
self.requirespower = point_difference; self.requirespower = point_difference;
#ifdef FTE #ifdef FTE
@ -396,7 +397,7 @@ void () GetUp =
self.teslacount = 0; self.teslacount = 0;
if (!player_count) { if (!player_count) {
addmoney(self, self.requirespower, false); Player_AddScore(self, self.requirespower, false);
} }
Weapon_AssignWeapon(0, self.weaponbk, self.currentmagbk, self.currentammobk); Weapon_AssignWeapon(0, self.weaponbk, self.currentmagbk, self.currentammobk);
@ -427,40 +428,43 @@ void(entity attacker, float d_style) DieHandler =
if (attacker.classname == "player") { if (attacker.classname == "player") {
attacker.kills++; attacker.kills++;
float points_earned = 0;
switch(d_style) { switch(d_style) {
case S_HEADSHOT: case S_HEADSHOT:
addmoney(attacker, 100, true); points_earned = 100;
attacker.headshots++; attacker.headshots++;
break; break;
case S_KNIFE: case S_KNIFE:
addmoney(attacker, 130, true); points_earned = 130;
break; break;
case S_TESLA: case S_TESLA:
addmoney(attacker, 50, true); points_earned = 50;
break; break;
case S_FLAME: case S_FLAME:
addmoney(attacker, 50, true); points_earned = 50;
// override their death sound (FIXME: make a new sound..) // override their death sound (FIXME: make a new sound..)
sound(self, CHAN_BODY, "sounds/pu/drop.wav", 1, ATTN_NORM); sound(self, CHAN_BODY, "sounds/pu/drop.wav", 1, ATTN_NORM);
break; break;
default: default:
addmoney(attacker, 60, true); points_earned = 60;
break; break;
} }
Player_AddScore(attacker, points_earned, true);
} }
} }
void(entity victim,entity attacker, float damage, float d_style) DamageHandler = { void(entity victim, entity attacker, float damage, float d_style) DamageHandler = {
// don't do any attacking during nuke delay // don't do any attacking during nuke delay
if (d_style == S_ZOMBIE && nuke_powerup_active > time) if (d_style == S_NORMAL && nuke_powerup_active > time)
return; return;
entity old_self; entity old_self;
if (victim.classname == "ai_zombie" || victim.classname == "ai_dog") { if (victim.classname == "ai_zombie" || victim.classname == "ai_dog") {
if (attacker.classname == "player" && (victim.health - damage)> 0) { if (attacker.classname == "player" && (victim.health - damage) > 0) {
addmoney(attacker, 10, 1); Player_AddScore(attacker, 10, true);
} }
victim.health = victim.health - damage; victim.health = victim.health - damage;
@ -472,9 +476,9 @@ void(entity victim,entity attacker, float damage, float d_style) DamageHandler =
} }
if (victim.health <= 0) if (victim.health <= 0)
addmoney(attacker, 60, 1); Player_AddScore(attacker, 60, true);
else else
addmoney(attacker, 10, 1); Player_AddScore(attacker, 10, true);
} }
if (victim.health <= 0 || instakill_finished > time) { if (victim.health <= 0 || instakill_finished > time) {
@ -525,9 +529,9 @@ void(entity victim,entity attacker, float damage, float d_style) DamageHandler =
// Play pain noise if this isn't done by an electric barrier. // Play pain noise if this isn't done by an electric barrier.
if (d_style != S_ZAPPER) if (d_style != S_ZAPPER)
sound (self, CHAN_AUTO, "sounds/player/pain4.wav", 1, ATTN_NORM); sound (victim, CHAN_AUTO, "sounds/player/pain4.wav", 1, ATTN_NORM);
else else
sound (self, CHAN_AUTO, "sounds/machines/elec_shock.wav", 1, ATTN_NORM); sound (victim, CHAN_AUTO, "sounds/machines/elec_shock.wav", 1, ATTN_NORM);
if (victim.sprinting) { if (victim.sprinting) {
old_self = self; old_self = self;
@ -639,11 +643,11 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
if (final_damage < other.health) if (final_damage < other.health)
{ {
addmoney(self, 10, 0); Player_AddScore(self, 10, false);
} }
else if (final_damage > other.health) else if (final_damage > other.health)
{ {
addmoney(self, 60, 0); Player_AddScore(self, 10, false);
} }
else else
{ {

View file

@ -97,7 +97,6 @@ entity local_client;
.float points; .float points;
.float cost; .float cost;
.float cost2; .float cost2;
void(entity person, float expamt , float doublepoint) addmoney;
//stats //stats
.float score; .float score;

View file

@ -26,7 +26,6 @@
*/ */
// Triggers // Triggers
void() trigger_relay = {remove(self);};
void() trigger_changelevel = {remove(self);}; void() trigger_changelevel = {remove(self);};
void() trigger_counter = {remove(self);}; void() trigger_counter = {remove(self);};
void() trigger_secret = {remove(self);}; void() trigger_secret = {remove(self);};

View file

@ -287,7 +287,7 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
default: default:
break; break;
} }
addmoney(other, self.cost*-1, 0); Player_RemoveScore(other, self.cost);
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
} }
else else

View file

@ -343,7 +343,7 @@ void() button_touch =
other.semi_actions |= SEMIACTION_USE; other.semi_actions |= SEMIACTION_USE;
if(other.points >= self.cost) { if(other.points >= self.cost) {
self.enemy = other; self.enemy = other;
addmoney(other, 0 - self.cost, FALSE); Player_RemoveScore(other, self.cost);
button_fire(); button_fire();
return; return;
@ -421,7 +421,7 @@ void() touch_ending =
if (other.points < self.cost) if (other.points < self.cost)
return; return;
addmoney(other, -self.cost, 0); Player_RemoveScore(other, self.cost);
entity tempe; entity tempe;
entity players = find(world, classname, "player"); entity players = find(world, classname, "player");

View file

@ -300,7 +300,7 @@ void() touch_perk =
useprint(other, 9, price, self.sequence); useprint(other, 9, price, self.sequence);
if (other.points >= price && other.button7 && !(other.semi_actions & SEMIACTION_USE)) { if (other.points >= price && other.button7 && !(other.semi_actions & SEMIACTION_USE)) {
addmoney(other, -price, 0); Player_RemoveScore(other, price);
// Play the sound of the bottle "vending" // Play the sound of the bottle "vending"
sound(self, CHAN_ITEM,"sounds/machines/vend.wav", 1, 1); sound(self, CHAN_ITEM,"sounds/machines/vend.wav", 1, 1);

View file

@ -94,7 +94,11 @@ void() radio_hit =
void() item_radio = void() item_radio =
{ {
precache_model ("models/props/radio.mdl"); if (!self.model) self.model = "models/props/radio.mdl";
if (!self.mins) self.mins = '-8 -8 -4';
if (!self.maxs) self.maxs = '8 8 4';
precache_model (self.model);
precache_sound ("sounds/misc/radio.wav"); precache_sound ("sounds/misc/radio.wav");
// Backwards compatibility // Backwards compatibility
@ -107,8 +111,8 @@ void() item_radio =
self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything
self.solid=SOLID_BBOX; self.solid=SOLID_BBOX;
self.classname = "item_radio"; self.classname = "item_radio";
setmodel (self, "models/props/radio.mdl"); setmodel (self, self.model);
setsize (self, '-8 -8 -4', '8 8 4'); setsize (self, self.mins, self.maxs);
self.takedamage = DAMAGE_YES; self.takedamage = DAMAGE_YES;
self.health = 1; self.health = 1;

View file

@ -437,7 +437,8 @@ void() MBOX_TeddyLeave =
void() MBOX_PresentTeddy = void() MBOX_PresentTeddy =
{ {
// Return the Player's points. // Return the Player's points.
addmoney(self.owner.owner, mystery_box_cost, 0); Player_AddScore(self.owner.owner, mystery_box_cost, false);
// Broadcast the bad luck. // Broadcast the bad luck.
sound(self, CHAN_ITEM, "sounds/misc/buy.wav", 1, ATTN_NONE); sound(self, CHAN_ITEM, "sounds/misc/buy.wav", 1, ATTN_NONE);
sound(self, 2, "sounds/misc/giggle.wav", 1, ATTN_NONE); sound(self, 2, "sounds/misc/giggle.wav", 1, ATTN_NONE);
@ -510,7 +511,6 @@ void() Float_Change =
return; return;
} }
else { else {
addmoney(self.owner.owner, mystery_box_cost, 0);
self.model = "models/props/teddy.mdl"; self.model = "models/props/teddy.mdl";
setmodel(self, self.model); setmodel(self, self.model);
self.angles_y = self.angles_y - 90; self.angles_y = self.angles_y - 90;
@ -688,7 +688,7 @@ void() MBOX_Touch =
if (other.points >= mystery_box_cost) if (other.points >= mystery_box_cost)
{ {
sound (self, CHAN_ITEM, mystery_box_open_sound, 1, ATTN_NORM); sound (self, CHAN_ITEM, mystery_box_open_sound, 1, ATTN_NORM);
addmoney(other, -mystery_box_cost, FALSE); Player_RemoveScore(other, mystery_box_cost);
self.boxstatus = 1; self.boxstatus = 1;
self.owner = other; self.owner = other;
MBOX_PlayOpenAnimation(); MBOX_PlayOpenAnimation();

View file

@ -172,7 +172,8 @@ void(entity pap, entity buyer) PAP_UpgradeWeapon =
tempe = self; tempe = self;
self = buyer; self = buyer;
addmoney (self, -pap.cost, 0);
Player_RemoveScore(self, pap.cost);
// Spawn Upgrade Spark if permitted // Spawn Upgrade Spark if permitted
if (!(pap.spawnflags & PAP_SPAWNFLAG_NOSPARK)) if (!(pap.spawnflags & PAP_SPAWNFLAG_NOSPARK))

View file

@ -250,7 +250,7 @@ void() PU_NukeFinalize =
players = find(world,classname,"player"); players = find(world,classname,"player");
while(players) while(players)
{ {
addmoney(players, 400*nuke_powerups_activated, 1); Player_AddScore(players, 400 * nuke_powerups_activated, true);
players = find(players,classname,"player"); players = find(players,classname,"player");
} }
@ -390,7 +390,7 @@ void() PU_CarpenterFinalize =
// Reward Players with Points // Reward Players with Points
while(players) { while(players) {
addmoney(players, 200, 1); Player_AddScore(players, 200, true);
players = find(players, classname, "player"); players = find(players, classname, "player");
} }

View file

@ -285,7 +285,7 @@ void() teleport_touch =
return; return;
} }
addmoney(other, -self.cost, 0); Player_RemoveScore(other, self.cost);
SUB_UseTargets(); SUB_UseTargets();

View file

@ -251,7 +251,7 @@ void zapper_touch () {
} }
zapper_start(self.zappername); zapper_start(self.zappername);
addmoney(other, -1*self.cost, false); Player_RemoveScore(other, self.cost);
} }
} }

View file

@ -321,6 +321,14 @@ void() trigger_once =
trigger_multiple(); trigger_multiple();
} }
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
void() trigger_relay =
{
self.use = SUB_UseTargets;
};
void() trigger_atroundend = void() trigger_atroundend =
{ {
self.classname = "trigger_atroundend"; self.classname = "trigger_atroundend";
@ -370,7 +378,7 @@ void() trigger_awardpoints_touch =
if (other.stance != PLAYER_STANCE_PRONE && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIREPRONE)) if (other.stance != PLAYER_STANCE_PRONE && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIREPRONE))
return; return;
addmoney(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS)); Player_AddScore(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS));
if (self.noise != "") if (self.noise != "")
sound(self, 0, self.noise, 1, 1); sound(self, 0, self.noise, 1, 1);

View file

@ -199,7 +199,7 @@ void () WallWeapon_TouchTrigger =
other.reload_delay = 0; other.reload_delay = 0;
// Subtract the cost from player points. // Subtract the cost from player points.
addmoney(other, wcost*-1, 0); Player_RemoveScore(other, wcost);
if (self.enemy) { if (self.enemy) {
oldent = self; oldent = self;
@ -244,7 +244,7 @@ void () WallWeapon_TouchTrigger =
other.reload_delay = 0; other.reload_delay = 0;
// Subtract the cost from player points. // Subtract the cost from player points.
addmoney(other, wcost*-1, 0); Player_RemoveScore(other, wcost);
if (self.enemy) { if (self.enemy) {
oldent = self; oldent = self;
@ -276,7 +276,7 @@ void () WallWeapon_TouchTrigger =
other.reload_delay = 0; other.reload_delay = 0;
sound(other, 0, "sounds/misc/ching.wav", 1, 1); sound(other, 0, "sounds/misc/ching.wav", 1, 1);
//other.boughtweapon = true; //other.boughtweapon = true;
addmoney(other, 0 - self.cost2, FALSE); Player_RemoveScore(other, self.cost2);
other.grenades = other.grenades | 2; other.grenades = other.grenades | 2;
other.secondary_grenades = 2; other.secondary_grenades = 2;
nzp_bettyprompt(other); nzp_bettyprompt(other);
@ -311,7 +311,7 @@ void () WallWeapon_TouchTrigger =
other.reload_delay = 0; other.reload_delay = 0;
sound(other, 0, "sounds/misc/ching.wav", 1, 1); sound(other, 0, "sounds/misc/ching.wav", 1, 1);
//other.boughtweapon = true; //other.boughtweapon = true;
addmoney(other, 0 - self.cost, FALSE); Player_RemoveScore(other, self.cost);
other.primary_grenades = 4; other.primary_grenades = 4;
if (self.enemy) if (self.enemy)
{ {
@ -336,7 +336,7 @@ void () WallWeapon_TouchTrigger =
return; return;
} else { } else {
W_HideCrosshair(other); W_HideCrosshair(other);
addmoney(other, -self.cost2, FALSE); Player_RemoveScore(other, self.cost2);
sound(other, 0, "sounds/misc/ching.wav", 1, 1); sound(other, 0, "sounds/misc/ching.wav", 1, 1);
other.ach_tracker_coll++; other.ach_tracker_coll++;
if (self.enemy) if (self.enemy)
@ -376,7 +376,7 @@ void () WallWeapon_TouchTrigger =
sound(other, 0, "sounds/misc/ching.wav", 1, 1); sound(other, 0, "sounds/misc/ching.wav", 1, 1);
other.reload_delay = 0; other.reload_delay = 0;
addmoney(other, -1*self.cost, 0); Player_RemoveScore(other, self.cost);
if (self.enemy) { if (self.enemy) {
oldent = self; oldent = self;
self = self.enemy; self = self.enemy;

View file

@ -62,7 +62,8 @@ void() Window_repaired =
if (maxreward > totalreward) if (maxreward > totalreward)
{ {
sound(self, 0,"sounds/misc/ching.wav", 1, ATTN_NORM); sound(self, 0,"sounds/misc/ching.wav", 1, ATTN_NORM);
addmoney(self.enemy, 10, 1); Player_AddScore(self.enemy, 10, true);
totalreward = totalreward + 10; totalreward = totalreward + 10;
} }
screen_shake(); screen_shake();

View file

@ -261,6 +261,41 @@ float(float dir) checkMovement =
} }
} }
#define Player_RemoveScore(who, value) Player_ChangeScore(who, -value, false)
#define Player_AddScore(who, value, impacted_by_2x_points) Player_ChangeScore(who, value, impacted_by_2x_points)
//
// Player_ChangeScore(who, value, impacted_by_2x_points)
// Appends the given value to the provided clients
// current score, potentially multiplied if the
// Double Points Power-Up is active.
//
void(entity who, float value, float impacted_by_2x_points) Player_ChangeScore =
{
// We shouldn't ever allow a player in Last Stand to have
// their score modified.
if (who.downed)
return;
// Multiply the value if it is to be impacted by Double
// Points
if (impacted_by_2x_points && x2_finished > time)
value *= 2;
// The value was positive, so we should do two things:
// 1. add this to our point threshold check for Power-Up
// spawning.
// 2. add the value to our total score, which is displayed
// at the end of the game to rank every player.
if (value > 0) {
who.score += value;
total_powerup_points += value;
}
// Append the value to our current score.
who.points += value;
};
// //
// Player_CanStandHere // Player_CanStandHere
// Performs a tracebox and will return true // Performs a tracebox and will return true
@ -874,7 +909,7 @@ void() PlayerSpawn =
self.secondary_grenades = -1; // shows that we both don't have betties AND shouldn't draw the image onscreen self.secondary_grenades = -1; // shows that we both don't have betties AND shouldn't draw the image onscreen
if (!self.points) if (!self.points)
addmoney(self, G_STARTPOINTS, 0); Player_AddScore(self, G_STARTPOINTS, false);
self.weaponmodel = GetWeaponModel(self.weapon, 0);// Give weapon model self.weaponmodel = GetWeaponModel(self.weapon, 0);// Give weapon model
self.weapon2model = GetWeapon2Model(self.weapon); self.weapon2model = GetWeapon2Model(self.weapon);

View file

@ -28,6 +28,7 @@
*/ */
void(vector where, float type) Spawn_Powerup; void(vector where, float type) Spawn_Powerup;
void(entity who, float value, float impacted_by_2x_points) Player_ChangeScore;
// Whether the command prohibits client-sending. // Whether the command prohibits client-sending.
float client_parse_override; float client_parse_override;
@ -84,7 +85,7 @@ float(string params) Command_addmoney =
} }
// Assign points to the player. // Assign points to the player.
addmoney(self, point_value, 0); Player_ChangeScore(self, point_value, false);
return COMMAND_SUCCESS; return COMMAND_SUCCESS;
} }

View file

@ -163,7 +163,6 @@ void() W_PrimeBetty =
// Prevent the Player from Sprinting and also avoid issues with // Prevent the Player from Sprinting and also avoid issues with
// the equipment being completely cancelled.. // the equipment being completely cancelled..
if (self.sprinting)
W_SprintStop(); W_SprintStop();
W_HideCrosshair(self); W_HideCrosshair(self);

View file

@ -85,7 +85,7 @@ void(entity hit_ent, entity arc_parent, entity arc_owner, float arc_num, float d
// 50 points for waffe kills // 50 points for waffe kills
if(arc_owner.classname == "player") { if(arc_owner.classname == "player") {
arc_owner.kills += 1; arc_owner.kills += 1;
addmoney(arc_owner, 50, true); Player_AddScore(arc_owner, 50, true);
} }
} }

View file

@ -121,11 +121,20 @@ void() W_AimIn =
if (IsDualWeapon(self.weapon) || if (IsDualWeapon(self.weapon) ||
self.reload_delay > time || self.reload_delay > time ||
self.knife_delay > time || self.knife_delay > time ||
self.sprinting ||
self.new_anim_stop) { self.new_anim_stop) {
return; return;
} }
if (self.sprinting) {
W_SprintStop();
// FIXME: When we eventually allow custom delay values
// for every weapon animation, this hardcoded frame
// timer can be removed.
float sprint_fire_delay = fabs(GetFrame(self.weapon, SPRINT_OUT_END) - GetFrame(self.weapon, SPRINT_OUT_START))/10;
self.fire_delay = self.fire_delay2 = time + sprint_fire_delay;
}
float ads_frame = GetFrame(self.weapon, AIM_IN); float ads_frame = GetFrame(self.weapon, AIM_IN);
if (ads_frame != 0 && self.fire_delay < time) { if (ads_frame != 0 && self.fire_delay < time) {
self.weaponframe_end = self.weaponframe = ads_frame; self.weaponframe_end = self.weaponframe = ads_frame;
@ -134,7 +143,7 @@ void() W_AimIn =
} }
if (WepDef_HasSniperScore(self.weapon)) if (WepDef_HasSniperScore(self.weapon))
self.scopetime = time + 0.3; self.scopetime = time + 0.2;
// Even if the weapon is scoped, we should still initialize // Even if the weapon is scoped, we should still initialize
// the Zoom factor of one so it begins moving into position. // the Zoom factor of one so it begins moving into position.
@ -167,23 +176,21 @@ void() W_AimOut =
void() W_SprintStop = void() W_SprintStop =
{ {
if (self.sprinting)
{
self.sprint_stop_time = time;
self.sprint_duration = self.sprint_timer;
}
if (self.isBuying || !self.sprinting) if (self.isBuying || !self.sprinting)
return; return;
Weapon_PlayViewModelAnimation(ANIM_SPRINT_STOP, ReturnWeaponModel, 0); Weapon_PlayViewModelAnimation(ANIM_SPRINT_STOP, ReturnWeaponModel, 0);
// Run Walk for a few frames to simulate an ease in velocity
PAnim_Walk6();
self.zoom = 0; self.zoom = 0;
self.tp_anim_time = 0; self.tp_anim_time = 0;
PAnim_Walk6(); // Run Walk for a few frames to simulate an ease in velocity
self.sprinting = 0; self.sprinting = 0;
self.into_sprint = 0; self.into_sprint = 0;
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0; self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
self.sprint_stop_time = time;
self.sprint_duration = self.sprint_timer;
} }
@ -1172,7 +1179,7 @@ void() WeaponCore_Melee =
// Do not trigger if we're Aiming down the Sight, or // Do not trigger if we're Aiming down the Sight, or
// already melee-ing, or doing some other action. // already melee-ing, or doing some other action.
if (self.knife_delay > time || self.new_anim_stop || if (self.knife_delay > time || self.new_anim_stop ||
self.new_anim2_stop || self.zoom || !(self.flags & FL_ONGROUND)) self.new_anim2_stop || self.zoom)
return; return;
// Perform the third person animation if standing // Perform the third person animation if standing
@ -1183,7 +1190,6 @@ void() WeaponCore_Melee =
W_HideCrosshair(self); W_HideCrosshair(self);
// Stop sprinting if we are // Stop sprinting if we are
if (self.sprinting)
W_SprintStop(); W_SprintStop();
vector applied_velocity = '0 0 0'; // The lunge velocity we intend to apply to the player. vector applied_velocity = '0 0 0'; // The lunge velocity we intend to apply to the player.
@ -1195,7 +1201,7 @@ void() WeaponCore_Melee =
vector trace_source = self.origin + self.view_ofs; vector trace_source = self.origin + self.view_ofs;
traceline(trace_source, trace_source + v_forward * melee_range, 0, self); traceline(trace_source, trace_source + v_forward * melee_range, 0, self);
if (fabs(trace_endpos_z - trace_source_z) <= 15) { if (trace_endpos_z - trace_source_z <= 15) {
// Check if this is a Zombie limb, set to the body if so // Check if this is a Zombie limb, set to the body if so
if (trace_ent.owner.head == trace_ent || trace_ent.owner.larm == trace_ent || trace_ent.owner.rarm == trace_ent) if (trace_ent.owner.head == trace_ent || trace_ent.owner.larm == trace_ent || trace_ent.owner.rarm == trace_ent)
trace_ent = trace_ent.owner; trace_ent = trace_ent.owner;
@ -1268,7 +1274,7 @@ void() WeaponCore_Melee =
self.knife_delay = anim_duration + time; self.knife_delay = anim_duration + time;
// Now apply the lunge velocity, but only if we're Standing. // Now apply the lunge velocity, but only if we're Standing.
if (self.stance == PLAYER_STANCE_STAND) if (self.stance == PLAYER_STANCE_STAND && did_lunge)
self.velocity = applied_velocity; self.velocity = applied_velocity;
} }
@ -1450,7 +1456,6 @@ void() W_Grenade =
// Prevent the Player from Sprinting and also avoid issues with // Prevent the Player from Sprinting and also avoid issues with
// the equipment being completely cancelled.. // the equipment being completely cancelled..
if (self.sprinting)
W_SprintStop(); W_SprintStop();
W_HideCrosshair(self); W_HideCrosshair(self);
@ -1567,7 +1572,7 @@ void () Impulse_Functions =
break; break;
case 22: case 22:
if (cheats_have_been_activated) { if (cheats_have_been_activated) {
addmoney(self, 10000, 0); Player_AddScore(self, 10000, true);
rounds += 4; rounds += 4;
} }
break; break;
@ -1668,6 +1673,8 @@ void() CheckPlayer =
CheckRevive(self); CheckRevive(self);
if (self.sprinting) { if (self.sprinting) {
makevectors(self.angles);
// We should stop sprinting if we are falling, technically // We should stop sprinting if we are falling, technically
// CoD continues the animation but applies a move speed // CoD continues the animation but applies a move speed
// penalty, however, that makes no sense! This also applies // penalty, however, that makes no sense! This also applies
@ -1680,6 +1687,11 @@ void() CheckPlayer =
// you're applying less pressure to the analog stick. // you're applying less pressure to the analog stick.
else if (vlen(self.velocity) <= 130 && self.sprint_delay <= time + 0.75) else if (vlen(self.velocity) <= 130 && self.sprint_delay <= time + 0.75)
W_SprintStop(); W_SprintStop();
// Another sprinting caveat -- if we are moving a considerabe distance
// horizontally, much more than reasonable, it is very obviously impossible
// to actually sprint.
else if (fabs(self.velocity * v_right) >= fabs(self.velocity * v_forward) * 0.75)
W_SprintStop();
} }
// FIXME - can't do frame independent stance changing.. ofs starts spazzing.. // FIXME - can't do frame independent stance changing.. ofs starts spazzing..
@ -1789,7 +1801,7 @@ void() CheckPlayer =
ent.beingrevived = true; ent.beingrevived = true;
ent.firer = self; ent.firer = self;
if (!self.progress_bar_percent) { if (!self.reviving) {
ChangeReviveIconState(ent.electro_targeted, 2); ChangeReviveIconState(ent.electro_targeted, 2);
self.movetype = MOVETYPE_TOSS; self.movetype = MOVETYPE_TOSS;
Set_W_Frame (0, 21, 0, 0, SPRINT, SUB_Null, "models/weapons/morphine/v_morphine.mdl", false, S_RIGHT); Set_W_Frame (0, 21, 0, 0, SPRINT, SUB_Null, "models/weapons/morphine/v_morphine.mdl", false, S_RIGHT);
@ -1815,7 +1827,7 @@ void() CheckPlayer =
self.progress_bar_time = 0; self.progress_bar_time = 0;
self.progress_bar_percent = 0; self.progress_bar_percent = 0;
self.revived = 0; self.revived = 0;
addmoney(self, ent.requirespower, false); Player_AddScore(self, ent.requirespower, false);
#ifdef FTE #ifdef FTE
@ -2117,6 +2129,15 @@ void() WeaponCore_MeleeButtonPressed =
if (self.semi_actions & SEMIACTION_MELEE) if (self.semi_actions & SEMIACTION_MELEE)
return; return;
#ifdef FTE
// On FTE, we should resort to standard CoD
// behavior where pressing melee should cancel
// sprinting.
W_SprintStop();
#endif // FTE
WeaponCore_Melee(); WeaponCore_Melee();
self.semi_actions |= SEMIACTION_MELEE; self.semi_actions |= SEMIACTION_MELEE;
}; };

View file

@ -1537,7 +1537,7 @@ float GetWeaponWalkSpeed(float perks, float weapon)
/* /*
=========================== ===========================
Weapon PSP ADS Declarations Weapon ADS Declarations
=========================== ===========================
*/ */
// x: left/right // x: left/right
@ -1559,7 +1559,7 @@ vector GetWeaponADSOfs(float wep) =
return [-5295.9, 3206.9, -5000]; return [-5295.9, 3206.9, -5000];
case W_KAR_SCOPE: case W_KAR_SCOPE:
case W_HEADCRACKER: case W_HEADCRACKER:
return [-5286, 706.1, 0]; return [-5286, 706.1, -1500];
case W_THOMPSON: case W_THOMPSON:
case W_GIBS: case W_GIBS:
return [-6200.3, 3407.6, -800]; return [-6200.3, 3407.6, -800];
@ -1617,7 +1617,7 @@ vector GetWeaponADSOfs(float wep) =
return [-8000, 3020, -6500]; return [-8000, 3020, -6500];
case W_PTRS: case W_PTRS:
case W_PENETRATOR: case W_PENETRATOR:
return [-7200, 906.9, 0]; return [-7200, 906.9, -6500];
case W_PANZER: case W_PANZER:
case W_LONGINUS: case W_LONGINUS:
return [-7679.2, 2900, -20000]; return [-7679.2, 2900, -20000];