GetCurrentActionType player1_object
CMP #$03
BEQ checkSpriteWeapon
JMP skipSpriteWeaponCheck
checkSpriteWeapon:
;;;;;;;;;;;;;;;;;;;;;;;;;
;;here it did equal the melee attack pose.
LDX player1_object
LDA Object_movement,x
AND #%00000111
TAY ;; direction for offset table index
LDA Object_x_hi,x
;;; offset x for creation
CLC
ADC weaponOffsetTableX,y
STA selfRight
SEC
SBC #$08 ;; width of weapon
STA selfLeft
LDA Object_y_hi,x
;;; offset x for creation
CLC
ADC weaponOffsetTableY,y
STA selfBottom
SEC
SBC #$08 ;; width of weapon
STA selfTop
;; run through objects.
LDX #$00
DoMonsterWeaponSpriteLoop:
LDA Object_flags,x
AND #%00001000
BNE +
JMP ++
+
JSR GetOtherCollisionBox
LDA selfRight
CMP otherLeft
BCS + ;; no player object collision
JMP ++
+
LDA otherRight
CMP selfLeft
BCS +
JMP ++
+
LDA otherBottom
CMP selfTop
BCS +
JMP ++
+
LDA selfBottom
CMP otherTop
BCS +
JMP ++
+
;; ok, there is a collision with an monster object, from HERE :
;;; what should we do with the monster?
LDA Object_vulnerability,x
AND #%00000100 ;; is it weapon immune?
BEQ notWeaponImmuneSpriteWeapon
;PlaySound #SFX_MISS
JMP skipHurtingMonsterAndSoundSpriteWeapon
notWeaponImmuneSpriteWeapon:
LDA Object_status,x
AND #HURT_STATUS_MASK
BEQ dontskipHurtingMonsterSpriteWeapon
JMP skipHurtingMonsterSpriteWeapon
dontskipHurtingMonsterSpriteWeapon:
LDA Object_status,x
ORA #%00000001
STA Object_status,x
LDA #HURT_TIMER
STA Object_timer_0,x
;;; assume idle is in step 0
ChangeObjectState #$00,#$02
;;;; unfortunately this recoil is backwards
LDA Object_status,x
AND #%00000100
BNE skipRecoilBecauseOnEdgeSpriteWeapon
LDA Object_vulnerability,x
AND #%00001000
BNE skipRecoilBecauseOnEdgeSpriteWeapon ;; skip recoil because bit is flipped to ignore recoil
LDA selfCenterX
STA recoil_otherX
LDA selfCenterY
STA recoil_otherY
LDA otherCenterX
STA recoil_selfX
LDA otherCenterY
STA recoil_selfY
JSR DetermineRecoilDirection
skipRecoilBecauseOnEdgeSpriteWeapon:
LDA Object_health,x
SEC
SBC #$01
CMP #$01
BCC isMonsterDeathSpriteWeapon:
JMP notMonsterDeathSpriteWeapon
isMonsterDeathSpriteWeapon:
;LDA Object_x_hi,x
;STA temp
;LDA Object_y_hi,x
;STA temp1
DeactivateCurrentObject
;CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, currentNametable ;; create a "pouf" death effect
PlaySound #SND_SPLAT
TXA
STA tempx
AddValue #$08, myScore, #$01, #$00
UpdateHud HUD_myScore
LDX tempx
JSR HandleDrops
JSR HandleToggleScrolling
;; check for monter locks begin:
CountObjects #%00001000, #$00
LDA monsterCounter
CLC
BEQ +
JMP ++
+
.include SCR_KILLED_LAST_MONSTER
JMP skipHurtingMonsterSpriteWeapon
notMonsterDeathSpriteWeapon:
STA Object_health,x
skipHurtingMonsterSpriteWeapon:
;PlaySound #SFX_MONSTER_HURT
skipHurtingMonsterAndSoundSpriteWeapon:
++
INX
CPX #TOTAL_MAX_OBJECTS
BEQ skipSpriteWeaponCheck ;; done with checking against objects
JMP DoMonsterWeaponSpriteLoop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
skipSpriteWeaponCheck ;; there is no collision here horizontally.