aboutsummaryrefslogtreecommitdiffstats
path: root/engine/events
diff options
context:
space:
mode:
authorNarishma-gb <194818981+Narishma-gb@users.noreply.github.com>2025-09-10 06:31:11 +0200
committerGitHub <noreply@github.com>2025-09-10 00:31:11 -0400
commitd237b01cfb241f417567c964e0df0658cf921570 (patch)
tree799e92e48259443aa6cf4c553ed7adf38bd442d4 /engine/events
parentMerge branch 'master' of https://github.com/pret/pokered (diff)
downloadpokeyellow-d237b01cfb241f417567c964e0df0658cf921570.tar.gz
pokeyellow-d237b01cfb241f417567c964e0df0658cf921570.tar.xz
pokeyellow-d237b01cfb241f417567c964e0df0658cf921570.zip
Misc. naming and cleanup (#139)
* Name some printer/diploma routines * Name `wd434` * Name `NAME_LENGTH_JP` * Rename `callabd`/`calladb` to `farcall`/`callfar`
Diffstat (limited to 'engine/events')
-rw-r--r--engine/events/black_out.asm2
-rw-r--r--engine/events/diploma.asm2
-rw-r--r--engine/events/diploma2.asm102
-rw-r--r--engine/events/hidden_objects/bench_guys.asm12
-rw-r--r--engine/events/pikachu_happiness.asm4
-rw-r--r--engine/events/poison.asm6
-rw-r--r--engine/events/pokecenter.asm8
7 files changed, 55 insertions, 81 deletions
diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm
index f142782a..2b017f71 100644
--- a/engine/events/black_out.asm
+++ b/engine/events/black_out.asm
@@ -1,7 +1,7 @@
ResetStatusAndHalveMoneyOnBlackout::
; Reset player status on blackout.
xor a
- ld [wd434], a
+ ld [wPikachuCollisionCounter], a
xor a ; gamefreak copypasting functions (double xor a)
ld [wBattleResult], a
ld [wWalkBikeSurfState], a
diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm
index 67837475..539cba42 100644
--- a/engine/events/diploma.asm
+++ b/engine/events/diploma.asm
@@ -6,7 +6,7 @@ DisplayDiploma::
ld [wUpdateSpritesEnabled], a
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
- callfar _DisplayDiploma
+ callfar DisplayDiplomaTop
call WaitForTextScrollButtonPress
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
diff --git a/engine/events/diploma2.asm b/engine/events/diploma2.asm
index 87a44439..0653526d 100644
--- a/engine/events/diploma2.asm
+++ b/engine/events/diploma2.asm
@@ -1,22 +1,19 @@
DEF CIRCLE_TILE_ID EQU $10
-_DisplayDiploma:
+DisplayDiplomaTop:
call GBPalWhiteOutWithDelay3
call ClearScreen
- ld de, SurfingPikachu3Graphics
+ ld de, DiplomaGraphics
ld hl, vChars2
- lb bc, BANK(SurfingPikachu3Graphics), (SurfingPikachu3GraphicsEnd - SurfingPikachu3Graphics) / $10
+ lb bc, BANK(DiplomaGraphics), (DiplomaGraphicsEnd - DiplomaGraphics) / $10
call CopyVideoData
hlcoord 0, 0
- call Func_e9bdf
-
+ call DiplomaDrawHorizontalBorder
hlcoord 0, 0
- call Func_e9beb
-
+ call DiplomaDrawVerticalBorder
hlcoord 19, 0
- call Func_e9beb
-
+ call DiplomaDrawVerticalBorder
ld a, $00
hlcoord 0, 0
ld [hl], a
@@ -67,105 +64,86 @@ DiplomaCongrats:
DiplomaGameFreak:
db "GAME FREAK@"
-Func_e9ad3:
+DisplayDiplomaBottom:
call ClearScreen
hlcoord 0, 17
- call Func_e9bdf
+ call DiplomaDrawHorizontalBorder
hlcoord 0, 0
- call Func_e9beb
+ call DiplomaDrawVerticalBorder
hlcoord 19, 0
- call Func_e9beb
+ call DiplomaDrawVerticalBorder
ld a, $00
hlcoord 0, 17
ld [hl], a
hlcoord 19, 17
ld [hl], a
- ld de, Tilemap_e9b3e
+
+ ld de, DiplomaPikachuTiles
hlcoord 6, 2
lb bc, 10, 12
call Diploma_Surfing_CopyBox
- ld de, Tilemap_e9bb6
+
+ ld de, CongratulationsTiles
hlcoord 5, 13
lb bc, 1, 11
call Diploma_Surfing_CopyBox
- ld de, String_e9bd5
+
+ ld de, DiplomaPlayTime
hlcoord 2, 15
call PlaceString
hlcoord 12, 15
ld de, wPlayTimeHours
- lb bc, $40 | 1, 3
+ lb bc, LEFT_ALIGN | 1, 3
call PrintNumber
- ld [hl], $16
+ ld [hl], $16 ; colon
inc hl
ld de, wPlayTimeMinutes
- lb bc, $80 | 1, 2
+ lb bc, LEADING_ZEROES | 1, 2
call PrintNumber
+
ld a, [wNumSetBits]
- cp 151
+ cp NUM_POKEMON
ret nz
- ld de, TileMap_e9bc1
+ ld de, DiplomaMewTiles
hlcoord 2, 0
lb bc, 4, 5
call Diploma_Surfing_CopyBox
ret
-Tilemap_e9b3e:
- db $7f, $7f, $7f, $1a, $1b, $7f, $7f, $7f, $7f, $7f
- db $7f, $7f, $7f, $7f, $7f, $1c, $1d, $1e, $1f, $20
- db $7f, $21, $22, $23, $7f, $24, $25, $26, $27, $28
- db $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32
- db $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c
- db $7f, $3d, $3e, $3f, $40, $41, $42, $43, $29, $44
- db $45, $46, $47, $48, $49, $4a, $4b, $29, $29, $4c
- db $4d, $4e, $4f, $50, $51, $52, $53, $54, $55, $56
- db $57, $58, $59, $7f, $7f, $7f, $5a, $5b, $5c, $5d
- db $5e, $5f, $60, $61, $62, $7f, $7f, $7f, $7f, $63
- db $64, $65, $66, $67, $68, $7f, $7f, $7f, $7f, $7f
- db $7f, $69, $6a, $6b, $6c, $6d, $6e, $7f, $7f, $7f
+DiplomaPikachuTiles:
+INCBIN "gfx/diploma/diploma_pikachu.tilemap"
-Tilemap_e9bb6:
- db $05
- db $06
- db $07
- db $08
- db $09
- db $0a
- db $0b
- db $0c
- db $0d
- db $0e
- db $0f
+CongratulationsTiles:
+ db $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; CONGRATULATIONS!
-TileMap_e9bc1:
- db $70, $71, $7f, $72, $7f
- db $73, $74, $75, $76, $77
- db $7f, $78, $11, $12, $13
- db $7f, $7f, $14, $15, $7f
+DiplomaMewTiles:
+INCBIN "gfx/diploma/diploma_mew.tilemap"
-String_e9bd5: db "PLAY TIME@"
+DiplomaPlayTime:
+ db "PLAY TIME@"
-Func_e9bdf:
- ld c, 10
-.asm_e9be1
+DiplomaDrawHorizontalBorder:
+ ld c, SCREEN_WIDTH / 2
+.loop
ld [hl], $02
inc hl
ld [hl], $01
inc hl
dec c
- jr nz, .asm_e9be1
+ jr nz, .loop
ret
-Func_e9beb:
- ld c, 9
+DiplomaDrawVerticalBorder:
+ ld c, SCREEN_HEIGHT / 2
ld de, SCREEN_WIDTH
-.asm_e9bed
+.loop
ld [hl], $04
add hl, de
ld [hl], $03
add hl, de
dec c
- jr nz, .asm_e9bed
+ jr nz, .loop
ret
-SurfingPikachu3Graphics: INCBIN "gfx/surfing_pikachu/surfing_pikachu_3.2bpp"
-SurfingPikachu3GraphicsEnd:
+DiplomaGraphics: INCBIN "gfx/diploma/diploma.2bpp"
+DiplomaGraphicsEnd:
diff --git a/engine/events/hidden_objects/bench_guys.asm b/engine/events/hidden_objects/bench_guys.asm
index e5a2a724..81519f2f 100644
--- a/engine/events/hidden_objects/bench_guys.asm
+++ b/engine/events/hidden_objects/bench_guys.asm
@@ -18,14 +18,10 @@ PrintBenchGuyText:
ld a, [wSpritePlayerStateData1FacingDirection]
cp b
- ; bug: an 'inc hl' instruction is needed before looping back. When trying to
- ; talk to a bench guy from above, this Sprite Facing test will fail, and the
- ; next loop iteration will be misaligned within BenchGuyTextPointers table.
- ; As a result, the routine will miss the terminator byte, and continue to
- ; process data beyond the table boundary.
- ; It seems that it will only return after starting to read data from VRAM
- ; (According to Pan Docs, during PPU mode 3, reads return garbage value,
- ; usually $FF).
+ ; bug: an 'inc hl' instruction is needed before looping back.
+ ; Due to Yellow's new Pokecenter layout, it's now impossible to talk to a
+ ; bench guy from above. The bug is still present but will not be triggered
+ ; in a regular play.
jr nz, .loop ; player isn't facing the bench guy
ld a, [hl]
jp PrintPredefTextID
diff --git a/engine/events/pikachu_happiness.asm b/engine/events/pikachu_happiness.asm
index 0aee04f9..32a69c2b 100644
--- a/engine/events/pikachu_happiness.asm
+++ b/engine/events/pikachu_happiness.asm
@@ -5,14 +5,14 @@ ModifyPikachuHappiness::
cp PIKAHAPPY_WALKING
jr z, .checkanywhereinparty
push de
- callfar IsThisPartymonStarterPikachu_Party
+ callfar IsThisPartyMonStarterPikachu
pop de
ret nc
jr .proceed
.checkanywhereinparty
push de
- callfar IsStarterPikachuInOurParty
+ callfar IsStarterPikachuAliveInOurParty
pop de
ret nc
diff --git a/engine/events/poison.asm b/engine/events/poison.asm
index 4645387c..6dfe1376 100644
--- a/engine/events/poison.asm
+++ b/engine/events/poison.asm
@@ -62,11 +62,11 @@ ApplyOutOfBattlePoisonDamage:
ld a, TEXT_MON_FAINTED
ldh [hTextID], a
call DisplayTextID
- callfar IsThisPartymonStarterPikachu_Party
+ callfar IsThisPartyMonStarterPikachu
jr nc, .curMonNotPlayerPikachu
ldpikacry e, PikachuCry4
callfar PlayPikachuSoundClip
- calladb_ModifyPikachuHappiness PIKAHAPPY_PSNFNT
+ callfar_ModifyPikachuHappiness PIKAHAPPY_PSNFNT
.curMonNotPlayerPikachu
pop de
pop hl
@@ -132,7 +132,7 @@ Func_c4c7:
call Random
and $1
jr z, .asm_c4de
- calladb_ModifyPikachuHappiness $6
+ callfar_ModifyPikachuHappiness PIKAHAPPY_WALKING
.asm_c4de
ld hl, wPikachuMood
ld a, [hl]
diff --git a/engine/events/pokecenter.asm b/engine/events/pokecenter.asm
index 6cb93a02..6b8c584c 100644
--- a/engine/events/pokecenter.asm
+++ b/engine/events/pokecenter.asm
@@ -25,7 +25,7 @@ DisplayPokemonCenterDialogue_::
and a
jp nz, .declinedHealing ; if the player chose No
call SetLastBlackoutMap
- callfar IsStarterPikachuInOurParty
+ callfar IsStarterPikachuAliveInOurParty
jr nc, .notHealingPlayerPikachu
call CheckPikachuFollowingPlayer
jr nz, .notHealingPlayerPikachu
@@ -41,7 +41,7 @@ DisplayPokemonCenterDialogue_::
call CheckPikachuFollowingPlayer
jr nz, .playerPikachuNotOnScreen
call DisablePikachuOverworldSpriteDrawing
- callfar IsStarterPikachuInOurParty
+ callfar IsStarterPikachuAliveInOurParty
call c, Func_6eaa
.playerPikachuNotOnScreen
lb bc, 1, 8
@@ -60,7 +60,7 @@ DisplayPokemonCenterDialogue_::
call PlaySound
call CheckPikachuFollowingPlayer
jr nz, .doNotReturnPikachu
- callfar IsStarterPikachuInOurParty
+ callfar IsStarterPikachuAliveInOurParty
call c, Func_6eaa
ld a, $5
ld [wPikachuSpawnState], a
@@ -70,7 +70,7 @@ DisplayPokemonCenterDialogue_::
call Func_6ebb
ld hl, PokemonFightingFitText
call PrintText
- callfar IsStarterPikachuInOurParty
+ callfar IsStarterPikachuAliveInOurParty
jr nc, .notInParty
lb bc, 15, 0
call Func_6ebb