source: Daodan/src/Daodan_Cheater.c@ 471

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

int32_t cheat_oldhealth = 1;
int32_t cheat_oldmaxhealth = 1;
Added "tellmetheversion", needs a version number.

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