Skip to content

Commit 35be4d0

Browse files
authored
Merge pull request #2239 from 2dos/A-Maze-ing-emergency-exit-(fix)
Exit Fix
2 parents 2f4ce9c + ac4d345 commit 35be4d0

File tree

7 files changed

+25
-21
lines changed

7 files changed

+25
-21
lines changed

base-hack/Build/adjust_exits.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
exit_adjustments = [
1414
{
15-
"containing_map": 0x30, # Fungi Main
15+
"containing_map": Maps.Fungi, # Fungi Main
1616
"exits": [
1717
{
1818
# Dark Attic
@@ -45,7 +45,7 @@
4545
],
4646
},
4747
{
48-
"containing_map": 0x1E, # Galleon
48+
"containing_map": Maps.Galleon, # Galleon
4949
"exits": [
5050
{
5151
# Lighthouse
@@ -64,7 +64,7 @@
6464
],
6565
},
6666
{
67-
"containing_map": 112, # DDC Crypt
67+
"containing_map": Maps.CastleCryptDKDiddyChunky, # DDC Crypt
6868
"exits": [
6969
{
7070
# Minecart
@@ -76,7 +76,7 @@
7676
],
7777
},
7878
{
79-
"containing_map": 0x22, # Isles
79+
"containing_map": Maps.Isles, # Isles
8080
"exits": [
8181
{
8282
# Aztec Lobby
@@ -95,7 +95,7 @@
9595
],
9696
},
9797
{
98-
"containing_map": 0x1A, # Factory
98+
"containing_map": Maps.Factory, # Factory
9999
"exits": [
100100
{
101101
# Crusher
@@ -107,7 +107,7 @@
107107
],
108108
},
109109
{
110-
"containing_map": 0x57, # Castle
110+
"containing_map": Maps.Castle, # Castle
111111
"exits": [
112112
{
113113
# Tree
@@ -126,7 +126,7 @@
126126
],
127127
},
128128
{
129-
"containing_map": 0x48, # Caves
129+
"containing_map": Maps.Caves, # Caves
130130
"exits": [
131131
{
132132
# Unused 5DI Portal Exit
@@ -193,22 +193,25 @@ def adjustExits(fh):
193193
coords.append(int(intf_to_float(int.from_bytes(fg.read(4), "big"))))
194194
coords[1] += 5
195195
exit_coords.append(coords.copy())
196-
if map_index == Maps.Isles:
197-
# Isles
198-
exit_coords.append([2524, 1724, 3841]) # Top of Krem Isles
199-
elif map_index == Maps.Galleon:
200-
# Galleon
201-
exit_coords.append([2886, 1249, 1121]) # Mech Fish Exit
202196
if os.path.exists(temp_file):
203197
os.remove(temp_file)
198+
if map_index == Maps.Isles:
199+
# Isles
200+
exit_coords.append([2524, 1724, 3841]) # Top of Krem Isles
201+
elif map_index == Maps.Galleon:
202+
# Galleon
203+
exit_coords.append([2886, 1249, 1121]) # Mech Fish Exit
204+
elif map_index == Maps.CavesBeetleRace:
205+
# Caves Beetle
206+
exit_coords.append([1315, 5130, 485])
204207
exit_additions.append(exit_coords.copy())
205208
# Exits
206209
fh.seek(main_pointer_table_offset + (4 * TableNames.Exits))
207210
ptr_table = main_pointer_table_offset + int.from_bytes(fh.read(4), "big")
208211
for map_index in range(216):
209212
fh.seek(ptr_table + (4 * map_index))
210-
exit_start = main_pointer_table_offset + int.from_bytes(fh.read(4), "big")
211-
exit_end = main_pointer_table_offset + int.from_bytes(fh.read(4), "big")
213+
exit_start = main_pointer_table_offset + (int.from_bytes(fh.read(4), "big") & 0x7FFFFFFF)
214+
exit_end = main_pointer_table_offset + (int.from_bytes(fh.read(4), "big") & 0x7FFFFFFF)
212215
exit_size = exit_end - exit_start
213216
fh.seek(exit_start)
214217
data = fh.read(exit_size)
@@ -234,14 +237,15 @@ def adjustExits(fh):
234237
data = fg.read()
235238
exit_count = int(len(data) / 10)
236239
if exit_count == 0:
240+
print(f"NO EXITS FOUND FOR {Maps(map_index).name}")
237241
data = bytes(bytearray([0] * 10))
238242
default_exit = 0
239243
if map_index == Maps.Japes:
240244
default_exit = 15
241245
elif map_index == Maps.Fungi:
242246
default_exit = 27
243247
default_start = default_exit * 10
244-
print("Rewriting exit file:", map_index, data)
248+
print(f"Rewriting exit file with {exit_count} exits:", map_index, data)
245249
with open(file_name, "wb") as fg:
246250
fg.write(data[default_start : default_start + 10])
247251
fg.write(exit_count.to_bytes(2, "big"))

base-hack/asm/hookcode/actor.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,4 @@ blockTreeClimbing:
665665

666666
blockTreeClimbing_noclimb:
667667
j 0x8072F474
668-
or $a0, $s2, $zero
668+
or $a0, $s2, $zero

base-hack/include/hooks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ extern void DilloRematchShort(void);
9999
extern void DKPhaseShort(void);
100100
extern void TinyPhaseShort(void);
101101
extern void ChunkyPhaseShort(void);
102-
extern void ChunkyPhaseAddedSave(void);
102+
extern void ChunkyPhaseAddedSave(void);

base-hack/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,4 +599,4 @@ void toggleStandardAmmo(void) {
599599
}
600600
}
601601
}
602-
}
602+
}

randomizer/Patching/BananaPortRando.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def move_bananaports(spoiler):
8888
}
8989
)
9090
# Modify Exit Table
91-
ROM_COPY.seek(exit_table + (10 * exit_id))
91+
ROM_COPY.seek(exit_table + (10 * exit_id) + 12)
9292
ROM_COPY.writeMultipleBytes(int(new_coords[0]), 2)
9393
ROM_COPY.writeMultipleBytes(int(new_coords[1] + 4.25), 2)
9494
ROM_COPY.writeMultipleBytes(int(new_coords[2]), 2)

static/patches/shrink-dk64.bps

8 Bytes
Binary file not shown.

wiki/article_markdown/custom_locations/CustomLocationsColoredBananas.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
| 5DT side (1 custom, 4 Diddy) | 5 | |
234234
| Around 5DT bottom ledge | 20 | |
235235
| Around 5DT top ledge | 15 | |
236-
| Bunches on patch of sand between Llama temple and W2-3-4 (accessible by jumping from nearby tree) | 10 | |
236+
| Bunches on patch of sand between Llama temple and W2-3-4 (accessible by jumping from nearby tree) | 10 | `l.climbing or l.jetpack` |
237237
| Bunches on 4 corners of Chunky BB cage | 20 | |
238238
| Bunches on top of Chunky BB cage | 10 | |
239239
| Along the walls around Chunky BB cage | 15 | |

0 commit comments

Comments
 (0)