~ares-developers/ares/gd03

« back to all changes in this revision

Viewing changes to src/Misc/Placeholders.cpp

  • Committer: Renegade
  • Date: 2010-05-29 08:12:17 UTC
  • Revision ID: git-v1:0a1bb6321f04d723afe64d1b843dc87b4da783ec
Creating /trunk/src.

git-svn-id: svn://svn.renegadeprojects.com/ares/trunk@622 859b54a9-7a54-0410-aeb3-f8d2f1fa40fd

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
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
 
6
 */
 
7
 
 
8
#if 0
 
9
#include <SpecificStructures.h>
 
10
 
 
11
/* #179 - New Upgrade System - promotions */
 
12
A_FINE_HOOK(6FA0F0, TechnoClass_Update_TurnedVeteran, 6)
 
13
{
 
14
        GET(TechnoClass *, Unit, ESI);
 
15
        bool apply_normal_logic = 1;
 
16
 
 
17
        // wraps around promotion audio effects
 
18
        return (apply_normal_logic) ? 0 : 0x6FA13E;
 
19
}
 
20
 
 
21
A_FINE_HOOK(6FA083, TechnoClass_Update_TurnedElite, 6)
 
22
{
 
23
        GET(TechnoClass *, Unit, ESI);
 
24
        bool apply_normal_logic = 1;
 
25
 
 
26
        // wraps around promotion audio effects and elite flashing
 
27
        return (apply_normal_logic) ? 0 : 0x6FA13E;
 
28
}
 
29
 
 
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)
 
33
{
 
34
        GET(BuildingClass *, Armory, EBP);
 
35
        GET(InfantryClass *, Soldier, ESI);
 
36
        return 0;
 
37
}
 
38
 
 
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)
 
43
{
 
44
        GET(UnitClass *, Vehicle, EBP);
 
45
        GET(BuildingClass *, Grinder, EBX);
 
46
        return 0;
 
47
}
 
48
 
 
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)
 
52
{
 
53
        GET(BuildingClass *, Item, ESI);
 
54
        bool apply_normal_logic = 1;
 
55
 
 
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;
 
58
}
 
59
 
 
60
A_FINE_HOOK(413FA3, AircraftClass_Init_Veterancy, 5)
 
61
{
 
62
        GET(AircraftClass *, Item, ESI);
 
63
        bool apply_normal_logic = 1;
 
64
 
 
65
        // wraps around VeteranAircraft scan
 
66
        return (apply_normal_logic) ? 0 : 0x413FD2;
 
67
}
 
68
 
 
69
A_FINE_HOOK(517CF1, InfantryClass_Init, 5)
 
70
{
 
71
        GET(InfantryClass *, Item, ESI);
 
72
        bool apply_normal_logic = 1;
 
73
 
 
74
        // wraps around VeteranInfantry and infiltrated barracks scans
 
75
        return (apply_normal_logic) ? 0 : 0x517D51;
 
76
}
 
77
 
 
78
A_FINE_HOOK(746831, UnitClass_Init, 5)
 
79
{
 
80
        GET(UnitClass *, Item, ESI);
 
81
        bool apply_normal_logic = 1;
 
82
 
 
83
        // wraps around VeteranUnits and infiltrated warfac scans
 
84
        return (apply_normal_logic) ? 0 : 0x74689B;
 
85
}
 
86
 
 
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)
 
90
{
 
91
        GET(BuildingClass *, Item, EBP);
 
92
 
 
93
        return 0;
 
94
}
 
95
 
 
96
// determining the maximum size of cloak buffers needed
 
97
A_FINE_HOOK(46546C, AllocateCloakBuffer_ToTile, 7)
 
98
{
 
99
        GET(BuildingTypeClass *, BType, EAX);
 
100
        int radius = BType->CloakRadiusInCells; // max (normal radius, deployed radius)
 
101
        R->set_EAX(radius);
 
102
        return 0x465473;
 
103
}
 
104
 
 
105
// determining radius of indicator
 
106
A_FINE_HOOK(45673E, BuildingClass_GetRangeOfRadial, 7)
 
107
{
 
108
        GET(BuildingClass *, Building, ESI);
 
109
        int radius = Building->Type->CloakRadiusInCells; // max (normal radius, deployed radius)
 
110
        R->set_EAX(radius);
 
111
        return 0x456745;
 
112
}
 
113
 
 
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
 
117
 
 
118
// structure with a PowersUnit= just came online
 
119
A_FINE_HOOK(4549D1, BuildingClass_UpdatePowered_PowersUnit_Online, A)
 
120
{
 
121
        GET(BuildingClass *, Structure, ESI);
 
122
        return 0x4549F8;
 
123
}
 
124
 
 
125
// structure with a PowersUnit= just came offline
 
126
 
 
127
A_FINE_HOOK(454B16, BuildingClass_UpdatePowered_PowersUnit_Offline, A)
 
128
{
 
129
        GET(BuildingClass *, Structure, ESI);
 
130
        return 0x454B3D;
 
131
}
 
132
 
 
133
// structure with a PowersUnit= was destroyed
 
134
A_FINE_HOOK(502645, HouseClass_RegisterTechnoLoss_PowersUnit, 6)
 
135
{
 
136
        GET(BuildingClass *, Structure, ESI);
 
137
        return 0x50277B;
 
138
}
 
139
 
 
140
// do we have powered centers for this type?
 
141
A_FINE_HOOK(50E1B0, HouseClass_HasPoweredCenters, 6)
 
142
{
 
143
        GET(HouseClass *, Owner, ECX);
 
144
        GET_STACK(TechnoTypeClass *, Type, 0x4);
 
145
 
 
146
        bool Online = 1;
 
147
 
 
148
        R->set_AL(Online);
 
149
 
 
150
        return 0x50E1BD;
 
151
}
 
152
 
 
153
/* #346 - Veterancy from MC */
 
154
A_FINE_HOOK(702FFC, TechnoClass_RegisterDestruction, 6)
 
155
{
 
156
        GET(TechnoClass *, Victim, ESI);
 
157
        GET(TechnoClass *, Killer, EDI);
 
158
        // normal veterancy has been awarded already
 
159
        return 0;
 
160
}
 
161
 
 
162
/* #347 - Power= tag on units */
 
163
A_FINE_HOOK(508D4A, HouseClass_Update_Power, 6)
 
164
{
 
165
        GET(HouseClass *, House, ESI);
 
166
        // loop over UnitClass::Array , count Power values, House->PowerOutput += x; House->PowerDrain += y;
 
167
        return 0;
 
168
}
 
169
 
 
170
/* #407 - Flash RGB */
 
171
        // if (has custom tint) currentTint |= Drawing::Color16bit(tint);
 
172
A_FINE_HOOK(73C15F, UnitClass_DrawVXL_Tint, 7)
 
173
{
 
174
        GET(UnitClass *, Item, EBP);
 
175
        DWORD currentTint = R->get_ESI();
 
176
 
 
177
        R->set_ESI(currentTint);
 
178
        return 0;
 
179
}
 
180
 
 
181
A_FINE_HOOK(43D52D, BuildingClass_Draw_Tint, 5)
 
182
{
 
183
        GET(BuildingClass *, Item, ESI);
 
184
        DWORD currentTint = R->get_EDI();
 
185
 
 
186
        R->set_EDI(currentTint);
 
187
        return 0;
 
188
}
 
189
 
 
190
 
 
191
A_FINE_HOOK(5190C5, InfantryClass_Draw_Tint, 5)
 
192
{
 
193
        GET(InfantryClass *, Item, ESI);
 
194
        DWORD currentTint = R->get_StackVar32(0x18);
 
195
 
 
196
        R->set_StackVar32(currentTint, 0x18);
 
197
        return 0;
 
198
}
 
199
 
 
200
/* #468 - Deglobalize WarpIn/Out */
 
201
A_FINE_HOOK(719439, TeleportLocomotionClass_ILocomotion_Update_1, 6)
 
202
{
 
203
        GET(LocomotionClass *, Loco, ESI);
 
204
        AnimTypeClass *Anim = NULL;
 
205
        // WarpOut
 
206
        R->set_EDX((DWORD)Anim);
 
207
        return 0x71943F;
 
208
}
 
209
 
 
210
A_FINE_HOOK(719788, TeleportLocomotionClass_ILocomotion_Update_2, 6)
 
211
{
 
212
        GET(LocomotionClass *, Loco, ESI);
 
213
        AnimTypeClass *Anim = NULL;
 
214
        // WarpIn
 
215
        R->set_EDX((DWORD)Anim);
 
216
        return 0x71978E;
 
217
}
 
218
 
 
219
A_FINE_HOOK(71986A, TeleportLocomotionClass_ILocomotion_Update_3, 6)
 
220
{
 
221
        GET(LocomotionClass *, Loco, ESI);
 
222
        AnimTypeClass *Anim = NULL;
 
223
        // WarpOut again
 
224
        R->set_ECX((DWORD)Anim);
 
225
        return 0x719870;
 
226
}
 
227
 
 
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
 
231
        /*
 
232
        if(!ObjType->ArcticArtInUse) {
 
233
                char buffer[0x19];
 
234
                sprintf(buffer, "%s%s", ObjType->ImageFile, custom extension);
 
235
                strcpy(ObjType->ImageFile, buffer);
 
236
                ObjType->ArcticArtInUse = 1;
 
237
        }
 
238
         */
 
239
 
 
240
 
 
241
// for SHPs
 
242
A_FINE_HOOK(5F907A, ObjectTypeClass_Load2DArt, 6)
 
243
{
 
244
        GET(ObjectTypeClass *, ObjType, EBP);
 
245
 
 
246
        return 0x5F9119;
 
247
}
 
248
 
 
249
 
 
250
A_FINE_HOOK(5F811E, ObjectTypeClass_Load3DArt, 6)
 
251
{
 
252
        GET(ObjectTypeClass *, ObjType, ESI);
 
253
 
 
254
        return 0;
 
255
}
 
256
 
 
257
/* #594 - Custom IFV Names */
 
258
A_FINE_HOOK(746BCB, UnitClass_GetUIName, 4)
 
259
{
 
260
        GET(UnitClass *, Unit, ESI);
 
261
        GET(InfantryClass *, Gunner, EDI);
 
262
        GET(int, ActiveTurretIndex, EAX);
 
263
/*
 
264
        if(have custom name) {
 
265
                Unit->set_ToolTipText(some_custom_text);
 
266
                R->set_EAX((DWORD)Unit->get_ToolTipText());
 
267
                return 0x746C76;
 
268
        }
 
269
        return ActiveTurretIndex ? 0x746BE7 : 0x746BCF;
 
270
*/
 
271
}
 
272
 
 
273
/* #453 - crate logic */
 
274
// see http://forums.renegadeprojects.com/showthread.php?tid=1128
 
275
 
 
276
// replaces crate result if , i.e. an Elite unit finds a veterancy crate
 
277
A_FINE_HOOK(481B22, CellClass_CrateBeingCollected_Part1_Overrides, 5)
 
278
{
 
279
        GET(ePowerup, RandomPowerup, EBX);
 
280
        GET(CellClass *, pThis, ESI);
 
281
        bool Handled = 0;
 
282
        return Handled ? 0x481D86 : 0;
 
283
}
 
284
 
 
285
A_FINE_HOOK(481DB8, CellClass_CrateBeingCollected_Part2_ActualEffects, 5)
 
286
{
 
287
        GET(ePowerup, RandomPowerup, EBX);
 
288
        GET(CellClass *, pThis, ESI);
 
289
        bool Handled = 0;
 
290
        return Handled ? 0x483389 : 0;
 
291
}
 
292
 
 
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
 
300
 * */
 
301
A_FINE_HOOK(5F7641, ObjectTypeClass_GetFoundationData, 6)
 
302
{
 
303
        CellStruct *StubFoundation = (CellStruct *)0xAC1438;
 
304
        CellStruct *TestFoundation = (CellStruct *)0x89C978;
 
305
        GET_STACK(ObjectTypeClass *, ObjType, 0x0);
 
306
 
 
307
        if(ObjType && ObjType->WhatAmI() == abs_UnitType && strcmp(ObjType->ID, "MTNK") == 0) {
 
308
                Debug::Log("EHLO\n");
 
309
                R->EAX<CellStruct *>(TestFoundation);
 
310
                return 0x5F7697;
 
311
        } else {
 
312
                R->EAX<CellStruct *>(StubFoundation);
 
313
                return 0;
 
314
        }
 
315
}
 
316
#endif