Skip to content

Commit 4dea5f0

Browse files
committed
Merge branch 'reactivedrop_beta' into welder_icon
2 parents e138a2e + 37a0729 commit 4dea5f0

24 files changed

Lines changed: 241 additions & 187 deletions

reactivedrop/content/traitors_challenge/resource/challenges/traitors.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"_rd_traitors_challenge_enabled" "1"
77
"rd_player_bots_allowed" "0"
88
"rd_add_index_to_name" "1"
9+
"rd_restrict_aspect_width" "1.77777777"
910
"rd_draw_restricted_rectangles_coop" "1"
1011

1112
"rd_auto_fast_restart" "1"

reactivedrop/content/traitors_challenge/scripts/vscripts/challenge_traitors.nut

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DEBUG <- true; // Debug flags 调试标识
1+
DEBUG <- false; // Debug flags 调试标识
22
INT_MAX <- 2147483647; // Constant 常量
33
isServer <- true; // If the code is running server side or client side 指示代码是在服务端运行的还是在客户端运行的
44
IsPaused <- false; // Not actually being used 没有实际用处
@@ -190,7 +190,14 @@ function SetTraitorIcon(interval = 10) {
190190
if (g_int_Counter % interval != 0) {
191191
return;
192192
}
193-
foreach(hMarine in g_marine_Total) {
193+
194+
195+
local list = {};
196+
for (local i = 6; i < 21; i++) {
197+
list[i] <- 0;
198+
}
199+
local i = 11;
200+
foreach(hMarine in g_marine_Traitor) {
194201
if (hMarine == null || !hMarine.IsValid()) {
195202
continue;
196203
}
@@ -205,30 +212,34 @@ function SetTraitorIcon(interval = 10) {
205212
case ROLE.INFECTED_SNIPER:
206213
case ROLE.INFECTED_DEMO:
207214
case ROLE.INFECTED_DESERTER:
208-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 8));
215+
list[i] = hMarine.entindex();
216+
i++;
209217
break;
210218
case ROLE.TRAITOR_LEADER:
211-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 9));
219+
list[6] = hMarine.entindex();
212220
break;
213221
case ROLE.INFECTOR:
214-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 10));
222+
list[7] = hMarine.entindex();
215223
break;
216224
case ROLE.BOOMER:
217-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 11));
225+
list[8] = hMarine.entindex();
218226
break;
219227
case ROLE.SILENCER:
220-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 12));
228+
list[9] = hMarine.entindex();
221229
break;
222230
case ROLE.MIMIC:
223-
NetProps.SetPropInt(hMarine, "m_iEmote", NetProps.GetPropInt(hMarine, "m_iEmote") | (1 << 13));
224-
break;
231+
list[10] = hMarine.entindex();
225232
}
226233
}
227234
foreach(hPlayer in g_player_TraitorHistory) {
228235
if (hPlayer == null || !hPlayer.IsValid()) {
229236
continue;
230237
}
231-
NetProps.SetPropInt(hPlayer, "m_iFrags", 99);
238+
239+
local hHud2 = Entities.FindByName(null, hPlayer.GetScriptScope().strHudName2);
240+
for(local i = 6;i<21;i++) {
241+
hHud2.SetInt(i, list[i]);
242+
}
232243
}
233244
}
234245

@@ -1158,10 +1169,10 @@ function DeterminRoleCount() {
11581169
//g_bool_HasInfector = true;
11591170
break;
11601171
case 1:
1161-
g_bool_HasBoomer = true;
1172+
g_bool_HasBoomer = true;
11621173
break;
11631174
case 2:
1164-
g_bool_HasSilencer = true;
1175+
g_bool_HasSilencer = true;
11651176
break;
11661177
}
11671178
g_bool_HasShield = (RandomHQUniformIntDistribution(0, 8) == 0);
@@ -1461,6 +1472,9 @@ function CreatePlayerHud(hPlayer) {
14611472
hHud1.SetEntity(0, hPlayer);
14621473
local strHud1 = "HUD_" + UniqueString();
14631474
hHud1.SetName(strHud1);
1475+
for (local i = 6; i < 21; i++) {
1476+
hHud1.SetInt(i, 0);
1477+
}
14641478

14651479
hPlayer.GetScriptScope().strHudName1 <- strHud1;
14661480
hHud1.SetInt(0, ROLE.SPECTATOR);
@@ -1488,6 +1502,9 @@ function CreatePlayerHud(hPlayer) {
14881502
hHud2.SetEntity(0, hPlayer);
14891503
local strHud2 = "HUD_" + UniqueString();
14901504
hHud2.SetName(strHud2);
1505+
for (local i = 6; i < 21; i++) {
1506+
hHud2.SetInt(i, 0);
1507+
}
14911508

14921509
hPlayer.ValidateScriptScope();
14931510
hPlayer.GetScriptScope().strHudName2 <- strHud2;
@@ -1516,6 +1533,9 @@ function CreatePlayerHud(hPlayer) {
15161533
hHud4.SetEntity(0, hPlayer);
15171534
local strHud4 = "HUD_" + UniqueString();
15181535
hHud4.SetName(strHud4);
1536+
for (local i = 6; i < 21; i++) {
1537+
hHud4.SetInt(i, 0);
1538+
}
15191539

15201540
hPlayer.GetScriptScope().strHudName4 <- strHud4;
15211541
hHud4.SetInt(0, ROLE.SPECTATOR);
@@ -1543,6 +1563,9 @@ function CreatePlayerHud(hPlayer) {
15431563
hHud3.SetEntity(0, hPlayer);
15441564
local strhHud3 = "HUD_" + UniqueString();
15451565
hHud3.SetName(strhHud3);
1566+
for (local i = 6; i < 21; i++) {
1567+
hHud3.SetInt(i, 0);
1568+
}
15461569

15471570
hPlayer.ValidateScriptScope();
15481571
hPlayer.GetScriptScope().strHudName3 <- strhHud3;

reactivedrop/content/traitors_challenge/scripts/vscripts/challenge_traitors_events/ontakedamage_alive_any.nut

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ function OnTakeDamage_Alive_Any(victim, inflictor, attacker, weapon, damage, dam
4646
factor3 = 0.10;
4747
break;
4848
case "asw_weapon_devastator": //毁灭者霰弹
49-
factor1 = 0.33;
50-
factor2 = 0.23;
51-
factor3 = 0.46;
49+
factor1 = 0.31;
50+
factor2 = 0.21;
51+
factor3 = 0.41;
5252
break;
5353
case "asw_weapon_vindicator": //复仇者霰弹
54-
factor1 = 0.16;
55-
factor2 = 0.12;
56-
factor3 = 0.20;
54+
factor1 = 0.20;
55+
factor2 = 0.15;
56+
factor3 = 0.25;
5757
break;
5858
default:
5959
factor1 = 0.08;
@@ -105,9 +105,9 @@ function OnTakeDamage_Alive_Any(victim, inflictor, attacker, weapon, damage, dam
105105
factor3 = 0.40;
106106
break;
107107
case "asw_weapon_minigun": //迷你机枪
108-
factor1 = 0.26;
109-
factor2 = 0.20;
110-
factor3 = 0.32;
108+
factor1 = 0.24;
109+
factor2 = 0.18;
110+
factor3 = 0.30;
111111
break;
112112
case "asw_weapon_deagle": //斗牛犬
113113
factor1 = 0.26;
@@ -137,9 +137,9 @@ function OnTakeDamage_Alive_Any(victim, inflictor, attacker, weapon, damage, dam
137137
factor3 = 0.145;
138138
break;
139139
case "asw_weapon_medrifle": //医疗冲锋枪
140-
factor1 = 0.55;
141-
factor2 = 0.45;
142-
factor3 = 0.65;
140+
factor1 = 0.50;
141+
factor2 = 0.40;
142+
factor3 = 0.60;
143143
break;
144144
case "asw_weapon_laser_mines": //激光地雷
145145
damage = 6;

reactivedrop/content/traitors_challenge/scripts/vscripts/challenge_traitors_player_info.nut

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
int 2 - 行号
55
int 3 - 投降,当前人数
66
int 4 - 投降,总人数
7+
8+
int 6 - TRAITOR_LEADER 对应的marine index
9+
int 7 - INFECTOR 对应的marine index
10+
int 8 - BOOMER 对应的marine index
11+
int 9 - SILENCER 对应的marine index
12+
int 10 - MIMIC 对应的marine index
13+
int 11 - TRAITOR 对应的marine index
14+
...
15+
int 20 - TRAITOR 对应的marine index
16+
717
int 63 - 标识,1和2代表显示的是内鬼提示1和提示2。3代表显示的是内鬼开始投票,4代表投票中,5代表投票停止
818
919
float 0 - HUD信息显示的起始时间
@@ -45,9 +55,32 @@ IncludeScript("challenge_traitors_enums.nut");
4555

4656
FONT_DEFAULTLARGE <- self.LookupFont("DefaultMedium");
4757

58+
TEXTURE_TRAITOR <- self.LookupTexture("vgui/swarm/Emotes/EmoteTraitor");
59+
TEXTURE_TRAITORS <- {
60+
[6] = self.LookupTexture("vgui/swarm/Emotes/EmoteTraitorLeader"),
61+
[7] = self.LookupTexture("vgui/swarm/Emotes/EmoteInfector"),
62+
[8] = self.LookupTexture("vgui/swarm/Emotes/EmoteBoomer"),
63+
[9] = self.LookupTexture("vgui/swarm/Emotes/EmoteSilencer"),
64+
[10] = self.LookupTexture("vgui/swarm/Emotes/EmoteMimic"),
65+
[11] = TEXTURE_TRAITOR,
66+
[12] = TEXTURE_TRAITOR,
67+
[13] = TEXTURE_TRAITOR,
68+
[14] = TEXTURE_TRAITOR,
69+
[15] = TEXTURE_TRAITOR,
70+
[16] = TEXTURE_TRAITOR,
71+
[17] = TEXTURE_TRAITOR,
72+
[18] = TEXTURE_TRAITOR,
73+
[19] = TEXTURE_TRAITOR,
74+
[20] = TEXTURE_TRAITOR,
75+
};
76+
4877
xMargin <- 0;
4978

5079
function Paint() {
80+
for (local i = 6; i < 21; i++) {
81+
PaintTraitorIcon(i);
82+
}
83+
5184
//如果正在控制士兵,显示信息。
5285
if (self.GetEntity(0) == GetLocalPlayer()) {
5386
local message = self.GetString(0);
@@ -96,6 +129,33 @@ function PaintMsg(point, role, font, message) {
96129

97130
}
98131

132+
function PaintTraitorIcon(idx) {
133+
134+
if (self.GetInt(idx) <= 0 || TEXTURE_TRAITORS[idx] == -1) {
135+
return;
136+
}
137+
local screenPos = self.ClientGetEntityScreenPos(self.GetInt(idx));
138+
if (screenPos.z < 0.5) { //无效屏幕坐标
139+
return;
140+
}
141+
142+
local xPos = screenPos.x;
143+
local yPos = screenPos.y;
144+
145+
local fScale = (ScreenHeight() / 768.0) * 0.4;
146+
local HalfW = 128.0 * fScale * 0.5;
147+
local HalfH = 128.0 * fScale * 0.5;
148+
yPos += 100 * (ScreenHeight() / 768.0);
149+
150+
local points = [
151+
{x = xPos - HalfW, y = yPos - HalfH, s = 0, t = 0},
152+
{x = xPos + HalfW, y = yPos - HalfH, s = 1, t = 0},
153+
{x = xPos + HalfW, y = yPos + HalfH, s = 1, t = 1},
154+
{x = xPos - HalfW, y = yPos + HalfH, s = 0, t = 1}
155+
];
156+
self.PaintPolygon(points, 255, 255, 255, 255, TEXTURE_TRAITORS[idx]);
157+
}
158+
99159
function interp(i, t) {
100160
local t0 = self.GetFloat(0 + 3 * i);
101161
local t1 = self.GetFloat(3 + 3 * i);

src/game/client/swarm/asw_in_mouse.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "cbase.h"
22
#include "asw_input.h"
33
#include "vgui/asw_vgui_ingame_panel.h"
4+
#include "asw_hud_master.h"
45
#include "asw_hud_crosshair.h"
56
#include "c_asw_player.h"
67
#include "c_asw_marine.h"
@@ -15,13 +16,6 @@
1516
// memdbgon must be the last include file in a .cpp file!!!
1617
#include "tier0/memdbgon.h"
1718

18-
// restricted area variables
19-
extern int g_nRestrictedAreaLeft;
20-
extern int g_nRestrictedAreaRight;
21-
extern int g_nScreenAreaWidth;
22-
extern int g_nScreenAreaHeight;
23-
extern bool g_bUltraWideScreen;
24-
2519
ConVar glow_outline_color_active( "glow_outline_color_active", "153 153 204", FCVAR_NONE );
2620
ConVar glow_outline_color_inactive( "glow_outline_color_inactive", "77 77 77", FCVAR_NONE );
2721

@@ -92,17 +86,15 @@ void CASWInput::ApplyMouse( int nSlot, QAngle& viewangles, CUserCmd *cmd, float
9286
int current_posx, current_posy;
9387
GetMousePos(current_posx, current_posy);
9488

95-
// restrict cursor to 16:9 area to prevent ultra-wide fov cheat
96-
C_ASW_Player* asw_player = C_ASW_Player::GetLocalASWPlayer();
89+
if ( ASWInput()->ControllerModeActiveMouse() )
90+
return;
9791

98-
if (asw_player && !asw_player->GetSpectatingNPC())
92+
CASW_Hud_Master *pHUDMaster = GET_HUDELEMENT( CASW_Hud_Master );
93+
if ( pHUDMaster )
9994
{
100-
current_posx = clamp(current_posx, g_nRestrictedAreaLeft, g_nRestrictedAreaRight);
95+
current_posx = clamp( current_posx, pHUDMaster->m_nMouseMinX, pHUDMaster->m_nMouseMaxX );
10196
}
10297

103-
if ( ASWInput()->ControllerModeActiveMouse() )
104-
return;
105-
10698
if ( MarineControllingTurret() )
10799
{
108100
// accelerate up the mouse intertia

src/game/client/swarm/c_asw_buzzer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ END_RECV_TABLE()
2929
C_ASW_Buzzer::C_ASW_Buzzer()
3030
{
3131
m_pEngineSound1 = NULL;
32+
33+
// reactivedrop: workaround to fix aliens red blood
34+
// m_bloodColor is not networked
35+
// so setting SetBloodColor() on server doesn't affect client
36+
SetBloodColor( BLOOD_COLOR_GREEN );
3237
}
3338

3439
C_ASW_Buzzer::~C_ASW_Buzzer()

src/game/client/swarm/c_asw_marine_resource.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_ASW_Marine_Resource, DT_ASW_Marine_Resource, CASW_Ma
5454
RecvPropIntWithMinusOneFlag( RECVINFO( m_iScore ) ),
5555
RecvPropFloat( RECVINFO( m_flFinishedMissionTime ) ),
5656
RecvPropDataTable( RECVINFO_DT( m_EquippedItemData ), 0, &REFERENCE_RECV_TABLE( DT_RD_ItemInstances_Marine_Resource ) ),
57+
RecvPropInt( RECVINFO( m_iChallengeScratch ) ),
5758
END_RECV_TABLE();
5859

5960
extern ConVar asw_leadership_radius;
@@ -81,6 +82,7 @@ C_ASW_Marine_Resource::C_ASW_Marine_Resource()
8182
m_flFinishedMissionTime = -1;
8283
memset( m_iWeaponsInSlots, -1, sizeof( m_iWeaponsInSlots ) );
8384
memset( m_iWeaponsInSlotsLastSeen, -1, sizeof( m_iWeaponsInSlotsLastSeen ) );
85+
m_iChallengeScratch = 0;
8486
}
8587

8688
C_ASW_Marine_Resource::~C_ASW_Marine_Resource()

src/game/client/swarm/c_asw_marine_resource.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ class C_ASW_Marine_Resource : public C_BaseEntity
114114
float m_flScoreLastChanged;
115115
int m_iPrevScore;
116116
int m_iCurScore;
117+
int m_iChallengeScratch;
117118

118119
CNetworkVarEmbedded( CRD_ItemInstances_Marine_Resource, m_EquippedItemData );
119120
void ClearInvalidEquipData();
120121

121122
private:
122-
C_ASW_Marine_Resource( const C_ASW_Marine_Resource & ); // not defined, not accessible
123+
C_ASW_Marine_Resource( const C_ASW_Marine_Resource & ) = delete;
123124
};
124125

125126
#endif /* _INCLUDED_C_ASW_MARINE_RESOURCE_H */

src/game/client/swarm/c_asw_objective.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,3 @@ const char *C_ASW_Objective::GetInfoIcon( int i )
132132
}
133133
return NULL;
134134
}
135-
136-
// allows this objective to paint its status on the HUD
137-
void C_ASW_Objective::PaintObjective( float &current_y )
138-
{
139-
}

src/game/client/swarm/c_asw_objective.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ class C_ASW_Objective : public C_BaseEntity
1818
const char *GetInfoIcon( int i );
1919
const char *GetObjectiveIconName( void );
2020

21-
// allows this objective to paint its status on the HUD
22-
virtual void PaintObjective( float &current_y );
23-
2421
virtual bool IsObjectiveComplete() { return m_bComplete; }
2522
virtual bool IsObjectiveFailed() { return m_bFailed; }
2623
virtual bool IsObjectiveOptional() { return m_bOptional; }

0 commit comments

Comments
 (0)