aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-05-20 15:16:43 +0200
committerAstatin <[email protected]>2025-05-20 15:16:43 +0200
commit34ee469cc32584d579bae925857fc25c0a8c6c1b (patch)
treeb5f33d4419ce400a4ad06179f88f7d6e1d6e5ae1
parent9843e1e65b6eb3e96a6b6a73ffaeab4481061ac6 (diff)
Fix object not deleted when dialogue open on specific frame
-rw-r--r--dialogues/dialogues.gbasm12
-rw-r--r--entity/bug.gbasm1
-rw-r--r--entity/mouse.gbasm1
-rw-r--r--gui.gbasm8
-rw-r--r--map/loading.gbasm1
-rw-r--r--scripts/edit-recording.py30
6 files changed, 46 insertions, 7 deletions
diff --git a/dialogues/dialogues.gbasm b/dialogues/dialogues.gbasm
index 2c4a2fd..02b6f79 100644
--- a/dialogues/dialogues.gbasm
+++ b/dialogues/dialogues.gbasm
@@ -74,7 +74,9 @@ Dialogue_script_instruction_Jump_Table:
CALL =Print_str
POP HL
- LD A, $05
+ LD A, $mem_display_flag
+ AND $40 ; Keeping the object ones
+ OR $05
LD $mem_display_flag, A
RET
@@ -110,7 +112,9 @@ Dialogue_script_instruction_Jump_Table:
CALL =Print_str
POP HL
- LD A, $07
+ LD A, $mem_display_flag
+ AND $40 ; Keeping the object ones
+ OR $07
LD $mem_display_flag, A
RET
@@ -156,7 +160,9 @@ Dialogue_script_instruction_Jump_Table:
CALL =Print_str
POP HL
- LD A, $07
+ LD A, $mem_display_flag
+ AND $40 ; Keeping the object ones
+ OR $07
LD $mem_display_flag, A
RET
diff --git a/entity/bug.gbasm b/entity/bug.gbasm
index 29e5b77..989122e 100644
--- a/entity/bug.gbasm
+++ b/entity/bug.gbasm
@@ -45,7 +45,6 @@ Bug_Turn:
LD L, A
LD (HL), $05
LD A, (HL)
- DBG
.attack_end:
.Mid_movement:
diff --git a/entity/mouse.gbasm b/entity/mouse.gbasm
index 75f84ab..f87bb88 100644
--- a/entity/mouse.gbasm
+++ b/entity/mouse.gbasm
@@ -41,7 +41,6 @@ Mouse_Turn:
LD L, A
LD (HL), $05
LD A, (HL)
- DBG
.attack_end:
.Mid_movement:
diff --git a/gui.gbasm b/gui.gbasm
index 1a71621..0e1098a 100644
--- a/gui.gbasm
+++ b/gui.gbasm
@@ -1,5 +1,7 @@
.MACRODEF CLOSE_DIALOGUE
- LD A, $04
+ LD A, $mem_display_flag
+ AND $60
+ OR $04
LD $mem_display_flag, A
LD HL, $dialogue_first_line
@@ -333,7 +335,9 @@ Open_dialogue_on_dungeon_menu_mode:
LD A, $mem_display_flag
BIT 0, A
RET NZ
- LD A, $0d
+ LD A, $mem_display_flag
+ AND $40 ; Keeping object additional tile
+ OR $0d
LD $mem_display_flag, A
RET
diff --git a/map/loading.gbasm b/map/loading.gbasm
index 878d0e1..1247b08 100644
--- a/map/loading.gbasm
+++ b/map/loading.gbasm
@@ -269,6 +269,7 @@ Load_Additional_Block:
LD $mem_additional_loading_block_position_1, A
LD A, $mem_prepared_block_position_2
LD $mem_additional_loading_block_position_2, A
+
RET
Display_Prepared_Blocks:
diff --git a/scripts/edit-recording.py b/scripts/edit-recording.py
new file mode 100644
index 0000000..5f98a7e
--- /dev/null
+++ b/scripts/edit-recording.py
@@ -0,0 +1,30 @@
+import sys
+
+file = open(sys.argv[1], "rb")
+output_file = open(sys.argv[2], "wb")
+
+last_cycle_update = 0
+offset = 0
+while True:
+ next_cycle_update_buf = file.read(16)
+ if len(next_cycle_update_buf) < 16:
+ break
+ inputs = file.read(2)
+
+ next_cycle_update = int.from_bytes(next_cycle_update_buf, byteorder="little", signed=False)
+ print("CYCLES: %d, input1: %08x, input2: %08x" % (next_cycle_update, inputs[0], inputs[1]))
+
+
+ next_cycle_update -= offset
+
+ if last_cycle_update != 0:
+ if next_cycle_update - last_cycle_update > 70224 * 256 * 8:
+ new_offset = (next_cycle_update - last_cycle_update) - ((next_cycle_update - last_cycle_update) % (70224 * 256)) - (70224 * 256)
+ print(new_offset)
+ next_cycle_update -= new_offset
+ offset += new_offset
+
+
+ last_cycle_update = next_cycle_update
+ output_file.write(next_cycle_update.to_bytes(16, byteorder="little", signed=False))
+ output_file.write(inputs)