summaryrefslogtreecommitdiff
path: root/home.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home.asm')
-rwxr-xr-xhome.asm200
1 files changed, 1 insertions, 199 deletions
diff --git a/home.asm b/home.asm
index eaadda9..b7776b5 100755
--- a/home.asm
+++ b/home.asm
@@ -4992,205 +4992,7 @@ SubTileXPos_CollisionData7: ; 0x268e
db $18, $08, $03
INCLUDE "data/sine_table.asm"
-
-CheckGameObjectCollisions: ; 0x2720
- ld a, $ff
- ld [wTriggeredGameObject], a
- call CheckGameObjectCollisions_
- ld a, [wTriggeredGameObject]
- ld [wPreviousTriggeredGameObject], a
- ret
-
-CheckGameObjectCollisions_: ; 0x272f
- ld a, [wCurrentStage]
- call CallInFollowingTable
-GameObjectCollisions_CallTable: ; 0x2735
- ; STAGE_RED_FIELD_TOP
- padded_dab CheckRedStageTopGameObjectCollisions
-
- ; STAGE_RED_FIELD_BOTTOM
- padded_dab CheckRedStageBottomGameObjectCollisions
-
- padded_dab DoNothing_18061
-
- padded_dab CheckRedStageLaunchAlleyCollision_
-
- ; STAGE_BLUE_FIELD_TOP
- padded_dab CheckBlueStageTopGameObjectCollisions
-
- ; STAGE_BLUE_FIELD_BOTTOM
- padded_dab CheckBlueStageBottomGameObjectCollisions
-
- ; STAGE_GENGAR_BONUS
- padded_dab CheckGengarBonusStageGameObjectCollisions
-
- ; STAGE_GENGAR_BONUS
- padded_dab CheckGengarBonusStageGameObjectCollisions
-
- ; STAGE_MEWTWO_BONUS
- padded_dab CheckMewtwoBonusStageGameObjectCollisions
-
- ; STAGE_MEWTWO_BONUS
- padded_dab CheckMewtwoBonusStageGameObjectCollisions
-
- ; STAGE_MEOWTH_BONUS
- padded_dab CheckMeowthBonusStageGameObjectCollisions
-
- ; STAGE_MEOWTH_BONUS
- padded_dab CheckMeowthBonusStageGameObjectCollisions
-
- ; STAGE_DIGLETT_BONUS
- padded_dab CheckDiglettBonusStageGameObjectCollisions
-
- ; STAGE_DIGLETT_BONUS
- padded_dab CheckDiglettBonusStageGameObjectCollisions
-
- ; STAGE_SEEL_BONUS
- padded_dab CheckSeelBonusStageGameObjectCollisions
-
- ; STAGE_SEEL_BONUS
- padded_dab CheckSeelBonusStageGameObjectCollisions
-
-HandleGameObjectCollision: ; 0x2775
-; Handle collision checking for one set of game objects, such as the bumpers, Pikachu savers, etc.
-; Input: hl = pointer to collision attribute list for game objects
-; de = pointer to object collision struct
-; carry flag = unset to skip the collision attribute list check
- ld a, [wTriggeredGameObject]
- inc a
- jr nz, .noTrigger
- ld a, [bc]
- bit 7, a
- jr nz, .noTrigger
- push bc
- push de
- call nc, IsCollisionInList
- pop hl
- call c, CheckGameObjectCollision
- ld a, [wTriggeredGameObject]
- ld b, a
- pop hl
- ld [hl], $0
- jr nc, .noTrigger
- ld a, [wPreviousTriggeredGameObject]
- cp b
- jr z, .noTrigger
- ld a, [wTriggeredGameObjectIndex]
- ld [hli], a
- ld a, [wTriggeredGameObject]
- ld [hl], a
- scf
- ret
-
-.noTrigger
- and a
- ret
-
-CheckGameObjectCollision: ; 0x27a4
-; Checks if any of the given game objects are colliding with the pinball.
-; Saves information about which game object was collided.
-; Sets carry flag if a game object was collided.
-; Input: hl = pointer to game object struct with the following format:
-; [x distance][y distance] (defines bounding box for the following list of objects)
-; [game object id][object x][object y] (terminate this list with $FF)
- xor a
- ld [wTriggeredGameObjectIndex], a
- ld a, [hli] ; x distance threshold
- ld d, a
- ld a, [hli] ; y distance threshold
- ld e, a
- ld a, [wBallXPos + 1]
- ld b, a
- ld a, [wBallYPos + 1]
- ld c, a
-.loop
- ld a, [wTriggeredGameObjectIndex]
- inc a
- ld [wTriggeredGameObjectIndex], a
- ld a, [hli]
- ld [wTriggeredGameObject], a
- cp $ff
- ret z
- ld a, [hli]
- sub b
- bit 7, a
- jr z, .compareXDifference
- cpl ; calculate absolute value of the difference
- inc a
-.compareXDifference
- cp d
- ld a, [hli]
- jr nc, .loop
- sub c
- bit 7, a
- jr z, .compareYDifference
- cpl ; calculate absolute value of the difference
- inc a
-.compareYDifference
- cp e
- jr nc, .loop
- scf
- ret
-
-IsCollisionInList: ; 0x27da
-; Checks if the pinball's current collision attribute is in the given list.
-; Input: hl = pointer to list of collision attributes, terminated by $FF.
-; Output: Sets carry flag if the attribute is in the list.
-; First byte in list is 0 if the list is independent of the stage's current collision state (Red stage's
-; top section changes during gameply.)
- ld a, [hli]
- and a
- jr z, .checkList
- dec hl
- ld a, [wStageCollisionState]
- ld c, a
- ld b, $0
- add hl, bc
- ld c, [hl]
- add hl, bc
-.checkList
- ld a, [wd7e9]
- and a
- ret z
- ld a, [wCurCollisionAttribute]
- ld b, a
- ld c, -1 ; This saves the list offset in C, but the result isn't used by any callers of this routine.
-.loop
- inc c
- ld a, [hli]
- cp $ff
- ret z
- cp b
- jr nz, .loop
- scf
- ret
-
-PinballCollidesWithPoints: ; 0x27fd
-; Checks if pinball collides with any of the (x, y) points in the given list.
-; Saves the index of the collided point.
-; Input: hl = pointer to array of (x, y) points
-; Output: Saves index of collided point in wd578
- ld a, [wBallXPos + 1]
- ld b, a
- ld a, [wBallYPos + 1]
- ld c, a
- ld d, $0
-.nextPoint
- ld a, [hli]
- and a
- ret z
- inc d
- ld a, [hli]
- sub b
- cp $e8
- ld a, [hli]
- jr c, .nextPoint
- sub c
- cp $e8
- jr c, .nextPoint
- ld a, d
- ld [wd578], a
- ret
+INCLUDE "engine/pinball_game/object_collision/object_collision.asm"
Func_281c: ; 0x281c
ld a, [wCurrentStage]