source: Daodan/src/Daodan_Cheater.c @ 454

Last change on this file since 454 was 454, checked in by rossy, 14 years ago

ninja mode tweak, level 1 easier, level 2 might be possible

File size: 7.1 KB
Line 
1#include <string.h>
2
3#include "Oni.h"
4#include "Oni_Character.h"
5
6#include "Daodan.h"
7#include "Daodan_Cheater.h"
8
9oniCheatCode DDr_CheatTable[] = {
10        { "shapeshifter",   "Change Characters Enabled",       "Change Characters Disabled", cheat_shapeshifter   },
11        { "liveforever",    "Invincibility Enabled",           "Invincibility Disabled",     cheat_liveforever    },
12        { "touchofdeath",   "Omnipotence Enabled",             "Omnipotence Disabled",       cheat_touchofdeath   },
13        { "canttouchthis",  "Unstoppable Enabled",             "Unstoppable Disabled",       cheat_canttouchthis  },
14        { "fatloot",        "Fat Loot Received",               NULL,                         cheat_fatloot        },
15        { "glassworld",     "Glass Furniture Enabled",         "Glass Furniture Disabled",   cheat_glassworld     },
16        { "winlevel",       "Instantly Win Level",             NULL,                         cheat_winlevel       },
17        { "loselevel",      "Instantly Lose Level",            NULL,                         cheat_loselevel      },
18        { "bighead",        "Big Head Enabled",                "Big Head Disabled",          cheat_bighead        },
19        { "minime",         "Mini Mode Enabled",               "Mini Mode Disabled",         cheat_minime         },
20        { "superammo",      "Super Ammo Mode Enabled",         "Super Ammo Mode Disabled",   cheat_superammo      },
21        { "thedayismine",   "Developer Access Enabled",        "Developer Access Disabled",  cheat_thedayismine   },
22        { "reservoirdogs",  "Last Man Standing Enabled",       "Last Man Standing Disabled", cheat_reservoirdogs  },
23        { "roughjustice",   "Gatling Guns Enabled",            "Gatling Guns Disabled",      cheat_roughjustice   },
24        { "chenille",       "Daodan Power Enabled",            "Daodan Power Disabled",      cheat_chenille       },
25        { "behemoth",       "Godzilla Mode Enabled",           "Godzilla Mode Disabled",     cheat_behemoth       },
26        { "elderrune",      "Regeneration Enabled",            "Regeneration Disabled",      cheat_elderrune      },
27        { "moonshadow",     "Phase Cloak Enabled",             "Phase Cloak Disabled",       cheat_moonshadow     },
28        { "munitionfrenzy", "Weapons Locker Created",          NULL,                         cheat_munitionfrenzy },
29        { "fistsoflegend",  "Fists Of Legend Enabled",         "Fists Of Legend Disabled",   cheat_fistsoflegend  },
30        { "killmequick",    "Ultra Mode Enabled",              "Ultra Mode Disabled",        cheat_killmequick    },
31        { "carousel",       "Slow Motion Enabled",             "Slow Motion Disabled",       cheat_carousel       },
32        { "bigbadboss",     "Boss Shield Enabled",             "Boss Shield Disabled",       cheat_bigbadboss     },
33        { "bulletproof",    "Force Field Enabled",             "Force Field Disabled",       cheat_bulletproof    },
34        { "kangaroo",       "Kangaroo Jump Enabled",           "Kangaroo Jump Disabled",     cheat_kangaroo       },
35        { "marypoppins",    "Jet Pack Mode Enabled",           "Jet Pack Mode Disabled",     cheat_marypoppins    },
36        { "buddha",         "Unkillable Enabled",              "Unkillable Disabled",        cheat_buddha         },
37        { "shinobi",        "Ninja Mode Enabled (good luck!)", "Ninja Mode Disabled",        cheat_shinobi        },
38        { "x",              "Developer Access Enabled",        "Developer Access Disabled",  cheat_x              },
39        { "testcheat",      "Testing...",                      "",                           cheat_testcheat      },
40        {0}
41};
42
43// Just copied all these defines from the old daodan, they were originaly from SFeLi's code.
44
45#define GSA_camera        (0x00000080)
46#define GSA_player        (0x000000AC)
47#define GSA_carousel      (0x00000104) /* char */
48#define GSA_slowmotimer   (0x00000108)
49#define GSA_splashscreen  (0x00000118) /* char */
50
51#define CHR_flags         (0x00000004)
52#define CHR_flags2        (0x00000008)
53#define CHR_oncc          (0x0000000C)
54#define CHR_team          (0x00000012) /* short */
55#define CHR_name          (0x00000014) /* char[32] */
56#define CHR_scalemodel    (0x00000034)
57#define CHR_weapon1       (0x00000194)
58#define CHR_weapon2       (0x00000198)
59#define CHR_weapon3       (0x0000019C)
60#define CHR_shield_curr   (0x000001B6) /* short */
61#define CHR_shield        (0x000001B8) /* short */
62#define CHR_phasecloak    (0x000001BA) /* short */
63#define CHR_stats_kills   (0x00001670)
64#define CHR_stats_damage  (0x00001674)
65
66#define ONCC_jet_accel    (0x00000010) /* float */
67#define ONCC_jet_timer    (0x00000016) /* short */
68#define ONCC_height1      (0x00000018) /* float */
69#define ONCC_height2      (0x0000001C) /* float */
70#define ONCC_bodysize_min (0x00000C58) /* float */
71#define ONCC_bodysize_max (0x00000C8C) /* float */
72
73uint16_t cheat_oldshield = 0;
74int32_t cheat_oldhealth = 0;
75int32_t cheat_oldmaxhealth = 0;
76
77uint8_t ONICALL DDrCheater(uint32_t cheat)
78{
79        switch (cheat)
80        {
81                case cheat_bigbadboss:
82                {
83                        char* player = *((char**)(ONgGameState + GSA_player));
84                        if (*(unsigned int*)(player + CHR_flags) & chr_bossshield)
85                        {
86                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_bossshield;
87                                return 0;
88                        }
89                        else
90                        {
91                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_bossshield;
92                                return 1;
93                        }
94                }
95                case cheat_bulletproof:
96                {
97                        char* player = *((char**)(ONgGameState + GSA_player));
98                        if (*(unsigned int*)(player + CHR_flags) & chr_weaponimmune)
99                        {
100                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_weaponimmune;
101                                *(unsigned short*)(player + CHR_shield) = cheat_oldshield;
102                                return 0;
103                        }
104                        else
105                        {
106                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_weaponimmune;
107                                cheat_oldshield = *(unsigned short*)(player + CHR_shield);
108                                *(unsigned short*)(player + CHR_shield) = 100;
109                                return 1;
110                        }
111                }
112                case cheat_buddha:
113                {
114                        char* player = *((char**)(ONgGameState + GSA_player));
115                        if (*(unsigned int*)(player + CHR_flags) & chr_unkillable)
116                        {
117                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_unkillable;
118                                return 0;
119                        }
120                        else
121                        {
122                                *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_unkillable;
123                                return 1;
124                        }
125                }
126                case cheat_shinobi:
127                {
128                        Character* player = (Character*)*((void**)(ONgGameState + GSA_player));
129                        if (player->MaxHealth == 1)
130                        {
131                                player->Health = cheat_oldhealth;
132                                player->MaxHealth = cheat_oldmaxhealth;
133                                player->Flags = player->Flags & ~(chr_bossshield | chr_weaponimmune);
134                                return 0;
135                        }
136                        else
137                        {
138                                cheat_oldhealth = player->Health;
139                                cheat_oldmaxhealth = player->MaxHealth;
140                                player->Health = 1;
141                                player->MaxHealth = 1;
142                                player->Flags = player->Flags | chr_bossshield | chr_weaponimmune;
143                                return 1;
144                        }
145                       
146                }
147                case cheat_testcheat:
148                {
149                        char* player = *((char**)(ONgGameState + GSA_player));
150                        *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_noncombatant;
151                        return 1;
152                }
153                case cheat_x:
154                        return ONrCheater(cheat_thedayismine);
155                default:
156                        return ONrCheater(cheat);
157        }
158}
Note: See TracBrowser for help on using the repository browser.