-
Notifications
You must be signed in to change notification settings - Fork 3
/
extreme_fixes.patch
335 lines (318 loc) · 14.1 KB
/
extreme_fixes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
diff --git a/include/config.h b/include/config.h
index a34d9c1..3fb64dc 100644
--- a/include/config.h
+++ b/include/config.h
@@ -10,6 +10,8 @@
// Qol Defines
#include "qol_defines.h"
+// Extreme Fixes
+#include "extreme_fixes.h"
// Bug Fixes
// --| Post-JP Version Nintendo Bug Fixes
diff --git a/include/extreme_fixes.h b/include/extreme_fixes.h
new file mode 100644
index 0000000..9830769
--- /dev/null
+++ b/include/extreme_fixes.h
@@ -0,0 +1,37 @@
+#ifndef EXTREME_FIXES_H
+#define EXTREME_FIXES_H
+
+// Extreme Fixes
+// Mostly a compilation of code provided by a few people
+// This patch changes most of Mario's physics that are considered remarkable
+// and also changes some "exploits" used in speedruns
+#define EXTREME_FIXES TRUE
+
+/// Fixes backwards long jump, preventing Mario from getting negative speeds
+#define EXTREME_FIX_BACKWARDS_LONG_JUMP (0 || EXTREME_FIXES)
+/// Changes how "Blast away the wall" is obtained, fixing it's skip
+#define EXTREME_FIX_BLAST_AWAY_WALL (0 || EXTREME_FIXES)
+/// Fixes lakitu skip at the beginning of the game
+#define EXTREME_FIX_LAKITU_INTRO_SKIP (0 || EXTREME_FIXES)
+/// Changes Bob-omb behavior, so now after throwing it becomes intangible
+#define EXTREME_FIX_BOBOMB_INTANGIBLE (0 || EXTREME_FIXES)
+/// Fixes Mario still alive after getting shot by a cannon even while 0 hp
+#define EXTREME_FIX_ZOMBIE_MARIO_CANNON (0 || EXTREME_FIXES)
+/// Fixes hands-free holding glitch, more info in it's code comment
+#define EXTREME_FIX_HANDS_FREE_HOLDING (0 || EXTREME_FIXES)
+/// Fixes triple jump on slopes
+#define EXTREME_FIX_TRIPLE_JUMP_SLOPES (0 || EXTREME_FIXES)
+/// Fixes kick while holding jump on slopes
+#define EXTREME_FIX_KICKING_SLOPES (0 || EXTREME_FIXES)
+/// Fixes shell negative hyperspeed
+#define EXTREME_FIX_NEGATIVE_SHELL_SPEED (0 || EXTREME_FIXES)
+/// Reset Mario's speed in wallkick
+#define EXTREME_FIX_SPEED_WALLKICK (0 || EXTREME_FIXES)
+/// Fix hat in hand glitch
+#define EXTREME_FIX_HAT_IN_HAND (0 || EXTREME_FIXES)
+/// Fix groundpound height damage
+#define EXTREME_FIX_GROUNDPOUND_HEIGHT (0 || EXTREME_FIXES)
+/// Fix Held Object's Last Position
+#define EXTREME_FIX_HOLP (0 || EXTREME_FIXES)
+
+#endif // EXTREME_FIXES
diff --git a/levels/wf/script.c b/levels/wf/script.c
index 6697b49..154fa5d 100644
--- a/levels/wf/script.c
+++ b/levels/wf/script.c
@@ -40,7 +40,11 @@ static const LevelScript script_func_local_2[] = {
OBJECT(/*model*/ MODEL_WF_SLIDING_PLATFORM, /*pos*/ 3328, 1075, -767, /*angle*/ 0, 90, 0, /*behParam*/ 0x00010000, /*beh*/ bhvWfSlidingPlatform),
OBJECT(/*model*/ MODEL_WF_SLIDING_PLATFORM, /*pos*/ 3328, 1075, -2815, /*angle*/ 0, 90, 0, /*behParam*/ 0x00030000, /*beh*/ bhvWfSlidingPlatform),
OBJECT(/*model*/ MODEL_WF_TUMBLING_BRIDGE, /*pos*/ 1792, 2496, 1600, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvWfTumblingBridge),
+#if EXTREME_FIX_BLAST_AWAY_WALL
+ OBJECT(/*model*/ MODEL_WF_BREAKABLE_WALL_RIGHT, /*pos*/ 512, 2176, 2944, /*angle*/ 0, 0, 0, /*behParam*/ 0x05000000, /*beh*/ bhvWfBreakableWallRight),
+#else
OBJECT(/*model*/ MODEL_WF_BREAKABLE_WALL_RIGHT, /*pos*/ 512, 2176, 2944, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvWfBreakableWallRight),
+#endif
OBJECT(/*model*/ MODEL_WF_BREAKABLE_WALL_LEFT, /*pos*/ -1023, 2176, 2944, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvWfBreakableWallLeft),
OBJECT_WITH_ACTS(/*model*/ MODEL_WF_KICKABLE_BOARD, /*pos*/ 13, 3584, -1407, /*angle*/ 0, 315, 0, /*behParam*/ 0x00000000, /*beh*/ bhvKickableBoard, /*acts*/ ACT_2 | ACT_3 | ACT_4 | ACT_5 | ACT_6),
OBJECT_WITH_ACTS(/*model*/ MODEL_1UP, /*pos*/ -384, 3584, 6, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhv1Up, /*acts*/ ACT_2 | ACT_3 | ACT_4 | ACT_5 | ACT_6),
@@ -87,7 +91,9 @@ static const LevelScript script_func_local_4[] = {
OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ -2500, 1500, -750, /*angle*/ 0, 0, 0, /*behParam*/ 0x02000000, /*beh*/ bhvStar, /*acts*/ ALL_ACTS),
OBJECT_WITH_ACTS(/*model*/ MODEL_NONE, /*pos*/ 4600, 550, 2500, /*angle*/ 0, 0, 0, /*behParam*/ 0x03000000, /*beh*/ bhvHiddenRedCoinStar, /*acts*/ ALL_ACTS),
OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ 2880, 4300, 190, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvStar, /*acts*/ ALL_ACTS),
+#if !EXTREME_FIX_BLAST_AWAY_WALL
OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ 590, 2450, 2650, /*angle*/ 0, 0, 0, /*behParam*/ 0x05000000, /*beh*/ bhvStar, /*acts*/ ALL_ACTS),
+#endif
RETURN(),
};
diff --git a/src/game/behaviors/bobomb.inc.c b/src/game/behaviors/bobomb.inc.c
index 4db4137..261e21c 100644
--- a/src/game/behaviors/bobomb.inc.c
+++ b/src/game/behaviors/bobomb.inc.c
@@ -28,6 +28,10 @@ void bobomb_spawn_coin(void) {
}
void bobomb_act_explode(void) {
+#if EXTREME_FIX_BOBOMB_INTANGIBLE
+ cur_obj_become_intangible();
+#endif
+
if (o->oTimer < 5) {
cur_obj_scale(1.0 + (f32) o->oTimer / 5.0);
} else {
@@ -100,6 +104,9 @@ void bobomb_act_chase_mario(void) {
void bobomb_act_launched(void) {
s16 collisionFlags = 0;
collisionFlags = object_step();
+#if EXTREME_FIX_BOBOMB_INTANGIBLE
+ cur_obj_become_intangible();
+#endif
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == OBJ_COL_FLAG_GROUNDED) {
o->oAction = BOBOMB_ACT_EXPLODE;
}
diff --git a/src/game/behaviors/breakable_wall.inc.c b/src/game/behaviors/breakable_wall.inc.c
index 7e98032..a12f71b 100644
--- a/src/game/behaviors/breakable_wall.inc.c
+++ b/src/game/behaviors/breakable_wall.inc.c
@@ -8,6 +8,9 @@ void bhv_wf_breakable_wall_loop(void) {
play_puzzle_jingle();
#if QOL_FEATURE_BETTER_WF_BREAKEABLE_WALL
set_mario_action(gMarioState, ACT_SPAWN_SPIN_AIRBORNE, 0);
+#endif
+#if EXTREME_FIX_BLAST_AWAY_WALL
+ spawn_default_star(o->oPosX, o->oPosY, o->oPosZ);
#endif
}
diff --git a/src/game/behaviors/camera_lakitu.inc.c b/src/game/behaviors/camera_lakitu.inc.c
index b337119..f1567b8 100644
--- a/src/game/behaviors/camera_lakitu.inc.c
+++ b/src/game/behaviors/camera_lakitu.inc.c
@@ -28,7 +28,12 @@ void bhv_camera_lakitu_init(void) {
static void camera_lakitu_intro_act_trigger_cutscene(void) {
//! These bounds are slightly smaller than the actual bridge bounds, allowing
// the RTA speedrunning method of lakitu skip
- if (gMarioObject->oPosX > -544.0f && gMarioObject->oPosX < 545.0f
+ if (
+#if EXTREME_FIX_LAKITU_INTRO_SKIP
+ gMarioObject->oPosX > -555.0f && gMarioObject->oPosX < 555.0f
+#else
+ gMarioObject->oPosX > -544.0f && gMarioObject->oPosX < 545.0f
+#endif
&& gMarioObject->oPosY > 800.0f && gMarioObject->oPosZ > -2000.0f
&& gMarioObject->oPosZ < -177.0f && gMarioObject->oPosZ < -177.0f // always double check your conditions
&& set_mario_npc_dialog(MARIO_DIALOG_LOOK_UP) == MARIO_DIALOG_STATUS_START) {
diff --git a/src/game/interaction.c b/src/game/interaction.c
index 87fd514..17d2539 100644
--- a/src/game/interaction.c
+++ b/src/game/interaction.c
@@ -308,7 +308,11 @@ void mario_drop_held_object(struct MarioState *m) {
// y-positon instead of the HOLP's y-position. This fact is often exploited when
// cloning objects.
m->heldObj->oPosX = m->marioBodyState->heldObjLastPosition[0];
+#if EXTREME_FIX_HOLP
+ m->heldObj->oPosY = m->marioBodyState->heldObjLastPosition[1];
+#else
m->heldObj->oPosY = m->pos[1];
+#endif
m->heldObj->oPosZ = m->marioBodyState->heldObjLastPosition[2];
m->heldObj->oMoveAngleYaw = m->faceAngle[1];
@@ -1087,7 +1091,11 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *
}
u32 interact_cannon_base(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
- if (m->action != ACT_IN_CANNON) {
+ if (m->action != ACT_IN_CANNON
+#if EXTREME_FIX_ZOMBIE_MARIO_CANNON
+ && m->health >= 0x100
+#endif
+ ) {
mario_stop_riding_and_holding(m);
o->oInteractStatus = INT_STATUS_INTERACTED;
m->interactObj = o;
diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c
index f49f5b1..09af4c1 100644
--- a/src/game/mario_actions_airborne.c
+++ b/src/game/mario_actions_airborne.c
@@ -71,22 +71,18 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
fallHeight = m->peakHeight - m->pos[1];
-#pragma GCC diagnostic push
-#if defined(__clang__)
-#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"
-#elif defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wtype-limits"
-#endif
-
+#if EXTREME_FIX_GROUNDPOUND_HEIGHT
+ if (m->action == ACT_GROUND_POUND)
+#else
//! Never true
- if (m->actionState == ACT_GROUND_POUND) {
+ if (m->actionState == ACT_GROUND_POUND)
+#endif
+ {
damageHeight = 600.0f;
} else {
damageHeight = 1150.0f;
}
-#pragma GCC diagnostic pop
-
#ifdef CHEATS_ACTIONS
if (Cheats.EnableCheats && Cheats.NoFallDamage) return FALSE;
#endif
@@ -435,12 +431,20 @@ u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation,
// not able to ledge grab it.
if (m->forwardVel >= 38.0f) {
m->particleFlags |= PARTICLE_VERTICAL_STAR;
+ #if EXTREME_FIX_HANDS_FREE_HOLDING
+ drop_and_set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
+ #else
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
+ #endif
} else {
if (m->forwardVel > 8.0f) {
mario_set_forward_vel(m, -8.0f);
}
+ #if EXTREME_FIX_HANDS_FREE_HOLDING
+ drop_and_set_mario_action(m, ACT_SOFT_BONK, 0);
+ #else
return set_mario_action(m, ACT_SOFT_BONK, 0);
+ #endif
}
}
} else {
@@ -1350,6 +1354,9 @@ s32 act_air_hit_wall(struct MarioState *m) {
if (m->input & INPUT_A_PRESSED) {
m->vel[1] = 52.0f;
m->faceAngle[1] += 0x8000;
+ #if EXTREME_FIX_SPEED_WALLKICK
+ m->forwardVel = 0.0f;
+ #endif
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
}
} else if (m->forwardVel >= 38.0f) {
diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c
index eb2f7a4..da3e0df 100644
--- a/src/game/mario_actions_cutscene.c
+++ b/src/game/mario_actions_cutscene.c
@@ -1657,6 +1657,12 @@ s32 act_putting_on_cap(struct MarioState *m) {
}
if (is_anim_at_end(m)) {
+#if EXTREME_FIX_HAT_IN_HAND
+ if (m->flags & MARIO_CAP_IN_HAND) {
+ m->flags &= ~MARIO_CAP_IN_HAND;
+ m->flags |= MARIO_CAP_ON_HEAD;
+ }
+#endif
set_mario_action(m, ACT_IDLE, 0);
disable_time_stop();
}
diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c
index 5a083ac..2fddcbf 100644
--- a/src/game/mario_actions_moving.c
+++ b/src/game/mario_actions_moving.c
@@ -167,7 +167,11 @@ void slide_bonk(struct MarioState *m, u32 fastAction, u32 slowAction) {
s32 set_triple_jump_action(struct MarioState *m, UNUSED u32 action, UNUSED u32 actionArg) {
if (m->flags & MARIO_WING_CAP) {
return set_mario_action(m, ACT_FLYING_TRIPLE_JUMP, 0);
- } else if (m->forwardVel > 20.0f) {
+ } else if (m->forwardVel > 20.0f
+#if EXTREME_FIX_TRIPLE_JUMP_SLOPES
+ && !mario_floor_is_slope(m)
+#endif
+ ) {
return set_mario_action(m, ACT_TRIPLE_JUMP, 0);
} else {
return set_mario_action(m, ACT_JUMP, 0);
@@ -408,6 +412,12 @@ void update_shell_speed(struct MarioState *m) {
m->forwardVel = 64.0f;
}
+#if EXTREME_FIX_NEGATIVE_SHELL_SPEED
+ if (m->forwardVel < 0.0f) {
+ m->forwardVel = 0.0f;
+ }
+#endif
+
m->faceAngle[1] =
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
@@ -898,7 +908,11 @@ s32 act_move_punching(struct MarioState *m) {
return set_mario_action(m, ACT_BEGIN_SLIDING, 0);
}
- if (m->actionState == 0 && (m->input & INPUT_A_DOWN)) {
+ if (m->actionState == 0 && (m->input & INPUT_A_DOWN)
+#if EXTREME_FIX_KICKING_SLOPES
+ && !mario_floor_is_slope(m)
+#endif
+ ) {
return set_mario_action(m, ACT_JUMP_KICK, 0);
}
@@ -1937,7 +1951,7 @@ s32 act_hold_freefall_land(struct MarioState *m) {
}
s32 act_long_jump_land(struct MarioState *m) {
-#ifdef VERSION_SH
+#if EXTREME_FIX_BACKWARDS_LONG_JUMP
// BLJ (Backwards Long Jump) speed build up fix, crushing SimpleFlips's dreams since July 1997
if (m->forwardVel < 0.0f) {
m->forwardVel = 0.0f;
diff --git a/src/game/mario_actions_object.c b/src/game/mario_actions_object.c
index c7341eb..f7f574a 100644
--- a/src/game/mario_actions_object.c
+++ b/src/game/mario_actions_object.c
@@ -181,7 +181,11 @@ s32 act_picking_up(struct MarioState *m) {
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
- if (m->actionState == 0 && is_anim_at_end(m)) {
+ if (m->actionState == 0 && is_anim_at_end(m)
+#if EXTREME_FIX_HOLP
+ && (m->usedObj != NULL)
+#endif
+ ) {
//! While the animation is playing, it is possible for the used object
// to unload. This allows you to pick up a vacant or newly loaded object
// slot (cloning via fake object).
diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c
index 43153ea..c533aec 100644
--- a/src/game/mario_misc.c
+++ b/src/game/mario_misc.c
@@ -598,7 +598,11 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
break;
}
}
- } else if (callContext == GEO_CONTEXT_HELD_OBJ) {
+ }
+#if !EXTREME_FIX_HOLP
+ else
+#endif
+ if (callContext == GEO_CONTEXT_HELD_OBJ) {
// ! The HOLP is set here, which is why it only updates when the held object is drawn.
// This is why it won't update during a pause buffered hitstun or when the camera is very far
// away.