aboutsummaryrefslogtreecommitdiffstats
path: root/engine
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2025-05-10 12:25:27 -0500
committerdannye <33dannye@gmail.com>2025-05-10 12:25:27 -0500
commit2c74f137fc42cf7eaffa0a6f9046e4aa89887f91 (patch)
treec52fc10a17597a1d04b63b79c6df78cc1b00de41 /engine
parentFix hardcoded address in VC patch (diff)
parentUse features new to RGBDS 0.9.2 (#506) (diff)
downloadpokeyellow-2c74f137fc42cf7eaffa0a6f9046e4aa89887f91.tar.gz
pokeyellow-2c74f137fc42cf7eaffa0a6f9046e4aa89887f91.tar.xz
pokeyellow-2c74f137fc42cf7eaffa0a6f9046e4aa89887f91.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/core.asm16
-rw-r--r--engine/battle/effects.asm2
-rw-r--r--engine/events/heal_party.asm2
-rw-r--r--engine/events/in_game_trades.asm29
-rw-r--r--engine/events/prize_menu.asm11
-rw-r--r--engine/gfx/mon_icons.asm12
-rw-r--r--engine/items/item_effects.asm10
-rw-r--r--engine/menus/start_sub_menus.asm2
-rw-r--r--engine/menus/text_box.asm2
-rw-r--r--engine/movie/hall_of_fame.asm2
-rw-r--r--engine/pokemon/status_screen.asm2
-rw-r--r--engine/slots/slot_machine.asm2
12 files changed, 53 insertions, 39 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 39e80e74..bfda1347 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2753,7 +2753,7 @@ ENDC
ld b, $0
add hl, bc
ld a, [hl]
- and $3f
+ and PP_MASK
jr z, .noPP
ld a, [wPlayerDisabledMove]
swap a
@@ -2885,7 +2885,7 @@ AnyMoveToSelect:
or [hl]
inc hl
or [hl]
- and $3f
+ and PP_MASK
ret nz
jr .noMovesLeft
.handleDisabledMove
@@ -3049,7 +3049,7 @@ PrintMenuItem:
ld hl, wBattleMonPP
add hl, bc
ld a, [hl]
- and $3f
+ and PP_MASK
ld [wBattleMenuCurrentPP], a
; print TYPE/<type> and <curPP>/<maxPP>
hlcoord 1, 9
@@ -4242,18 +4242,18 @@ CheckForDisobedience:
ld hl, wBattleMonPP
push hl
ld a, [hli]
- and $3f
+ and PP_MASK
ld b, a
ld a, [hli]
- and $3f
+ and PP_MASK
add b
ld b, a
ld a, [hli]
- and $3f
+ and PP_MASK
add b
ld b, a
ld a, [hl]
- and $3f
+ and PP_MASK
add b
pop hl
push af
@@ -4262,7 +4262,7 @@ CheckForDisobedience:
ld b, $0
add hl, bc
ld a, [hl]
- and $3f
+ and PP_MASK
ld b, a
pop af
cp b
diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm
index 28e78c3d..d7c7b9cb 100644
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -1388,7 +1388,7 @@ DisableEffect:
or [hl]
inc hl
or [hl]
- and $3f
+ and PP_MASK
pop hl ; wBattleMonPP or wEnemyMonPP
jr z, .moveMissedPopHL ; nothing to do if all moves have no PP left
add hl, bc
diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm
index 8bf162a7..e6551bcd 100644
--- a/engine/events/heal_party.asm
+++ b/engine/events/heal_party.asm
@@ -50,7 +50,7 @@ HealParty:
push bc
ld b, a
ld a, [hl]
- and $c0
+ and PP_UP_MASK
add b
ld [hl], a
pop bc
diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm
index 7ba5fe51..3671dba8 100644
--- a/engine/events/in_game_trades.asm
+++ b/engine/events/in_game_trades.asm
@@ -1,3 +1,12 @@
+; TradeTextPointers1-3 indexes
+ const_def
+ const TRADETEXT_WANNA_TRADE ; 0
+ const TRADETEXT_NO_TRADE ; 1
+ const TRADETEXT_WRONG_MON ; 2
+ const TRADETEXT_THANKS ; 3
+ const TRADETEXT_AFTER_TRADE ; 4
+DEF NUM_TRADE_TEXTS EQU const_value
+
DoInGameTradeDialogue:
; trigger the trade offer/action specified by wWhichTrade
call SaveScreenTilesToBuffer2
@@ -30,7 +39,7 @@ DoInGameTradeDialogue:
ld a, [wInGameTradeReceiveMonSpecies]
ld de, wInGameTradeReceiveMonName
call InGameTrade_GetMonName
- ld a, $4
+ ld a, TRADETEXT_AFTER_TRADE
ld [wInGameTradeTextPointerTableIndex], a
ld b, FLAG_TEST
call InGameTrade_FlagActionPredef
@@ -38,10 +47,10 @@ DoInGameTradeDialogue:
and a
jr nz, .printText
; if the trade hasn't been done yet
- ld a, $0
+ ld a, TRADETEXT_WANNA_TRADE
ld [wInGameTradeTextPointerTableIndex], a
call .printText
- ld a, $1
+ ld a, TRADETEXT_NO_TRADE
ld [wInGameTradeTextPointerTableIndex], a
call YesNoChoice
ld a, [wCurrentMenuItem]
@@ -87,13 +96,13 @@ InGameTrade_DoTrade:
push af
call InGameTrade_RestoreScreen
pop af
- ld a, $1
+ ld a, TRADETEXT_NO_TRADE
jp c, .tradeFailed ; jump if the player didn't select a pokemon
ld a, [wInGameTradeGiveMonSpecies]
ld b, a
ld a, [wCurPartySpecies]
cp b
- ld a, $2
+ ld a, TRADETEXT_WRONG_MON
jr nz, .tradeFailed ; jump if the selected mon's species is not the required one
ld a, [wWhichPokemon]
ld hl, wPartyMon1Level
@@ -131,7 +140,7 @@ InGameTrade_DoTrade:
call InGameTrade_RestoreScreen
farcall RedrawMapView
and a
- ld a, $3
+ ld a, TRADETEXT_THANKS
jr .tradeSucceeded
.tradeFailed
scf
@@ -254,30 +263,38 @@ InGameTrade_TrainerString:
InGameTradeTextPointers:
; entries correspond to TRADE_DIALOGSET_* constants
+ table_width 2
dw TradeTextPointers1
dw TradeTextPointers2
dw TradeTextPointers3
+ assert_table_length NUM_TRADE_DIALOGSETS
TradeTextPointers1:
+ table_width 2
dw WannaTrade1Text
dw NoTrade1Text
dw WrongMon1Text
dw Thanks1Text
dw AfterTrade1Text
+ assert_table_length NUM_TRADE_TEXTS
TradeTextPointers2:
+ table_width 2
dw WannaTrade2Text
dw NoTrade2Text
dw WrongMon2Text
dw Thanks2Text
dw AfterTrade2Text
+ assert_table_length NUM_TRADE_TEXTS
TradeTextPointers3:
+ table_width 2
dw WannaTrade3Text
dw NoTrade3Text
dw WrongMon3Text
dw Thanks3Text
dw AfterTrade3Text
+ assert_table_length NUM_TRADE_TEXTS
ConnectCableText:
text_far _ConnectCableText
diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm
index 4b2121f5..8701e351 100644
--- a/engine/events/prize_menu.asm
+++ b/engine/events/prize_menu.asm
@@ -125,18 +125,15 @@ GetPrizeMenuId:
; put prices on the right side of the textbox
ld de, wPrize1Price
hlcoord 13, 5
-; reg. c:
-; [low nybble] number of bytes
-; [bits 765 = %100] space-padding (not zero-padding)
- ld c, (1 << 7) | 2
+ ld c, 2 | LEADING_ZEROES
call PrintBCDNumber
ld de, wPrize2Price
hlcoord 13, 7
- ld c, (1 << 7) | 2
+ ld c, 2 | LEADING_ZEROES
call PrintBCDNumber
ld de, wPrize3Price
hlcoord 13, 9
- ld c, (1 << 7) | 2
+ ld c, 2 | LEADING_ZEROES
jp PrintBCDNumber
NoThanksText:
@@ -157,7 +154,7 @@ PrintPrizePrice:
call PlaceString
hlcoord 13, 1
ld de, wPlayerCoins
- ld c, %10000010
+ ld c, 2 | LEADING_ZEROES
call PrintBCDNumber
ret
diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm
index c82e00c0..4cc11284 100644
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -295,13 +295,13 @@ INCLUDE "data/pokemon/menu_icons.asm"
DEF INC_FRAME_1 EQUS "0, $20"
DEF INC_FRAME_2 EQUS "$20, $20"
-BugIconFrame1: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_1
-PlantIconFrame1: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_1
-BugIconFrame2: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_2
-PlantIconFrame2: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_2
-SnakeIconFrame1: INCBIN "gfx/icons/snake.2bpp", INC_FRAME_1
+BugIconFrame1: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_1
+PlantIconFrame1: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_1
+BugIconFrame2: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_2
+PlantIconFrame2: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_2
+SnakeIconFrame1: INCBIN "gfx/icons/snake.2bpp", INC_FRAME_1
QuadrupedIconFrame1: INCBIN "gfx/icons/quadruped.2bpp", INC_FRAME_1
-SnakeIconFrame2: INCBIN "gfx/icons/snake.2bpp", INC_FRAME_2
+SnakeIconFrame2: INCBIN "gfx/icons/snake.2bpp", INC_FRAME_2
QuadrupedIconFrame2: INCBIN "gfx/icons/quadruped.2bpp", INC_FRAME_2
TradeBubbleIconGFX: INCBIN "gfx/trade/bubble.2bpp"
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index de95b0c7..9802eb50 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -2301,7 +2301,7 @@ ItemUsePPRestore:
cp MAX_ETHER
jr z, .fullyRestorePP
ld a, [hl] ; move PP
- and %00111111 ; lower 6 bit bits store current PP
+ and PP_MASK
cp b ; does current PP equal max PP?
ret z ; if so, return
add 10 ; increase current PP by 10
@@ -2314,7 +2314,7 @@ ItemUsePPRestore:
ld b, a
.storeNewAmount
ld a, [hl] ; move PP
- and %11000000 ; PP Up counter bits
+ and PP_UP_MASK
add b
ld [hl], a
ret
@@ -2684,7 +2684,7 @@ RestoreBonusPP:
jr nz, .nextMove
.skipMenuItemIDCheck
ld a, [hl]
- and %11000000 ; have any PP Ups been used?
+ and PP_UP_MASK
call nz, AddBonusPP ; if so, add bonus PP
.nextMove
inc hl
@@ -2791,7 +2791,7 @@ GetMaxPP:
.addPPOffset
add hl, bc
ld a, [hl] ; a = current PP
- and %11000000 ; get PP Up count
+ and PP_UP_MASK
pop bc
or b ; place normal max PP in 6 lower bits of a
ASSERT wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP
@@ -2803,7 +2803,7 @@ GetMaxPP:
ld [wUsingPPUp], a
call AddBonusPP ; add bonus PP from PP Ups
ld a, [hl]
- and %00111111 ; mask out the PP Up count
+ and PP_MASK
ld [wMaxPP], a ; store max PP
ret
diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm
index d2b027f5..96a7da16 100644
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -570,7 +570,7 @@ DrawTrainerInfo:
call PlaceString
hlcoord 8, 4
ld de, wPlayerMoney
- ld c, $e3
+ ld c, 3 | LEADING_ZEROES | LEFT_ALIGN | MONEY_SIGN
call PrintBCDNumber
hlcoord 9, 6
ld de, wPlayTimeHours ; hours
diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm
index 43428f67..fe792274 100644
--- a/engine/menus/text_box.asm
+++ b/engine/menus/text_box.asm
@@ -138,7 +138,7 @@ DisplayMoneyBox:
call ClearScreenArea
hlcoord 12, 1
ld de, wPlayerMoney
- ld c, $a3
+ ld c, 3 | LEADING_ZEROES | MONEY_SIGN
call PrintBCDNumber
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm
index 670c8261..21848bb9 100644
--- a/engine/movie/hall_of_fame.asm
+++ b/engine/movie/hall_of_fame.asm
@@ -252,7 +252,7 @@ HoFDisplayPlayerStats:
call PlaceString
hlcoord 4, 10
ld de, wPlayerMoney
- ld c, $a3
+ ld c, 3 | LEADING_ZEROES | MONEY_SIGN
call PrintBCDNumber
ld hl, DexSeenOwnedText
call HoFPrintTextAndDelay
diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm
index d88ef8c1..1c9b2fc2 100644
--- a/engine/pokemon/status_screen.asm
+++ b/engine/pokemon/status_screen.asm
@@ -378,7 +378,7 @@ StatusScreen2:
ld bc, wPartyMon1PP - wPartyMon1Moves - 1
add hl, bc
ld a, [hl]
- and $3f
+ and PP_MASK
ld [wStatusScreenCurrentPP], a
ld h, d
ld l, e
diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm
index 9ad5aa6d..835ba1cf 100644
--- a/engine/slots/slot_machine.asm
+++ b/engine/slots/slot_machine.asm
@@ -648,7 +648,7 @@ SlotMachine_SubtractBetFromPlayerCoins:
SlotMachine_PrintCreditCoins:
hlcoord 5, 1
ld de, wPlayerCoins
- ld c, $2
+ ld c, 2
jp PrintBCDNumber
SlotMachine_PrintPayoutCoins: