From 18e92a499d216d895c681f78718a4ae71d5855fb Mon Sep 17 00:00:00 2001 From: artemus21 Date: Sat, 31 May 2025 23:44:28 +0930 Subject: [PATCH 1/2] init --- constants/seasons/parts.s | 4 +- object_code/seasons/enemies/facade.s | 331 ++++++++++++++------ object_code/seasons/parts/2e.s | 48 --- object_code/seasons/parts/facadeHoleMaker.s | 81 +++++ seasons.s | 2 +- 5 files changed, 312 insertions(+), 154 deletions(-) delete mode 100644 object_code/seasons/parts/2e.s create mode 100644 object_code/seasons/parts/facadeHoleMaker.s diff --git a/constants/seasons/parts.s b/constants/seasons/parts.s index a801699a..882a0a9a 100644 --- a/constants/seasons/parts.s +++ b/constants/seasons/parts.s @@ -41,8 +41,8 @@ .define PART_KING_MOBLINS_CANNONS $2d ;; -; created by facade - holes? -.define PART_2e $2e +; Created by facade to temporarily make holes. +.define PART_FACADE_HOLE_MAKER $2e ;; .define PART_2f $2f diff --git a/object_code/seasons/enemies/facade.s b/object_code/seasons/enemies/facade.s index 2bab385d..8d9f86f9 100644 --- a/object_code/seasons/enemies/facade.s +++ b/object_code/seasons/enemies/facade.s @@ -1,315 +1,440 @@ ; ================================================================================================== ; ENEMY_FACADE +; TODO: Add more detail. ; ================================================================================================== enemyCode71: jr z,@normalStatus - sub $03 + sub ENEMYSTATUS_NO_HEALTH ret c ret nz - ; dead - ld e,$a4 + + ; Dead + ld e,Enemy.collisionType ld a,(de) or a - call nz,@dead - ld e,$82 + call nz,facadeKillSpawnedBeetles + + ld e,Enemy.subid ld a,(de) or a jp nz,enemyDie jp enemyBoss_dead @normalStatus: - ld e,$84 + ld e,Enemy.state ld a,(de) rst_jumpTable - .dw @state0 - .dw @stateStub - .dw @stateStub - .dw @stateStub - .dw @stateStub - .dw @stateStub - .dw @stateStub - .dw @stateStub - .dw @state8 - .dw @state9 - .dw @stateA - .dw @stateB - .dw @stateC - -@state0: + .dw facade_state_uninitialized + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_stub + .dw facade_state_waiting + .dw facade_state_chooseAttack + .dw facade_state_waitAndRumble + .dw facade_state_attack + .dw facade_state_reset + +; Do different initialization depending on [subId]: +; zero: Just wait. +; non-zero: Start the fight. +facade_state_uninitialized: call ecom_setSpeedAndState8 - ld l,$8b + + ld l,Enemy.yh ld (hl),$58 - ld l,$8d + ld l,Enemy.xh ld (hl),$78 - ld e,$82 + + ; If subid == 0, jump to enemyBoss_initializeRoom + ld e,Enemy.subid ld a,(de) or a ld a,$ff ld b,$00 jp z,enemyBoss_initializeRoom - ld l,$86 + + ; If subid is non-zero, start the fight. + ld l,Enemy.counter1 ld (hl),$3c - ld l,$84 + + ; [state] = 9 + ld l,Enemy.state inc (hl) ret -@stateStub: +facade_state_stub: ret -@state8: +; Waiting for link to enter the fight. Only entered when subId is 0. +facade_state_waiting: + ; If link is below $58, the fight is triggered. ldh a,(wRoomCollisions + ld a,(hl) + or a + jp nz,partDelete + + ld a,SND_POOF + call playSound + + jp objectSetVisible83 + +; Either make a hole or reset the tile at this position, depending on the value +; of animParameter. +@modifyTile: + ; Set animParameter to 0 so we only run this once. TODO: confirm this. + push af + xor a + ld (de),a + call objectGetTileAtPosition + pop af + + ld e,Part.var30 + + ; If [animParameter] == 1, make a hole, otherwise (if it's 2), reset. + dec a + jr z,@@makeHole + + ; Reset the tile to what it was before. + ld a,(de) + ld (hl),a + ret + +; Store the current kind of tile in var30, then make the tile a hole. +@@makeHole: + ld a,(hl) + ld (de),a + ld (hl),TILEINDEX_HOLE + ret diff --git a/seasons.s b/seasons.s index ba2faabd..e228c5e6 100644 --- a/seasons.s +++ b/seasons.s @@ -675,7 +675,7 @@ m_section_free Part_Code_2 NAMESPACE partCode .include "object_code/seasons/parts/wallFlameShooterFlames.s" .include "object_code/seasons/parts/buriedMoldorm.s" .include "object_code/seasons/parts/kingMoblinsCannons.s" - .include "object_code/seasons/parts/2e.s" + .include "object_code/seasons/parts/facadeHoleMaker.s" .include "object_code/seasons/parts/2f.s" .include "object_code/seasons/parts/poppableBubble.s" .include "object_code/seasons/parts/33.s" From f37fe177858850316a18d87432b301b6ffd0b853 Mon Sep 17 00:00:00 2001 From: artemus21 Date: Sun, 1 Jun 2025 10:56:57 +0930 Subject: [PATCH 2/2] fix todos --- object_code/seasons/enemies/facade.s | 50 ++++++++++++--------- object_code/seasons/parts/facadeHoleMaker.s | 8 +++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/object_code/seasons/enemies/facade.s b/object_code/seasons/enemies/facade.s index 8d9f86f9..033b0d68 100644 --- a/object_code/seasons/enemies/facade.s +++ b/object_code/seasons/enemies/facade.s @@ -1,6 +1,9 @@ ; ================================================================================================== ; ENEMY_FACADE -; TODO: Add more detail. +; +; Variables: +; var03: The attack that has been randomly chosen. +; var30: The number of Beetles that have been spawned by the Beetle attack. ; ================================================================================================== enemyCode71: jr z,@normalStatus @@ -33,10 +36,10 @@ enemyCode71: .dw facade_state_stub .dw facade_state_stub .dw facade_state_waiting - .dw facade_state_chooseAttack + .dw facade_state_chooseAttackAndBecomeVisible .dw facade_state_waitAndRumble .dw facade_state_attack - .dw facade_state_reset + .dw facade_state_resetAndInvisible ; Do different initialization depending on [subId]: ; zero: Just wait. @@ -49,7 +52,7 @@ facade_state_uninitialized: ld l,Enemy.xh ld (hl),$78 - ; If subid == 0, jump to enemyBoss_initializeRoom + ; If subid == 0, jump to enemyBoss_initializeRoom. ld e,Enemy.subid ld a,(de) or a @@ -69,9 +72,9 @@ facade_state_uninitialized: facade_state_stub: ret -; Waiting for link to enter the fight. Only entered when subId is 0. +; Waiting for Link to enter the fight. Only entered when subId is 0. facade_state_waiting: - ; If link is below $58, the fight is triggered. + ; If Link is below $58, the fight is triggered. ldh a,(