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
void() crawler_die1 =[ 0, crawler_die2] {SetZombieHitBox(CRAWLER_BBOX);self.frame = 37;};
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 ============================
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);
}
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 ret = false;

View file

@ -144,8 +144,8 @@ void() EndGameSetup =
NotifyGameEnd();
}
game_over = true;
addmoney(self, -self.points, 0);
addmoney(self, self.score, 0);
Player_RemoveScore(self, self.points);
Player_AddScore(self, self.score, false);
return;
}
@ -212,7 +212,8 @@ void() GetDown =
float point_difference;
point_difference = self.points;
point_difference -= 10*rint((self.points*0.95)/10);
addmoney(self, point_difference * -1, false);
Player_RemoveScore(self, point_difference);
self.requirespower = point_difference;
#ifdef FTE
@ -396,7 +397,7 @@ void () GetUp =
self.teslacount = 0;
if (!player_count) {
addmoney(self, self.requirespower, false);
Player_AddScore(self, self.requirespower, false);
}
Weapon_AssignWeapon(0, self.weaponbk, self.currentmagbk, self.currentammobk);
@ -427,40 +428,43 @@ void(entity attacker, float d_style) DieHandler =
if (attacker.classname == "player") {
attacker.kills++;
float points_earned = 0;
switch(d_style) {
case S_HEADSHOT:
addmoney(attacker, 100, true);
points_earned = 100;
attacker.headshots++;
break;
case S_KNIFE:
addmoney(attacker, 130, true);
points_earned = 130;
break;
case S_TESLA:
addmoney(attacker, 50, true);
points_earned = 50;
break;
case S_FLAME:
addmoney(attacker, 50, true);
points_earned = 50;
// override their death sound (FIXME: make a new sound..)
sound(self, CHAN_BODY, "sounds/pu/drop.wav", 1, ATTN_NORM);
break;
default:
addmoney(attacker, 60, true);
points_earned = 60;
break;
}
Player_AddScore(attacker, points_earned, true);
}
}
void(entity victim, entity attacker, float damage, float d_style) DamageHandler = {
// 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;
entity old_self;
if (victim.classname == "ai_zombie" || victim.classname == "ai_dog") {
if (attacker.classname == "player" && (victim.health - damage) > 0) {
addmoney(attacker, 10, 1);
Player_AddScore(attacker, 10, true);
}
victim.health = victim.health - damage;
@ -472,9 +476,9 @@ void(entity victim,entity attacker, float damage, float d_style) DamageHandler =
}
if (victim.health <= 0)
addmoney(attacker, 60, 1);
Player_AddScore(attacker, 60, true);
else
addmoney(attacker, 10, 1);
Player_AddScore(attacker, 10, true);
}
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.
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
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) {
old_self = self;
@ -639,11 +643,11 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
if (final_damage < other.health)
{
addmoney(self, 10, 0);
Player_AddScore(self, 10, false);
}
else if (final_damage > other.health)
{
addmoney(self, 60, 0);
Player_AddScore(self, 10, false);
}
else
{

View file

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

View file

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

View file

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

View file

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

View file

@ -300,7 +300,7 @@ void() touch_perk =
useprint(other, 9, price, self.sequence);
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"
sound(self, CHAN_ITEM,"sounds/machines/vend.wav", 1, 1);

View file

@ -94,7 +94,11 @@ void() radio_hit =
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");
// Backwards compatibility
@ -107,8 +111,8 @@ void() item_radio =
self.movetype = MOVETYPE_NONE; // so it doesn't get pushed by anything
self.solid=SOLID_BBOX;
self.classname = "item_radio";
setmodel (self, "models/props/radio.mdl");
setsize (self, '-8 -8 -4', '8 8 4');
setmodel (self, self.model);
setsize (self, self.mins, self.maxs);
self.takedamage = DAMAGE_YES;
self.health = 1;

View file

@ -437,7 +437,8 @@ void() MBOX_TeddyLeave =
void() MBOX_PresentTeddy =
{
// 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.
sound(self, CHAN_ITEM, "sounds/misc/buy.wav", 1, ATTN_NONE);
sound(self, 2, "sounds/misc/giggle.wav", 1, ATTN_NONE);
@ -510,7 +511,6 @@ void() Float_Change =
return;
}
else {
addmoney(self.owner.owner, mystery_box_cost, 0);
self.model = "models/props/teddy.mdl";
setmodel(self, self.model);
self.angles_y = self.angles_y - 90;
@ -688,7 +688,7 @@ void() MBOX_Touch =
if (other.points >= mystery_box_cost)
{
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.owner = other;
MBOX_PlayOpenAnimation();

View file

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

View file

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

View file

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

View file

@ -251,7 +251,7 @@ void zapper_touch () {
}
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();
}
/*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 =
{
self.classname = "trigger_atroundend";
@ -370,7 +378,7 @@ void() trigger_awardpoints_touch =
if (other.stance != PLAYER_STANCE_PRONE && (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_REQUIREPRONE))
return;
addmoney(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS));
Player_AddScore(other, self.points, (self.spawnflags & SPAWNFLAG_TRIGGERSCORE_APPLY2XPOINTS));
if (self.noise != "")
sound(self, 0, self.noise, 1, 1);

View file

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

View file

@ -62,7 +62,8 @@ void() Window_repaired =
if (maxreward > totalreward)
{
sound(self, 0,"sounds/misc/ching.wav", 1, ATTN_NORM);
addmoney(self.enemy, 10, 1);
Player_AddScore(self.enemy, 10, true);
totalreward = totalreward + 10;
}
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
// 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
if (!self.points)
addmoney(self, G_STARTPOINTS, 0);
Player_AddScore(self, G_STARTPOINTS, false);
self.weaponmodel = GetWeaponModel(self.weapon, 0);// Give weapon model
self.weapon2model = GetWeapon2Model(self.weapon);

View file

@ -28,6 +28,7 @@
*/
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.
float client_parse_override;
@ -84,7 +85,7 @@ float(string params) Command_addmoney =
}
// Assign points to the player.
addmoney(self, point_value, 0);
Player_ChangeScore(self, point_value, false);
return COMMAND_SUCCESS;
}

View file

@ -163,7 +163,6 @@ void() W_PrimeBetty =
// Prevent the Player from Sprinting and also avoid issues with
// the equipment being completely cancelled..
if (self.sprinting)
W_SprintStop();
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
if(arc_owner.classname == "player") {
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) ||
self.reload_delay > time ||
self.knife_delay > time ||
self.sprinting ||
self.new_anim_stop) {
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);
if (ads_frame != 0 && self.fire_delay < time) {
self.weaponframe_end = self.weaponframe = ads_frame;
@ -134,7 +143,7 @@ void() W_AimIn =
}
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
// the Zoom factor of one so it begins moving into position.
@ -167,23 +176,21 @@ void() W_AimOut =
void() W_SprintStop =
{
if (self.sprinting)
{
self.sprint_stop_time = time;
self.sprint_duration = self.sprint_timer;
}
if (self.isBuying || !self.sprinting)
return;
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.tp_anim_time = 0;
PAnim_Walk6(); // Run Walk for a few frames to simulate an ease in velocity
self.sprinting = 0;
self.into_sprint = 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
// already melee-ing, or doing some other action.
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;
// Perform the third person animation if standing
@ -1183,7 +1190,6 @@ void() WeaponCore_Melee =
W_HideCrosshair(self);
// Stop sprinting if we are
if (self.sprinting)
W_SprintStop();
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;
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
if (trace_ent.owner.head == trace_ent || trace_ent.owner.larm == trace_ent || trace_ent.owner.rarm == trace_ent)
trace_ent = trace_ent.owner;
@ -1268,7 +1274,7 @@ void() WeaponCore_Melee =
self.knife_delay = anim_duration + time;
// 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;
}
@ -1450,7 +1456,6 @@ void() W_Grenade =
// Prevent the Player from Sprinting and also avoid issues with
// the equipment being completely cancelled..
if (self.sprinting)
W_SprintStop();
W_HideCrosshair(self);
@ -1567,7 +1572,7 @@ void () Impulse_Functions =
break;
case 22:
if (cheats_have_been_activated) {
addmoney(self, 10000, 0);
Player_AddScore(self, 10000, true);
rounds += 4;
}
break;
@ -1668,6 +1673,8 @@ void() CheckPlayer =
CheckRevive(self);
if (self.sprinting) {
makevectors(self.angles);
// We should stop sprinting if we are falling, technically
// CoD continues the animation but applies a move speed
// penalty, however, that makes no sense! This also applies
@ -1680,6 +1687,11 @@ void() CheckPlayer =
// you're applying less pressure to the analog stick.
else if (vlen(self.velocity) <= 130 && self.sprint_delay <= time + 0.75)
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..
@ -1789,7 +1801,7 @@ void() CheckPlayer =
ent.beingrevived = true;
ent.firer = self;
if (!self.progress_bar_percent) {
if (!self.reviving) {
ChangeReviveIconState(ent.electro_targeted, 2);
self.movetype = MOVETYPE_TOSS;
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_percent = 0;
self.revived = 0;
addmoney(self, ent.requirespower, false);
Player_AddScore(self, ent.requirespower, false);
#ifdef FTE
@ -2117,6 +2129,15 @@ void() WeaponCore_MeleeButtonPressed =
if (self.semi_actions & SEMIACTION_MELEE)
return;
#ifdef FTE
// On FTE, we should resort to standard CoD
// behavior where pressing melee should cancel
// sprinting.
W_SprintStop();
#endif // FTE
WeaponCore_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
@ -1559,7 +1559,7 @@ vector GetWeaponADSOfs(float wep) =
return [-5295.9, 3206.9, -5000];
case W_KAR_SCOPE:
case W_HEADCRACKER:
return [-5286, 706.1, 0];
return [-5286, 706.1, -1500];
case W_THOMPSON:
case W_GIBS:
return [-6200.3, 3407.6, -800];
@ -1617,7 +1617,7 @@ vector GetWeaponADSOfs(float wep) =
return [-8000, 3020, -6500];
case W_PTRS:
case W_PENETRATOR:
return [-7200, 906.9, 0];
return [-7200, 906.9, -6500];
case W_PANZER:
case W_LONGINUS:
return [-7679.2, 2900, -20000];