1 |
|
#include <string.h> |
2 |
< |
#include <stdbool.h> |
3 |
< |
|
2 |
> |
#include "bool.h" |
3 |
> |
#include <math.h> |
4 |
|
#include "Oni.h" |
5 |
|
#include "Oni_Character.h" |
6 |
|
|
7 |
|
#include "Daodan.h" |
8 |
|
#include "Daodan_Cheater.h" |
9 |
+ |
union MSVC_EVIL_FLOAT_HACK |
10 |
+ |
{ |
11 |
+ |
unsigned __int8 Bytes[4]; |
12 |
+ |
float Value; |
13 |
+ |
}; |
14 |
+ |
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}}; |
15 |
+ |
#define INFINITY (INFINITY_HACK.Value) |
16 |
|
|
17 |
|
oniCheatCode DDr_CheatTable[] = { |
18 |
|
{ "shapeshifter", "Change Characters Enabled", "Change Characters Disabled", cheat_shapeshifter }, |
82 |
|
#define ONCC_bodysize_min (0x00000C58) /* float */ |
83 |
|
#define ONCC_bodysize_max (0x00000C8C) /* float */ |
84 |
|
|
85 |
< |
#define kangaroo_h (60) |
86 |
< |
#define kangaroo_jp (0.06) |
87 |
< |
#define marypoppins_jp (0.14) |
85 |
> |
#define kangaroo_h (short)(60) |
86 |
> |
#define kangaroo_jp (float)(0.06) |
87 |
> |
#define marypoppins_jp (float)(0.14) |
88 |
|
|
89 |
|
uint16_t cheat_oldshield = 0; |
90 |
|
int32_t cheat_oldhealth = 1; |
94 |
|
float cheat_oldheight1 = 45; |
95 |
|
float cheat_oldheight2 = 135; |
96 |
|
bool inc_fallingframes = true; |
97 |
< |
|
97 |
> |
extern bool patch_bsl; |
98 |
|
uint8_t ONICALL DDrCheater(uint32_t cheat) |
99 |
|
{ |
100 |
|
switch (cheat) |
101 |
|
{ |
102 |
|
case cheat_bigbadboss: |
103 |
|
{ |
104 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
105 |
< |
if (*(unsigned int*)(player + CHR_flags) & chr_bossshield) |
104 |
> |
GameState* GameState = ONgGameState; |
105 |
> |
|
106 |
> |
Character* player = ONgGameState->PlayerCharacter; |
107 |
> |
//char* player = *((char**)(ONgGameState + GSA_player)); |
108 |
> |
if (player->Flags & chr_bossshield) |
109 |
|
{ |
110 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_bossshield; |
110 |
> |
player->Flags = player->Flags & ~chr_bossshield; |
111 |
|
return 0; |
112 |
|
} |
113 |
|
else |
114 |
|
{ |
115 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_bossshield; |
115 |
> |
player->Flags = player->Flags | chr_bossshield; |
116 |
|
return 1; |
117 |
|
} |
118 |
|
} |
119 |
|
case cheat_bulletproof: |
120 |
|
{ |
121 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
122 |
< |
if (*(unsigned int*)(player + CHR_flags) & chr_weaponimmune) |
121 |
> |
Character* player = ONgGameState->PlayerCharacter; |
122 |
> |
if (player->Flags & chr_weaponimmune) |
123 |
|
{ |
124 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_weaponimmune; |
125 |
< |
*(unsigned short*)(player + CHR_shield) = cheat_oldshield; |
124 |
> |
player->Flags = player->Flags & ~chr_weaponimmune; |
125 |
> |
player->Inventory.ShieldUsed = cheat_oldshield; |
126 |
|
return 0; |
127 |
|
} |
128 |
|
else |
129 |
|
{ |
130 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_weaponimmune; |
131 |
< |
cheat_oldshield = *(unsigned short*)(player + CHR_shield); |
132 |
< |
*(unsigned short*)(player + CHR_shield) = 100; |
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 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
139 |
< |
char* oncc = *(char**)(player + CHR_oncc); |
138 |
> |
Character* player = ONgGameState->PlayerCharacter; |
139 |
> |
//char* oncc = *(char**)(player + CHR_oncc); |
140 |
|
if (!inc_fallingframes) |
141 |
|
inc_fallingframes = true; |
142 |
< |
if (*(unsigned int*)(oncc + ONCC_jet_timer) == kangaroo_h) |
142 |
> |
if (player->ONCC->JetpackTimer == kangaroo_h) |
143 |
|
{ |
144 |
< |
*(float*)(oncc + ONCC_jet_accel) = cheat_oldjet_accel; |
145 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = cheat_oldjet_timer; |
146 |
< |
*(float*)(oncc + ONCC_height1) = cheat_oldheight1; |
147 |
< |
*(float*)(oncc + ONCC_height2) = cheat_oldheight2; |
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 int*)(oncc + ONCC_jet_timer) == 0xFFFF) |
150 |
> |
else if (player->ONCC->JetpackTimer == 0xFFFF) |
151 |
|
{ |
152 |
< |
*(float*)(oncc + ONCC_jet_accel) = kangaroo_jp; |
153 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = kangaroo_h; |
154 |
< |
*(float*)(oncc + ONCC_height1) = 0x7f800000; |
155 |
< |
*(float*)(oncc + ONCC_height2) = 0x7f800000; |
152 |
> |
player->ONCC->JumpAcceleration = kangaroo_jp; |
153 |
> |
player->ONCC->JetpackTimer = kangaroo_h; |
154 |
> |
player->ONCC->MaxFallingHeightWithoutDamage = INFINITY; |
155 |
> |
player->ONCC->MaxFallingHeightWithDamage = INFINITY; |
156 |
|
return 1; |
157 |
|
} |
158 |
|
else |
159 |
|
{ |
160 |
< |
cheat_oldjet_accel = *(float*)(oncc + ONCC_jet_accel); |
161 |
< |
cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer); |
162 |
< |
cheat_oldheight1 = *(float*)(oncc + ONCC_height1); |
163 |
< |
cheat_oldheight2 = *(float*)(oncc + ONCC_height2); |
164 |
< |
*(float*)(oncc + ONCC_jet_accel) = kangaroo_jp; |
165 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = kangaroo_h; |
166 |
< |
*(float*)(oncc + ONCC_height1) = 0x7f800000; |
167 |
< |
*(float*)(oncc + ONCC_height2) = 0x7f800000; |
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 = INFINITY; |
167 |
> |
player->ONCC->MaxFallingHeightWithDamage = INFINITY; |
168 |
|
return 1; |
169 |
|
} |
170 |
|
} |
171 |
|
case cheat_marypoppins: |
172 |
|
{ |
173 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
164 |
< |
char* oncc = *(char**)(player + CHR_oncc); |
173 |
> |
Character* player = ONgGameState->PlayerCharacter; |
174 |
|
if (!inc_fallingframes) |
175 |
|
{ |
176 |
|
inc_fallingframes = true; |
177 |
< |
if (*(unsigned int*)(oncc + ONCC_jet_timer) == 0xFFFF) |
177 |
> |
if (player->ONCC->JetpackTimer == 0xFFFF) |
178 |
|
{ |
179 |
< |
*(float*)(oncc + ONCC_jet_accel) = cheat_oldjet_accel; |
180 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = cheat_oldjet_timer; |
181 |
< |
*(float*)(oncc + ONCC_height1) = cheat_oldheight1; |
182 |
< |
*(float*)(oncc + ONCC_height2) = cheat_oldheight2; |
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 (*(unsigned int*)(oncc + ONCC_jet_timer) == kangaroo_h) |
186 |
> |
else if (player->ONCC->JetpackTimer == kangaroo_h) |
187 |
|
{ |
188 |
< |
*(float*)(oncc + ONCC_jet_accel) = marypoppins_jp; |
189 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = 0xFFFF; |
190 |
< |
*(float*)(oncc + ONCC_height1) = 0x7f800000; |
191 |
< |
*(float*)(oncc + ONCC_height2) = 0x7f800000; |
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 = *(float*)(oncc + ONCC_jet_accel); |
198 |
< |
cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer); |
199 |
< |
cheat_oldheight1 = *(float*)(oncc + ONCC_height1); |
200 |
< |
cheat_oldheight2 = *(float*)(oncc + ONCC_height2); |
201 |
< |
*(float*)(oncc + ONCC_jet_accel) = marypoppins_jp; |
202 |
< |
*(unsigned short*)(oncc + ONCC_jet_timer) = 0xFFFF; |
203 |
< |
*(float*)(oncc + ONCC_height1) = 0x7f800000; |
204 |
< |
*(float*)(oncc + ONCC_height2) = 0x7f800000; |
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 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
212 |
< |
if (*(unsigned int*)(player + CHR_flags) & chr_unkillable) |
211 |
> |
Character* player = ONgGameState->PlayerCharacter; |
212 |
> |
if (player->Flags& chr_unkillable) |
213 |
|
{ |
214 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_unkillable; |
214 |
> |
player->Flags= player->Flags& ~chr_unkillable; |
215 |
|
return 0; |
216 |
|
} |
217 |
|
else |
218 |
|
{ |
219 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_unkillable; |
219 |
> |
player->Flags= player->Flags| chr_unkillable; |
220 |
|
return 1; |
221 |
|
} |
222 |
|
} |
223 |
|
case cheat_shinobi: |
224 |
|
{ |
225 |
< |
Character* player = (Character*)*((void**)(ONgGameState + GSA_player)); |
225 |
> |
Character* player = ONgGameState->PlayerCharacter; |
226 |
|
if (player->MaxHealth == 1) |
227 |
|
{ |
228 |
|
player->Health = cheat_oldhealth; |
245 |
|
} |
246 |
|
case cheat_testcheat: |
247 |
|
{ |
248 |
< |
char* player = *((char**)(ONgGameState + GSA_player)); |
249 |
< |
*(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_noncombatant; |
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: |
285 |
|
} |
286 |
|
|
287 |
|
// Biggest hack in the entire thing ^_^ |
288 |
< |
__stdcall void FallingFrames(void* Ebp) |
288 |
> |
void __stdcall FallingFrames(void* Ebp) |
289 |
|
{ |
290 |
|
if (inc_fallingframes) |
291 |
< |
++*((unsigned int*)(Ebp + 0xf6)); |
291 |
> |
++*((unsigned int*)((char*)Ebp + 0xf6)); |
292 |
|
} |
293 |
+ |
|