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