summaryrefslogtreecommitdiff
path: root/scripts/fightingdojo.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
commitd2ed7674f499b1fd6c4059da40b8b42c6bf96995 (patch)
treef581489b522fc647477d7b36dee072d553c44fd1 /scripts/fightingdojo.asm
parent3394d8320f35f524231aa13bd9cae34e22246a6d (diff)
parent1a987d1e1ab96ca9553d4253c72858057332a03a (diff)
Merge branch 'master' of https://github.com/iimarckus/pokered
Doesn't build.
Diffstat (limited to 'scripts/fightingdojo.asm')
-rwxr-xr-xscripts/fightingdojo.asm131
1 files changed, 60 insertions, 71 deletions
diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm
index e26da1b1..fa05d486 100755
--- a/scripts/fightingdojo.asm
+++ b/scripts/fightingdojo.asm
@@ -21,15 +21,13 @@ FightingDojoScriptPointers: ; 5cd7b (17:4d7b)
dw FightingDojoScript3
FightingDojoScript1: ; 5cd83 (17:4d83)
- ld a, [wd7b1]
- bit 0, a
+ CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
ret nz
call CheckFightingMapTrainers
ld a, [wTrainerHeaderFlagBit]
and a
ret nz
- ld a, [wd7b1]
- bit 1, a
+ CheckEvent EVENT_BEAT_KARATE_MASTER
ret nz
xor a
ld [hJoyHeld], a
@@ -42,15 +40,15 @@ FightingDojoScript1: ; 5cd83 (17:4d83)
ret nz
ld a, $1
ld [wcf0d], a
+ ld a, PLAYER_DIR_RIGHT
+ ld [wPlayerMovingDirection], a
ld a, $1
- ld [wd528], a
- ld a, $1
- ld [$ff8c], a
- ld a, $8
- ld [$ff8d], a
+ ld [H_SPRITEINDEX], a
+ ld a, SPRITE_FACING_LEFT
+ ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
- ld [$ff8c], a
+ ld [hSpriteIndexOrTextID], a
call DisplayTextID
ret
@@ -61,22 +59,20 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)
ld a, [wcf0d]
and a
jr z, .asm_5cde4
+ ld a, PLAYER_DIR_RIGHT
+ ld [wPlayerMovingDirection], a
ld a, $1
- ld [wd528], a
- ld a, $1
- ld [$ff8c], a
- ld a, $8
- ld [$ff8d], a
+ ld [H_SPRITEINDEX], a
+ ld a, SPRITE_FACING_LEFT
+ ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
.asm_5cde4
ld a, $f0
ld [wJoyIgnore], a
- ld a, [wd7b1]
- or $3e
- ld [wd7b1], a
+ SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
ld a, $8
- ld [$ff8c], a
+ ld [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
@@ -96,49 +92,48 @@ FightingDojoTextPointers: ; 5ce03 (17:4e03)
FightingDojoTrainerHeaders: ; 5ce13 (17:4e13)
FightingDojoTrainerHeader0: ; 5ce13 (17:4e13)
- db $2 ; flag's bit
+ dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_0
db ($4 << 4) ; trainer's view range
- dw wd7b1 ; flag's byte
- dw FightingDojoBattleText1 ; 0x4eac TextBeforeBattle
- dw FightingDojoAfterBattleText1 ; 0x4eb6 TextAfterBattle
- dw FightingDojoEndBattleText1 ; 0x4eb1 TextEndBattle
- dw FightingDojoEndBattleText1 ; 0x4eb1 TextEndBattle
+ dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_0
+ dw FightingDojoBattleText1 ; TextBeforeBattle
+ dw FightingDojoAfterBattleText1 ; TextAfterBattle
+ dw FightingDojoEndBattleText1 ; TextEndBattle
+ dw FightingDojoEndBattleText1 ; TextEndBattle
FightingDojoTrainerHeader1: ; 5ce1f (17:4e1f)
- db $3 ; flag's bit
+ dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_1
db ($4 << 4) ; trainer's view range
- dw wd7b1 ; flag's byte
- dw FightingDojoBattleText2 ; 0x4ec5 TextBeforeBattle
- dw FightingDojoAfterBattleText2 ; 0x4ecf TextAfterBattle
- dw FightingDojoEndBattleText2 ; 0x4eca TextEndBattle
- dw FightingDojoEndBattleText2 ; 0x4eca TextEndBattle
+ dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_1
+ dw FightingDojoBattleText2 ; TextBeforeBattle
+ dw FightingDojoAfterBattleText2 ; TextAfterBattle
+ dw FightingDojoEndBattleText2 ; TextEndBattle
+ dw FightingDojoEndBattleText2 ; TextEndBattle
FightingDojoTrainerHeader2: ; 5ce2b (17:4e2b)
- db $4 ; flag's bit
+ dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_2
db ($3 << 4) ; trainer's view range
- dw wd7b1 ; flag's byte
- dw FightingDojoBattleText3 ; 0x4ede TextBeforeBattle
- dw FightingDojoAfterBattleText3 ; 0x4ee8 TextAfterBattle
- dw FightingDojoEndBattleText3 ; 0x4ee3 TextEndBattle
- dw FightingDojoEndBattleText3 ; 0x4ee3 TextEndBattle
+ dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_2
+ dw FightingDojoBattleText3 ; TextBeforeBattle
+ dw FightingDojoAfterBattleText3 ; TextAfterBattle
+ dw FightingDojoEndBattleText3 ; TextEndBattle
+ dw FightingDojoEndBattleText3 ; TextEndBattle
FightingDojoTrainerHeader3: ; 5ce37 (17:4e37)
- db $5 ; flag's bit
+ dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
db ($3 << 4) ; trainer's view range
- dw wd7b1 ; flag's byte
- dw FightingDojoBattleText4 ; 0x4ef7 TextBeforeBattle
- dw FightingDojoAfterBattleText4 ; 0x4f01 TextAfterBattle
- dw FightingDojoEndBattleText4 ; 0x4efc TextEndBattle
- dw FightingDojoEndBattleText4 ; 0x4efc TextEndBattle
+ dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
+ dw FightingDojoBattleText4 ; TextBeforeBattle
+ dw FightingDojoAfterBattleText4 ; TextAfterBattle
+ dw FightingDojoEndBattleText4 ; TextEndBattle
+ dw FightingDojoEndBattleText4 ; TextEndBattle
db $ff
FightingDojoText1: ; 5ce44 (17:4e44)
- db $08 ; asm
- ld a, [wd7b1]
- bit 0, a
+ TX_ASM
+ CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
jp nz, .continue1
- bit 1, a
+ CheckEventReuseA EVENT_BEAT_KARATE_MASTER
jp nz, .continue2
ld hl, FightingDojoText_5ce8e
call PrintText
@@ -148,22 +143,22 @@ FightingDojoText1: ; 5ce44 (17:4e44)
ld hl, FightingDojoText_5ce93
ld de, FightingDojoText_5ce93
call SaveEndBattleTextPointers
- ldh a, [$8c]
+ ld a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
ld a, $3
ld [W_FIGHTINGDOJOCURSCRIPT], a
ld [W_CURMAPSCRIPT], a
- jr .asm_9dba4 ; 0x5ce7b
-.continue1 ; 0x5ce7d
+ jr .asm_9dba4
+.continue1
ld hl, FightingDojoText_5ce9d
call PrintText
- jr .asm_9dba4 ; 0x5ce83
-.continue2 ; 0x5ce85f
+ jr .asm_9dba4
+.continue2
ld hl, FightingDojoText8
call PrintText
-.asm_9dba4 ; 0x5ce8b
+.asm_9dba4
jp TextScriptEnd
FightingDojoText_5ce8e: ; 5ce8e (17:4e8e)
@@ -183,7 +178,7 @@ FightingDojoText_5ce9d: ; 5ce9d (17:4e9d)
db "@"
FightingDojoText2: ; 5cea2 (17:4ea2)
- db $08 ; asm
+ TX_ASM
ld hl, FightingDojoTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
@@ -201,7 +196,7 @@ FightingDojoAfterBattleText1: ; 5ceb6 (17:4eb6)
db "@"
FightingDojoText3: ; 5cebb (17:4ebb)
- db $08 ; asm
+ TX_ASM
ld hl, FightingDojoTrainerHeader1
call TalkToTrainer
jp TextScriptEnd
@@ -219,7 +214,7 @@ FightingDojoAfterBattleText2: ; 5cecf (17:4ecf)
db "@"
FightingDojoText4: ; 5ced4 (17:4ed4)
- db $08 ; asm
+ TX_ASM
ld hl, FightingDojoTrainerHeader2
call TalkToTrainer
jp TextScriptEnd
@@ -237,7 +232,7 @@ FightingDojoAfterBattleText3: ; 5cee8 (17:4ee8)
db "@"
FightingDojoText5: ; 5ceed (17:4eed)
- db $08 ; asm
+ TX_ASM
ld hl, FightingDojoTrainerHeader3
call TalkToTrainer
jp TextScriptEnd
@@ -256,9 +251,8 @@ FightingDojoAfterBattleText4: ; 5cf01 (17:4f01)
FightingDojoText6: ; 5cf06 (17:4f06)
; Hitmonlee Poké Ball
- db $08 ; asm
- ld a, [wd7b1]
- and %11000000
+ TX_ASM
+ CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
jr z, .GetMon
ld hl, OtherHitmonText
call PrintText
@@ -280,11 +274,9 @@ FightingDojoText6: ; 5cf06 (17:4f06)
; once Poké Ball is taken, hide sprite
ld a, HS_FIGHTING_DOJO_GIFT_1
- ld [wcc4d], a
+ ld [wMissableObjectIndex], a
predef HideObject
- ld hl, wd7b1
- set 6, [hl]
- set 0, [hl]
+ SetEvents EVENT_GOT_HITMONLEE, EVENT_DEFEATED_FIGHTING_DOJO
.done
jp TextScriptEnd
@@ -294,9 +286,8 @@ WantHitmonleeText: ; 5cf49 (17:4f49)
FightingDojoText7: ; 5cf4e (17:4f4e)
; Hitmonchan Poké Ball
- db $08 ; asm
- ld a, [wd7b1]
- and %11000000
+ TX_ASM
+ CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
jr z, .GetMon
ld hl, OtherHitmonText
call PrintText
@@ -315,13 +306,11 @@ FightingDojoText7: ; 5cf4e (17:4f4e)
ld c,30
call GivePokemon
jr nc, .done
- ld hl, wd7b1
- set 7, [hl]
- set 0, [hl]
+ SetEvents EVENT_GOT_HITMONCHAN, EVENT_DEFEATED_FIGHTING_DOJO
; once Poké Ball is taken, hide sprite
ld a, HS_FIGHTING_DOJO_GIFT_2
- ld [wcc4d], a
+ ld [wMissableObjectIndex], a
predef HideObject
.done
jp TextScriptEnd