Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Tyler Young 2023-11-28 23:07:37 -05:00
commit 1ca3f90906
13 changed files with 150 additions and 37 deletions

View file

@ -86,7 +86,7 @@ const float MENU_AUDSETTINGS = 16384;
const float MENU_CREATE = 32768;
float matchmake_enabled;
float double_tap_version;
float useprint_type;
float useprint_weapon;

View file

@ -1055,12 +1055,20 @@ void(float width, float height) HUD_Perks =
if (cvar("vid_ultrawide_limiter"))
x += ULTRAWIDE_OFFSET;
// Double-Tap can have 2 icons depending on
// machine-specified version.
string double_tap_icon;
if (double_tap_version == 1) // damage buffed
double_tap_icon = "gfx/hud/double2.tga";
else // just rof
double_tap_icon = "gfx/hud/double.tga";
// Draw second column first -- these need to be
// overlayed below the first column.
for (float i = 4; i < 8; i++) {
if (perk_order[i]) {
if (perk_order[i] == P_JUG) {drawpic([x, y], "gfx/hud/jug.tga", [scale, scale], [1,1,1], 1);}
if (perk_order[i] == P_DOUBLE) {drawpic([x, y], "gfx/hud/double.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_DOUBLE) {drawpic([x, y], double_tap_icon, [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_SPEED) {drawpic([x, y], "gfx/hud/speed.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_REVIVE) {drawpic([x, y], "gfx/hud/revive.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_FLOP) {drawpic([x, y], "gfx/hud/flopper.tga", [scale, scale, 1], [1,1,1], 1);}
@ -1081,7 +1089,7 @@ void(float width, float height) HUD_Perks =
for (float i = 0; i < 4; i++) {
if (perk_order[i]) {
if (perk_order[i] == P_JUG) {drawpic([x, y], "gfx/hud/jug.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_DOUBLE) {drawpic([x, y], "gfx/hud/double.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_DOUBLE) {drawpic([x, y], double_tap_icon, [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_SPEED) {drawpic([x, y], "gfx/hud/speed.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_REVIVE) {drawpic([x, y], "gfx/hud/revive.tga", [scale, scale, 1], [1,1,1], 1);}
if (perk_order[i] == P_FLOP) {drawpic([x, y], "gfx/hud/flopper.tga", [scale, scale, 1], [1,1,1], 1);}

View file

@ -1476,6 +1476,9 @@ noref void() CSQC_Parse_Event =
UpdatePerks(newperks);
break;
case EVENT_DOUBLETAPUPDATE:
double_tap_version = readbyte();
break;
case EVENT_UPDATE:
float updatetype = readbyte();
float var_1 = readbyte();

View file

@ -532,28 +532,82 @@ void(float dist) Window_Hop =
}
}
//
// FTE's custom "tracemove" -- no way in hell I'm reimplementing SV_Move
// in QuakeC. So this is just a really bad traceline hack. We can't even
// use tracebox since that's limited by BSP hulls,
//
#ifdef FTE
inline float(vector start, vector min, vector max, vector end, float nomonsters, entity forent) tracemove =
#else
float(vector start, vector min, vector max, vector end, float nomonsters, entity forent) tracemove_fake =
#endif // FTE
{
makevectors(forent.angles);
// Top left of the box
traceline(start + '0 0 32' + v_right * -18, end, nomonsters, forent);
// Results Check
if (trace_ent != forent && trace_endpos != end)
return 0;
// Top right of the box
traceline(start + '0 0 32' + v_right * 18, end, nomonsters, forent);
// Results Check
if (trace_ent != forent && trace_endpos != end)
return 0;
// Bottom left of the box
traceline(start - '0 0 24' + v_right * -18, end, nomonsters, forent);
// Results Check
if (trace_ent != forent && trace_endpos != end)
return 0;
// Bottom right of the box
traceline(start - '0 0 24' + v_right * 18, end, nomonsters, forent);
// Results Check
if (trace_ent != forent && trace_endpos != end)
return 0;
return 1;
}
float() TryWalkToEnemy =
{
// TryWalkToEnemy attempts to see if a Zombie can ignore waypoints
// and just charge straight towards its enemy. Originally, this was
// pretty broken and limited. If it could draw a line from its origin
// to the player's, it'd walk right towards it. This was an issue if
// only the zombies's torso was exposed but not the head (meaning it
// could not fit in a walkable space). It now performs both a head
// trace and a foot trace. It also makes sure the Z (up/down) axis
// between the two entities are in close proximity to avoid neglecting
// staircases. -- cypress (30 Oct 2023)
float TraceResultHead, TraceResultFeet;
TraceResultHead = tracemove(self.origin + '0 0 32',VEC_HULL_MIN,VEC_HULL_MAX,self.enemy.origin,TRUE,self);
TraceResultFeet = tracemove(self.origin - '0 0 24',VEC_HULL_MIN,VEC_HULL_MAX,self.enemy.origin,TRUE,self);
// Early out hack for FTE -- if there's tons of z-diff, GTFO!
float z_axis_diff = fabs(self.origin_z - self.enemy.origin_z);
if(TraceResultHead == 1 && TraceResultFeet == 1 && z_axis_diff <= 30) {
if (z_axis_diff >= 30)
return 0;
// This has been a headache...
// TryWalkToEnemy is a system that attempts to ignore waypoints from a
// certain distance to simulate proper player-targeting. It does this
// using the custom builtin tracemove, which calls SV_Move to determine
// if it's possible for the enemy to walk directly to the target. This
// is problematic, however -- in that FTE does not feature this builtin
// since it's non-standard and was written by blubs. This means there
// needs to be improvisation, and as a result there is disparity here.
// See the custom tracemove() function for details on that.
// -- cypress (28 Nov 2023)
#ifdef FTE
float TraceResult = tracemove(self.origin, VEC_HULL_MIN, VEC_HULL_MAX, self.enemy.origin, TRUE, self);
#else
float TraceResult = tracemove_fake(self.origin, VEC_HULL_MIN, VEC_HULL_MAX, self.enemy.origin, TRUE, self);
#endif // FTE
if (TraceResult == 1) {
self.goalentity = self.enemy;
self.chase_time = time + 7;
return 1;
} else {
return 0;
}
} else {
return 0;
}
};
void() PathfindToEnemy =
@ -641,22 +695,6 @@ void() NextPathfindToEnemy {
}
#ifdef FTE
inline float(vector start, vector min, vector max, vector end, float nomonsters, entity forent) tracemove
{
//was tracebox
traceline(start,end,nomonsters,forent);
if(trace_ent == forent || trace_endpos == end) {
return 1;
} else {
return 0;
}
}
#endif // FTE
void(float dist) Inside_Walk = {
// Hellhounds should only change targets if current one is in Last Stand
if (self.classname == "ai_dog" && self.enemy.downed == true) {

View file

@ -634,6 +634,19 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch
}
#ifdef FTE
void(entity who, float version) nzp_setdoubletapver =
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EVENT_DOUBLETAPUPDATE);
WriteByte(MSG_MULTICAST, version);
msg_entity = who;
multicast('0 0 0', MULTICAST_ONE);
};
#endif // FTE
// *****************************************
// Unrelated to engine, but custom functions
// *****************************************

View file

@ -73,6 +73,7 @@ float ach_tracker_spin;
float global_trace_damage_multiplier;
.float ads_release;
.float has_doubletap_damage_buff;
.vector oldvelocity;
.float lastsound_time;

View file

@ -272,6 +272,7 @@ void (entity who)
float () nzp_maxai = #503;
void (entity who) nzp_bettyprompt = #504;
void (entity who, string name) nzp_setplayername = #505;
void (entity who, float version) nzp_setdoubletapver = #506;
//
// constants

View file

@ -47,6 +47,9 @@ void(entity person) W_HideCrosshair;
#define PERK_SPAWNFLAG_LIMELIGHT 256
#define PERK_SPAWNFLAG_YELLOWLIGHT 512
// Double-Tap Damage Boost
#define PERK_SPAWNFLAG_DOUBLETAPV1 1024
#define PERK_JUGGERNOG_HEALTH 160
//
@ -148,6 +151,11 @@ void DrinkPerk() {
W_HideCrosshair(self);
Set_W_Frame (machine.weapon_animduration, machine.weapon2_animduration, 2.25, 0, PERK, GivePerk, machine.weapon2model, true, S_RIGHT);
sound(self, CHAN_ITEM, machine.oldmodel, 1, ATTN_NORM);
// Communicate to our engines that this client should display correct Double-Tap icon.
if (self.style == P_DOUBLE) {
nzp_setdoubletapver(self, self.has_doubletap_damage_buff);
}
}
//
@ -300,6 +308,11 @@ void() touch_perk =
// Pass along the Perk information to the Player to avoid complications later on, then Drink!
other.style = self.style;
// Double-Tap 2.0 flag set here
if (self.classname == "perk_double") {
other.has_doubletap_damage_buff = !(self.spawnflags & PERK_SPAWNFLAG_DOUBLETAPV1);
}
entity tempe = self; // Set machine to tempe
self = other; // Set self to client
self.usedent = tempe; // Set usedent to machine

View file

@ -213,6 +213,7 @@ void() findboxspot =
setmodel(g, mystery_box_glow_model);
setorigin(g,newspot.origin);
g.angles = newspot.angles;
g.effects = EF_FULLBRIGHT;
#ifdef FTE

View file

@ -105,7 +105,30 @@ void() StartFrame =
if (ai_delay_time < time) {
Do_Zombie_AI ();
ai_delay_time = time + 0.04;
// This determines the delay between each AI's update sequence.
// It needs to be variable -- the more AI, the smaller this number
// should end up being, or else you'll have AI completely stall
// waiting for it's chance in the spotlight.
// -----
#ifdef FTE
// On FTE, resources are available to make this super short (0.01s,
// meaning all 24 ai update 4 times a second).
ai_delay_time = time + 0.01;
#else
// On other platforms, have this be 0.03 / ai factor / 12.
// This means that:
// AI Updates at ~30Hz with 12 Zombies
// AI Updates at ~45Hz with 18 Zombies
// AI Updates at ~60Hz with 24 Zombies
ai_delay_time = time + (0.03 / (nzp_maxai()/12));
#endif // FTE
}
} else {
entity SpawnedIn;

View file

@ -514,6 +514,11 @@ void() PlayerPostThink =
case 1: self.frame = 115; break;
case 0: self.frame = 162; break;
}
// If we're downed force set the last stand idle frame as well
// so the player doesn't look like they're just prone.
if (self.downed)
self.frame = 37;
}
}

View file

@ -1073,7 +1073,7 @@ void(float side) W_Fire =
delay = getWeaponDelay(self.weapon, FIRE);
// Double Tap 2.0
if (self.perks & P_DOUBLE)
if (self.perks & P_DOUBLE && self.has_doubletap_damage_buff)
shotcount *= 2;
if (self.velocity)
@ -2271,11 +2271,17 @@ void () Weapon_Logic =
if (self.button6 && !self.semiknife)
{
// Don't do this at all on FTE.
#ifndef FTE
if (self.sprinting) {
dolphin_dive();
return;
}
#endif // FTE
W_Knife();
self.semiknife = true;
}

View file

@ -59,6 +59,7 @@ const float EVENT_GRENADEPULSE = 42;
const float EVENT_BETTYPROMPT = 43;
const float EVENT_LIMBGIB = 44;
const float EVENT_CHATMESSAGE = 45;
const float EVENT_DOUBLETAPUPDATE = 46;
// Define our FTE platform
#ifndef STANDARD