source: Daodan/src/Daodan_Cheater.c@ 455

Last change on this file since 455 was 455, checked in by rossy, 15 years ago

marypoppins & kangaroo

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