2
* this file contains placeholder hooks for certain features so that C++ coders can implement them without any ASM issues
3
* when you implement a feature, please move the hook from this file to wherever it's appropriate
4
* (that would be where the rest of the implementation is, consult the project leaders if you're not sure)
5
* do not simply move it outside this if0/endif block
9
#include <SpecificStructures.h>
11
/* #179 - New Upgrade System - promotions */
12
A_FINE_HOOK(6FA0F0, TechnoClass_Update_TurnedVeteran, 6)
14
GET(TechnoClass *, Unit, ESI);
15
bool apply_normal_logic = 1;
17
// wraps around promotion audio effects
18
return (apply_normal_logic) ? 0 : 0x6FA13E;
21
A_FINE_HOOK(6FA083, TechnoClass_Update_TurnedElite, 6)
23
GET(TechnoClass *, Unit, ESI);
24
bool apply_normal_logic = 1;
26
// wraps around promotion audio effects and elite flashing
27
return (apply_normal_logic) ? 0 : 0x6FA13E;
30
/* #306 - infantry exits armory after being promoted */
31
// note: a hook to say "can't enter armory" will come later
32
A_FINE_HOOK(44BB3C, BuildingClass_Mi_Repair, 6)
34
GET(BuildingClass *, Armory, EBP);
35
GET(InfantryClass *, Soldier, ESI);
39
/* #368 - vehicle enters a grinder */
40
// passengers have already been paid for and erased, same for parasite
41
// the unit itself has also been paid for
42
A_FINE_HOOK(73A1BC, UnitClass_UpdatePosition, 7)
44
GET(UnitClass *, Vehicle, EBP);
45
GET(BuildingClass *, Grinder, EBX);
49
/* #320 - objects are being instantiated (See also fix #277 in Bugfixes.cpp) */
50
/* #183 - cloakable on Buildings and Aircraft */
51
A_FINE_HOOK(442CE0, BuildingClass_Init_Veterancy, 6)
53
GET(BuildingClass *, Item, ESI);
54
bool apply_normal_logic = 1;
56
// wraps around the scanning for infiltrated warfactory, which should make this veteran if it's trainable and can UndeploysInto= something
57
return (apply_normal_logic) ? 0 : 0x442D1B;
60
A_FINE_HOOK(413FA3, AircraftClass_Init_Veterancy, 5)
62
GET(AircraftClass *, Item, ESI);
63
bool apply_normal_logic = 1;
65
// wraps around VeteranAircraft scan
66
return (apply_normal_logic) ? 0 : 0x413FD2;
69
A_FINE_HOOK(517CF1, InfantryClass_Init, 5)
71
GET(InfantryClass *, Item, ESI);
72
bool apply_normal_logic = 1;
74
// wraps around VeteranInfantry and infiltrated barracks scans
75
return (apply_normal_logic) ? 0 : 0x517D51;
78
A_FINE_HOOK(746831, UnitClass_Init, 5)
80
GET(UnitClass *, Item, ESI);
81
bool apply_normal_logic = 1;
83
// wraps around VeteranUnits and infiltrated warfac scans
84
return (apply_normal_logic) ? 0 : 0x74689B;
87
/* #283 - overpowerable cloak generators */
88
// DO NOT USE YET - the ranges are only updated when building is placed/removed, needs updating on deploy as well
89
A_FINE_HOOK(44E29D, BuildingClass_Unload, 6)
91
GET(BuildingClass *, Item, EBP);
96
// determining the maximum size of cloak buffers needed
97
A_FINE_HOOK(46546C, AllocateCloakBuffer_ToTile, 7)
99
GET(BuildingTypeClass *, BType, EAX);
100
int radius = BType->CloakRadiusInCells; // max (normal radius, deployed radius)
105
// determining radius of indicator
106
A_FINE_HOOK(45673E, BuildingClass_GetRangeOfRadial, 7)
108
GET(BuildingClass *, Building, ESI);
109
int radius = Building->Type->CloakRadiusInCells; // max (normal radius, deployed radius)
114
/* #617 - robot control centers */
115
// hook also into technoclass::ctor/dtor to update power requirements, or use the hook for #347 below
116
// don't forget RegisteredAsPoweredUnitSource
118
// structure with a PowersUnit= just came online
119
A_FINE_HOOK(4549D1, BuildingClass_UpdatePowered_PowersUnit_Online, A)
121
GET(BuildingClass *, Structure, ESI);
125
// structure with a PowersUnit= just came offline
127
A_FINE_HOOK(454B16, BuildingClass_UpdatePowered_PowersUnit_Offline, A)
129
GET(BuildingClass *, Structure, ESI);
133
// structure with a PowersUnit= was destroyed
134
A_FINE_HOOK(502645, HouseClass_RegisterTechnoLoss_PowersUnit, 6)
136
GET(BuildingClass *, Structure, ESI);
140
// do we have powered centers for this type?
141
A_FINE_HOOK(50E1B0, HouseClass_HasPoweredCenters, 6)
143
GET(HouseClass *, Owner, ECX);
144
GET_STACK(TechnoTypeClass *, Type, 0x4);
153
/* #346 - Veterancy from MC */
154
A_FINE_HOOK(702FFC, TechnoClass_RegisterDestruction, 6)
156
GET(TechnoClass *, Victim, ESI);
157
GET(TechnoClass *, Killer, EDI);
158
// normal veterancy has been awarded already
162
/* #347 - Power= tag on units */
163
A_FINE_HOOK(508D4A, HouseClass_Update_Power, 6)
165
GET(HouseClass *, House, ESI);
166
// loop over UnitClass::Array , count Power values, House->PowerOutput += x; House->PowerDrain += y;
170
/* #407 - Flash RGB */
171
// if (has custom tint) currentTint |= Drawing::Color16bit(tint);
172
A_FINE_HOOK(73C15F, UnitClass_DrawVXL_Tint, 7)
174
GET(UnitClass *, Item, EBP);
175
DWORD currentTint = R->get_ESI();
177
R->set_ESI(currentTint);
181
A_FINE_HOOK(43D52D, BuildingClass_Draw_Tint, 5)
183
GET(BuildingClass *, Item, ESI);
184
DWORD currentTint = R->get_EDI();
186
R->set_EDI(currentTint);
191
A_FINE_HOOK(5190C5, InfantryClass_Draw_Tint, 5)
193
GET(InfantryClass *, Item, ESI);
194
DWORD currentTint = R->get_StackVar32(0x18);
196
R->set_StackVar32(currentTint, 0x18);
200
/* #468 - Deglobalize WarpIn/Out */
201
A_FINE_HOOK(719439, TeleportLocomotionClass_ILocomotion_Update_1, 6)
203
GET(LocomotionClass *, Loco, ESI);
204
AnimTypeClass *Anim = NULL;
206
R->set_EDX((DWORD)Anim);
210
A_FINE_HOOK(719788, TeleportLocomotionClass_ILocomotion_Update_2, 6)
212
GET(LocomotionClass *, Loco, ESI);
213
AnimTypeClass *Anim = NULL;
215
R->set_EDX((DWORD)Anim);
219
A_FINE_HOOK(71986A, TeleportLocomotionClass_ILocomotion_Update_3, 6)
221
GET(LocomotionClass *, Loco, ESI);
222
AnimTypeClass *Anim = NULL;
224
R->set_ECX((DWORD)Anim);
228
/* #599 - new alternate arts */
229
// sprintf newly formed file basename back into ObjectType::ImageFile
230
// might need a different method for VXL to avoid duplicating all related files
232
if(!ObjType->ArcticArtInUse) {
234
sprintf(buffer, "%s%s", ObjType->ImageFile, custom extension);
235
strcpy(ObjType->ImageFile, buffer);
236
ObjType->ArcticArtInUse = 1;
242
A_FINE_HOOK(5F907A, ObjectTypeClass_Load2DArt, 6)
244
GET(ObjectTypeClass *, ObjType, EBP);
250
A_FINE_HOOK(5F811E, ObjectTypeClass_Load3DArt, 6)
252
GET(ObjectTypeClass *, ObjType, ESI);
257
/* #594 - Custom IFV Names */
258
A_FINE_HOOK(746BCB, UnitClass_GetUIName, 4)
260
GET(UnitClass *, Unit, ESI);
261
GET(InfantryClass *, Gunner, EDI);
262
GET(int, ActiveTurretIndex, EAX);
264
if(have custom name) {
265
Unit->set_ToolTipText(some_custom_text);
266
R->set_EAX((DWORD)Unit->get_ToolTipText());
269
return ActiveTurretIndex ? 0x746BE7 : 0x746BCF;
273
/* #453 - crate logic */
274
// see http://forums.renegadeprojects.com/showthread.php?tid=1128
276
// replaces crate result if , i.e. an Elite unit finds a veterancy crate
277
A_FINE_HOOK(481B22, CellClass_CrateBeingCollected_Part1_Overrides, 5)
279
GET(ePowerup, RandomPowerup, EBX);
280
GET(CellClass *, pThis, ESI);
282
return Handled ? 0x481D86 : 0;
285
A_FINE_HOOK(481DB8, CellClass_CrateBeingCollected_Part2_ActualEffects, 5)
287
GET(ePowerup, RandomPowerup, EBX);
288
GET(CellClass *, pThis, ESI);
290
return Handled ? 0x483389 : 0;
293
/* outrageously delicious
294
* start for multicell units
295
* marks cells as occupied, mouseover events work
296
* pathfinding of other units around this one works
297
* pathfinding of this unit around others doesn't
298
* click target becomes {0, 0} and unit disregards its own child cells when pathfinding
299
* so can park {0, 0} next to a structure, then {1, 0} ends up inside said structure and unit explodes upon stopping
301
A_FINE_HOOK(5F7641, ObjectTypeClass_GetFoundationData, 6)
303
CellStruct *StubFoundation = (CellStruct *)0xAC1438;
304
CellStruct *TestFoundation = (CellStruct *)0x89C978;
305
GET_STACK(ObjectTypeClass *, ObjType, 0x0);
307
if(ObjType && ObjType->WhatAmI() == abs_UnitType && strcmp(ObjType->ID, "MTNK") == 0) {
308
Debug::Log("EHLO\n");
309
R->EAX<CellStruct *>(TestFoundation);
312
R->EAX<CellStruct *>(StubFoundation);