source: Daodan/src/Daodan_Cheater.c@ 616

Last change on this file since 616 was 476, checked in by gumby, 15 years ago

Added Weapon information for dropped weapons
Started on adding new dsay colors

File size: 10.7 KB
Line 
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
10oniCheatCode 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
47
48// Just copied all these defines from the old daodan, they were originaly from SFeLi's code.
49
50#define GSA_camera (0x00000080)
51#define GSA_player (0x000000AC)
52#define GSA_carousel (0x00000104) /* char */
53#define GSA_slowmotimer (0x00000108)
54#define GSA_splashscreen (0x00000118) /* char */
55
56#define CHR_flags (0x00000004)
57#define CHR_flags2 (0x00000008)
58#define CHR_oncc (0x0000000C)
59#define CHR_team (0x00000012) /* short */
60#define CHR_name (0x00000014) /* char[32] */
61#define CHR_scalemodel (0x00000034)
62#define CHR_weapon1 (0x00000194)
63#define CHR_weapon2 (0x00000198)
64#define CHR_weapon3 (0x0000019C)
65#define CHR_shield_curr (0x000001B6) /* short */
66#define CHR_shield (0x000001B8) /* short */
67#define CHR_phasecloak (0x000001BA) /* short */
68#define CHR_stats_kills (0x00001670)
69#define CHR_stats_damage (0x00001674)
70
71#define ONCC_jet_accel (0x00000010) /* float */
72#define ONCC_jet_timer (0x00000016) /* short */
73#define ONCC_height1 (0x00000018) /* float */
74#define ONCC_height2 (0x0000001C) /* float */
75#define ONCC_bodysize_min (0x00000C58) /* float */
76#define ONCC_bodysize_max (0x00000C8C) /* float */
77
78#define kangaroo_h (60)
79#define kangaroo_jp (0.06)
80#define marypoppins_jp (0.14)
81
82uint16_t cheat_oldshield = 0;
83int32_t cheat_oldhealth = 1;
84int32_t cheat_oldmaxhealth = 1;
85float cheat_oldjet_accel = 0.03f;
86uint16_t cheat_oldjet_timer = 20;
87float cheat_oldheight1 = 45;
88float cheat_oldheight2 = 135;
89bool inc_fallingframes = true;
90
91uint8_t ONICALL DDrCheater(uint32_t cheat)
92{
93 switch (cheat)
94 {
95 case cheat_bigbadboss:
96 {
97 char* player = *((char**)(ONgGameState + GSA_player));
98 if (*(unsigned int*)(player + CHR_flags) & chr_bossshield)
99 {
100 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_bossshield;
101 return 0;
102 }
103 else
104 {
105 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_bossshield;
106 return 1;
107 }
108 }
109 case cheat_bulletproof:
110 {
111 char* player = *((char**)(ONgGameState + GSA_player));
112 if (*(unsigned int*)(player + CHR_flags) & chr_weaponimmune)
113 {
114 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_weaponimmune;
115 *(unsigned short*)(player + CHR_shield) = cheat_oldshield;
116 return 0;
117 }
118 else
119 {
120 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_weaponimmune;
121 cheat_oldshield = *(unsigned short*)(player + CHR_shield);
122 *(unsigned short*)(player + CHR_shield) = 100;
123 return 1;
124 }
125 }
126 case cheat_kangaroo:
127 {
128 char* player = *((char**)(ONgGameState + GSA_player));
129 char* oncc = *(char**)(player + CHR_oncc);
130 if (!inc_fallingframes)
131 inc_fallingframes = true;
132 if (*(unsigned int*)(oncc + ONCC_jet_timer) == kangaroo_h)
133 {
134 *(float*)(oncc + ONCC_jet_accel) = cheat_oldjet_accel;
135 *(unsigned short*)(oncc + ONCC_jet_timer) = cheat_oldjet_timer;
136 *(float*)(oncc + ONCC_height1) = cheat_oldheight1;
137 *(float*)(oncc + ONCC_height2) = cheat_oldheight2;
138 return 0;
139 }
140 else if (*(unsigned int*)(oncc + ONCC_jet_timer) == 0xFFFF)
141 {
142 *(float*)(oncc + ONCC_jet_accel) = kangaroo_jp;
143 *(unsigned short*)(oncc + ONCC_jet_timer) = kangaroo_h;
144 *(float*)(oncc + ONCC_height1) = 0x7f800000;
145 *(float*)(oncc + ONCC_height2) = 0x7f800000;
146 return 1;
147 }
148 else
149 {
150 cheat_oldjet_accel = *(float*)(oncc + ONCC_jet_accel);
151 cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer);
152 cheat_oldheight1 = *(float*)(oncc + ONCC_height1);
153 cheat_oldheight2 = *(float*)(oncc + ONCC_height2);
154 *(float*)(oncc + ONCC_jet_accel) = kangaroo_jp;
155 *(unsigned short*)(oncc + ONCC_jet_timer) = kangaroo_h;
156 *(float*)(oncc + ONCC_height1) = 0x7f800000;
157 *(float*)(oncc + ONCC_height2) = 0x7f800000;
158 return 1;
159 }
160 }
161 case cheat_marypoppins:
162 {
163 char* player = *((char**)(ONgGameState + GSA_player));
164 char* oncc = *(char**)(player + CHR_oncc);
165 if (!inc_fallingframes)
166 {
167 inc_fallingframes = true;
168 if (*(unsigned int*)(oncc + ONCC_jet_timer) == 0xFFFF)
169 {
170 *(float*)(oncc + ONCC_jet_accel) = cheat_oldjet_accel;
171 *(unsigned short*)(oncc + ONCC_jet_timer) = cheat_oldjet_timer;
172 *(float*)(oncc + ONCC_height1) = cheat_oldheight1;
173 *(float*)(oncc + ONCC_height2) = cheat_oldheight2;
174 }
175 return 0;
176 }
177 else if (*(unsigned int*)(oncc + ONCC_jet_timer) == kangaroo_h)
178 {
179 *(float*)(oncc + ONCC_jet_accel) = marypoppins_jp;
180 *(unsigned short*)(oncc + ONCC_jet_timer) = 0xFFFF;
181 *(float*)(oncc + ONCC_height1) = 0x7f800000;
182 *(float*)(oncc + ONCC_height2) = 0x7f800000;
183 inc_fallingframes = false;
184 return 1;
185 }
186 else
187 {
188 cheat_oldjet_accel = *(float*)(oncc + ONCC_jet_accel);
189 cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer);
190 cheat_oldheight1 = *(float*)(oncc + ONCC_height1);
191 cheat_oldheight2 = *(float*)(oncc + ONCC_height2);
192 *(float*)(oncc + ONCC_jet_accel) = marypoppins_jp;
193 *(unsigned short*)(oncc + ONCC_jet_timer) = 0xFFFF;
194 *(float*)(oncc + ONCC_height1) = 0x7f800000;
195 *(float*)(oncc + ONCC_height2) = 0x7f800000;
196 inc_fallingframes = false;
197 return 1;
198 }
199 }
200 case cheat_buddha:
201 {
202 char* player = *((char**)(ONgGameState + GSA_player));
203 if (*(unsigned int*)(player + CHR_flags) & chr_unkillable)
204 {
205 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_unkillable;
206 return 0;
207 }
208 else
209 {
210 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_unkillable;
211 return 1;
212 }
213 }
214 case cheat_shinobi:
215 {
216 Character* player = (Character*)*((void**)(ONgGameState + GSA_player));
217 if (player->MaxHealth == 1)
218 {
219 player->Health = cheat_oldhealth;
220 player->MaxHealth = cheat_oldmaxhealth;
221 player->Flags = player->Flags & ~(chr_bossshield | chr_weaponimmune);
222 ai2_deaf = 0;
223 return 0;
224 }
225 else
226 {
227 cheat_oldhealth = player->Health;
228 cheat_oldmaxhealth = player->MaxHealth;
229 player->Health = 1;
230 player->MaxHealth = 1;
231 player->Flags = player->Flags | chr_bossshield | chr_weaponimmune;
232 ai2_deaf = 1;
233 return 1;
234 }
235
236 }
237 case cheat_testcheat:
238 {
239 char* player = *((char**)(ONgGameState + GSA_player));
240 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_noncombatant;
241 return 1;
242 }
243 case cheat_tellmetheversion:
244 return 1;
245 case cheat_x:
246 return ONrCheater(cheat_thedayismine);
247 default:
248 return ONrCheater(cheat);
249 }
250}
251
252void ONICALL DDrCheater_LevelLoad()
253{
254 inc_fallingframes = true;
255}
256
257// Biggest hack in the entire thing ^_^
258__stdcall void FallingFrames(void* Ebp)
259{
260 if (inc_fallingframes)
261 ++*((unsigned int*)(Ebp + 0xf6));
262}
Note: See TracBrowser for help on using the repository browser.