SERVER/CLIENT: Trigger a Bouncing Betty tutorial on purchase

This commit is contained in:
cypress 2023-10-28 12:09:57 -04:00
parent e3eafffcb9
commit 84fb0662e3
7 changed files with 56 additions and 0 deletions

View file

@ -83,6 +83,8 @@ float useprint_weapon;
float useprint_cost;
float useprint_time;
float bettyprompt_time;
string scrolltext;
float stext;
float scrollopacity;

View file

@ -1088,6 +1088,39 @@ void(float width, float height) HUD_Weaponstring =
drawstring([x - GetUltraWideOffset(), g_height - 49], weaponstring, [12, 12], [1, 1, 1], 1, 0);
}
/*********************
* HUD Bouncing Betty *
*********************/
void(float width, float height) HUD_BouncingBetty =
{
float top_x, bot_x, but_x;
string betty_key;
string betty_space;
string activate_string, activate_string2;
tokenize(findkeysforcommand("impulse 33"));
betty_key = strtoupper(keynumtostring(stof(argv(0))));
betty_space = "";
for(float i = 0; i < strlen(betty_key); i++) {
betty_space = strcat(betty_space, " ");
}
activate_string = strcat("Press ", betty_space, " to place a");
activate_string2 = "Bouncing Betty";
top_x = (g_width/2) - (stringwidth(activate_string, 0, [12, 12])/2);
bot_x = (g_width/2) - (stringwidth(activate_string2, 0, [12, 12])/2);
drawstring([top_x, g_height - 303], activate_string, [12, 12], [1, 1, 1], 1, 0);
drawstring([bot_x, g_height - 289], activate_string2, [12, 12], [1, 1, 1], 1, 0);
// Draw the highlighted button
but_x = top_x + stringwidth("Press ", 0, [12, 12, 0]);
drawstring([but_x, g_height - 303], betty_key, [12, 12], [1, 1, 0], 1, 0);
}
/*******************
* HUD Progress Bar *
*******************/
@ -1590,6 +1623,9 @@ void(float width, float height) HUD_Draw =
if (vmodel.model == GetWeaponModel(getstatf(STAT_ACTIVEWEAPON), FALSE) && vmodel.model != "")
HUD_AmmoString();
if (bettyprompt_time > time)
HUD_BouncingBetty(width, height);
if (HUD_Change_time > time)
{

View file

@ -1209,6 +1209,9 @@ noref void() CSQC_Parse_Event =
case EVENT_GRENADEPULSE:
crosshair_pulse_grenade = true;
break;
case EVENT_BETTYPROMPT:
bettyprompt_time = time + 4;
break;
case EVENT_WEAPONUPDATE:
float wepnum = readbyte();
string wepname = readstring();

View file

@ -333,6 +333,18 @@ void(entity who) grenade_pulse =
}
#endif // FTE
#ifdef FTE
void(entity who) nzp_bettyprompt =
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EVENT_BETTYPROMPT);
msg_entity = who;
multicast('0 0 0', MULTICAST_ONE);
}
#endif // FTE
void(entity who) UpdatePunchangle =
{
#ifdef FTE

View file

@ -268,6 +268,7 @@ void (string trackname)
void () nzp_maxammo = #501;
void (entity who) grenade_pulse = #502;
float () nzp_maxai = #503;
void (entity who) nzp_bettyprompt = #504;
//
// constants

View file

@ -275,6 +275,7 @@ void () WallWeapon_TouchTrigger =
addmoney(other, 0 - self.cost2, FALSE);
other.grenades = other.grenades | 2;
other.secondary_grenades = 2;
nzp_bettyprompt(other);
if (self.enemy)
{
oldent = self;

View file

@ -56,6 +56,7 @@ const float EVENT_REVIVECHANGE = 39;
const float EVENT_WEAPONRECOIL = 40;
const float EVENT_SONGPLAY = 41;
const float EVENT_GRENADEPULSE = 42;
const float EVENT_BETTYPROMPT = 43;
// Define our FTE platform
#ifndef STANDARD