1212
1313exit_adjustments = [
1414 {
15- "containing_map" : 0x30 , # Fungi Main
15+ "containing_map" : Maps . Fungi , # Fungi Main
1616 "exits" : [
1717 {
1818 # Dark Attic
4545 ],
4646 },
4747 {
48- "containing_map" : 0x1E , # Galleon
48+ "containing_map" : Maps . Galleon , # Galleon
4949 "exits" : [
5050 {
5151 # Lighthouse
6464 ],
6565 },
6666 {
67- "containing_map" : 112 , # DDC Crypt
67+ "containing_map" : Maps . CastleCryptDKDiddyChunky , # DDC Crypt
6868 "exits" : [
6969 {
7070 # Minecart
7676 ],
7777 },
7878 {
79- "containing_map" : 0x22 , # Isles
79+ "containing_map" : Maps . Isles , # Isles
8080 "exits" : [
8181 {
8282 # Aztec Lobby
9595 ],
9696 },
9797 {
98- "containing_map" : 0x1A , # Factory
98+ "containing_map" : Maps . Factory , # Factory
9999 "exits" : [
100100 {
101101 # Crusher
107107 ],
108108 },
109109 {
110- "containing_map" : 0x57 , # Castle
110+ "containing_map" : Maps . Castle , # Castle
111111 "exits" : [
112112 {
113113 # Tree
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" ))
0 commit comments