summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghoulslash <41651341+ghoulslash@users.noreply.github.com>2022-02-24 14:43:33 -0700
committerghoulslash <41651341+ghoulslash@users.noreply.github.com>2022-02-24 14:43:33 -0700
commite7ee03b4bcba3fd287be94caa3b176f608703b77 (patch)
treed1171218fa48135d029827b944bd1ff89f8f4b0b
parentfe4485e9b2c245e7546d5ef6caf18b555e588123 (diff)
Created Reflections (markdown)
-rw-r--r--Reflections.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/Reflections.md b/Reflections.md
new file mode 100644
index 0000000..3f0b303
--- /dev/null
+++ b/Reflections.md
@@ -0,0 +1,49 @@
+## Better Reflection System
+
+### Process
+1. Find `PlayerStep` in `src/field_player_avatar.c`
+2. add this function above it:
+```c
+static void TryHidePlayerReflection(void)
+{
+ if (gObjectEvents[gPlayerAvatar.objectEventId].hasReflection) {
+ s16 x, y;
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
+ x = playerObjEvent->currentCoords.x;
+ y = playerObjEvent->currentCoords.y;
+ MoveCoords(DIR_SOUTH, &x, &y);
+ if (!MetatileBehavior_IsReflective(MapGridGetMetatileBehaviorAt(x, y)))
+ playerObjEvent->hideReflection = TRUE;
+ else
+ playerObjEvent->hideReflection = FALSE;
+ }
+}
+```
+3. Now change the function to this:
+```c
+void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys)
+{
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
+
+ HideShowWarpArrow(playerObjEvent);
+ if (gPlayerAvatar.preventStep == FALSE)
+ {
+ TryHidePlayerReflection();
+ Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
+ if (TryInterruptObjectEventSpecialAnim(playerObjEvent, direction) == 0)
+ {
+ npc_clear_strange_bits(playerObjEvent);
+ DoPlayerAvatarTransition();
+ if (TryDoMetatileBehaviorForcedMovement() == 0)
+ {
+ MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys);
+ PlayerAllowForcedMovementIfMovingSameDirection();
+ }
+
+ TryHidePlayerReflection();
+ }
+ }
+}
+```
+
+You're done!