Skip to content

Commit a9e0adf

Browse files
committed
Merge branch 'specialupdown' into staging
2 parents b2dfa3c + 43d3771 commit a9e0adf

File tree

7 files changed

+119
-77
lines changed

7 files changed

+119
-77
lines changed

csqc/csextradefs.qc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ float vote_list_offset;
115115
entity current_vote;
116116
string vote_list_filter;
117117
float oldbuttons;
118-
float zoomed_in;
118+
float zoom_scale;
119119
float pick_up_time;
120120
float flag_team;
121121

csqc/events.qc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ void() CSQC_Parse_Event = {
103103
last_id_time = time;
104104
SBAR.Identify = readstring();
105105
break;
106+
case MSG_PLAYER_DIE:
107+
zoom_scale = 1;
108+
break;
109+
case MSG_PLAYER_SPAWN:
110+
zoom_scale = 1;
111+
break;
106112
case MSG_GRENPRIMED:
107113
float entno = readentitynum();
108114
float grentype = readbyte();

csqc/main.qc

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init = {
199199
sentry_preview_range_sphere.scale = 1000;
200200
sentry_preview_range_sphere.alpha = 0.02;
201201

202+
zoom_scale = 1;
203+
202204
print("CSQC initialization finished\n");
203205
};
204206

@@ -225,8 +227,8 @@ noref void(float width, float height, float menushown) CSQC_UpdateView = {
225227

226228
FO_CussView();
227229

228-
if (zoomed_in)
229-
setviewprop(VF_AFOV, CVARF(fov)/3);
230+
setviewprop(VF_AFOV, CVARF(fov)/zoom_scale);
231+
setsensitivityscaler(1/zoom_scale);
230232

231233
// Draw original sbar, viewsize honoured automatically.
232234
if (!CVARF(fo_fte_hud) || CVARF(fo_legacy_sbar))
@@ -308,6 +310,9 @@ noref float(string cmd) CSQC_ConsoleCommand = {
308310
localcmd("cmd sentry rotate 15\n");
309311
}
310312
break;
313+
default:
314+
zoom_scale = min(zoom_scale + 1, 5);
315+
break;
311316
}
312317
break;
313318
case "specialdown":
@@ -322,6 +327,9 @@ noref float(string cmd) CSQC_ConsoleCommand = {
322327
localcmd("cmd sentry rotate -15\n");
323328
}
324329
break;
330+
default:
331+
zoom_scale = max(zoom_scale - 1, 1);
332+
break;
325333
}
326334
break;
327335
case "+slot":
@@ -752,61 +760,63 @@ noref void CSQC_Input_Frame() {
752760

753761
Sync_GameState();
754762

755-
// Intercept rocket jump
756-
if ((WP_PlayerClass() == PC_SOLDIER || WP_PlayerClass() == PC_PYRO) &&
757-
(input_buttons & BUTTON4))
758-
input_buttons |= BUTTON0 | BUTTON2;
759-
760-
if (WP_PlayerClass() == PC_ENGINEER) {
761-
// Intercept sentry build
762-
if (!getstatf(STAT_HAS_SENTRY) && getstatf(STAT_CELLS) >= 130 && game_state.is_alive && !prematch) {
763+
switch (WP_PlayerClass()) {
764+
case PC_SNIPER:
765+
if (keydowns & BUTTON3) {
766+
if (zoom_scale == 1) {
767+
zoom_scale = 3;
768+
} else {
769+
zoom_scale = 1;
770+
}
771+
}
772+
break;
773+
case PC_SOLDIER:
774+
case PC_PYRO:
775+
// Intercept rocket jump
763776
if (input_buttons & BUTTON4) {
764-
if (keydowns & BUTTON4) {
765-
if (!previewing_sentry) {
766-
SentryPreviewStart();
767-
} else {
768-
SentryPreviewStop();
777+
input_buttons |= BUTTON0 | BUTTON2;
778+
}
779+
break;
780+
case PC_ENGINEER:
781+
// Intercept sentry build
782+
if (!getstatf(STAT_HAS_SENTRY) && getstatf(STAT_CELLS) >= 130 && game_state.is_alive && !prematch) {
783+
if (input_buttons & BUTTON4) {
784+
if (keydowns & BUTTON4) {
785+
if (!previewing_sentry) {
786+
SentryPreviewStart();
787+
} else {
788+
SentryPreviewStop();
789+
}
769790
}
770-
}
771791

772-
input_buttons = input_buttons - BUTTON4;
773-
}
792+
input_buttons = input_buttons - BUTTON4;
793+
}
774794

775-
if (previewing_sentry) {
776-
if (keydowns & BUTTON0) {
777-
if (sentry_fits) {
778-
localcmd(sprintf("cmd build sentry %f\n", anglemod(180 + sentry_preview_offset)));
779-
SentryPreviewStop();
780-
} else {
781-
print("Can't build here\n");
795+
if (previewing_sentry) {
796+
if (keydowns & BUTTON0) {
797+
if (sentry_fits) {
798+
localcmd(sprintf("cmd build sentry %f\n", anglemod(180 + sentry_preview_offset)));
799+
SentryPreviewStop();
800+
} else {
801+
print("Can't build here\n");
802+
}
782803
}
783-
}
784804

785-
if (input_buttons & BUTTON0) {
786-
input_buttons = input_buttons - BUTTON0;
805+
if (input_buttons & BUTTON0) {
806+
input_buttons = input_buttons - BUTTON0;
807+
}
787808
}
788809
}
789-
790-
}
791-
792-
if (prevent_firing && !previewing_sentry && (keyups & BUTTON0)) {
793-
prevent_firing = FALSE;
794-
}
795-
796-
if (prevent_firing) {
797-
input_buttons &= ~BUTTON0;
798-
}
810+
break;
799811
}
800812

801-
// Handle zoom
802-
float prev_zoomed_in = zoomed_in;
803-
if (WP_PlayerClass() == PC_SNIPER)
804-
zoomed_in = input_buttons & BUTTON3;
805-
else
806-
zoomed_in = 0;
813+
if (prevent_firing && !previewing_sentry && (keyups & BUTTON0)) {
814+
prevent_firing = FALSE;
815+
}
807816

808-
if (prev_zoomed_in != zoomed_in)
809-
setsensitivityscaler(zoomed_in ? 1/3 : 1);
817+
if (prevent_firing) {
818+
input_buttons &= ~BUTTON0;
819+
}
810820

811821
PM_InputFrame();
812822
FO_ApplyCussInput();

share/commondefs.qc

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -185,37 +185,39 @@ const float SERVER_FRAME_MS = SERVER_FRAME_DT * 1000.0;
185185
#define GAMEMODE_DUEL 4
186186
#define GAMEMODE_VOTE 8
187187

188-
#define MSG_FLAGINFOINIT 1
189-
#define MSG_FLAGINFO 2
190-
191-
#define MSG_SBAR 4
192-
#define MSG_GRENPRIMED 5
193-
#define MSG_CLIENT_MENU 6
194-
#define MSG_TEAMS_UPDATE 7
195-
#define MSG_CLASSES_UPDATE 8
196-
#define MSG_SENTRY_POS 9
197-
#define MSG_DISPENSER_POS 10
188+
#define MSG_FLAGINFOINIT 1
189+
#define MSG_FLAGINFO 2
190+
// 3
191+
#define MSG_SBAR 4
192+
#define MSG_GRENPRIMED 5
193+
#define MSG_CLIENT_MENU 6
194+
#define MSG_TEAMS_UPDATE 7
195+
#define MSG_CLASSES_UPDATE 8
196+
#define MSG_SENTRY_POS 9
197+
#define MSG_DISPENSER_POS 10
198198
#define MSG_SERVER_ADMIN_INFO 11
199-
#define MSG_CAPTAINS 12
200-
#define MSG_MOTD 13
201-
#define MSG_PREMATCH 14
202-
#define MSG_GRENTHROWN 15
203-
#define MSG_ID 16
204-
#define MSG_TEAM_SCORES 17
205-
#define MSG_VOTE_MAPS 18
206-
#define MSG_VOTE_UPDATE 19
207-
#define MSG_VOTE_MAP_ADD 20
208-
#define MSG_VOTE_MAP_DELETE 21
209-
#define MSG_PAUSE 22
210-
#define MSG_UNPAUSE 23
211-
#define MSG_TFX_GRENTIMER 24
212-
#define MSG_QUAD_ROUND_BEGIN 25
213-
#define MSG_LOGIN 26
214-
#define MSG_HITFLAG 27
215-
#define MSG_RELOADSOUND 28
216-
#define MSG_FLAG_PICKUP 29
217-
#define MSG_FLAG_DROP 30
218-
#define MSG_BUILDING 31
199+
#define MSG_CAPTAINS 12
200+
#define MSG_MOTD 13
201+
#define MSG_PREMATCH 14
202+
#define MSG_GRENTHROWN 15
203+
#define MSG_ID 16
204+
#define MSG_TEAM_SCORES 17
205+
#define MSG_VOTE_MAPS 18
206+
#define MSG_VOTE_UPDATE 19
207+
#define MSG_VOTE_MAP_ADD 20
208+
#define MSG_VOTE_MAP_DELETE 21
209+
#define MSG_PAUSE 22
210+
#define MSG_UNPAUSE 23
211+
#define MSG_TFX_GRENTIMER 24
212+
#define MSG_QUAD_ROUND_BEGIN 25
213+
#define MSG_LOGIN 26
214+
#define MSG_HITFLAG 27
215+
#define MSG_RELOADSOUND 28
216+
#define MSG_FLAG_PICKUP 29
217+
#define MSG_FLAG_DROP 30
218+
#define MSG_BUILDING 31
219+
#define MSG_PLAYER_DIE 32
220+
#define MSG_PLAYER_SPAWN 33
219221

220222
#define FLAGINFO_HOME 1
221223
#define FLAGINFO_CARRIED 2

ssqc/client.qc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,8 @@ void (float all_dimensions) SetDimensions = {
21222122
};
21232123

21242124
void () PutClientInServer = {
2125+
UpdateClientPlayerSpawn(self);
2126+
21252127
if (fo_login_required && self.fo_login == string_null)
21262128
UpdateClient_Login(self);
21272129

ssqc/player.qc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ void () GibPlayer = {
439439
};
440440

441441
void () PlayerDie = {
442+
UpdateClientPlayerDie(self);
443+
442444
self.spawn_gen += 1;
443445
self.last_death_ctime = self.client_time;
444446

ssqc/status.qc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,26 @@ string GetSBClassInfo(entity pl, float csqcactive)
757757
return st1;
758758
}
759759

760+
void UpdateClientPlayerDie(entity pl) {
761+
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
762+
return;
763+
764+
msg_entity = pl;
765+
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
766+
WriteByte(MSG_MULTICAST, MSG_PLAYER_DIE);
767+
multicast('0 0 0', MULTICAST_ONE_NOSPECS);
768+
}
769+
770+
void UpdateClientPlayerSpawn(entity pl) {
771+
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
772+
return;
773+
774+
msg_entity = pl;
775+
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
776+
WriteByte(MSG_MULTICAST, MSG_PLAYER_SPAWN);
777+
multicast('0 0 0', MULTICAST_ONE_NOSPECS);
778+
}
779+
760780
void UpdateClientBuilding(entity pl) {
761781
if(!infokeyf(pl, INFOKEY_P_CSQCACTIVE))
762782
return;

0 commit comments

Comments
 (0)