Skip to content

Commit e2a2d98

Browse files
authored
Merge pull request #1325 from drzel/improved-flag-pickup-notification
Improved flag pickup notification
2 parents 95c7c2b + 791abcc commit e2a2d98

File tree

16 files changed

+163
-85
lines changed

16 files changed

+163
-85
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ sound files are found in `fortress/sound/hitaudio/` and `fortress/sound/announc
161161
* Server option for making all walls block EMP. Off by default. `localinfo walls_block_emp 1` or `localinfo wbe 1`. (SPAWNFLAG_BLOCK_EMP 4096 will work regardless)
162162
* Server option for setting detpack to solid (blocking). Off by default. `localinfo solid_detpack 1` or `localinfo sdp 1`.
163163
* Server option for overriding map class restrictions (except civilian). `serverinfo override_mapclasses 1` or `serverinfo omc 1`.
164-
* Option for maximum grenades for all classes. `localinfo max_gren1_<class> <number>`, short `localinfo mg1_<classnum> <number>`. Works for gren1s and gren2s. Eg `localinfo max_gren1_scout 0` to remove caltrops or `localinfo mg2_9 2` to reduce max EMPs to 2.
164+
* Option for maximum grenades for all classes. `localinfo max_gren1_<class> <number>`, short `localinfo mg1_<classnum> <number>`. Works for gren1s and gren2s. Eg `localinfo max_gren1_scout 0` to remove caltrops or `localinfo mg2_9 2` to reduce max EMPs to 2. Set to -1 for default.
165165
* Option to fully restock player's clip and finish reload immediately if in progress. `localinfo stock_reload 1` (`localinfo srd 1`) will trigger only on flag capture (with stock_on_cap enabled). `2` will trigger whenever any tfgoal gives you the appropriate ammo.
166166
* Option for statusbar flaginfo. `setinfo sbflaginfo 1` (default). Setting it to `2` will skip the tf tips on respawn and show flag info all the time.
167167
* Admin system created to allow for easy setup of pub/clan/quad/duel games, kick players etc `localinfo adminpwd <password>` and `cmd adminpwd <password>; wait; adminmenu`
@@ -177,6 +177,7 @@ sound files are found in `fortress/sound/hitaudio/` and `fortress/sound/announc
177177
* Keys and flags glow their colour.
178178
* Option to adjust conussion grenade effect time in seconds. `localinfo cussgrentime`.
179179
* Option to fully restock player on cap. `localinfo stock_on_cap on`.
180+
* Option to strip ammo and grens from defenders within 1500 units of cap point when flag is capped. `localinfo cap_strip 1`.
180181
* Option for packs to fully restock health and armor of player. `localinfo stockfull on`.
181182
* Automatic server-side mvd recording of clan matches. Requires `localinfo serverdemo on`.
182183
* Map vote (4 random maps + current map) during last few minutes of game (shown for newly spawned or toggled with /togglevote).

csqc/csextradefs.qc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ float vote_list_offset;
115115
entity current_vote;
116116
string vote_list_filter;
117117
float zoomed_in;
118+
float pick_up_time;
119+
float flag_team;
118120

119121
float slot_history[MAX_SLOT_HISTORY_SIZE];
120122
float slot_history_top, slot_under_stack;
@@ -412,7 +414,7 @@ enum PanelID:float {
412414
HUDP_GRENTIMER,
413415
HUDP_MOTD,
414416
HUDP_GAME_MODE,
415-
HUDP_READY,
417+
HUDP_NOTIFICATION,
416418
HUDP_HEALTH,
417419
HUDP_FACE,
418420
HUDP_AMMO,

csqc/events.qc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ void() CSQC_Parse_Event = {
355355
local float weapon = readfloat();
356356
FO_ReloadSound(weapon);
357357
break;
358+
case MSG_FLAG_PICKUP:
359+
flag_team = readfloat();
360+
pick_up_time = time;
361+
break;
358362
}
359363
}
360364

csqc/hud.qc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void FO_Hud_Editor_LoadDefaultSettings()
2626
getHudPanel(HUDP_GAME_MODE)->Position = [width - getHudPanel(HUDP_GAME_MODE)->FillSize.x, 30];
2727
getHudPanel(HUDP_GAME_MODE)->Orientation = FO_HUD_INSERT_AFTER;
2828
getHudPanel(HUDP_MOTD)->Position = [(width / 2) - (getHudPanel(HUDP_MOTD)->FillSize.x / 2), 30];
29-
getHudPanel(HUDP_READY)->Position = [(width / 2) - (getHudPanel(HUDP_READY)->FillSize.x / 2), 30];
29+
getHudPanel(HUDP_NOTIFICATION)->Position = [(width / 2) - (getHudPanel(HUDP_NOTIFICATION)->FillSize.x / 2), 30];
3030
getHudPanel(HUDP_MENU_HINT)->Position = [(width / 2) - (getHudPanel(HUDP_MENU)->FillSize.x / 2), 80];
3131
getHudPanel(HUDP_MENU_HINT)->Orientation = FO_HUD_INSERT_MIDDLE;
3232
getHudPanel(HUDP_MENU)->Position = [(width / 2) - (getHudPanel(HUDP_MENU)->FillSize.x / 2), 120];

csqc/hud_helpers.qc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void FO_Hud_InitSystemPanels() {
257257
if (panel->System) {
258258
switch (panel->id) {
259259
case HUDP_MOTD:
260-
case HUDP_READY:
260+
case HUDP_NOTIFICATION:
261261
FO_Hud_ShowPanel(i);
262262
break;
263263

csqc/status.qc

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void(PanelID panelid, string text) drawGameModePanel = {
508508
}
509509
}
510510

511-
void(PanelID panelid, string text) drawReadyPanel = {
511+
void(PanelID panelid, string text) drawNotificationPanel = {
512512
FO_Hud_Panel* panel = getHudPanel(panelid);
513513

514514
vector position = getPanelPosition(panel);
@@ -520,7 +520,7 @@ void(PanelID panelid, string text) drawReadyPanel = {
520520
local float pos_aligned;
521521
local string message = "";
522522
if (fo_hud_editor) {
523-
message = "Ready Status";
523+
message = "Notification panel";
524524
if (hud_panel(panelid, position, size, 0.3, panel.Display)) {
525525
// click event
526526
}
@@ -606,6 +606,49 @@ void(PanelID panelid, string text) drawReadyPanel = {
606606
}
607607
}
608608
}
609+
} else if (pick_up_time && time < pick_up_time + 1.5) {
610+
local vector alert_text_size = MENU_TEXT_MEDIUM * panel.Scale;
611+
local vector alert_text_position;
612+
alert_text_position.y = ScreenSize.y / 3;
613+
alert_text_position.x = (ScreenSize.x / 2) - (size.x / 2);
614+
615+
local string flag_team_str = "the";
616+
local vector menu_text_color = MENU_TEXT_4;
617+
618+
switch(flag_team) {
619+
case 1:
620+
flag_team_str = "blue's";
621+
menu_text_color = MENU_TEXT_BLUE_FO;
622+
break;
623+
case 2:
624+
flag_team_str = "red's";
625+
menu_text_color = MENU_TEXT_RED_FO;
626+
break;
627+
case 3:
628+
flag_team_str = "yellow's";
629+
menu_text_color = MENU_TEXT_YELLOW_FO;
630+
break;
631+
case 4:
632+
flag_team_str = "green's";
633+
menu_text_color = MENU_TEXT_GREEN_FO;
634+
break;
635+
}
636+
637+
local string alert_text_message = sprintf("You got %s flag!", flag_team_str);
638+
639+
pos_aligned = GetTextAlignOffset(
640+
alert_text_position.x,
641+
size.x,
642+
padding,
643+
alert_text_message,
644+
alert_text_size.x,
645+
panel.Orientation
646+
);
647+
648+
HRC_drawstring(
649+
[pos_aligned, alert_text_position.y],
650+
alert_text_message, alert_text_size, menu_text_color, 1, 0
651+
);
609652
}
610653
}
611654
if(message) {
@@ -1110,7 +1153,7 @@ var FO_Hud_Panel Hud_Panels[] = {
11101153
{HUDP_GRENTIMER, "grentimer", FO_HUD_GRENTIMER_NAME, '100 110', '26 26', 1,0,1,0,0, drawGrenTimerPanel, {return "";}},
11111154
{HUDP_MOTD, "motd", FO_HUD_MOTD_NAME, '150 100', '100 24', 1,0,1,0,0, drawMOTDPanel, {return SBAR.MOTD;}},
11121155
{HUDP_GAME_MODE, "gamemode", FO_HUD_GAME_MODE_NAME, '100 140', '100 10', 1,0,1,0,0, drawGameModePanel, {return "";}},
1113-
{HUDP_READY, "ready", FO_HUD_READY_NAME, '10 100', '100 10', 2,0,1,FO_HUD_INSERT_MIDDLE, 1, drawReadyPanel, {return SBAR.Hint;}},
1156+
{HUDP_NOTIFICATION, "notification", FO_HUD_NOTIFICATION_NAME, '10 100', '100 10', 2,0,1,FO_HUD_INSERT_MIDDLE, 1, drawNotificationPanel, {return SBAR.Hint;}},
11141157
{HUDP_HEALTH, "health", FO_HUD_HEALTH_NAME, '-22 -2', '72 24', 1,0,1,0,0, drawHealthArmourTextPanel, {return ftos(getstatf(STAT_HEALTH));}, 0, 34},
11151158
{HUDP_FACE, "face", FO_HUD_FACE_NAME, '-70 -2', '24 24', 1,0,1,0,0, drawFacePanel, {return "";}, 0, 34},
11161159
{HUDP_AMMO, "ammo", FO_HUD_AMMO_NAME, '90 -2', '72 24', 1,0,1,0,0, drawAmmoTextPanel, {return ftos(WP_CurrentAmmo());}, 0, 34},

share/commondefs.qc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ const float SERVER_FRAME_MS = SERVER_FRAME_DT * 1000.0;
213213
#define MSG_LOGIN 26
214214
#define MSG_HITFLAG 27
215215
#define MSG_RELOADSOUND 28
216+
#define MSG_FLAG_PICKUP 29
216217

217218
#define FLAGINFO_HOME 1
218219
#define FLAGINFO_CARRIED 2

share/defs.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ enum {
976976
#define PC_DEMOMAN_GRENADE_INIT_1 4
977977
#define PC_DEMOMAN_GRENADE_INIT_2 4
978978
#define PC_DEMOMAN_GRENADE_MAX_1 4
979-
#define PC_DEMOMAN_GRENADE_MAX_2 4
979+
#define PC_DEMOMAN_GRENADE_MAX_2 1
980980
#define PC_DEMOMAN_TF_ITEMS 0
981981

982982
// Class Details for COMBAT MEDIC
@@ -1003,7 +1003,7 @@ enum {
10031003
#define PC_MEDIC_GRENADE_INIT_1 3
10041004
#define PC_MEDIC_GRENADE_INIT_2 3
10051005
#define PC_MEDIC_GRENADE_MAX_1 4
1006-
#define PC_MEDIC_GRENADE_MAX_2 3
1006+
#define PC_MEDIC_GRENADE_MAX_2 2
10071007
#define PC_MEDIC_TF_ITEMS 0
10081008
#define PC_MEDIC_REGEN_TIME 3 // Number of seconds between each regen.
10091009
#define PC_MEDIC_REGEN_AMOUNT 2 // Amount of health regenerated each regen.
@@ -1043,7 +1043,6 @@ enum {
10431043
#define PC_HVYWEAP_TF_ITEMS 0
10441044
#define PC_HVYWEAP_CELL_FIRE 7
10451045

1046-
10471046
// Class Details for PYRO
10481047
#define PC_PYRO_SKIN 21
10491048
#define PC_PYRO_MAXHEALTH 100
@@ -1065,7 +1064,7 @@ enum {
10651064
#define PC_PYRO_GRENADE_INIT_1 1
10661065
#define PC_PYRO_GRENADE_INIT_2 4
10671066
#define PC_PYRO_GRENADE_MAX_1 4
1068-
#define PC_PYRO_GRENADE_MAX_2 4
1067+
#define PC_PYRO_GRENADE_MAX_2 1
10691068
#define PC_PYRO_TF_ITEMS 0
10701069
#define PC_PYRO_AIRBLAST_RANGE 400
10711070
#define PC_PYRO_AIRBLAST_CELLS 55
@@ -1100,7 +1099,7 @@ enum {
11001099
#define PC_SPY_GRENADE_INIT_1 2
11011100
#define PC_SPY_GRENADE_INIT_2 2
11021101
#define PC_SPY_GRENADE_MAX_1 4
1103-
#define PC_SPY_GRENADE_MAX_2 2
1102+
#define PC_SPY_GRENADE_MAX_2 1
11041103
#define PC_SPY_TF_ITEMS 0
11051104
#define PC_SPY_CELL_REGEN_TIME 5
11061105
#define PC_SPY_CELL_REGEN_AMOUNT 1
@@ -1129,7 +1128,7 @@ enum {
11291128
#define PC_ENGINEER_GRENADE_INIT_1 2
11301129
#define PC_ENGINEER_GRENADE_INIT_2 2
11311130
#define PC_ENGINEER_GRENADE_MAX_1 4
1132-
#define PC_ENGINEER_GRENADE_MAX_2 4
1131+
#define PC_ENGINEER_GRENADE_MAX_2 2
11331132
#define PC_ENGINEER_TF_ITEMS 0
11341133
#define PC_ENGINEER_RAILSPEED 1500
11351134

@@ -1396,7 +1395,7 @@ enum {
13961395
#define FO_HUD_MOTD_NAME "MOTD"
13971396
#define FO_HUD_MENU_HINT_NAME "Menu Hints"
13981397
#define FO_HUD_GAME_MODE_NAME "Game Mode"
1399-
#define FO_HUD_READY_NAME "Ready Status"
1398+
#define FO_HUD_NOTIFICATION_NAME "Notification"
14001399
#define FO_HUD_SHOWSCORES_NAME "Show Scores"
14011400
#define FO_HUD_MAP_MENU_NAME "Map Menu"
14021401
#define FO_HUD_HEALTH_NAME "Health"

0 commit comments

Comments
 (0)