From be76f47edf63d82abf6560c0ba935312a712eac0 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Sat, 14 Sep 2024 10:12:14 -0400 Subject: [PATCH] Tighten up some opcodes --- src/rooms/city_building2.asm | 5 +++-- src/rooms/city_center.asm | 5 +++-- src/rooms/sewer_basin.asm | 3 +-- src/rooms/sewer_south.asm | 3 +-- src/rooms/sewer_west.asm | 3 +-- src/rooms/shadow_hall.asm | 5 ++--- src/sounds/sequence.asm | 3 +-- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/rooms/city_building2.asm b/src/rooms/city_building2.asm index ea2ba430..3bdd2e79 100644 --- a/src/rooms/city_building2.asm +++ b/src/rooms/city_building2.asm @@ -171,8 +171,9 @@ _Devices_sDevice_arr: @loop: jsr Func_GetRandomByte ; preserves X, returns A and #$03 - add #1 - sta Zp_RoomState + sCityCenterState::Key_u8_arr, x + tay + iny + sty Zp_RoomState + sCityCenterState::Key_u8_arr, x dex bpl @loop inx ; now X is zero diff --git a/src/rooms/city_center.asm b/src/rooms/city_center.asm index 84e3c39b..863eb7b6 100644 --- a/src/rooms/city_center.asm +++ b/src/rooms/city_center.asm @@ -625,8 +625,9 @@ _GenerateKey: @loop: jsr Func_GetRandomByte ; preserves X and Y, returns A and #$03 - add #1 - sta Zp_RoomState + sCityCenterState::Key_u8_arr, x + tay + iny + sty Zp_RoomState + sCityCenterState::Key_u8_arr, x dex bpl @loop @done: diff --git a/src/rooms/sewer_basin.asm b/src/rooms/sewer_basin.asm index 9621c4e7..2ef7db52 100644 --- a/src/rooms/sewer_basin.asm +++ b/src/rooms/sewer_basin.asm @@ -324,8 +324,7 @@ _ReadY: beq @error dex @success: - txa - sta Zp_RoomState + sState::MultiplexerGoalVert_u8_arr, y + stx Zp_RoomState + sState::MultiplexerGoalVert_u8_arr, y jmp FuncA_Machine_StartWorking @error: jmp FuncA_Machine_Error diff --git a/src/rooms/sewer_south.asm b/src/rooms/sewer_south.asm index 93d02965..78279764 100644 --- a/src/rooms/sewer_south.asm +++ b/src/rooms/sewer_south.asm @@ -278,8 +278,7 @@ _ReadY: tax ; goal vert dex @success: - txa - sta Zp_RoomState + sState::MultiplexerGoalVert_u8_arr, y + stx Zp_RoomState + sState::MultiplexerGoalVert_u8_arr, y jmp FuncA_Machine_StartWorking @error: jmp FuncA_Machine_Error diff --git a/src/rooms/sewer_west.asm b/src/rooms/sewer_west.asm index 76be0cbc..9496ebea 100644 --- a/src/rooms/sewer_west.asm +++ b/src/rooms/sewer_west.asm @@ -256,8 +256,7 @@ _ReadX: beq @error dex @success: - txa - sta Zp_RoomState + sState::MultiplexerGoalHorz_u8_arr, y + stx Zp_RoomState + sState::MultiplexerGoalHorz_u8_arr, y jmp FuncA_Machine_StartWorking @error: jmp FuncA_Machine_Error diff --git a/src/rooms/shadow_hall.asm b/src/rooms/shadow_hall.asm index e903dd10..0d036263 100644 --- a/src/rooms/shadow_hall.asm +++ b/src/rooms/shadow_hall.asm @@ -501,10 +501,9 @@ _BlinkBreakableGlass: stx T4 ; bullet actor index ldx Zp_RoomState + sState::BreakableGlassHits_u8_arr2, y inx - txa - sta Zp_RoomState + sState::BreakableGlassHits_u8_arr2, y + stx Zp_RoomState + sState::BreakableGlassHits_u8_arr2, y ;; Check if the glass is broken yet. - cmp #kNumHitsToBreakGlass + cpx #kNumHitsToBreakGlass bge _Broken _NotBroken: jsr FuncA_Room_PlaySfxCrack ; preserves T0+ diff --git a/src/sounds/sequence.asm b/src/sounds/sequence.asm index 00b08d61..ab24dc35 100644 --- a/src/sounds/sequence.asm +++ b/src/sounds/sequence.asm @@ -97,8 +97,7 @@ _SoundFinished: .EXPORT Func_PlaySfxSequence .PROC Func_PlaySfxSequence sta Zp_Next_sChanSfx_arr + sChanSfx::Param1_byte, x - tya - sta Zp_Next_sChanSfx_arr + sChanSfx::Param2_byte, x + sty Zp_Next_sChanSfx_arr + sChanSfx::Param2_byte, x lda #0 sta Zp_Next_sChanSfx_arr + sChanSfx::Timer_u8, x lda #eSound::Sequence