From 35ea47e35b687752adef4193e3dd89032f14abc9 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Wed, 1 May 2024 08:56:14 -0400 Subject: [PATCH] Change layout of blaster machine and mirrors in CoreBoss --- src/chr.asm | 3 + src/machine.asm | 3 - src/machines/ammorack.inc | 1 - src/machines/blaster.asm | 187 +++++++++++------------------------ src/machines/blaster.inc | 9 +- src/machines/boiler.inc | 1 - src/machines/bridge.inc | 1 - src/machines/cannon.inc | 1 - src/machines/carriage.inc | 1 - src/machines/conveyor.inc | 1 - src/machines/crane.inc | 1 - src/machines/emitter.inc | 1 - src/machines/field.inc | 1 - src/machines/hoist.inc | 1 - src/machines/jet.inc | 1 - src/machines/laser.inc | 1 - src/machines/launcher.inc | 1 - src/machines/lift.inc | 1 - src/machines/minigun.inc | 1 - src/machines/multiplexer.inc | 1 - src/machines/pump.inc | 1 - src/machines/reloader.inc | 1 - src/machines/rotor.inc | 1 - src/machines/semaphore.inc | 1 - src/machines/winch.inc | 1 - src/rooms/boss_lava.asm | 15 ++- src/rooms/core_boss.asm | 133 ++++++++++--------------- src/rooms/core_boss.bg | 8 +- src/rooms/lava_center.asm | 50 +++------- src/rooms/lava_east.asm | 50 +++------- src/tiles/blaster.ahi | 11 +-- src/tiles/core_pipes2.ahi | 20 ++-- src/tilesets/core.bg | 6 +- 33 files changed, 166 insertions(+), 350 deletions(-) diff --git a/src/chr.asm b/src/chr.asm index 0589e560..0bf72540 100644 --- a/src/chr.asm +++ b/src/chr.asm @@ -1113,6 +1113,7 @@ _chr_begin: chr_inc "launcher_horz", kTileIdObjLauncherHorzFirst chr_inc "boulder", kTileIdObjBoulderFirst chr_inc "blaster", kTileIdObjBlasterFirst + chr_res $01 chr_inc "fireblast", kTileIdObjFireblastFirst chr_inc "platform_city_walls", kTileIdObjPlatformCityWalls chr_inc "outbreak_obj", kTileIdObjOutbreakFirst @@ -1146,6 +1147,7 @@ _chr_begin: chr_res $02 chr_inc "eirene_parley", kTileIdObjEireneParleyFirst chr_inc "blaster", kTileIdObjBlasterFirst + chr_res $01 chr_inc "fireblast", kTileIdObjFireblastFirst chr_inc "orc_gronta_parley", kTileIdObjOrcGrontaParleyFirst chr_inc "orc_gronta_standing", kTileIdObjOrcGrontaStandingFirst @@ -1275,6 +1277,7 @@ _chr_begin: chr_inc "boiler_flame", kTileIdObjBoilerFlameFirst chr_res $0a chr_inc "blaster", kTileIdObjBlasterFirst + chr_res $01 chr_inc "fireblast", kTileIdObjFireblastFirst chr_res $04 chr_inc "bad_hothead", kTileIdObjBadHotheadFirst diff --git a/src/machine.asm b/src/machine.asm index 8e7c2871..2e895924 100644 --- a/src/machine.asm +++ b/src/machine.asm @@ -114,8 +114,6 @@ Ram_MachineState1_byte_arr: .res kMaxMachines Ram_MachineState2_byte_arr: .res kMaxMachines .EXPORT Ram_MachineState3_byte_arr Ram_MachineState3_byte_arr: .res kMaxMachines -.EXPORT Ram_MachineState4_byte_arr -Ram_MachineState4_byte_arr: .res kMaxMachines ;;;=========================================================================;;; @@ -315,7 +313,6 @@ _ReadRegB: sta Ram_MachineState1_byte_arr, x sta Ram_MachineState2_byte_arr, x sta Ram_MachineState3_byte_arr, x - sta Ram_MachineState4_byte_arr, x ;; Initialize any machine-specific state. ldy #sMachine::Init_func_ptr ; param: function pointer offset jsr Func_MachineCall diff --git a/src/machines/ammorack.inc b/src/machines/ammorack.inc index cc0af845..3251b86d 100644 --- a/src/machines/ammorack.inc +++ b/src/machines/ammorack.inc @@ -22,7 +22,6 @@ ;;; slot number N. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; How many ammo slots are in an ammo rack machine. kNumAmmoRackSlots = 3 diff --git a/src/machines/blaster.asm b/src/machines/blaster.asm index feb64229..4df8be3c 100644 --- a/src/machines/blaster.asm +++ b/src/machines/blaster.asm @@ -25,6 +25,8 @@ .INCLUDE "blaster.inc" .INCLUDE "shared.inc" +.IMPORT FuncA_Machine_GenericMoveTowardGoalHorz +.IMPORT FuncA_Machine_ReachedGoal .IMPORT FuncA_Machine_StartWaiting .IMPORT FuncA_Machine_StartWorking .IMPORT FuncA_Objects_Alloc2x2MachineShape @@ -35,7 +37,6 @@ .IMPORT Func_InitActorProjFireblast .IMPORT Func_IsPointInPlatform .IMPORT Func_MovePointDownByA -.IMPORT Func_MovePointHorz .IMPORT Func_PlaySfxShootFire .IMPORT Func_ReinitActorProjFireblastVelocity .IMPORT Func_SetActorCenterToPoint @@ -45,9 +46,7 @@ .IMPORT Ram_ActorState3_byte_arr .IMPORT Ram_ActorType_eActor_arr .IMPORT Ram_MachineState1_byte_arr -.IMPORT Ram_MachineState2_byte_arr .IMPORT Ram_MachineState3_byte_arr -.IMPORT Ram_MachineState4_byte_arr .IMPORT Ram_Oam_sObj_arr64 .IMPORTZP Zp_ConsoleMachineIndex_u8 .IMPORTZP Zp_Current_sMachine_ptr @@ -62,108 +61,61 @@ kBlasterProjectileOffset = 9 ;;; How many frames a blaster machine spends per ACT operation. kBlasterActCountdown = $60 +;;; The offset from relative to absolute angles for blaster mirrors, in +;;; increments of tau/16. +kMirrorAngleOffset = 7 + ;;; Various OBJ tile IDs used for drawing blaster machines. -kTileIdObjBlasterBarrelVert = kTileIdObjBlasterFirst + 0 -kTileIdObjBlasterBarrelHorz = kTileIdObjBlasterFirst + 1 +kTileIdObjBlasterBarrel = kTileIdObjBlasterFirst + 0 ;;;=========================================================================;;; .SEGMENT "PRG8" -;;; ReadReg implemention for a blaster machine's mirrors. +;;; ReadReg implemention for a blaster machine's M (mirror) register. ;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -;;; @param A The mirror register to read ($c or $d). ;;; @return A The value of the register (0-9). -.EXPORT Func_MachineBlasterReadRegMirrors -.PROC Func_MachineBlasterReadRegMirrors +.EXPORT Func_MachineBlasterReadRegM +.PROC Func_MachineBlasterReadRegM ldx Zp_MachineIndex_u8 - cmp #$0d - beq @mirror2 - @mirror1: lda Ram_MachineState1_byte_arr, x rts - @mirror2: - lda Ram_MachineState2_byte_arr, x - rts .ENDPROC ;;;=========================================================================;;; .SEGMENT "PRGA_Machine" -;;; WriteReg implemention for a blaster machine's mirrors. +;;; WriteReg implemention for a blaster machine's M (mirror) register. ;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. ;;; @param A The value to write (0-9). -;;; @param X The register to write to ($c or $d). -.EXPORT FuncA_Machine_BlasterWriteRegMirrors -.PROC FuncA_Machine_BlasterWriteRegMirrors +.EXPORT FuncA_Machine_BlasterWriteRegM +.PROC FuncA_Machine_BlasterWriteRegM ldy Zp_MachineIndex_u8 - cpx #$0d - beq @mirror2 - @mirror1: cmp Ram_MachineState1_byte_arr, y beq @done sta Ram_MachineState1_byte_arr, y jmp FuncA_Machine_StartWorking - @mirror2: - cmp Ram_MachineState2_byte_arr, y - beq @done - sta Ram_MachineState2_byte_arr, y - jmp FuncA_Machine_StartWorking @done: rts .ENDPROC ;;; TryAct implemention for vertical blaster machines. ;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -.EXPORT FuncA_Machine_BlasterVertTryAct -.PROC FuncA_Machine_BlasterVertTryAct +.EXPORT FuncA_Machine_BlasterTryAct +.PROC FuncA_Machine_BlasterTryAct + jsr Func_FindEmptyActorSlot ; returns C and X + bcs _Finish +_InitProjectile: ldy #sMachine::MainPlatform_u8 lda (Zp_Current_sMachine_ptr), y tay ; param: platform index jsr Func_SetPointToPlatformCenter ; preserves X lda #kBlasterProjectileOffset ; param: offset jsr Func_MovePointDownByA ; preserves X - ldy #$40 ; param: projectile angle - bne FuncA_Machine_BlasterShootFireblast ; unconditional -.ENDPROC - -;;; TryAct implemention for horizontal blaster machines. -;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -.EXPORT FuncA_Machine_BlasterHorzTryAct -.PROC FuncA_Machine_BlasterHorzTryAct - ldy #sMachine::MainPlatform_u8 - lda (Zp_Current_sMachine_ptr), y - tay ; param: platform index - jsr Func_SetPointToPlatformCenter ; preserves X - ldy #sMachine::Flags_bMachine - lda (Zp_Current_sMachine_ptr), y - and #bMachine::FlipH - beq @shootRight - @shootLeft: - ldy #$80 ; projectile angle - lda #<-kBlasterProjectileOffset ; param: offset - bmi @movePoint ; unconditional - @shootRight: - ldy #$00 ; projectile angle - lda #kBlasterProjectileOffset ; param: offset - @movePoint: - jsr Func_MovePointHorz ; preserves X and Y - .assert * = FuncA_Machine_BlasterShootFireblast, error, "fallthrough" -.ENDPROC - -;;; Shoots a fireblast from a blaster machine, and makes the machine starting -;;; waiting for a bit. -;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -;;; @prereq Zp_Point* stores the starting position of the fireblast. -;;; @param Y The angle to fire at, measured in increments of tau/256. -.PROC FuncA_Machine_BlasterShootFireblast - jsr Func_FindEmptyActorSlot ; preserves Y, returns C and X - bcs _Finish -_InitProjectile: - jsr Func_SetActorCenterToPoint ; preserves X and Y - tya ; param: projectile angle - jsr Func_InitActorProjFireblast + jsr Func_SetActorCenterToPoint ; preserves X + lda #$40 ; param: projectile angle + jsr Func_InitActorProjFireblast ; preserves X ;; If the console is active, then we must be debugging, so immediately ;; replace the fireblast with a smoke particle (so as to dry-fire the ;; blaster). @@ -181,20 +133,18 @@ _Finish: jmp FuncA_Machine_StartWaiting .ENDPROC -;;; Tick implemention for blaster machine mirrors. +;;; Tick implemention for vertical blaster machines. ;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -;;; @return A The number of mirrors that moved. -;;; @return Z Set if no mirrors moved. -;;; @preserve T1+ -.EXPORT FuncA_Machine_BlasterTickMirrors -.PROC FuncA_Machine_BlasterTickMirrors - lda #0 - sta T0 ; num mirrors moved +;;; @param AX The minimum platform left position for the machine. +.EXPORT FuncA_Machine_BlasterTick +.PROC FuncA_Machine_BlasterTick + jsr FuncA_Machine_GenericMoveTowardGoalHorz ; returns A + sta T0 ; nonzero if moved +_TickMirrors: ldx Zp_MachineIndex_u8 -_Mirror1: - lda Ram_MachineState1_byte_arr, x ; mirror 1 goal + lda Ram_MachineState1_byte_arr, x ; mirror goal mul #kBlasterMirrorAnimSlowdown - cmp Ram_MachineState3_byte_arr, x ; mirror 1 animation angle + cmp Ram_MachineState3_byte_arr, x ; mirror animation angle beq @done blt @decrement @increment: @@ -203,24 +153,11 @@ _Mirror1: @decrement: dec Ram_MachineState3_byte_arr, x ; mirror 1 animation angle @moved: - inc T0 ; num mirrors moved - @done: -_Mirror2: - lda Ram_MachineState2_byte_arr, x ; mirror 2 goal - mul #kBlasterMirrorAnimSlowdown - cmp Ram_MachineState4_byte_arr, x ; mirror 2 animation angle - beq @done - blt @decrement - @increment: - inc Ram_MachineState4_byte_arr, x ; mirror 2 animation angle - bne @moved ; unconditional - @decrement: - dec Ram_MachineState4_byte_arr, x ; mirror 2 animation angle - @moved: - inc T0 ; num mirrors moved + inc T0 ; nonzero if moved @done: -_Finish: - lda T0 ; num mirrors moved +_CheckIfReachedGoal: + lda T0 ; nonzero if moved + jeq FuncA_Machine_ReachedGoal rts .ENDPROC @@ -230,11 +167,15 @@ _Finish: ;;; Checks if any fireblasts are hitting the specified mirror, and if so, ;;; reflects them off of the mirror. -;;; @param A The absolute mirror angle, in increments of tau/16. +;;; @param X The machine index for the blaster that controls this mirror. ;;; @param Y The platform index for the mirror. -;;; @preserve Y, T5+ +;;; @preserve X, Y .EXPORT FuncA_Room_ReflectFireblastsOffMirror .PROC FuncA_Room_ReflectFireblastsOffMirror + stx T5 ; blaster machine index + lda Ram_MachineState3_byte_arr, x ; mirror anim + div #kBlasterMirrorAnimSlowdown + add #kMirrorAngleOffset mul #$10 sta T4 ; absolute mirror angle (in tau/256 units) ldx #kMaxActors - 1 @@ -284,6 +225,7 @@ _Continue: dex .assert kMaxActors <= $80, error bpl _Loop + ldx T5 ; blaster machine index rts .ENDPROC @@ -291,32 +233,10 @@ _Continue: .SEGMENT "PRGA_Objects" -;;; Draw implemention for horizontal blaster machines. -;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -.EXPORT FuncA_Objects_DrawBlasterMachineHorz -.PROC FuncA_Objects_DrawBlasterMachineHorz - lda #kPaletteObjMachineLight ; param: object flags - jsr FuncA_Objects_Alloc2x2MachineShape ; returns C, A, and Y - bcs @done - eor #bObj::FlipH - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 1 + sObj::Flags_bObj, y - eor #bObj::FlipHV - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 3 + sObj::Flags_bObj, y - jsr FuncA_Objects_GetMachineLightTileId ; preserves Y, returns A - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 0 + sObj::Tile_u8, y - lda #kTileIdObjMachineCorner - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 1 + sObj::Tile_u8, y - lda #kTileIdObjBlasterBarrelHorz - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 2 + sObj::Tile_u8, y - sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 3 + sObj::Tile_u8, y - @done: - rts -.ENDPROC - ;;; Draw implemention for vertical blaster machines. ;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. -.EXPORT FuncA_Objects_DrawBlasterMachineVert -.PROC FuncA_Objects_DrawBlasterMachineVert +.EXPORT FuncA_Objects_DrawBlasterMachine +.PROC FuncA_Objects_DrawBlasterMachine lda #kPaletteObjMachineLight ; param: object flags jsr FuncA_Objects_Alloc2x2MachineShape ; returns C, A, and Y bcs @done @@ -329,7 +249,7 @@ _Continue: sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 0 + sObj::Tile_u8, y jsr FuncA_Objects_GetMachineLightTileId ; preserves Y, returns A sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 2 + sObj::Tile_u8, y - lda #kTileIdObjBlasterBarrelVert + lda #kTileIdObjBlasterBarrel sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 1 + sObj::Tile_u8, y sta Ram_Oam_sObj_arr64 + .sizeof(sObj) * 3 + sObj::Tile_u8, y @done: @@ -337,23 +257,28 @@ _Continue: .ENDPROC ;;; Draws a mirror that can reflect blaster machine projectiles. -;;; @param A The absolute mirror angle, in increments of tau/16. +;;; @prereq Zp_MachineIndex_u8 and Zp_Current_sMachine_ptr are initialized. ;;; @param X The platform index for the mirror. -;;; @preserve T2+ +;;; @preserve X, T2+ .EXPORT FuncA_Objects_DrawBlasterMirror .PROC FuncA_Objects_DrawBlasterMirror - tay ; mirror angle - jsr FuncA_Objects_SetShapePosToPlatformTopLeft ; preserves Y and T0+ - tya ; mirror angle + stx T0 ; mirror platform index + jsr FuncA_Objects_SetShapePosToPlatformTopLeft ; preserves T0+ + ldy Zp_MachineIndex_u8 + lda Ram_MachineState3_byte_arr, y ; mirror anim + div #kBlasterMirrorAnimSlowdown + add #kMirrorAngleOffset + tay ; absolute mirror angle (in increments of tau/16) div #4 and #$03 tax - tya ; mirror angle + tya ; absolute mirror angle (in increments of tau/16) ldy _Flags_bObj_arr4, x ; param: object flags and #$07 tax ; mirror angle (mod 8) lda _TileId_u8_arr8, x ; param: tile ID - jmp FuncA_Objects_Draw1x1Shape ; preserves T2+ + ldx T0 ; mirror platform index + jmp FuncA_Objects_Draw1x1Shape ; preserves X and T2+ _TileId_u8_arr8: .byte kTileIdObjMirrorFirst + 0 .byte kTileIdObjMirrorFirst + 1 diff --git a/src/machines/blaster.inc b/src/machines/blaster.inc index b6c0c593..1b27bd11 100644 --- a/src/machines/blaster.inc +++ b/src/machines/blaster.inc @@ -19,12 +19,11 @@ ;;; State bytes for blaster machines: ;;; * Slowdown: Unused. -;;; * State1: The relative goal angle for mirror #1, in increments of tau/16. -;;; * State2: The relative goal angle for mirror #2, in increments of tau/16. -;;; * State3: The current animation angle for mirror #1, which ticks each +;;; * State1: The relative goal angle for the mirrors, in increments of +;;; tau/16. +;;; * State2: Unused. +;;; * State3: The current animation angle for the mirrors, which ticks each ;;; frame toward (State1 * kBlasterMirrorAnimSlowdown). -;;; * State4: The current animation angle for mirror #2, which ticks each -;;; frame toward (State2 * kBlasterMirrorAnimSlowdown). ;;; The size of a blaster machine's main platform, in pixels. kBlasterMachineWidthPx = $10 diff --git a/src/machines/boiler.inc b/src/machines/boiler.inc index 1c586437..8c48dfd8 100644 --- a/src/machines/boiler.inc +++ b/src/machines/boiler.inc @@ -23,7 +23,6 @@ ;;; * State2: The current angle of valve #2, which tends toward ;;; MachineGoalVert * kBoilerValveAnimSlowdown. ;;; * State3: A cooldown timer for drawing the ignition flame. -;;; * State4: Unused. ;;; The number of frames between valve angles when animating a boiler valve. .DEFINE kBoilerValveAnimSlowdown 4 diff --git a/src/machines/bridge.inc b/src/machines/bridge.inc index 4e0d0e85..452c6bbe 100644 --- a/src/machines/bridge.inc +++ b/src/machines/bridge.inc @@ -22,7 +22,6 @@ ;;; kBridgeMaxAngle for all the way up. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The maximum permitted value for the bridge angle (which is stored in ;;; State1). diff --git a/src/machines/cannon.inc b/src/machines/cannon.inc index 27d4ef3c..f12fee39 100644 --- a/src/machines/cannon.inc +++ b/src/machines/cannon.inc @@ -23,7 +23,6 @@ ;;; way up). ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The CHR bank numbers containing the diagrams for cannon machines. kChrBankDiagramCannonLeft = $04 diff --git a/src/machines/carriage.inc b/src/machines/carriage.inc index c8591349..ddb1fd32 100644 --- a/src/machines/carriage.inc +++ b/src/machines/carriage.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a carriage machine's main platform, in pixels. kCarriageMachineWidthPx = $20 diff --git a/src/machines/conveyor.inc b/src/machines/conveyor.inc index 3c04d025..fd25c357 100644 --- a/src/machines/conveyor.inc +++ b/src/machines/conveyor.inc @@ -26,7 +26,6 @@ ;;; * State2: True ($ff) if the player avatar is currently standing on one of ;;; this machine's conveyor belt platforms, false ($00) otherwise. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of conveyor machine's main platform, in pixels. kConveyorMainPlatformWidthPx = $08 diff --git a/src/machines/crane.inc b/src/machines/crane.inc index 2cef5741..c8aa56f4 100644 --- a/src/machines/crane.inc +++ b/src/machines/crane.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; How many frames the crane machine spends per act operation. kCraneActCooldown = 8 diff --git a/src/machines/emitter.inc b/src/machines/emitter.inc index e5206f1b..3be33c3d 100644 --- a/src/machines/emitter.inc +++ b/src/machines/emitter.inc @@ -22,7 +22,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; How many frames an emitter machine spends per ACT operation. kEmitterActCountdown = 10 diff --git a/src/machines/field.inc b/src/machines/field.inc index 7540f732..cc7f6bcf 100644 --- a/src/machines/field.inc +++ b/src/machines/field.inc @@ -22,7 +22,6 @@ ;;; since it was last reset or discharged. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size, in pixels, of a teleport field machine's primary platform. kFieldMachineWidth = $10 diff --git a/src/machines/hoist.inc b/src/machines/hoist.inc index 6c98cb26..4df36254 100644 --- a/src/machines/hoist.inc +++ b/src/machines/hoist.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a hoist machine's main platform, in pixels. kHoistMachineWidthPx = $10 diff --git a/src/machines/jet.inc b/src/machines/jet.inc index 634f7992..1ce368ae 100644 --- a/src/machines/jet.inc +++ b/src/machines/jet.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a jet machine's main platform, in pixels. kJetPlatformWidthPx = $20 diff --git a/src/machines/laser.inc b/src/machines/laser.inc index 44a6ef22..7ff3879b 100644 --- a/src/machines/laser.inc +++ b/src/machines/laser.inc @@ -24,7 +24,6 @@ ;;; will be red; if odd, the laser beam will be green. ;;; * State2: The lo byte of the Y-position for the bottom of the laser beam. ;;; * State3: The hi byte of the Y-position for the bottom of the laser beam. -;;; * State4: Unused. ;;; The size of a laser machine's main platform, in pixels. kLaserMachineWidthPx = $10 diff --git a/src/machines/launcher.inc b/src/machines/launcher.inc index 59852597..a2716d72 100644 --- a/src/machines/launcher.inc +++ b/src/machines/launcher.inc @@ -22,7 +22,6 @@ ;;; (0 or 1). ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a launcher machine's main platform, in pixels. kLauncherMachineWidthPx = $10 diff --git a/src/machines/lift.inc b/src/machines/lift.inc index eaf997f6..776be0e0 100644 --- a/src/machines/lift.inc +++ b/src/machines/lift.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a lift machine's main platform, in pixels. kLiftMachineWidthPx = $10 diff --git a/src/machines/minigun.inc b/src/machines/minigun.inc index 174c81d3..7d78e2f9 100644 --- a/src/machines/minigun.inc +++ b/src/machines/minigun.inc @@ -24,7 +24,6 @@ ;;; minigun fires a shot. Used to animate the rotation of the minigun ;;; barrel. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a minigun machine's main platform, in pixels. kMinigunMachineWidthPx = $20 diff --git a/src/machines/multiplexer.inc b/src/machines/multiplexer.inc index 3bc6c13a..47207afe 100644 --- a/src/machines/multiplexer.inc +++ b/src/machines/multiplexer.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The CHR bank number containing the diagram for multiplexer machines. kChrBankDiagramMultiplexer = $0d diff --git a/src/machines/pump.inc b/src/machines/pump.inc index c267aece..b5b4d01d 100644 --- a/src/machines/pump.inc +++ b/src/machines/pump.inc @@ -21,7 +21,6 @@ ;;; * State1: Unused. ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; How many frames it takes a pump machine to pump water up or down one pixel. kPumpWaterSlowdown = 3 diff --git a/src/machines/reloader.inc b/src/machines/reloader.inc index 3de95530..b03045bc 100644 --- a/src/machines/reloader.inc +++ b/src/machines/reloader.inc @@ -22,7 +22,6 @@ ;;; (0 or 1). ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a reloader machine's main platform, in pixels. kReloaderMachineWidthPx = $10 diff --git a/src/machines/rotor.inc b/src/machines/rotor.inc index f8944244..997b6d87 100644 --- a/src/machines/rotor.inc +++ b/src/machines/rotor.inc @@ -21,7 +21,6 @@ ;;; * State1: The current rotation angle for the rotor wheel (0-255). ;;; * State2: Unused. ;;; * State3: Unused. -;;; * State4: Unused. ;;; The size of a rotor machine's main platform, in pixels. kRotorMachineWidthPx = $10 diff --git a/src/machines/semaphore.inc b/src/machines/semaphore.inc index de1d13dc..a1ba66a7 100644 --- a/src/machines/semaphore.inc +++ b/src/machines/semaphore.inc @@ -24,7 +24,6 @@ ;;; * State2: The current bSemaphoreFlag state for the upper flag. ;;; * State3: The current upward vertical offset of the movable actuator, in ;;; pixels (0-16). -;;; * State4: Unused. ;;; The number of digits in the combination key that must be transferred by ;;; semaphore. diff --git a/src/machines/winch.inc b/src/machines/winch.inc index 76623a11..c46415ff 100644 --- a/src/machines/winch.inc +++ b/src/machines/winch.inc @@ -23,7 +23,6 @@ ;;; * State2: The lo byte of the current falling speed, measured in subpixels ;;; per frame. ;;; * State3: The hi byte of the current falling speed. -;;; * State4: Unused. ;;; The size of a winch spikeball platform, in pixels. kSpikeballWidthPx = $0d diff --git a/src/rooms/boss_lava.asm b/src/rooms/boss_lava.asm index 0190bd5a..5d00935f 100644 --- a/src/rooms/boss_lava.asm +++ b/src/rooms/boss_lava.asm @@ -39,19 +39,18 @@ .IMPORT DataA_Room_Lava_sTileset .IMPORT Data_Empty_sActor_arr -.IMPORT FuncA_Machine_BlasterVertTryAct +.IMPORT FuncA_Machine_BlasterTick +.IMPORT FuncA_Machine_BlasterTryAct .IMPORT FuncA_Machine_BoilerFinishEmittingSteam .IMPORT FuncA_Machine_BoilerTick .IMPORT FuncA_Machine_BoilerWriteReg .IMPORT FuncA_Machine_Error -.IMPORT FuncA_Machine_GenericMoveTowardGoalHorz .IMPORT FuncA_Machine_GenericTryMoveX -.IMPORT FuncA_Machine_ReachedGoal .IMPORT FuncA_Machine_WriteToLever .IMPORT FuncA_Objects_Alloc2x1Shape .IMPORT FuncA_Objects_AnimateLavaTerrain .IMPORT FuncA_Objects_Draw1x1Shape -.IMPORT FuncA_Objects_DrawBlasterMachineVert +.IMPORT FuncA_Objects_DrawBlasterMachine .IMPORT FuncA_Objects_DrawBoilerMachine .IMPORT FuncA_Objects_DrawBoilerValve1 .IMPORT FuncA_Objects_DrawBoss @@ -302,9 +301,9 @@ _Machines_sMachine_arr: d_addr ReadReg_func_ptr, FuncC_Boss_LavaBlaster_ReadReg d_addr WriteReg_func_ptr, FuncA_Machine_BossLava_WriteRegLR d_addr TryMove_func_ptr, FuncA_Machine_BossLavaBlaster_TryMove - d_addr TryAct_func_ptr, FuncA_Machine_BlasterVertTryAct + d_addr TryAct_func_ptr, FuncA_Machine_BlasterTryAct d_addr Tick_func_ptr, FuncA_Machine_BossLavaBlaster_Tick - d_addr Draw_func_ptr, FuncA_Objects_DrawBlasterMachineVert + d_addr Draw_func_ptr, FuncA_Objects_DrawBlasterMachine d_addr Reset_func_ptr, FuncA_Room_BossLavaBlaster_InitReset D_END .assert * - :- = kBoilerMachineIndex * .sizeof(sMachine), error @@ -1041,9 +1040,7 @@ _WriteR: .PROC FuncA_Machine_BossLavaBlaster_Tick ldax #kBlasterMinPlatformLeft ; param: min platform left - jsr FuncA_Machine_GenericMoveTowardGoalHorz ; returns A - jeq FuncA_Machine_ReachedGoal - rts + jmp FuncA_Machine_BlasterTick .ENDPROC .PROC FuncA_Machine_BossLavaBoiler_TryAct diff --git a/src/rooms/core_boss.asm b/src/rooms/core_boss.asm index bd6e4a4b..d48957a1 100644 --- a/src/rooms/core_boss.asm +++ b/src/rooms/core_boss.asm @@ -42,17 +42,15 @@ .INCLUDE "../scroll.inc" .IMPORT DataA_Room_Core_sTileset -.IMPORT FuncA_Machine_BlasterHorzTryAct -.IMPORT FuncA_Machine_BlasterTickMirrors -.IMPORT FuncA_Machine_BlasterWriteRegMirrors +.IMPORT FuncA_Machine_BlasterTick +.IMPORT FuncA_Machine_BlasterTryAct +.IMPORT FuncA_Machine_BlasterWriteRegM .IMPORT FuncA_Machine_CannonTick .IMPORT FuncA_Machine_CannonTryAct .IMPORT FuncA_Machine_CannonTryMove .IMPORT FuncA_Machine_Error .IMPORT FuncA_Machine_GenericMoveTowardGoalHorz -.IMPORT FuncA_Machine_GenericMoveTowardGoalVert .IMPORT FuncA_Machine_GenericTryMoveX -.IMPORT FuncA_Machine_GenericTryMoveY .IMPORT FuncA_Machine_GetWinchHorzSpeed .IMPORT FuncA_Machine_GetWinchVertSpeed .IMPORT FuncA_Machine_LaserTryAct @@ -62,7 +60,7 @@ .IMPORT FuncA_Machine_WinchReachedGoal .IMPORT FuncA_Machine_WinchStartFalling .IMPORT FuncA_Objects_Draw1x1Shape -.IMPORT FuncA_Objects_DrawBlasterMachineHorz +.IMPORT FuncA_Objects_DrawBlasterMachine .IMPORT FuncA_Objects_DrawBlasterMirror .IMPORT FuncA_Objects_DrawCannonMachine .IMPORT FuncA_Objects_DrawLaserMachine @@ -92,7 +90,7 @@ .IMPORT Func_IsActorWithinVertDistancesOfPoint .IMPORT Func_IsFlagSet .IMPORT Func_IsPointInPlatform -.IMPORT Func_MachineBlasterReadRegMirrors +.IMPORT Func_MachineBlasterReadRegM .IMPORT Func_MachineCannonReadRegY .IMPORT Func_MachineLaserReadRegC .IMPORT Func_MovePlatformHorz @@ -124,9 +122,7 @@ .IMPORT Ram_MachineGoalVert_u8_arr .IMPORT Ram_MachineSlowdown_u8_arr .IMPORT Ram_MachineState1_byte_arr -.IMPORT Ram_MachineState2_byte_arr .IMPORT Ram_MachineState3_byte_arr -.IMPORT Ram_MachineState4_byte_arr .IMPORT Ram_MachineStatus_eMachine_arr .IMPORT Ram_PlatformLeft_i16_0_arr .IMPORT Ram_PlatformTop_i16_0_arr @@ -177,25 +173,19 @@ kCutsceneZonePlatformIndex = 7 ;;; fight. kPassageBarrierPlatformIndex = 8 -;;; The initial values for the blaster's M/R mirror registers. -kBlasterInitGoalM = 4 -kBlasterInitGoalR = 4 -;;; The initial and maximum permitted values for the blaster's Y register. -kBlasterInitGoalY = 2 -kBlasterMaxGoalY = 2 +;;; The initial value for the blaster's M (mirror) register. +kBlasterInitGoalM = 5 +;;; The initial and maximum permitted values for the blaster's X register. +kBlasterInitGoalX = 1 +kBlasterMaxGoalX = 2 -;;; The maximum and initial Y-positions for the top of the blaster platform. +;;; The minimum and initial X-positions for the left of the blaster platform. .LINECONT + -kBlasterMaxPlatformTop = $0060 -kBlasterInitPlatformTop = \ - kBlasterMaxPlatformTop - kBlasterInitGoalY * kBlockHeightPx +kBlasterMinPlatformLeft = $01a0 +kBlasterInitPlatformLeft = \ + kBlasterMinPlatformLeft + kBlasterInitGoalX * kBlockWidthPx .LINECONT - -;;; The mirrors' offsets from relative to absolute angles, in increments of -;;; tau/16. -kMirror1AngleOffset = 12 -kMirror2AngleOffset = 8 - ;;; The initial and maximum permitted horizontal goal values for the laser. kLaserInitGoalX = 0 kLaserMaxGoalX = 4 @@ -334,19 +324,18 @@ _Machines_sMachine_arr: d_byte Code_eProgram, eProgram::CoreBossBlaster d_byte Breaker_eFlag, 0 .linecont + - d_byte Flags_bMachine, bMachine::FlipH | bMachine::MoveV | \ - bMachine::Act | bMachine::WriteCD + d_byte Flags_bMachine, bMachine::MoveH | bMachine::Act | bMachine::WriteC .linecont - - d_byte Status_eDiagram, eDiagram::LauncherLeft ; TODO + d_byte Status_eDiagram, eDiagram::LauncherDown ; TODO d_word ScrollGoalX_u16, $0110 d_byte ScrollGoalY_u8, $00 - d_byte RegNames_u8_arr4, "M", "R", 0, "Y" + d_byte RegNames_u8_arr4, "M", 0, "X", 0 d_byte MainPlatform_u8, kBlasterPlatformIndex d_addr Init_func_ptr, FuncA_Room_CoreBossBlaster_Init d_addr ReadReg_func_ptr, FuncC_Core_BossBlaster_ReadReg - d_addr WriteReg_func_ptr, FuncA_Machine_BlasterWriteRegMirrors + d_addr WriteReg_func_ptr, FuncA_Machine_BlasterWriteRegM d_addr TryMove_func_ptr, FuncA_Machine_CoreBossBlaster_TryMove - d_addr TryAct_func_ptr, FuncA_Machine_BlasterHorzTryAct + d_addr TryAct_func_ptr, FuncA_Machine_BlasterTryAct d_addr Tick_func_ptr, FuncA_Machine_CoreBossBlaster_Tick d_addr Draw_func_ptr, FuncA_Objects_CoreBossBlaster_Draw d_addr Reset_func_ptr, FuncA_Room_CoreBossBlaster_Reset @@ -413,16 +402,16 @@ _Platforms_sPlatform_arr: d_byte Type_ePlatform, ePlatform::Solid d_word WidthPx_u16, kBlasterMachineWidthPx d_byte HeightPx_u8, kBlasterMachineHeightPx - d_word Left_i16, $01f0 - d_word Top_i16, kBlasterInitPlatformTop + d_word Left_i16, kBlasterInitPlatformLeft + d_word Top_i16, $0010 D_END .assert * - :- = kMirror1PlatformIndex * .sizeof(sPlatform), error D_STRUCT sPlatform d_byte Type_ePlatform, ePlatform::Zone d_word WidthPx_u16, $08 d_byte HeightPx_u8, $08 - d_word Left_i16, $01c4 - d_word Top_i16, $0064 + d_word Left_i16, $01a4 + d_word Top_i16, $0084 D_END .assert * - :- = kMirror2PlatformIndex * .sizeof(sPlatform), error D_STRUCT sPlatform @@ -504,14 +493,14 @@ _Devices_sDevice_arr: : .assert * - :- = kWinchConsoleDeviceIndex * .sizeof(sDevice), error D_STRUCT sDevice d_byte Type_eDevice, eDevice::Console - d_byte BlockRow_u8, 10 + d_byte BlockRow_u8, 6 d_byte BlockCol_u8, 2 d_byte Target_byte, kWinchMachineIndex D_END .assert * - :- = kBlasterConsoleDeviceIndex * .sizeof(sDevice), error D_STRUCT sDevice d_byte Type_eDevice, eDevice::Console - d_byte BlockRow_u8, 10 + d_byte BlockRow_u8, 6 d_byte BlockCol_u8, 31 d_byte Target_byte, kBlasterMachineIndex D_END @@ -549,13 +538,13 @@ _Passages_sPassage_arr: .ENDPROC .PROC FuncC_Core_BossBlaster_ReadReg - cmp #$f - beq _ReadY - jmp Func_MachineBlasterReadRegMirrors -_ReadY: - lda #kBlasterMaxPlatformTop + kTileHeightPx - sub Ram_PlatformTop_i16_0_arr + kBlasterPlatformIndex - div #kBlockHeightPx + cmp #$e + beq _ReadX + jmp Func_MachineBlasterReadRegM +_ReadX: + lda Ram_PlatformLeft_i16_0_arr + kBlasterPlatformIndex + sub #<(kBlasterMinPlatformLeft - kTileWidthPx) + div #kBlockWidthPx rts .ENDPROC @@ -566,7 +555,7 @@ _ReadC: jmp Func_MachineLaserReadRegC _ReadX: lda Ram_PlatformLeft_i16_0_arr + kLaserPlatformIndex - sub #kLaserMinPlatformLeft - kTileHeightPx + sub #kLaserMinPlatformLeft - kTileWidthPx div #kBlockWidthPx rts .ENDPROC @@ -599,17 +588,12 @@ _MachineProjectiles: jsr FuncA_Room_TurnProjectilesToSmokeIfConsoleOpen lda #eActor::ProjGrenade ; param: projectile type jsr FuncA_Room_TurnProjectilesToSmokeIfConsoleOpen -_Mirror1: - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror 1 anim - div #kBlasterMirrorAnimSlowdown - add #kMirror1AngleOffset ; param: absolute mirror angle +_Mirrors: + ldx #kBlasterMachineIndex ; param: blaster machine index ldy #kMirror1PlatformIndex ; param: mirror platform index - jsr FuncA_Room_ReflectFireblastsOffMirror -_Mirror2: - lda Ram_MachineState4_byte_arr + kBlasterMachineIndex ; mirror 2 anim - div #kBlasterMirrorAnimSlowdown - add #kMirror2AngleOffset ; param: absolute mirror angle - ldy #kMirror2PlatformIndex ; param: mirror platform index + jsr FuncA_Room_ReflectFireblastsOffMirror ; preserves X and Y + .assert kMirror2PlatformIndex = 1 + kMirror1PlatformIndex, error + iny ; param: mirror platform index jsr FuncA_Room_ReflectFireblastsOffMirror _TalkToGronta: lda Zp_RoomState + sState::Current_eGrontaPhase @@ -1438,18 +1422,13 @@ _Finished: .ENDPROC .PROC FuncA_Machine_CoreBossBlaster_TryMove - lda #kBlasterMaxGoalY ; param: max goal vert - jmp FuncA_Machine_GenericTryMoveY + lda #kBlasterMaxGoalX ; param: max goal horz + jmp FuncA_Machine_GenericTryMoveX .ENDPROC .PROC FuncA_Machine_CoreBossBlaster_Tick - ldax #kBlasterMaxPlatformTop ; param: max platform top - jsr FuncA_Machine_GenericMoveTowardGoalVert ; returns A - sta T1 ; nonzero if moved - jsr FuncA_Machine_BlasterTickMirrors ; preserves T1+, returns A - ora T1 ; nonzero if moved - jeq FuncA_Machine_ReachedGoal - rts + ldax #kBlasterMinPlatformLeft ; param: max platform top + jmp FuncA_Machine_BlasterTick .ENDPROC ;;;=========================================================================;;; @@ -1477,19 +1456,15 @@ _Finished: .PROC FuncA_Room_CoreBossBlaster_Init lda #kBlasterInitGoalM * kBlasterMirrorAnimSlowdown - sta Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror 1 anim - lda #kBlasterInitGoalR * kBlasterMirrorAnimSlowdown - sta Ram_MachineState4_byte_arr + kBlasterMachineIndex ; mirror 2 anim + sta Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror anim fall FuncA_Room_CoreBossBlaster_Reset .ENDPROC .PROC FuncA_Room_CoreBossBlaster_Reset lda #kBlasterInitGoalM - sta Ram_MachineState1_byte_arr + kBlasterMachineIndex ; mirror 1 goal - lda #kBlasterInitGoalR - sta Ram_MachineState2_byte_arr + kBlasterMachineIndex ; mirror 2 goal - lda #kBlasterInitGoalY - sta Ram_MachineGoalVert_u8_arr + kBlasterMachineIndex + sta Ram_MachineState1_byte_arr + kBlasterMachineIndex ; mirror goal + lda #kBlasterInitGoalX + sta Ram_MachineGoalHorz_u8_arr + kBlasterMachineIndex rts .ENDPROC @@ -1894,22 +1869,16 @@ _BarrierTileId_u8_arr: ;;; Draws the CoreBossBlaster machine. .PROC FuncA_Objects_CoreBossBlaster_Draw -_Mirror1: +_Mirrors: ldx #kMirror1PlatformIndex ; param: mirror platform index - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror 1 anim - div #kBlasterMirrorAnimSlowdown - add #kMirror1AngleOffset ; param: absolute mirror angle - jsr FuncA_Objects_DrawBlasterMirror -_Mirror2: - ldx #kMirror2PlatformIndex ; param: mirror platform index - lda Ram_MachineState4_byte_arr + kBlasterMachineIndex ; mirror 2 anim - div #kBlasterMirrorAnimSlowdown - add #kMirror2AngleOffset ; param: absolute mirror angle + jsr FuncA_Objects_DrawBlasterMirror ; preserves X + .assert kMirror2PlatformIndex = 1 + kMirror1PlatformIndex, error + inx ; now X is kMirror2PlatformIndex jsr FuncA_Objects_DrawBlasterMirror _Blaster: lda Zp_RoomState + sState::MachineHits_i8_arr + kBlasterMachineIndex bmi FuncA_Objects_CoreBoss_DoNotDraw ; machine is smashed - jmp FuncA_Objects_DrawBlasterMachineHorz + jmp FuncA_Objects_DrawBlasterMachine .ENDPROC ;;; A no-op drawing function that the machine draw functions in this file can diff --git a/src/rooms/core_boss.bg b/src/rooms/core_boss.bg index 5c78808b..e11f0ace 100644 --- a/src/rooms/core_boss.bg +++ b/src/rooms/core_boss.bg @@ -9,16 +9,16 @@ >core_7 GPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGPGP - GLBAAHBPECECECBCBL BCAIAEAEAEAEGL + GLBAAHBPECECECBCBL BKBDECECECBCAIAEGL ADFBBH FN AMFBAMAMAMCECC DNDMANANANFB FB CACBCC DNDODP FB FB GOCACBCC DNDOGL FB - FB CACBCC DNDODPGKCK FN + FBAB CACBCC DNDODPGK ABFN FIGNADBB CACBCCGO EAGIHKEB GODNDODP GMFJ - FB AK CACBCC HAEDEFHB DNDODP FB + FB AK CACBCC HAEDEFHB DNDODP DK FB FB BKAIGMGN CACDAMAMAMHCHCEEHDANANANDLDP GMGNADADADAHFB - FBAB AK DAHGHEHLHFDB ABFB + FB AK DAHGHEHLHFDB FB FIGN AG GO DEDEEIEOEJDF GO GMFJ FB AG CNCMAMAMDGDEEK ELDHANANCICH DK FB AEFBAEAEAIGMGN CNCOCP DEDEEMEHENDF CFCGCH GMGNADAHADFB diff --git a/src/rooms/lava_center.asm b/src/rooms/lava_center.asm index 62e11230..39cd4525 100644 --- a/src/rooms/lava_center.asm +++ b/src/rooms/lava_center.asm @@ -35,16 +35,14 @@ .INCLUDE "../room.inc" .IMPORT DataA_Room_Lava_sTileset -.IMPORT FuncA_Machine_BlasterTickMirrors -.IMPORT FuncA_Machine_BlasterVertTryAct -.IMPORT FuncA_Machine_BlasterWriteRegMirrors -.IMPORT FuncA_Machine_GenericMoveTowardGoalHorz +.IMPORT FuncA_Machine_BlasterTick +.IMPORT FuncA_Machine_BlasterTryAct +.IMPORT FuncA_Machine_BlasterWriteRegM .IMPORT FuncA_Machine_GenericTryMoveX -.IMPORT FuncA_Machine_ReachedGoal .IMPORT FuncA_Machine_WriteToLever .IMPORT FuncA_Objects_AnimateLavaTerrain .IMPORT FuncA_Objects_Draw1x1Shape -.IMPORT FuncA_Objects_DrawBlasterMachineVert +.IMPORT FuncA_Objects_DrawBlasterMachine .IMPORT FuncA_Objects_DrawBlasterMirror .IMPORT FuncA_Objects_DrawCratePlatform .IMPORT FuncA_Objects_MoveShapeDownOneTile @@ -57,7 +55,7 @@ .IMPORT Func_IsActorWithinDistanceOfPoint .IMPORT Func_IsFlagSet .IMPORT Func_IsPointInPlatform -.IMPORT Func_MachineBlasterReadRegMirrors +.IMPORT Func_MachineBlasterReadRegM .IMPORT Func_MovePlatformTopTowardPointY .IMPORT Func_MovePlatformVert .IMPORT Func_SetFlag @@ -103,10 +101,6 @@ kBlasterInitPlatformLeft = \ kBlasterMinPlatformLeft + kBlasterInitGoalX * kBlockWidthPx .LINECONT - -;;; The mirrors' offsets from relative to absolute angles, in increments of -;;; tau/16. -kMirrorAngleOffset = 7 - ;;;=========================================================================;;; ;;; Enum for the hanging crates in this room. @@ -195,7 +189,7 @@ _Machines_sMachine_arr: d_addr ReadReg_func_ptr, FuncC_Lava_CenterBlaster_ReadReg d_addr WriteReg_func_ptr, FuncA_Machine_LavaCenterBlaster_WriteReg d_addr TryMove_func_ptr, FuncA_Machine_LavaCenterBlaster_TryMove - d_addr TryAct_func_ptr, FuncA_Machine_BlasterVertTryAct + d_addr TryAct_func_ptr, FuncA_Machine_BlasterTryAct d_addr Tick_func_ptr, FuncA_Machine_LavaCenterBlaster_Tick d_addr Draw_func_ptr, FuncC_Lava_CenterBlaster_Draw d_addr Reset_func_ptr, FuncA_Room_LavaCenterBlaster_Reset @@ -426,7 +420,7 @@ _Lava: beq _ReadL cmp #$e beq _ReadX - jmp Func_MachineBlasterReadRegMirrors + jmp Func_MachineBlasterReadRegM _ReadL: lda Zp_RoomState + sState::Lever_u8 rts @@ -440,22 +434,15 @@ _ReadX: ;;; Draws the LavaCenterBlaster machine. .PROC FuncC_Lava_CenterBlaster_Draw _Mirrors: - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror 1 anim - div #kBlasterMirrorAnimSlowdown - add #kMirrorAngleOffset - sta T2 ; absolute mirror angle ldx #kMirror3PlatformIndex @loop: - stx T3 ; platform index - lda T2 ; param: absolute mirror angle - jsr FuncA_Objects_DrawBlasterMirror ; preserves T2+ - ldx T3 ; platform index + jsr FuncA_Objects_DrawBlasterMirror ; preserves X dex .assert kMirror1PlatformIndex > 0, error cpx #kMirror1PlatformIndex bge @loop _Blaster: - jmp FuncA_Objects_DrawBlasterMachineVert + jmp FuncA_Objects_DrawBlasterMachine .ENDPROC ;;;=========================================================================;;; @@ -577,14 +564,10 @@ _CheckIfFireblastHitsHothead: bpl @loop @done: _Mirrors: - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror anim - div #kBlasterMirrorAnimSlowdown - add #kMirrorAngleOffset - sta T5 ; absolute mirror angle (in tau/16 units) - ldy #kMirror3PlatformIndex + ldx #kBlasterMachineIndex ; param: blaster machine index + ldy #kMirror3PlatformIndex ; param: mirror platform index @loop: - lda T5 ; param: absolute mirror angle (in tau/16 units) - jsr FuncA_Room_ReflectFireblastsOffMirror ; preserves Y and T5+ + jsr FuncA_Room_ReflectFireblastsOffMirror ; preserves X and Y dey .assert kMirror1PlatformIndex > 0, error cpy #kMirror1PlatformIndex @@ -700,7 +683,7 @@ _Return: .PROC FuncA_Machine_LavaCenterBlaster_WriteReg cpx #$d beq _WriteL - jmp FuncA_Machine_BlasterWriteRegMirrors + jmp FuncA_Machine_BlasterWriteRegM _WriteL: ldx #kLeverDeviceIndex ; param: device index jmp FuncA_Machine_WriteToLever @@ -713,12 +696,7 @@ _WriteL: .PROC FuncA_Machine_LavaCenterBlaster_Tick ldax #kBlasterMinPlatformLeft ; param: min platform left - jsr FuncA_Machine_GenericMoveTowardGoalHorz ; returns A - sta T1 ; nonzero if moved - jsr FuncA_Machine_BlasterTickMirrors ; preserves T1+, returns A - ora T1 ; nonzero if moved - jeq FuncA_Machine_ReachedGoal - rts + jmp FuncA_Machine_BlasterTick .ENDPROC ;;;=========================================================================;;; diff --git a/src/rooms/lava_east.asm b/src/rooms/lava_east.asm index d67b375a..c12a79b6 100644 --- a/src/rooms/lava_east.asm +++ b/src/rooms/lava_east.asm @@ -34,19 +34,17 @@ .INCLUDE "../room.inc" .IMPORT DataA_Room_Lava_sTileset -.IMPORT FuncA_Machine_BlasterTickMirrors -.IMPORT FuncA_Machine_BlasterVertTryAct -.IMPORT FuncA_Machine_BlasterWriteRegMirrors +.IMPORT FuncA_Machine_BlasterTick +.IMPORT FuncA_Machine_BlasterTryAct +.IMPORT FuncA_Machine_BlasterWriteRegM .IMPORT FuncA_Machine_BoilerFinishEmittingSteam .IMPORT FuncA_Machine_BoilerTick .IMPORT FuncA_Machine_BoilerWriteReg .IMPORT FuncA_Machine_Error -.IMPORT FuncA_Machine_GenericMoveTowardGoalHorz .IMPORT FuncA_Machine_GenericTryMoveX -.IMPORT FuncA_Machine_ReachedGoal .IMPORT FuncA_Machine_WriteToLever .IMPORT FuncA_Objects_AnimateLavaTerrain -.IMPORT FuncA_Objects_DrawBlasterMachineVert +.IMPORT FuncA_Objects_DrawBlasterMachine .IMPORT FuncA_Objects_DrawBlasterMirror .IMPORT FuncA_Objects_DrawBoilerMachine .IMPORT FuncA_Objects_DrawBoilerValve1 @@ -59,7 +57,7 @@ .IMPORT FuncA_Terrain_FadeInTallRoomWithLava .IMPORT Func_EmitSteamRightFromPipe .IMPORT Func_EmitSteamUpFromPipe -.IMPORT Func_MachineBlasterReadRegMirrors +.IMPORT Func_MachineBlasterReadRegM .IMPORT Func_MachineBoilerReadReg .IMPORT Func_Noop .IMPORT Ppu_ChrObjLava @@ -118,10 +116,6 @@ kBlasterInitPlatformLeft = \ kBlasterMinPlatformLeft + kBlasterInitGoalX * kBlockWidthPx .LINECONT - -;;; The mirrors' offsets from relative to absolute angles, in increments of -;;; tau/16. -kMirrorAngleOffset = 7 - ;;;=========================================================================;;; ;;; Defines room-specific state data for this particular room. @@ -181,7 +175,7 @@ _Machines_sMachine_arr: d_addr ReadReg_func_ptr, FuncC_Lava_EastBlaster_ReadReg d_addr WriteReg_func_ptr, FuncA_Machine_LavaEastBlaster_WriteReg d_addr TryMove_func_ptr, FuncA_Machine_LavaEastBlaster_TryMove - d_addr TryAct_func_ptr, FuncA_Machine_BlasterVertTryAct + d_addr TryAct_func_ptr, FuncA_Machine_BlasterTryAct d_addr Tick_func_ptr, FuncA_Machine_LavaEastBlaster_Tick d_addr Draw_func_ptr, FuncC_Lava_EastBlaster_Draw d_addr Reset_func_ptr, FuncA_Room_LavaEastBlaster_Reset @@ -470,7 +464,7 @@ _Passages_sPassage_arr: bge _ReadL cmp #$d beq _ReadU - jmp Func_MachineBlasterReadRegMirrors + jmp Func_MachineBlasterReadRegM _ReadL: lda Zp_RoomState + sState::MiddleLeverL_u8 rts @@ -500,22 +494,15 @@ _ReadL: .PROC FuncC_Lava_EastBlaster_Draw _Mirrors: - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror 1 anim - div #kBlasterMirrorAnimSlowdown - add #kMirrorAngleOffset - sta T2 ; absolute mirror angle ldx #kMirror3PlatformIndex @loop: - stx T3 ; platform index - lda T2 ; param: absolute mirror angle - jsr FuncA_Objects_DrawBlasterMirror ; preserves T2+ - ldx T3 ; platform index + jsr FuncA_Objects_DrawBlasterMirror ; preserves X dex .assert kMirror1PlatformIndex > 0, error cpx #kMirror1PlatformIndex bge @loop _Blaster: - jmp FuncA_Objects_DrawBlasterMachineVert + jmp FuncA_Objects_DrawBlasterMachine .ENDPROC .PROC FuncC_Lava_EastUpperBoiler_Draw @@ -535,14 +522,10 @@ _Blaster: lda #eActor::ProjFireblast ; param: projectile type jsr FuncA_Room_TurnProjectilesToSmokeIfConsoleOpen _Mirrors: - lda Ram_MachineState3_byte_arr + kBlasterMachineIndex ; mirror anim - div #kBlasterMirrorAnimSlowdown - add #kMirrorAngleOffset - sta T5 ; absolute mirror angle (in tau/16 units) - ldy #kMirror3PlatformIndex + ldx #kBlasterMachineIndex ; param: blaster machine index + ldy #kMirror3PlatformIndex ; param: mirror platform index @loop: - lda T5 ; param: absolute mirror angle (in tau/16 units) - jsr FuncA_Room_ReflectFireblastsOffMirror ; preserves Y and T5+ + jsr FuncA_Room_ReflectFireblastsOffMirror ; preserves X and Y dey .assert kMirror1PlatformIndex > 0, error cpy #kMirror1PlatformIndex @@ -587,7 +570,7 @@ _Mirrors: cpx #$d beq _WriteU bge _WriteL - jmp FuncA_Machine_BlasterWriteRegMirrors + jmp FuncA_Machine_BlasterWriteRegM _WriteU: ldx #kMiddleLeverUDeviceIndex ; param: device index jmp FuncA_Machine_WriteToLever @@ -617,12 +600,7 @@ _WriteL: .PROC FuncA_Machine_LavaEastBlaster_Tick ldax #kBlasterMinPlatformLeft ; param: min platform left - jsr FuncA_Machine_GenericMoveTowardGoalHorz ; returns A - sta T1 ; nonzero if moved - jsr FuncA_Machine_BlasterTickMirrors ; preserves T1+, returns A - ora T1 ; nonzero if moved - jeq FuncA_Machine_ReachedGoal - rts + jmp FuncA_Machine_BlasterTick .ENDPROC ;;; TryAct implemention for the LavaEastUpperBoiler machine. diff --git a/src/tiles/blaster.ahi b/src/tiles/blaster.ahi index 839d6a16..8919a5b8 100644 --- a/src/tiles/blaster.ahi +++ b/src/tiles/blaster.ahi @@ -1,4 +1,4 @@ -ahi1 f0 p1 i2 w8 h8 +ahi1 f0 p1 i1 w8 h8 0004;0;54;ECEEEC;FF0;FF0;982220;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 @@ -10,12 +10,3 @@ ahi1 f0 p1 i2 w8 h8 03003113 03313311 00003000 - -33000000 -13133330 -13000030 -13300010 -13333333 -11111130 -13333110 -13333310 diff --git a/src/tiles/core_pipes2.ahi b/src/tiles/core_pipes2.ahi index ca04e8a7..7de3b912 100644 --- a/src/tiles/core_pipes2.ahi +++ b/src/tiles/core_pipes2.ahi @@ -77,17 +77,17 @@ ahi1 f0 p1 i12 w8 h8 00000000 00000000 00000000 -22000000 -22220000 -00222200 -00002220 -22222200 +00000000 +00000000 +00000000 +00000000 +00000000 -22222200 -00002220 -00222200 -22220000 -22000000 +00000000 +00000000 +00000000 +00000000 +00000000 00000000 00000000 00000000 diff --git a/src/tilesets/core.bg b/src/tilesets/core.bg index 68691b01..5f865f31 100644 --- a/src/tilesets/core.bg +++ b/src/tilesets/core.bg @@ -12,8 +12,8 @@ FOFPFEFF BGBGBH BH CEBGBH CFAEAFABABADAD AEAF BIBGBGBJBH BH BKBL BIBJ BHBH BKBGBGBL BH BHBKBGBGBL BIBJ BHBH BKBL BIBGBGBJ -AJAIAHAG AHAAAAAGARAQAPAO ACAOAPAOCI AKALAKAA AKALAMAN - AJAIAHAG ABABAIAH ARAQAPAO AQAPAQAFCJ AEAMALAM AKALAMAN +AJAIAHAG AHAAAAAGARAQAPAO ACAOAPAO AKALAKAA AKALAMAN + AJAIAHAG ABABAIAH ARAQAPAO AQAPAQAF AEAMALAM AKALAMAN DKDL DGDH AADGDHACDFECDFDF ACATASAC ASATAUAV DIDJ DGDH ABDGDHAD AEAF CKCLADADATAU ASATAUAV DIDJ GCGDEEDEEKELDEDEEKELEDED EFEH EFEH HAHA @@ -21,6 +21,6 @@ DIDMDNDJ DG EKELEKEL EFEH EFEH EDED BABABBBBBCBABACABBBEBFBBBABABFBEBBBEBFBB BACCCDBBBFBEBMBN BABABBBBBBBCBDBBBEBABABFBDBCBABABBBCBDBB BABABBBBBDCABOBP GAGBGAGBGA GBGA GB DEEE BBBBCABDBCBABACABCBDGAGB -GB GAGB GAGBGAGBGA DIDMBBBBBEBFBBBBCABABABFBEBFGBGA +GB GAGB GAGBGAGBGA DIDM BEBFBBBBCABABABFBEBFGBGA EADEDEEBDG DHDG DHDG DFEGEADEDEEBDEDE DFDFEEDEDFDFDFDF DG DHDG DHDEDEDEDEDEEEDG DKDODPDL DEDE DKDODG DH