Skip to content

Commit 2db1ffb

Browse files
committed
Post 2.8 clarity
- Due to buggy behaviour, disable l4d_predict_tank_glow (for now?) - Added missing include for l4d_predict_tank_glow
1 parent 672d067 commit 2db1ffb

7 files changed

Lines changed: 158 additions & 12 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#if defined _TANKGLOW_DEFINES_included
2+
#endinput
3+
#endif
4+
#define _TANKGLOW_DEFINES_included
5+
6+
#define KEY_THEESCAPEROUTE "TheEscapeRoute"
7+
#define KEY_GETPOSITIONONPATH "CEscapeRoute::GetPositionOnPath"
8+
#define KEY_ISSPACEFORZOMBIEHERE "ZombieManager::IsSpaceForZombieHere"
9+
#define KEY_GETNEXTESCAPESTEP "TerrorNavArea::GetNextEscapeStep"
10+
#define KEY_ISVALIDFORWANDERINGPOPULATION "TerrorNavArea::IsValidForWanderingPopulation"
11+
#define KEY_m_vecCenter "CNavArea::m_vecCenter"
12+
#define KEY_m_bIsUnderwater "TerrorNavArea::m_bIsUnderwater"
13+
#define KEY_m_activeSurvivors "TerrorNavArea::m_activeSurvivors"
14+
#define KEY_m_connect "CNavArea::m_connect"
15+
16+
static Handle
17+
s_hSDKCall_GetPositionOnPath,
18+
s_hSDKCall_IsSpaceForZombieHere,
19+
s_hSDKCall_GetNextEscapeStep,
20+
s_hSDKCall_IsValidForWanderingPopulation;
21+
22+
static Address
23+
s_addr_TheEscapeRoute;
24+
25+
static int
26+
s_iOffs_m_vecCenter,
27+
s_iOffs_m_bIsUnderwater,
28+
s_iOffs_m_activeSurvivors/*,
29+
s_iOffs_m_connect*/;
30+
31+
methodmap CEscapeRoute
32+
{
33+
public void GetPositionOnPath(float flow, float vPos[3]) {
34+
SDKCall(s_hSDKCall_GetPositionOnPath, this, flow, vPos);
35+
}
36+
}
37+
38+
CEscapeRoute TheEscapeRoute()
39+
{
40+
return view_as<CEscapeRoute>(LoadFromAddress(s_addr_TheEscapeRoute, NumberType_Int32));
41+
}
42+
43+
/*methodmap NavConnectVector
44+
{
45+
public TerrorNavArea Element(int i) {
46+
return LoadFromAddress(this.m_pData + view_as<Address>(8 * i + 4), NumberType_Int32);
47+
}
48+
public int Count() {
49+
return LoadFromAddress(this.m_pData, NumberType_Int32);
50+
}
51+
property Address m_pData {
52+
public get() { return LoadFromAddress(view_as<Address>(this), NumberType_Int32); }
53+
}
54+
}*/
55+
56+
methodmap TerrorNavArea
57+
{
58+
public TerrorNavArea(float vPos[3]) {
59+
return view_as<TerrorNavArea>(L4D2Direct_GetTerrorNavArea(vPos, 120.0));
60+
}
61+
public TerrorNavArea GetNextEscapeStep(int &traverse_type = 0) {
62+
return SDKCall(s_hSDKCall_GetNextEscapeStep, this, traverse_type);
63+
}
64+
public bool IsValidForWanderingPopulation() {
65+
return SDKCall(s_hSDKCall_IsValidForWanderingPopulation, this);
66+
}
67+
public void GetCenter(float vec[3]) {
68+
vec[0] = LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_vecCenter), NumberType_Int32);
69+
vec[1] = LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_vecCenter + 4), NumberType_Int32);
70+
vec[2] = LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_vecCenter + 8), NumberType_Int32);
71+
}
72+
property bool m_isUnderwater {
73+
public get() { return !!LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_bIsUnderwater), NumberType_Int8); }
74+
}
75+
property int m_activeSurvivors {
76+
public get() { return LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_activeSurvivors), NumberType_Int8); }
77+
}
78+
/*public NavConnectVector GetConnectVector(int dir) {
79+
if (g_bLeft4Dead2) {
80+
return LoadFromAddress(view_as<Address>(this) + view_as<Address>(s_iOffs_m_connect + 4 * dir), NumberType_Int32);
81+
}
82+
}*/
83+
}
84+
#define NULL_NAV_AREA view_as<TerrorNavArea>(0)
85+
86+
methodmap CZombieManager
87+
{
88+
public bool IsSpaceForZombieHere(const float vPos[3]) {
89+
return SDKCall(s_hSDKCall_IsSpaceForZombieHere, L4D_GetPointer(POINTER_ZOMBIEMANAGER), vPos);
90+
}
91+
}
92+
93+
void LoadSDK()
94+
{
95+
Handle conf = LoadGameConfigFile(GAMEDATA_FILE);
96+
if (!conf)
97+
SetFailState("Missing gamedata \""...GAMEDATA_FILE..."\"");
98+
99+
StartPrepSDKCall(SDKCall_Raw);
100+
if (!PrepSDKCall_SetFromConf(conf, SDKConf_Signature, KEY_GETPOSITIONONPATH))
101+
SetFailState("Missing signature "...KEY_GETPOSITIONONPATH..."");
102+
PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain);
103+
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef, _, VENCODE_FLAG_COPYBACK);
104+
s_hSDKCall_GetPositionOnPath = EndPrepSDKCall();
105+
if (s_hSDKCall_GetPositionOnPath == null)
106+
SetFailState("Failed to prepare SDKCall for \""...KEY_GETPOSITIONONPATH..."\"");
107+
108+
StartPrepSDKCall(SDKCall_Raw);
109+
if (!PrepSDKCall_SetFromConf(conf, SDKConf_Signature, KEY_ISVALIDFORWANDERINGPOPULATION))
110+
SetFailState("Missing signature "...KEY_ISVALIDFORWANDERINGPOPULATION..."");
111+
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_Plain);
112+
s_hSDKCall_IsValidForWanderingPopulation = EndPrepSDKCall();
113+
if (s_hSDKCall_IsValidForWanderingPopulation == null)
114+
SetFailState("Failed to prepare SDKCall for \""...KEY_ISVALIDFORWANDERINGPOPULATION..."\"");
115+
116+
StartPrepSDKCall(SDKCall_Raw);
117+
if (!PrepSDKCall_SetFromConf(conf, SDKConf_Signature, KEY_ISSPACEFORZOMBIEHERE))
118+
SetFailState("Missing signature "...KEY_ISSPACEFORZOMBIEHERE..."");
119+
PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
120+
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_Plain);
121+
s_hSDKCall_IsSpaceForZombieHere = EndPrepSDKCall();
122+
if (s_hSDKCall_IsSpaceForZombieHere == null)
123+
SetFailState("Failed to prepare SDKCall for \""...KEY_ISSPACEFORZOMBIEHERE..."\"");
124+
125+
StartPrepSDKCall(SDKCall_Raw);
126+
if (!PrepSDKCall_SetFromConf(conf, SDKConf_Signature, KEY_GETNEXTESCAPESTEP))
127+
SetFailState("Missing signature "...KEY_GETNEXTESCAPESTEP..."");
128+
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer, VDECODE_FLAG_ALLOWNULL);
129+
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
130+
s_hSDKCall_GetNextEscapeStep = EndPrepSDKCall();
131+
if (s_hSDKCall_GetNextEscapeStep == null)
132+
SetFailState("Failed to prepare SDKCall for \""...KEY_GETNEXTESCAPESTEP..."\"");
133+
134+
s_addr_TheEscapeRoute = GameConfGetAddress(conf, KEY_THEESCAPEROUTE);
135+
if (s_addr_TheEscapeRoute == Address_Null)
136+
SetFailState("Missing address \""...KEY_THEESCAPEROUTE..."\"");
137+
138+
s_iOffs_m_vecCenter = GameConfGetOffset(conf, KEY_m_vecCenter);
139+
if (s_iOffs_m_vecCenter == -1)
140+
SetFailState("Missing offset \""...KEY_m_vecCenter..."\"");
141+
142+
s_iOffs_m_bIsUnderwater = GameConfGetOffset(conf, KEY_m_bIsUnderwater);
143+
if (s_iOffs_m_bIsUnderwater == -1)
144+
SetFailState("Missing offset \""...KEY_m_bIsUnderwater..."\"");
145+
146+
s_iOffs_m_activeSurvivors = GameConfGetOffset(conf, KEY_m_activeSurvivors);
147+
if (s_iOffs_m_activeSurvivors == -1)
148+
SetFailState("Missing offset \""...KEY_m_activeSurvivors..."\"");
149+
150+
/*if (g_bLeft4Dead2)
151+
{
152+
s_iOffs_m_connect = GameConfGetOffset(conf, KEY_m_connect);
153+
if (s_iOffs_m_connect == -1)
154+
SetFailState("Missing offset \""...KEY_m_connect..."\"");
155+
}*/
156+
157+
delete conf;
158+
}

cfg/cfgogl/zonehunters/shared_plugins.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ sm plugins load optional/l4d_tank_rush.smx
9595
sm plugins load optional/noteam_nudging.smx
9696
sm plugins load optional/l4d2_tank_horde_monitor.smx
9797
sm plugins load optional/staggersolver.smx
98-
sm plugins load optional/l4d_predict_tank_glow.smx
9998

10099
//----------------------
101100
// ZoneHunters

cfg/cfgogl/zonehunters/shared_settings.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ confogl_addcvar l4d2_tank_prop_glow_only 0
3737
confogl_addcvar l4d2_tank_prop_glow_spectators 1
3838
confogl_addcvar l4d2_tank_prop_dissapear_time 10.0
3939

40-
// [l4d_predict_tank_glow.smx]
41-
confogl_addcvar l4d_predict_glow_tp 1 // Teleports tank to glow position for consistency
42-
4340
// [l4d2_sound_manipulation.smx]
4441
confogl_addcvar sound_flags 7
4542

cfg/cfgogl/zonemod/shared_plugins.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ sm plugins load optional/charger_incap_damage.smx
107107
sm plugins load optional/l4d2_steady_boost.smx
108108
sm plugins load optional/staggersolver.smx
109109
sm plugins load optional/l4d2_nobackjumps.smx
110-
sm plugins load optional/l4d_predict_tank_glow.smx
111110

112111
//----------------------
113112
// Static shotgun spread

cfg/cfgogl/zonemod/shared_settings.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ confogl_addcvar l4d2_steady_boost_flags 2 // Infected only
1818
confogl_addcvar l4d2_ghost_warp_flag 1 // Enable ghost warp with command only 'sm_warp'
1919
confogl_addcvar l4d2_ghost_warp_delay 0.45
2020

21-
// [l4d_predict_tank_glow.smx]
22-
confogl_addcvar l4d_predict_glow_tp 1 // Teleports tank to glow position for consistency
23-
2421
// [l4d_static_punch_getup.smx]
2522
confogl_addcvar tank_punch_getup_scale 0.5 // 54 frames / 30 fps * 0.5 = 0.9s
2623

cfg/cfgogl/zoneretro/shared_plugins.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ sm plugins load optional/l4d2_dominatorscontrol.smx
9898
sm plugins load optional/noteam_nudging.smx
9999
sm plugins load optional/l4d2_tank_horde_monitor.smx
100100
sm plugins load optional/staggersolver.smx
101-
sm plugins load optional/l4d_predict_tank_glow.smx
102101

103102
//----------------------
104103
// Static shotgun spread

cfg/cfgogl/zoneretro/shared_settings.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ confogl_addcvar l4d2_tank_prop_glow_only 0
3838
confogl_addcvar l4d2_tank_prop_glow_spectators 1
3939
confogl_addcvar l4d2_tank_prop_dissapear_time 10.0
4040

41-
// [l4d_predict_tank_glow.smx]
42-
confogl_addcvar l4d_predict_glow_tp 1 // Teleports tank to glow position for consistency
43-
4441
// [l4d2_sound_manipulation.smx]
4542
confogl_addcvar sound_flags 7
4643

0 commit comments

Comments
 (0)