aboutsummaryrefslogtreecommitdiffstats
path: root/home/trainers.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2024-09-25 00:45:00 -0500
committerdannye <33dannye@gmail.com>2024-09-25 00:45:00 -0500
commita02a98ee7ada1a658e28698484058be2796dc0df (patch)
tree945986054565bd8b5212fc755415096050d1d3a8 /home/trainers.asm
parentUse long option flags for rgbgfx, same as tools/gfx (diff)
parentUse `const_skip` (diff)
downloadpokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.gz
pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.tar.xz
pokeyellow-a02a98ee7ada1a658e28698484058be2796dc0df.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'home/trainers.asm')
-rw-r--r--home/trainers.asm62
1 files changed, 31 insertions, 31 deletions
diff --git a/home/trainers.asm b/home/trainers.asm
index 4166a4db..09a69ae1 100644
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -7,7 +7,7 @@ StoreTrainerHeaderPointer::
ret
; executes the current map script from the function pointer array provided in de.
-; a: map script index to execute (unless overridden by [wd733] bit 4)
+; a: map script index to execute (unless overridden by [wStatusFlags7] BIT_USE_CUR_MAP_SCRIPT)
; hl: trainer header pointer
ExecuteCurMapScriptInTable::
push af
@@ -16,9 +16,9 @@ ExecuteCurMapScriptInTable::
pop hl
pop af
push hl
- ld hl, wFlags_D733
- bit 4, [hl]
- res 4, [hl]
+ ld hl, wStatusFlags7
+ bit BIT_USE_CUR_MAP_SCRIPT, [hl]
+ res BIT_USE_CUR_MAP_SCRIPT, [hl]
jr z, .useProvidedIndex ; test if map script index was overridden manually
ld a, [wCurMapScript]
.useProvidedIndex
@@ -114,10 +114,10 @@ TalkToTrainer::
call ReadTrainerHeaderInfo ; read end battle text
pop de
call SaveEndBattleTextPointers
- ld hl, wFlags_D733
- set 4, [hl] ; activate map script index override (index is set below)
- ld hl, wFlags_0xcd60
- bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
+ ld hl, wStatusFlags7
+ set BIT_USE_CUR_MAP_SCRIPT, [hl] ; activate map script index override (index is set below)
+ ld hl, wMiscFlags
+ bit BIT_SEEN_BY_TRAINER, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
ret nz
; if the player talked to the trainer of his own volition
call EngageMapTrainer
@@ -143,8 +143,8 @@ ENDC
ld [wTrainerHeaderFlagBit], a
ret
.trainerEngaging
- ld hl, wFlags_D733
- set 3, [hl]
+ ld hl, wStatusFlags7
+ set BIT_TRAINER_BATTLE, [hl]
ld [wEmotionBubbleSpriteIndex], a
xor a ; EXCLAMATION_BUBBLE
ld [wWhichEmotionBubble], a
@@ -160,12 +160,12 @@ ENDC
; display the before battle text after the enemy trainer has walked up to the player's sprite
DisplayEnemyTrainerTextAndStartBattle::
- ld a, [wd730]
- and $1
+ ld a, [wStatusFlags5]
+ and 1 << BIT_SCRIPTED_NPC_MOVEMENT
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
- ldh [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndex], a
call DisplayTextID
; fall through
@@ -173,23 +173,23 @@ StartTrainerBattle::
xor a
ld [wJoyIgnore], a
call InitBattleEnemyParameters
- ld hl, wd72d
- set 6, [hl]
- set 7, [hl]
- ld hl, wd72e
- set 1, [hl]
+ ld hl, wStatusFlags3
+ set BIT_TALKED_TO_TRAINER, [hl]
+ set BIT_PRINT_END_BATTLE_TEXT, [hl]
+ ld hl, wStatusFlags4
+ set BIT_UNKNOWN_4_1, [hl]
ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually EndTrainerBattle)
ret
EndTrainerBattle::
ld hl, wCurrentMapScriptFlags
- set 5, [hl]
- set 6, [hl]
- ld hl, wd72d
- res 7, [hl]
- ld hl, wFlags_0xcd60
- res 0, [hl] ; player is no longer engaged by any trainer
+ set BIT_CUR_MAP_LOADED_1, [hl]
+ set BIT_CUR_MAP_LOADED_2, [hl]
+ ld hl, wStatusFlags3
+ res BIT_PRINT_END_BATTLE_TEXT, [hl]
+ ld hl, wMiscFlags
+ res BIT_SEEN_BY_TRAINER, [hl] ; player is no longer engaged by any trainer
ld a, [wIsInBattle]
cp $ff
jp z, ResetButtonPressedAndMapScript
@@ -211,9 +211,9 @@ EndTrainerBattle::
ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it
predef HideObject
.skipRemoveSprite
- ld hl, wd730
- bit 4, [hl]
- res 4, [hl]
+ ld hl, wStatusFlags5
+ bit BIT_UNKNOWN_5_4, [hl]
+ res BIT_UNKNOWN_5_4, [hl]
ret nz
ResetButtonPressedAndMapScript::
@@ -240,7 +240,7 @@ InitBattleEnemyParameters::
ld [wTrainerNo], a
ret
.noTrainer
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
ret
GetSpritePosition1::
@@ -340,9 +340,9 @@ EngageMapTrainer::
PrintEndBattleText::
push hl
- ld hl, wd72d
- bit 7, [hl]
- res 7, [hl]
+ ld hl, wStatusFlags3
+ bit BIT_PRINT_END_BATTLE_TEXT, [hl]
+ res BIT_PRINT_END_BATTLE_TEXT, [hl]
pop hl
ret z
ldh a, [hLoadedROMBank]