ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_Cheater.c
(Generate patch)

Comparing Daodan/src/Daodan_Cheater.c (file contents):
Revision 454 by rossy, Mon Aug 10 10:45:57 2009 UTC vs.
Revision 455 by rossy, Mon Aug 10 11:46:16 2009 UTC

# Line 1 | Line 1
1   #include <string.h>
2 + #include <stdbool.h>
3  
4   #include "Oni.h"
5   #include "Oni_Character.h"
# Line 70 | Line 71 | oniCheatCode DDr_CheatTable[] = {
71   #define ONCC_bodysize_min (0x00000C58) /* float */
72   #define ONCC_bodysize_max (0x00000C8C) /* float */
73  
74 + #define kangaroo_h     (60)
75 + #define kangaroo_jp    (0.06)
76 + #define marypoppins_jp (0.14)
77 +
78   uint16_t cheat_oldshield = 0;
79   int32_t cheat_oldhealth = 0;
80   int32_t cheat_oldmaxhealth = 0;
81 + float cheat_oldjet_accel = 0.03f;
82 + uint16_t cheat_oldjet_timer = 20;
83 + float cheat_oldheight1 = 45;
84 + float cheat_oldheight2 = 135;
85 + bool inc_fallingframes = true;
86  
87   uint8_t ONICALL DDrCheater(uint32_t cheat)
88   {
# Line 109 | Line 119 | uint8_t ONICALL DDrCheater(uint32_t chea
119                                  return 1;
120                          }
121                  }
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 +                }
196                  case cheat_buddha:
197                  {
198                          char* player = *((char**)(ONgGameState + GSA_player));
# Line 156 | Line 240 | uint8_t ONICALL DDrCheater(uint32_t chea
240                          return ONrCheater(cheat);
241          }
242   }
243 +
244 + void 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 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)