[339] | 1 | #include <string.h>
|
---|
[692] | 2 | #include "stdint.h"
|
---|
[677] | 3 | #include <math.h>
|
---|
[452] | 4 | #include "Oni.h"
|
---|
[453] | 5 | #include "Oni_Character.h"
|
---|
[452] | 6 |
|
---|
[685] | 7 | #include "_Version.h"
|
---|
| 8 |
|
---|
[452] | 9 | #include "Daodan.h"
|
---|
[339] | 10 | #include "Daodan_Cheater.h"
|
---|
[677] | 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}};
|
---|
[689] | 17 | #define DD_INFINITY (INFINITY_HACK.Value)
|
---|
[339] | 18 |
|
---|
| 19 | oniCheatCode DDr_CheatTable[] = {
|
---|
[474] | 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 },
|
---|
[837] | 44 | { "kangaroo", "Kangaroo Jump Enabled", "Kangaroo Jump Disabled", cheat_kangaroo },
|
---|
[474] | 45 | { "marypoppins", "Jet Pack Mode Enabled", "Jet Pack Mode Disabled", cheat_marypoppins },
|
---|
| 46 | { "buddha", "Unkillable Enabled", "Unkillable Disabled", cheat_buddha },
|
---|
| 47 | { "shinobi", "Ninja Mode Enabled (good luck!)", "Ninja Mode Disabled", cheat_shinobi },
|
---|
| 48 | { "x", "Developer Access Enabled", "Developer Access Disabled", cheat_x },
|
---|
| 49 | { "testcheat", "Testing...", "", cheat_testcheat },
|
---|
[685] | 50 | { "tellmetheversion", "Daodan v."DAODAN_VERSION_STRING"", "", cheat_tellmetheversion },
|
---|
[689] | 51 | {0, 0, 0, 0}
|
---|
[339] | 52 | };
|
---|
[452] | 53 |
|
---|
[476] | 54 |
|
---|
| 55 |
|
---|
[453] | 56 | // Just copied all these defines from the old daodan, they were originaly from SFeLi's code.
|
---|
| 57 |
|
---|
| 58 | #define GSA_camera (0x00000080)
|
---|
| 59 | #define GSA_player (0x000000AC)
|
---|
| 60 | #define GSA_carousel (0x00000104) /* char */
|
---|
| 61 | #define GSA_slowmotimer (0x00000108)
|
---|
| 62 | #define GSA_splashscreen (0x00000118) /* char */
|
---|
| 63 |
|
---|
| 64 | #define CHR_flags (0x00000004)
|
---|
| 65 | #define CHR_flags2 (0x00000008)
|
---|
| 66 | #define CHR_oncc (0x0000000C)
|
---|
| 67 | #define CHR_team (0x00000012) /* short */
|
---|
| 68 | #define CHR_name (0x00000014) /* char[32] */
|
---|
| 69 | #define CHR_scalemodel (0x00000034)
|
---|
| 70 | #define CHR_weapon1 (0x00000194)
|
---|
| 71 | #define CHR_weapon2 (0x00000198)
|
---|
| 72 | #define CHR_weapon3 (0x0000019C)
|
---|
| 73 | #define CHR_shield_curr (0x000001B6) /* short */
|
---|
| 74 | #define CHR_shield (0x000001B8) /* short */
|
---|
| 75 | #define CHR_phasecloak (0x000001BA) /* short */
|
---|
| 76 | #define CHR_stats_kills (0x00001670)
|
---|
| 77 | #define CHR_stats_damage (0x00001674)
|
---|
| 78 |
|
---|
| 79 | #define ONCC_jet_accel (0x00000010) /* float */
|
---|
| 80 | #define ONCC_jet_timer (0x00000016) /* short */
|
---|
| 81 | #define ONCC_height1 (0x00000018) /* float */
|
---|
| 82 | #define ONCC_height2 (0x0000001C) /* float */
|
---|
| 83 | #define ONCC_bodysize_min (0x00000C58) /* float */
|
---|
| 84 | #define ONCC_bodysize_max (0x00000C8C) /* float */
|
---|
| 85 |
|
---|
[677] | 86 | #define kangaroo_h (short)(60)
|
---|
| 87 | #define kangaroo_jp (float)(0.06)
|
---|
| 88 | #define marypoppins_jp (float)(0.14)
|
---|
[455] | 89 |
|
---|
[453] | 90 | uint16_t cheat_oldshield = 0;
|
---|
[471] | 91 | int32_t cheat_oldhealth = 1;
|
---|
| 92 | int32_t cheat_oldmaxhealth = 1;
|
---|
[455] | 93 | float cheat_oldjet_accel = 0.03f;
|
---|
| 94 | uint16_t cheat_oldjet_timer = 20;
|
---|
| 95 | float cheat_oldheight1 = 45;
|
---|
| 96 | float cheat_oldheight2 = 135;
|
---|
| 97 | bool inc_fallingframes = true;
|
---|
[677] | 98 | extern bool patch_bsl;
|
---|
[452] | 99 | uint8_t ONICALL DDrCheater(uint32_t cheat)
|
---|
| 100 | {
|
---|
| 101 | switch (cheat)
|
---|
| 102 | {
|
---|
[453] | 103 | case cheat_bigbadboss:
|
---|
| 104 | {
|
---|
[677] | 105 | Character* player = ONgGameState->PlayerCharacter;
|
---|
| 106 | //char* player = *((char**)(ONgGameState + GSA_player));
|
---|
| 107 | if (player->Flags & chr_bossshield)
|
---|
[453] | 108 | {
|
---|
[677] | 109 | player->Flags = player->Flags & ~chr_bossshield;
|
---|
[453] | 110 | return 0;
|
---|
| 111 | }
|
---|
| 112 | else
|
---|
| 113 | {
|
---|
[677] | 114 | player->Flags = player->Flags | chr_bossshield;
|
---|
[453] | 115 | return 1;
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | case cheat_bulletproof:
|
---|
| 119 | {
|
---|
[677] | 120 | Character* player = ONgGameState->PlayerCharacter;
|
---|
| 121 | if (player->Flags & chr_weaponimmune)
|
---|
[453] | 122 | {
|
---|
[677] | 123 | player->Flags = player->Flags & ~chr_weaponimmune;
|
---|
| 124 | player->Inventory.ShieldUsed = cheat_oldshield;
|
---|
[453] | 125 | return 0;
|
---|
| 126 | }
|
---|
| 127 | else
|
---|
| 128 | {
|
---|
[677] | 129 | player->Flags |= chr_weaponimmune;
|
---|
| 130 | cheat_oldshield = player->Inventory.ShieldUsed;
|
---|
| 131 | player->Inventory.ShieldUsed = 100;
|
---|
[453] | 132 | return 1;
|
---|
| 133 | }
|
---|
| 134 | }
|
---|
[455] | 135 | case cheat_kangaroo:
|
---|
| 136 | {
|
---|
[677] | 137 | Character* player = ONgGameState->PlayerCharacter;
|
---|
| 138 | //char* oncc = *(char**)(player + CHR_oncc);
|
---|
[455] | 139 | if (!inc_fallingframes)
|
---|
| 140 | inc_fallingframes = true;
|
---|
[677] | 141 | if (player->ONCC->JetpackTimer == kangaroo_h)
|
---|
[455] | 142 | {
|
---|
[677] | 143 | player->ONCC->JumpAcceleration = cheat_oldjet_accel;
|
---|
| 144 | player->ONCC->JetpackTimer = cheat_oldjet_timer;
|
---|
| 145 | player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1;
|
---|
| 146 | player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2;
|
---|
[455] | 147 | return 0;
|
---|
| 148 | }
|
---|
[689] | 149 | else if ((unsigned short)player->ONCC->JetpackTimer == 0xFFFF)
|
---|
[455] | 150 | {
|
---|
[677] | 151 | player->ONCC->JumpAcceleration = kangaroo_jp;
|
---|
| 152 | player->ONCC->JetpackTimer = kangaroo_h;
|
---|
[689] | 153 | player->ONCC->MaxFallingHeightWithoutDamage = DD_INFINITY;
|
---|
| 154 | player->ONCC->MaxFallingHeightWithDamage = DD_INFINITY;
|
---|
[455] | 155 | return 1;
|
---|
| 156 | }
|
---|
| 157 | else
|
---|
| 158 | {
|
---|
[677] | 159 | cheat_oldjet_accel = player->ONCC->JumpAcceleration;
|
---|
| 160 | cheat_oldjet_timer = player->ONCC->JetpackTimer;
|
---|
| 161 | cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage ;
|
---|
| 162 | cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage;
|
---|
| 163 | player->ONCC->JumpAcceleration = kangaroo_jp;
|
---|
| 164 | player->ONCC->JetpackTimer = kangaroo_h;
|
---|
[689] | 165 | player->ONCC->MaxFallingHeightWithoutDamage = DD_INFINITY;
|
---|
| 166 | player->ONCC->MaxFallingHeightWithDamage = DD_INFINITY;
|
---|
[455] | 167 | return 1;
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 | case cheat_marypoppins:
|
---|
| 171 | {
|
---|
[677] | 172 | Character* player = ONgGameState->PlayerCharacter;
|
---|
[455] | 173 | if (!inc_fallingframes)
|
---|
| 174 | {
|
---|
| 175 | inc_fallingframes = true;
|
---|
[689] | 176 | if ((unsigned short)player->ONCC->JetpackTimer == 0xFFFF)
|
---|
[455] | 177 | {
|
---|
[677] | 178 | player->ONCC->JumpAcceleration = cheat_oldjet_accel;
|
---|
| 179 | player->ONCC->JetpackTimer = cheat_oldjet_timer;
|
---|
| 180 | player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1;
|
---|
| 181 | player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2;
|
---|
[455] | 182 | }
|
---|
| 183 | return 0;
|
---|
| 184 | }
|
---|
[677] | 185 | else if (player->ONCC->JetpackTimer == kangaroo_h)
|
---|
[455] | 186 | {
|
---|
[677] | 187 | player->ONCC->JumpAcceleration = marypoppins_jp;
|
---|
| 188 | player->ONCC->JetpackTimer = 0xFFFF;
|
---|
| 189 | player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000;
|
---|
| 190 | player->ONCC->MaxFallingHeightWithDamage = 0x7f800000;
|
---|
[455] | 191 | inc_fallingframes = false;
|
---|
| 192 | return 1;
|
---|
| 193 | }
|
---|
| 194 | else
|
---|
| 195 | {
|
---|
[677] | 196 | cheat_oldjet_accel = player->ONCC->JumpAcceleration;
|
---|
| 197 | cheat_oldjet_timer = player->ONCC->JetpackTimer;
|
---|
| 198 | cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage;
|
---|
| 199 | cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage ;
|
---|
| 200 | player->ONCC->JumpAcceleration = marypoppins_jp;
|
---|
| 201 | player->ONCC->JetpackTimer = 0xFFFF;
|
---|
| 202 | player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000;
|
---|
| 203 | player->ONCC->MaxFallingHeightWithDamage = 0x7f800000;
|
---|
[455] | 204 | inc_fallingframes = false;
|
---|
| 205 | return 1;
|
---|
| 206 | }
|
---|
| 207 | }
|
---|
[453] | 208 | case cheat_buddha:
|
---|
| 209 | {
|
---|
[677] | 210 | Character* player = ONgGameState->PlayerCharacter;
|
---|
| 211 | if (player->Flags& chr_unkillable)
|
---|
[453] | 212 | {
|
---|
[677] | 213 | player->Flags= player->Flags& ~chr_unkillable;
|
---|
[453] | 214 | return 0;
|
---|
| 215 | }
|
---|
| 216 | else
|
---|
| 217 | {
|
---|
[677] | 218 | player->Flags= player->Flags| chr_unkillable;
|
---|
[453] | 219 | return 1;
|
---|
| 220 | }
|
---|
| 221 | }
|
---|
| 222 | case cheat_shinobi:
|
---|
| 223 | {
|
---|
[677] | 224 | Character* player = ONgGameState->PlayerCharacter;
|
---|
[453] | 225 | if (player->MaxHealth == 1)
|
---|
| 226 | {
|
---|
| 227 | player->Health = cheat_oldhealth;
|
---|
| 228 | player->MaxHealth = cheat_oldmaxhealth;
|
---|
[454] | 229 | player->Flags = player->Flags & ~(chr_bossshield | chr_weaponimmune);
|
---|
[473] | 230 | ai2_deaf = 0;
|
---|
[453] | 231 | return 0;
|
---|
| 232 | }
|
---|
| 233 | else
|
---|
| 234 | {
|
---|
| 235 | cheat_oldhealth = player->Health;
|
---|
| 236 | cheat_oldmaxhealth = player->MaxHealth;
|
---|
| 237 | player->Health = 1;
|
---|
| 238 | player->MaxHealth = 1;
|
---|
[454] | 239 | player->Flags = player->Flags | chr_bossshield | chr_weaponimmune;
|
---|
[473] | 240 | ai2_deaf = 1;
|
---|
[453] | 241 | return 1;
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | }
|
---|
| 245 | case cheat_testcheat:
|
---|
| 246 | {
|
---|
[677] | 247 | Character* player = ONgGameState->PlayerCharacter;
|
---|
| 248 | player->Flags = player->Flags | chr_noncombatant;
|
---|
[453] | 249 | return 1;
|
---|
| 250 | }
|
---|
[677] | 251 | case cheat_elderrune:
|
---|
| 252 | {
|
---|
| 253 | if(patch_bsl) {
|
---|
| 254 | int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax;
|
---|
| 255 | if(*Regeneration)
|
---|
| 256 | {
|
---|
| 257 | *Regeneration = 0;
|
---|
| 258 | return 0;
|
---|
| 259 | }
|
---|
| 260 | else
|
---|
| 261 | {
|
---|
| 262 | *Regeneration = 1;
|
---|
| 263 | return 1;
|
---|
| 264 | }
|
---|
| 265 | }
|
---|
| 266 | else
|
---|
| 267 | {
|
---|
| 268 | return ONrCheater(cheat_elderrune);
|
---|
| 269 | }
|
---|
| 270 | }
|
---|
| 271 |
|
---|
[471] | 272 | case cheat_tellmetheversion:
|
---|
| 273 | return 1;
|
---|
[452] | 274 | case cheat_x:
|
---|
| 275 | return ONrCheater(cheat_thedayismine);
|
---|
| 276 | default:
|
---|
| 277 | return ONrCheater(cheat);
|
---|
| 278 | }
|
---|
| 279 | }
|
---|
[455] | 280 |
|
---|
| 281 | void ONICALL DDrCheater_LevelLoad()
|
---|
| 282 | {
|
---|
| 283 | inc_fallingframes = true;
|
---|
| 284 | }
|
---|
| 285 |
|
---|
[474] | 286 | // Biggest hack in the entire thing ^_^
|
---|
[677] | 287 | void __stdcall FallingFrames(void* Ebp)
|
---|
[455] | 288 | {
|
---|
| 289 | if (inc_fallingframes)
|
---|
[677] | 290 | ++*((unsigned int*)((char*)Ebp + 0xf6));
|
---|
[455] | 291 | }
|
---|
[685] | 292 |
|
---|