Skip to content

Commit

Permalink
Make laser machines zero the C register on machine reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed May 21, 2024
1 parent 560bfcd commit 4c75588
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/actors/goo.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
;;; cleared if it is facing right.
;;; * State1: A counter that increments each frame, to drive the goo's
;;; animation.
;;; * State2: Unused.
;;; * State3: Unused.
;;; * State2: The room block column for the goo's "home base" (red goo only).
;;; * State3: Boolean; true ($ff) if the goo should move this movement cycle,
;;; false ($00) if it should stay put (red goo only).
;;; * State4: Unused.

;;; Tile IDs for drawing goo baddie actors.
Expand Down
10 changes: 10 additions & 0 deletions src/machines/laser.asm
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ _Outside:
rts
.ENDPROC

;;; Reset implemention for laser machines.
;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized.
.EXPORT FuncA_Room_MachineLaserReset
.PROC FuncA_Room_MachineLaserReset
ldx Zp_MachineIndex_u8
lda #0
sta Ram_MachineState1_byte_arr, x ; laser color (even=red, odd=green)
rts
.ENDPROC

;;;=========================================================================;;;

.SEGMENT "PRGA_Machine"
Expand Down
3 changes: 2 additions & 1 deletion src/rooms/core_boss.asm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
.IMPORT FuncA_Room_HarmBadGronta
.IMPORT FuncA_Room_IsPointInLaserBeam
.IMPORT FuncA_Room_MachineCannonReset
.IMPORT FuncA_Room_MachineLaserReset
.IMPORT FuncA_Room_ReflectFireblastsOffMirror
.IMPORT FuncA_Room_TurnProjectilesToSmoke
.IMPORT FuncA_Room_TurnProjectilesToSmokeIfConsoleOpen
Expand Down Expand Up @@ -1469,7 +1470,7 @@ _Finished:
.PROC FuncA_Room_CoreBossLaser_InitReset
lda #kLaserInitGoalX
sta Ram_MachineGoalHorz_u8_arr + kLaserMachineIndex
rts
jmp FuncA_Room_MachineLaserReset
.ENDPROC

;;;=========================================================================;;;
Expand Down
3 changes: 2 additions & 1 deletion src/rooms/shadow_drill.asm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
.IMPORT FuncA_Objects_DrawLaserMachine
.IMPORT FuncA_Room_HarmAvatarIfWithinLaserBeam
.IMPORT FuncA_Room_KillGooWithLaserBeam
.IMPORT FuncA_Room_MachineLaserReset
.IMPORT Func_MachineLaserReadRegC
.IMPORT Func_Noop
.IMPORT Func_SetMachineIndex
Expand Down Expand Up @@ -232,7 +233,7 @@ _ReadX:
.PROC FuncA_Room_ShadowDrillLaser_InitReset
lda #kLaserInitGoalX
sta Ram_MachineGoalHorz_u8_arr + kLaserMachineIndex
rts
jmp FuncA_Room_MachineLaserReset
.ENDPROC

;;;=========================================================================;;;
Expand Down
3 changes: 2 additions & 1 deletion src/rooms/shadow_flower.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
.IMPORT FuncA_Objects_DrawLaserMachine
.IMPORT FuncA_Room_HarmAvatarIfWithinLaserBeam
.IMPORT FuncA_Room_KillGooWithLaserBeam
.IMPORT FuncA_Room_MachineLaserReset
.IMPORT FuncA_Room_RemoveFlowerDeviceIfCarriedOrDelivered
.IMPORT FuncA_Room_RespawnFlowerDeviceIfDropped
.IMPORT Func_MachineLaserReadRegC
Expand Down Expand Up @@ -224,7 +225,7 @@ _ReadX:
.PROC FuncA_Room_ShadowFlowerLaser_InitReset
lda #kLaserInitGoalX
sta Ram_MachineGoalHorz_u8_arr + kLaserMachineIndex
rts
jmp FuncA_Room_MachineLaserReset
.ENDPROC

;;;=========================================================================;;;
Expand Down
3 changes: 2 additions & 1 deletion src/rooms/shadow_trap.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
.IMPORT FuncA_Room_HarmAvatarIfWithinLaserBeam
.IMPORT FuncA_Room_InitActorBadFlydrop
.IMPORT FuncA_Room_IsPointInLaserBeam
.IMPORT FuncA_Room_MachineLaserReset
.IMPORT FuncC_Shadow_DrawBarrierPlatform
.IMPORT Func_FindEmptyActorSlot
.IMPORT Func_InitActorSmokeExplosion
Expand Down Expand Up @@ -379,7 +380,7 @@ _OpenBarriers:
.PROC FuncA_Room_ShadowTrapLaser_InitReset
lda #kLaserInitGoalX
sta Ram_MachineGoalHorz_u8_arr + kLaserMachineIndex
rts
jmp FuncA_Room_MachineLaserReset
.ENDPROC

;;;=========================================================================;;;
Expand Down

0 comments on commit 4c75588

Please sign in to comment.