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