summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2019-07-03 19:00:28 +0200
committerxCrystal <rgr.crystal@gmail.com>2019-07-03 19:00:28 +0200
commite91b56ada6dda8576d64821bb51793a18a62b17b (patch)
treef16923321b87d7efcfde06f8354e10f7d6311a19 /src
parent880d8b42d8013dd2fc1f4a7424f9621c137cee6b (diff)
Fix/consolidate some function names
Diffstat (limited to 'src')
-rw-r--r--src/engine/bank01.asm52
-rw-r--r--src/engine/bank02.asm4
-rw-r--r--src/engine/bank03.asm8
-rw-r--r--src/engine/bank04.asm6
-rw-r--r--src/engine/bank06.asm88
-rw-r--r--src/engine/home.asm16
6 files changed, 91 insertions, 83 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 3c6e3f1..fff7239 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -424,55 +424,61 @@ Func_42fd: ; 42fd (1:42fd)
; triggered by pressing B + UP in the duel menu
DuelMenuShortcut_OpponentPlayArea: ; 430b (1:430b)
- call OpenOpponentPlayAreaScreen
+ call OpenNonTurnHolderPlayAreaScreen
jp DuelMainInterface
; triggered by pressing B + DOWN in the duel menu
DuelMenuShortcut_PlayerPlayArea: ; 4311 (1:4311)
- call OpenPlayAreaScreen
+ call OpenTurnHolderPlayAreaScreen
jp DuelMainInterface
; triggered by pressing B + RIGHT in the duel menu
DuelMenuShortcut_OpponentDiscardPile: ; 4317 (1:4317)
- call OpenOpponentDiscardPileScreen
+ call OpenNonTurnHolderDiscardPileScreen
jp c, PrintDuelMenuAndHandleInput
jp DuelMainInterface
; triggered by pressing B + LEFT in the duel menu
DuelMenuShortcut_PlayerDiscardPile: ; 4320 (1:4320)
- call OpenPlayerDiscardPileScreen
+ call OpenTurnHolderDiscardPileScreen
jp c, PrintDuelMenuAndHandleInput
jp DuelMainInterface
-; draw the opponent's play area screen
-OpenOpponentPlayAreaScreen: ; 4329 (1:4329)
+; draw the non-turn holder's play area screen
+OpenNonTurnHolderPlayAreaScreen: ; 4329 (1:4329)
call SwapTurn
- call OpenPlayAreaScreen
+ call OpenTurnHolderPlayAreaScreen
call SwapTurn
ret
; draw the turn holder's play area screen
-OpenPlayAreaScreen: ; 4333 (1:4333)
+OpenTurnHolderPlayAreaScreen: ; 4333 (1:4333)
call HasAlivePokemonInPlayArea
jp OpenPlayAreaScreenForViewing
-; draw the opponent's discard pile screen
-OpenOpponentDiscardPileScreen: ; 4339 (1:4339)
+; draw the non-turn holder's discard pile screen
+OpenNonTurnHolderDiscardPileScreen: ; 4339 (1:4339)
call SwapTurn
call OpenDiscardPileScreen
jp SwapTurn
-; draw the player's discard pile screen
-OpenPlayerDiscardPileScreen: ; 4342 (1:4342)
+; draw the turn holder's discard pile screen
+OpenTurnHolderDiscardPileScreen: ; 4342 (1:4342)
jp OpenDiscardPileScreen
-Func_4345: ; 4345 (1:4345)
+; draw the non-turn holder's hand screen.
+; simpler version of OpenPlayerHandScreen where any selected card is directly submitted
+; and the duelist could also be the opponent.
+OpenNonTurnHolderHandScreen_Simple: ; 4345 (1:4345)
call SwapTurn
- call Func_434e
+ call OpenTurnHolderHandScreen_Simple
jp SwapTurn
; 0x434e
-Func_434e: ; 434e (1:434e)
+; draw the turn holder's hand screen.
+; simpler version of OpenPlayerHandScreen where any selected card is directly submitted
+; and the duelist could also be the opponent.
+OpenTurnHolderHandScreen_Simple: ; 434e (1:434e)
call CreateHandCardList
jr c, .no_cards_in_hand
call InitAndDrawCardListScreenLayout
@@ -1662,7 +1668,7 @@ DrawDuelistPortraitsAndNames: ; 4a97 (1:4a97)
push de
call CopyOpponentName
pop hl
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
push hl
add SCREEN_WIDTH
ld d, a
@@ -2528,7 +2534,7 @@ DrawDuelHUD: ; 5093 (1:5093)
or a
jr nz, .print_color_icon
ld hl, wDefaultText
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
add SCREEN_WIDTH
ld d, a
.print_color_icon
@@ -5196,7 +5202,7 @@ Func_60dd: ; 60dd (1:60dd)
call Func_3096
jr .asm_60f2
.asm_6132
- call Func_434e
+ call OpenTurnHolderHandScreen_Simple
jr .asm_60f2
; 0x6137
@@ -6294,7 +6300,7 @@ Func_67fb: ; 67fb (1:67fb)
call Func_3096
jr .asm_6829
.asm_6839
- call Func_434e
+ call OpenTurnHolderHandScreen_Simple
jr .asm_6829
; 0x683e
@@ -6369,16 +6375,16 @@ Func_6862: ; 6862 (1:6862)
call Func_4597
jr .return_carry
.down_pressed
- call OpenPlayAreaScreen
+ call OpenTurnHolderPlayAreaScreen
jr .return_carry
.left_pressed
- call OpenPlayerDiscardPileScreen
+ call OpenTurnHolderDiscardPileScreen
jr .return_carry
.up_pressed
- call OpenOpponentPlayAreaScreen
+ call OpenNonTurnHolderPlayAreaScreen
jr .return_carry
.right_pressed
- call OpenOpponentDiscardPileScreen
+ call OpenNonTurnHolderDiscardPileScreen
jr .return_carry
; 0x68c6
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm
index 232fa98..4bbf7ca 100644
--- a/src/engine/bank02.asm
+++ b/src/engine/bank02.asm
@@ -690,7 +690,7 @@ Func_9253: ; 9253 (2:5253)
ld de, wDefaultText
call Func_92ad
ld hl, wDefaultText
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
ld b, $0
ld hl, wDefaultText
add hl, bc
@@ -709,7 +709,7 @@ Func_926e: ; 926e (2:526e)
ld de, wDefaultText
call Func_92b4
ld hl, wDefaultText
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
ld b, $0
ld hl, wDefaultText
add hl, bc
diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm
index 5539d38..00c6c88 100644
--- a/src/engine/bank03.asm
+++ b/src/engine/bank03.asm
@@ -10,7 +10,7 @@ LoadMap: ; c000 (3:4000)
ld [wd110], a
ld [wMatchStartTheme], a
farcall Func_10a9b
- call Func_c1a4
+ call WhiteOutDMGPals
call ZeroObjectPositions
xor a
ld [wTileMapFill], a
@@ -22,7 +22,7 @@ LoadMap: ; c000 (3:4000)
ld [wd291], a
.asm_c037
farcall Func_10ab4
- call Func_c1a4
+ call WhiteOutDMGPals
call Func_c241
call EmptyScreen
call Func_3ca0
@@ -217,7 +217,7 @@ Func_c1a0: ; c1a0 (3:41a0)
call ResetDoFrameFunction
ret
-Func_c1a4: ; c1a4 (3:41a4)
+WhiteOutDMGPals: ; c1a4 (3:41a4)
xor a
call SetBGP
xor a
@@ -2016,7 +2016,7 @@ Func_cee2: ; cee2 (3:4ee2)
farcall Func_10031
pop af
bank1call Func_7594
- call Func_c1a4
+ call WhiteOutDMGPals
call DoFrameIfLCDEnabled
call Func_c2d4
jp IncreaseOWScriptPointerBy2
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index ffbef50..290b004 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -161,7 +161,7 @@ BoosterPack_1031b: ; 1031b (4:431b)
ld a, $4
ld [wTextBoxFrameType], a
farcall Func_7599
- farcall Func_c1a4
+ farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
pop af
ld [wd291], a
@@ -1152,7 +1152,7 @@ MainMenu_CardPop: ; 12768 (4:6768)
ld a, MUSIC_CARD_POP
call PlaySong
bank1call Func_7571
- farcall Func_c1a4
+ farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
ld a, MUSIC_STOP
call PlaySong
@@ -1192,7 +1192,7 @@ DisplayPlayerNamingScreen:: ; 128a9 (4:68a9)
ld hl, wNameBuffer
farcall InputPlayerName
- farcall Func_c1a4
+ farcall WhiteOutDMGPals
call DoFrameIfLCDEnabled
call DisableLCD
ld hl, wNameBuffer
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index 5c61c8d..d9cb234 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -38,7 +38,7 @@ _CopyCardNameAndLevel: ; 18000 (6:4000)
pop hl
push de
ld e, c
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
add e
ld c, a
pop hl
@@ -292,7 +292,7 @@ Func_180d5: ; 180d5 (6:40d5)
call SetupText
ldh a, [hWhoseTurn]
push af
- bank1call OpenPlayAreaScreen
+ bank1call OpenTurnHolderPlayAreaScreen
pop af
ldh [hWhoseTurn], a
ld a, [$ce57]
@@ -303,7 +303,7 @@ Func_180d5: ; 180d5 (6:40d5)
call SetupText
ldh a, [hWhoseTurn]
push af
- bank1call OpenOpponentPlayAreaScreen
+ bank1call OpenNonTurnHolderPlayAreaScreen
pop af
ldh [hWhoseTurn], a
ld a, [$ce57]
@@ -330,11 +330,11 @@ Func_180d5: ; 180d5 (6:40d5)
Func_006_4248:
ld a, [$ce52]
inc a
- cp $06
+ cp PLAY_AREA_BENCH_5 + $01
jr nz, .asm_006_4251
- xor a
+ xor a ; PLAY_AREA_ARENA
.asm_006_4251
- ld [wHUDEnergyAndHPBarsX], a
+ ld [wCurPlayAreaSlot], a
add DUELVARS_ARENA_CARD
call GetTurnDuelistVariable
cp -1
@@ -353,7 +353,7 @@ Func_006_426a:
jr z, .asm_006_4274
sub $02
.asm_006_4274
- ld [wHUDEnergyAndHPBarsX], a
+ ld [wCurPlayAreaSlot], a
add DUELVARS_ARENA_CARD
call GetNonTurnDuelistVariable
cp -1
@@ -370,7 +370,7 @@ Func_006_426a:
Func_006_4293:
ldh a, [hWhoseTurn]
push af
- bank1call Func_434e
+ bank1call OpenTurnHolderHandScreen_Simple
pop af
ldh [hWhoseTurn], a
ret
@@ -378,7 +378,7 @@ Func_006_4293:
Func_006_429d:
ldh a, [hWhoseTurn]
push af
- bank1call Func_4345
+ bank1call OpenNonTurnHolderHandScreen_Simple
pop af
ldh [hWhoseTurn], a
ret
@@ -386,7 +386,7 @@ Func_006_429d:
Func_006_42a7:
ldh a, [hWhoseTurn]
push af
- bank1call OpenPlayerDiscardPileScreen
+ bank1call OpenTurnHolderDiscardPileScreen
pop af
ldh [hWhoseTurn], a
ret
@@ -394,14 +394,14 @@ Func_006_42a7:
Func_006_42b1:
ldh a, [hWhoseTurn]
push af
- bank1call OpenOpponentDiscardPileScreen
+ bank1call OpenNonTurnHolderDiscardPileScreen
pop af
ldh [hWhoseTurn], a
ret
Data_006_42bb:
INCROM $182bb, $183bb
-
+
Func_006_43bb: ; 183bb (6:43bb)
xor a
ld [wcfe3], a
@@ -1509,17 +1509,17 @@ ClearMemory: ; (6:6787)
ret
; play different sfx by a.
-; if a is 0xff play sfx with 0x03,
-; else with 0x02.
-PlaySFXByA: ; (6:6794)
+; if a is 0xff play sfx with 0x03 (usually following a B press),
+; else with 0x02 (usually following an A press).
+PlayAcceptOrDeclineSFX: ; (6:6794)
push af
inc a
- jr z, .on_three
+ jr z, .sfx_decline
ld a, $02
- jr .on_two
-.on_three
+ jr .sfx_accept
+.sfx_decline
ld a, $03
-.on_two
+.sfx_accept
call PlaySFX
pop af
ret
@@ -1543,7 +1543,7 @@ InputPlayerName: ; (6:67a3)
call LoadSymbolsFont
lb de, $38, $bf
call SetupText
- call SetVram0xFF
+ call LoadTextCursorTile
ld a, $02
ld [wd009], a
call DrawNamingScreenBG
@@ -1568,7 +1568,7 @@ InputPlayerName: ; (6:67a3)
jr z, .else
; if pressed start button.
ld a, $01
- call PlaySFXByA
+ call PlayAcceptOrDeclineSFX
call Func_006_6a07
ld a, 6
ld [wNamingScreenCursorX], a
@@ -1605,7 +1605,7 @@ InputPlayerName: ; (6:67a3)
dec [hl]
call PrintPlayerNameFromInput
jr .loop
-
+
; it's called when naming(either player's or deck's) starts.
; a: maximum length of name(depending on whether player's or deck's).
; bc: position of name.
@@ -1648,7 +1648,7 @@ InitializeInputName:
dec b
jr nz, .loop
ld hl, wNamingScreenBuffer
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
ld a, c
ld [wNamingScreenBufferLength], a
ret
@@ -1896,7 +1896,7 @@ NamingScreen_CheckButtonState:
jr nz, .asm_006_69e5
ld a, $ff
.asm_006_69e5
- call PlaySFXByA
+ call PlayAcceptOrDeclineSFX
push af
call Func_006_6a23
pop af
@@ -1982,16 +1982,15 @@ Func_006_6a28:
pop af
ret
-SetVram0xFF:
- ld hl, v0Tiles0
+; load, to the first tile of v0Tiles0, the graphics for the
+; blinking black square used in name input screens.
+; for inputting full width text.
+LoadTextCursorTile:
+ ld hl, v0Tiles0 + $00 tiles
ld de, .data
ld b, 0
.loop
- ; copy data from de to hl
- ; for 0x10 bytes.
- ; and de has all of 0xff data,
- ; which means that it puts only 0xff.
- ld a, $10
+ ld a, TILE_SIZE
cp b
ret z
inc b
@@ -1999,8 +1998,9 @@ SetVram0xFF:
inc de
ld [hli], a
jr .loop
+
.data
-rept $10
+rept TILE_SIZE
db $ff
endr
@@ -2387,7 +2387,7 @@ InputDeckName: ; 1ad89 (6:6d89)
lb de, $38, $bf
call SetupText
- call FillVramWith0xF0
+ call LoadHalfWidthTextCursorTile
xor a
ld [wd009], a
@@ -2417,7 +2417,7 @@ InputDeckName: ; 1ad89 (6:6d89)
jr z, .on_start
ld a, $01
- call PlaySFXByA
+ call PlayAcceptOrDeclineSFX
call Func_006_6fa1
ld a, 6
@@ -2470,23 +2470,25 @@ InputDeckName: ; 1ad89 (6:6d89)
jp .loop
-; fill v0Tiles0 for 0x10 tiles
-; with 0xF0.
-FillVramWith0xF0:
- ld hl, v0Tiles0
+; load, to the first tile of v0Tiles0, the graphics for the
+; blinking black square used in name input screens.
+; for inputting half width text.
+LoadHalfWidthTextCursorTile:
+ ld hl, v0Tiles0 + $00 tiles
ld de, .data
ld b, 0
-.asm_006_6e3f
- ld a, $10
+.loop
+ ld a, TILE_SIZE
cp b
ret z
inc b
ld a, [de]
inc de
ld [hli], a
- jr .asm_006_6e3f
+ jr .loop
+
.data
-rept $10
+rept TILE_SIZE
db $f0
endr
@@ -2675,7 +2677,7 @@ Func_006_6efb:
jr nz, .asm_006_6f7f
ld a, $ff
.asm_006_6f7f
- call PlaySFXByA
+ call PlayAcceptOrDeclineSFX
push af
call Func_006_6fbd
pop af
diff --git a/src/engine/home.asm b/src/engine/home.asm
index cab683d..0101028 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -5675,7 +5675,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00)
pop hl
call CopyText
ld hl, wc000 + 3
- call GetTextSizeInTiles
+ call GetTextLengthInTiles
ld l, e
ld h, d
; white tile after the text
@@ -6771,14 +6771,14 @@ CaseHalfWidthLetter: ; 23b1 (0:23b1)
; iterates over text at hl until TX_END is found, and sets wFontWidth to
; FULL_WIDTH if the first character is TX_HALFWIDTH
; returns:
-; b = size of text in tiles
-; c = size of text in bytes
+; b = length of text in tiles
+; c = length of text in bytes
; a = -b
-GetTextSizeInTiles: ; 23c1 (0:23c1)
+GetTextLengthInTiles: ; 23c1 (0:23c1)
ld a, [hl]
cp TX_HALFWIDTH
jr nz, .full_width
- call GetTextSizeInHalfTiles
+ call GetTextLengthInHalfTiles
; return a = - ceil(b/2)
inc b
srl b
@@ -6792,10 +6792,10 @@ GetTextSizeInTiles: ; 23c1 (0:23c1)
; iterates over text at hl until TX_END is found
; returns:
-; b = size of text in half-tiles
-; c = size of text in bytes
+; b = length of text in half-tiles
+; c = length of text in bytes
; a = -b
-GetTextSizeInHalfTiles: ; 23d3 (0:23d3)
+GetTextLengthInHalfTiles: ; 23d3 (0:23d3)
push hl
push de
lb bc, $00, $00