shithub: pokered

Download patch

ref: 0af6c061fe44a417ebaed46f7f6865dfa8afba09
parent: b273050dc6f1b051c05fba100d2e00a850e9f937
author: IIMarckus <iimarckus@gmail.com>
date: Wed Dec 28 22:31:17 EST 2011

Add status checks + text.

hg-commit-id: 58043ea19ab5


--- a/constants.asm
+++ b/constants.asm
@@ -78,6 +78,18 @@
 	; bit 6 par
 	; unused? (XXX confirm)
 
+W_CURMONSTATUS EQU $D018 ; the status of the player’s current monster
+	; bit 0 slp
+	; bit 1 slp
+	; bit 2 slp
+	; bit 3 psn
+	; bit 4 brn
+	; bit 5 frz
+	; bit 6 par
+	; unused? (XXX confirm)
+
+W_CURMONBATTSTATUS EQU $D067 ; various battle statuses
+	; bit 5 held in place (Bind, Clamp, etc.)
 
 W_TRAINERCLASS EQU $D031
 
--- a/pokered.asm
+++ b/pokered.asm
@@ -10128,7 +10128,7 @@
 	ld a,[$CFD3]
 	cp a,$2B
 	jr z,.next5\@
-	cp a,$27
+	cp a,$27 ; XXX SLP | FRZ ?
 	jr z,.next5\@
 	jr .next4\@
 .next5\@
@@ -10225,8 +10225,8 @@
 	ld a,[$FFF3]
 	and a
 	jr nz,.next\@
-	ld a,[$D018]
-	and a,$27
+	ld a,[W_CURMONSTATUS]
+	and a,SLP | FRZ
 	ret nz
 	ld hl,ScaredText
 	call PrintText
@@ -10263,8 +10263,116 @@
 	and a
 	ret
 
-INCBIN "baserom.gbc",$3D854,$3E474 - $3D854
+Function5854: ; 5854
+	ld hl,W_CURMONSTATUS
+	ld a,[hl]
+	and a,SLP
+	jr z,.FrozenCheck\@ ; to 5884
 
+	dec a
+	ld [W_CURMONSTATUS],a ; decrement sleep count
+	and a
+	jr z,.WakeUp\@ ; to 5874
+
+	xor a
+	ld [$CC5B],a
+	ld a,$BC ; XXX SLP_ANIM?
+	call $6F07
+	ld hl,FastAsleepText
+	call PrintText
+	jr .sleepDone\@
+.WakeUp\@
+	ld hl,WokeUpText
+	call PrintText
+.sleepDone\@
+	xor a
+	ld [$CCF1],a
+	ld hl,Function580A
+	jp $5A37
+
+.FrozenCheck\@
+	bit 5,[hl] ; frozen?
+	jr z,.HeldInPlaceCheck\@ ; to 5898
+	ld hl,FrozenText
+	call PrintText
+	xor a
+	ld [$CCF1],a
+	ld hl,Function580A
+	jp $5A37
+
+.HeldInPlaceCheck\@
+	ld a,[W_CURMONBATTSTATUS]
+	bit 5,a
+	jp z,$58AC
+	ld hl,CantMoveText
+	call PrintText
+	ld hl,Function580A
+	jp $5A37
+
+INCBIN "baserom.gbc",$3D8AC,$3DA3D - $3D8AC
+
+FastAsleepText:
+	TX_FAR _FastAsleepText
+	db "@"
+
+WokeUpText:
+	TX_FAR _WokeUpText
+	db "@"
+
+FrozenText:
+	TX_FAR _FrozenText
+	db "@"
+
+FullyParalyzedText:
+	TX_FAR _FullyParalyzedText
+	db "@"
+
+FlinchedText:
+	TX_FAR _FlinchedText
+	db "@"
+
+MustRechargeText:
+	TX_FAR _MustRechargeText
+	db "@"
+
+DisabledNoMoreText:
+	TX_FAR _DisabledNoMoreText
+	db "@"
+
+IsConfusedText:
+	TX_FAR _IsConfusedText
+	db "@"
+
+HurtItselfText:
+	TX_FAR _HurtItselfText
+	db "@"
+
+ConfusedNoMoreText:
+	TX_FAR _ConfusedNoMoreText
+	db "@"
+
+SavingEnergyText:
+	TX_FAR _SavingEnergyText
+	db "@"
+
+UnleashedEnergyText:
+	TX_FAR _UnleashedEnergyText
+	db "@"
+
+ThrashingAboutText:
+	TX_FAR _ThrashingAboutText
+	db "@"
+
+AttackContinuesText:
+	TX_FAR _AttackContinuesText
+	db "@"
+
+CantMoveText:
+	TX_FAR _CantMoveText
+	db "@"
+
+INCBIN "baserom.gbc",$3DA88,$3E474 - $3DA88
+
 TypeEffects: ; 6474
 ; format: attacking type, defending type, damage multiplier
 ; the multiplier is a (decimal) fixed-point number:
@@ -14008,7 +14116,67 @@
 	db 0,"GHOST: Get out...",$4F
 	db "Get out...",$58
 
-INCBIN "baserom.gbc",$89901,$8A425 - $89901
+_FastAsleepText:
+	db 0,$5A,$4F
+	db "is fast asleep!",$58
+
+_WokeUpText:
+	db 0,$5A,$4F
+	db "woke up!",$58
+
+_FrozenText:
+	db 0,$5A,$4F
+	db "is frozen solid!",$58
+
+_FullyParalyzedText:
+	db 0,$5A,"'s",$4F
+	db "fully paralyzed!",$58
+
+_FlinchedText:
+	db 0,$5A,$4F
+	db "flinched!",$58
+
+_MustRechargeText:
+	db 0,$5A,$4F
+	db "must recharge!",$58
+
+_DisabledNoMoreText:
+	db 0,$5A,"'s",$4F
+	db "disabled no more!",$58
+
+_IsConfusedText:
+	db 0,$5A,$4F
+	db "is confused!",$58
+
+_HurtItselfText:
+	db 0,"It hurt itself in",$4F
+	db "its confusion!",$58
+
+_ConfusedNoMoreText:
+	db 0,$5A,"'s",$4F
+	db "confused no more!",$58
+
+_SavingEnergyText:
+	db 0,$5A,$4F
+	db "is saving energy!",$58
+
+_UnleashedEnergyText:
+	db 0,$5A,$4F
+	db "unleashed energy!",$58
+
+_ThrashingAboutText:
+	db 0,$5A,"'s",$4F
+	db "thrashing about!",$57
+
+_AttackContinuesText:
+	db 0,$5A,"'s",$4F
+	db "attack continues!",$57
+
+_CantMoveText:
+	db 0,$5A,$4F
+	db "can't move!",$58
+
+INCBIN "baserom.gbc",$89A29,$8A425 - $89A29
 INCLUDE "text/oakspeech.tx"
 
 INCBIN "baserom.gbc",$8A605,$6696 - $6605