1 | #include <string.h>
|
---|
2 | #include "bool.h"
|
---|
3 | #include <math.h>
|
---|
4 | #include "Oni.h"
|
---|
5 | #include "Oni_Character.h"
|
---|
6 |
|
---|
7 | #include "_Version.h"
|
---|
8 |
|
---|
9 | #include "Daodan.h"
|
---|
10 | #include "Daodan_Cheater.h"
|
---|
11 | union MSVC_EVIL_FLOAT_HACK
|
---|
12 | {
|
---|
13 | unsigned __int8 Bytes[4];
|
---|
14 | float Value;
|
---|
15 | };
|
---|
16 | static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
|
---|
17 | #define DD_INFINITY (INFINITY_HACK.Value)
|
---|
18 |
|
---|
19 | oniCheatCode DDr_CheatTable[] = {
|
---|
20 | { "shapeshifter", "Change Characters Enabled", "Change Characters Disabled", cheat_shapeshifter },
|
---|
21 | { "liveforever", "Invincibility Enabled", "Invincibility Disabled", cheat_liveforever },
|
---|
22 | { "touchofdeath", "Omnipotence Enabled", "Omnipotence Disabled", cheat_touchofdeath },
|
---|
23 | { "canttouchthis", "Unstoppable Enabled", "Unstoppable Disabled", cheat_canttouchthis },
|
---|
24 | { "fatloot", "Fat Loot Received", NULL, cheat_fatloot },
|
---|
25 | { "glassworld", "Glass Furniture Enabled", "Glass Furniture Disabled", cheat_glassworld },
|
---|
26 | { "winlevel", "Instantly Win Level", NULL, cheat_winlevel },
|
---|
27 | { "loselevel", "Instantly Lose Level", NULL, cheat_loselevel },
|
---|
28 | { "bighead", "Big Head Enabled", "Big Head Disabled", cheat_bighead },
|
---|
29 | { "minime", "Mini Mode Enabled", "Mini Mode Disabled", cheat_minime },
|
---|
30 | { "superammo", "Super Ammo Mode Enabled", "Super Ammo Mode Disabled", cheat_superammo },
|
---|
31 | { "thedayismine", "Developer Access Enabled", "Developer Access Disabled", cheat_thedayismine },
|
---|
32 | { "reservoirdogs", "Last Man Standing Enabled", "Last Man Standing Disabled", cheat_reservoirdogs },
|
---|
33 | { "roughjustice", "Gatling Guns Enabled", "Gatling Guns Disabled", cheat_roughjustice },
|
---|
34 | { "chenille", "Daodan Power Enabled", "Daodan Power Disabled", cheat_chenille },
|
---|
35 | { "behemoth", "Godzilla Mode Enabled", "Godzilla Mode Disabled", cheat_behemoth },
|
---|
36 | { "elderrune", "Regeneration Enabled", "Regeneration Disabled", cheat_elderrune },
|
---|
37 | { "moonshadow", "Phase Cloak Enabled", "Phase Cloak Disabled", cheat_moonshadow },
|
---|
38 | { "munitionfrenzy", "Weapons Locker Created", NULL, cheat_munitionfrenzy },
|
---|
39 | { "fistsoflegend", "Fists Of Legend Enabled", "Fists Of Legend Disabled", cheat_fistsoflegend },
|
---|
40 | { "killmequick", "Ultra Mode Enabled", "Ultra Mode Disabled", cheat_killmequick },
|
---|
41 | { "carousel", "Slow Motion Enabled", "Slow Motion Disabled", cheat_carousel },
|
---|
42 | { "bigbadboss", "Boss Shield Enabled", "Boss Shield Disabled", cheat_bigbadboss },
|
---|
43 | { "bulletproof", "Force Field Enabled", "Force Field Disabled", cheat_bulletproof },
|
---|
44 | { "kangaroo", "Alex Okita Mode Enabled", "Alex Okita Mode Disabled", cheat_kangaroo },
|
---|
45 | { "himynameisalex", "Kangaroo Jump Enabled", "Kangaroo Jump Disabled", cheat_kangaroo },
|
---|
46 | { "marypoppins", "Jet Pack Mode Enabled", "Jet Pack Mode Disabled", cheat_marypoppins },
|
---|
47 | { "buddha", "Unkillable Enabled", "Unkillable Disabled", cheat_buddha },
|
---|
48 | { "shinobi", "Ninja Mode Enabled (good luck!)", "Ninja Mode Disabled", cheat_shinobi },
|
---|
49 | { "x", "Developer Access Enabled", "Developer Access Disabled", cheat_x },
|
---|
50 | { "testcheat", "Testing...", "", cheat_testcheat },
|
---|
51 | { "tellmetheversion", "Daodan v."DAODAN_VERSION_STRING"", "", cheat_tellmetheversion },
|
---|
52 | {0, 0, 0, 0}
|
---|
53 | };
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 | // Just copied all these defines from the old daodan, they were originaly from SFeLi's code.
|
---|
58 |
|
---|
59 | #define GSA_camera (0x00000080)
|
---|
60 | #define GSA_player (0x000000AC)
|
---|
61 | #define GSA_carousel (0x00000104) /* char */
|
---|
62 | #define GSA_slowmotimer (0x00000108)
|
---|
63 | #define GSA_splashscreen (0x00000118) /* char */
|
---|
64 |
|
---|
65 | #define CHR_flags (0x00000004)
|
---|
66 | #define CHR_flags2 (0x00000008)
|
---|
67 | #define CHR_oncc (0x0000000C)
|
---|
68 | #define CHR_team (0x00000012) /* short */
|
---|
69 | #define CHR_name (0x00000014) /* char[32] */
|
---|
70 | #define CHR_scalemodel (0x00000034)
|
---|
71 | #define CHR_weapon1 (0x00000194)
|
---|
72 | #define CHR_weapon2 (0x00000198)
|
---|
73 | #define CHR_weapon3 (0x0000019C)
|
---|
74 | #define CHR_shield_curr (0x000001B6) /* short */
|
---|
75 | #define CHR_shield (0x000001B8) /* short */
|
---|
76 | #define CHR_phasecloak (0x000001BA) /* short */
|
---|
77 | #define CHR_stats_kills (0x00001670)
|
---|
78 | #define CHR_stats_damage (0x00001674)
|
---|
79 |
|
---|
80 | #define ONCC_jet_accel (0x00000010) /* float */
|
---|
81 | #define ONCC_jet_timer (0x00000016) /* short */
|
---|
82 | #define ONCC_height1 (0x00000018) /* float */
|
---|
83 | #define ONCC_height2 (0x0000001C) /* float */
|
---|
84 | #define ONCC_bodysize_min (0x00000C58) /* float */
|
---|
85 | #define ONCC_bodysize_max (0x00000C8C) /* float */
|
---|
86 |
|
---|
87 | #define kangaroo_h (short)(60)
|
---|
88 | #define kangaroo_jp (float)(0.06)
|
---|
89 | #define marypoppins_jp (float)(0.14)
|
---|
90 |
|
---|
91 | uint16_t cheat_oldshield = 0;
|
---|
92 | int32_t cheat_oldhealth = 1;
|
---|
93 | int32_t cheat_oldmaxhealth = 1;
|
---|
94 | float cheat_oldjet_accel = 0.03f;
|
---|
95 | uint16_t cheat_oldjet_timer = 20;
|
---|
96 | float cheat_oldheight1 = 45;
|
---|
97 | float cheat_oldheight2 = 135;
|
---|
98 | bool inc_fallingframes = true;
|
---|
99 | extern bool patch_bsl;
|
---|
100 | uint8_t ONICALL DDrCheater(uint32_t cheat)
|
---|
101 | {
|
---|
102 | switch (cheat)
|
---|
103 | {
|
---|
104 | case cheat_bigbadboss:
|
---|
105 | {
|
---|
106 | Character* player = ONgGameState->PlayerCharacter;
|
---|
107 | //char* player = *((char**)(ONgGameState + GSA_player));
|
---|
108 | if (player->Flags & chr_bossshield)
|
---|
109 | {
|
---|
110 | player->Flags = player->Flags & ~chr_bossshield;
|
---|
111 | return 0;
|
---|
112 | }
|
---|
113 | else
|
---|
114 | {
|
---|
115 | player->Flags = player->Flags | chr_bossshield;
|
---|
116 | return 1;
|
---|
117 | }
|
---|
118 | }
|
---|
119 | case cheat_bulletproof:
|
---|
120 | {
|
---|
121 | Character* player = ONgGameState->PlayerCharacter;
|
---|
122 | if (player->Flags & chr_weaponimmune)
|
---|
123 | {
|
---|
124 | player->Flags = player->Flags & ~chr_weaponimmune;
|
---|
125 | player->Inventory.ShieldUsed = cheat_oldshield;
|
---|
126 | return 0;
|
---|
127 | }
|
---|
128 | else
|
---|
129 | {
|
---|
130 | player->Flags |= chr_weaponimmune;
|
---|
131 | cheat_oldshield = player->Inventory.ShieldUsed;
|
---|
132 | player->Inventory.ShieldUsed = 100;
|
---|
133 | return 1;
|
---|
134 | }
|
---|
135 | }
|
---|
136 | case cheat_kangaroo:
|
---|
137 | {
|
---|
138 | Character* player = ONgGameState->PlayerCharacter;
|
---|
139 | //char* oncc = *(char**)(player + CHR_oncc);
|
---|
140 | if (!inc_fallingframes)
|
---|
141 | inc_fallingframes = true;
|
---|
142 | if (player->ONCC->JetpackTimer == kangaroo_h)
|
---|
143 | {
|
---|
144 | player->ONCC->JumpAcceleration = cheat_oldjet_accel;
|
---|
145 | player->ONCC->JetpackTimer = cheat_oldjet_timer;
|
---|
146 | player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1;
|
---|
147 | player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2;
|
---|
148 | return 0;
|
---|
149 | }
|
---|
150 | else if ((unsigned short)player->ONCC->JetpackTimer == 0xFFFF)
|
---|
151 | {
|
---|
152 | player->ONCC->JumpAcceleration = kangaroo_jp;
|
---|
153 | player->ONCC->JetpackTimer = kangaroo_h;
|
---|
154 | player->ONCC->MaxFallingHeightWithoutDamage = DD_INFINITY;
|
---|
155 | player->ONCC->MaxFallingHeightWithDamage = DD_INFINITY;
|
---|
156 | return 1;
|
---|
157 | }
|
---|
158 | else
|
---|
159 | {
|
---|
160 | cheat_oldjet_accel = player->ONCC->JumpAcceleration;
|
---|
161 | cheat_oldjet_timer = player->ONCC->JetpackTimer;
|
---|
162 | cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage ;
|
---|
163 | cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage;
|
---|
164 | player->ONCC->JumpAcceleration = kangaroo_jp;
|
---|
165 | player->ONCC->JetpackTimer = kangaroo_h;
|
---|
166 | player->ONCC->MaxFallingHeightWithoutDamage = DD_INFINITY;
|
---|
167 | player->ONCC->MaxFallingHeightWithDamage = DD_INFINITY;
|
---|
168 | return 1;
|
---|
169 | }
|
---|
170 | }
|
---|
171 | case cheat_marypoppins:
|
---|
172 | {
|
---|
173 | Character* player = ONgGameState->PlayerCharacter;
|
---|
174 | if (!inc_fallingframes)
|
---|
175 | {
|
---|
176 | inc_fallingframes = true;
|
---|
177 | if ((unsigned short)player->ONCC->JetpackTimer == 0xFFFF)
|
---|
178 | {
|
---|
179 | player->ONCC->JumpAcceleration = cheat_oldjet_accel;
|
---|
180 | player->ONCC->JetpackTimer = cheat_oldjet_timer;
|
---|
181 | player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1;
|
---|
182 | player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2;
|
---|
183 | }
|
---|
184 | return 0;
|
---|
185 | }
|
---|
186 | else if (player->ONCC->JetpackTimer == kangaroo_h)
|
---|
187 | {
|
---|
188 | player->ONCC->JumpAcceleration = marypoppins_jp;
|
---|
189 | player->ONCC->JetpackTimer = 0xFFFF;
|
---|
190 | player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000;
|
---|
191 | player->ONCC->MaxFallingHeightWithDamage = 0x7f800000;
|
---|
192 | inc_fallingframes = false;
|
---|
193 | return 1;
|
---|
194 | }
|
---|
195 | else
|
---|
196 | {
|
---|
197 | cheat_oldjet_accel = player->ONCC->JumpAcceleration;
|
---|
198 | cheat_oldjet_timer = player->ONCC->JetpackTimer;
|
---|
199 | cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage;
|
---|
200 | cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage ;
|
---|
201 | player->ONCC->JumpAcceleration = marypoppins_jp;
|
---|
202 | player->ONCC->JetpackTimer = 0xFFFF;
|
---|
203 | player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000;
|
---|
204 | player->ONCC->MaxFallingHeightWithDamage = 0x7f800000;
|
---|
205 | inc_fallingframes = false;
|
---|
206 | return 1;
|
---|
207 | }
|
---|
208 | }
|
---|
209 | case cheat_buddha:
|
---|
210 | {
|
---|
211 | Character* player = ONgGameState->PlayerCharacter;
|
---|
212 | if (player->Flags& chr_unkillable)
|
---|
213 | {
|
---|
214 | player->Flags= player->Flags& ~chr_unkillable;
|
---|
215 | return 0;
|
---|
216 | }
|
---|
217 | else
|
---|
218 | {
|
---|
219 | player->Flags= player->Flags| chr_unkillable;
|
---|
220 | return 1;
|
---|
221 | }
|
---|
222 | }
|
---|
223 | case cheat_shinobi:
|
---|
224 | {
|
---|
225 | Character* player = ONgGameState->PlayerCharacter;
|
---|
226 | if (player->MaxHealth == 1)
|
---|
227 | {
|
---|
228 | player->Health = cheat_oldhealth;
|
---|
229 | player->MaxHealth = cheat_oldmaxhealth;
|
---|
230 | player->Flags = player->Flags & ~(chr_bossshield | chr_weaponimmune);
|
---|
231 | ai2_deaf = 0;
|
---|
232 | return 0;
|
---|
233 | }
|
---|
234 | else
|
---|
235 | {
|
---|
236 | cheat_oldhealth = player->Health;
|
---|
237 | cheat_oldmaxhealth = player->MaxHealth;
|
---|
238 | player->Health = 1;
|
---|
239 | player->MaxHealth = 1;
|
---|
240 | player->Flags = player->Flags | chr_bossshield | chr_weaponimmune;
|
---|
241 | ai2_deaf = 1;
|
---|
242 | return 1;
|
---|
243 | }
|
---|
244 |
|
---|
245 | }
|
---|
246 | case cheat_testcheat:
|
---|
247 | {
|
---|
248 | Character* player = ONgGameState->PlayerCharacter;
|
---|
249 | player->Flags = player->Flags | chr_noncombatant;
|
---|
250 | return 1;
|
---|
251 | }
|
---|
252 | case cheat_elderrune:
|
---|
253 | {
|
---|
254 | if(patch_bsl) {
|
---|
255 | int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax;
|
---|
256 | if(*Regeneration)
|
---|
257 | {
|
---|
258 | *Regeneration = 0;
|
---|
259 | return 0;
|
---|
260 | }
|
---|
261 | else
|
---|
262 | {
|
---|
263 | *Regeneration = 1;
|
---|
264 | return 1;
|
---|
265 | }
|
---|
266 | }
|
---|
267 | else
|
---|
268 | {
|
---|
269 | return ONrCheater(cheat_elderrune);
|
---|
270 | }
|
---|
271 | }
|
---|
272 |
|
---|
273 | case cheat_tellmetheversion:
|
---|
274 | return 1;
|
---|
275 | case cheat_x:
|
---|
276 | return ONrCheater(cheat_thedayismine);
|
---|
277 | default:
|
---|
278 | return ONrCheater(cheat);
|
---|
279 | }
|
---|
280 | }
|
---|
281 |
|
---|
282 | void ONICALL DDrCheater_LevelLoad()
|
---|
283 | {
|
---|
284 | inc_fallingframes = true;
|
---|
285 | }
|
---|
286 |
|
---|
287 | // Biggest hack in the entire thing ^_^
|
---|
288 | void __stdcall FallingFrames(void* Ebp)
|
---|
289 | {
|
---|
290 | if (inc_fallingframes)
|
---|
291 | ++*((unsigned int*)((char*)Ebp + 0xf6));
|
---|
292 | }
|
---|
293 |
|
---|