SERVER: Allow Mappers to specify Double-Tap 1.0

This commit is contained in:
cypress 2023-11-28 11:34:39 -05:00
parent 38839b0bfd
commit 130ccd6cd1
9 changed files with 44 additions and 4 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

@ -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

@ -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)

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