From f0bf1dfeaeb56c48e83190e59caee4eca3c85c95 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 4 Feb 2025 08:29:14 +0100 Subject: Fix hardcoded address in Blue VC patch --- vc/pokeblue.patch.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vc/pokeblue.patch.template b/vc/pokeblue.patch.template index 0bd83a07..e497eddd 100644 --- a/vc/pokeblue.patch.template +++ b/vc/pokeblue.patch.template @@ -427,7 +427,7 @@ ConditionValueC = {dws_ R_CHAR O_CHAR C_CHAR K_CHAR [FPA 76 Begin@Reduce_move_anim_flashing_Explosion] Mode = 3 Type = 0 -Address = 0x78186 +Address = {hex @} MotionBEnable0 = 3 MotionBlur0 = 28 ConditionType = 0 -- cgit v1.3.1-sl0p From b460637b812f9829b69203f32e9a4f42a43070b6 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:07:17 -0500 Subject: Avoid using `EQUS` when `EQU` or `MACRO` will do (#496) --- engine/gfx/mon_icons.asm | 12 ++++++------ macros/coords.asm | 42 +++++++++++++++++++++++++++++++++--------- macros/scripts/maps.asm | 12 +++++++++--- macros/scripts/text.asm | 45 +++++++++++++++++++++++++++++++++++---------- 4 files changed, 83 insertions(+), 28 deletions(-) diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 24e9446e..49e789a5 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -283,13 +283,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/macros/coords.asm b/macros/coords.asm index 81388895..984073ed 100644 --- a/macros/coords.asm +++ b/macros/coords.asm @@ -11,9 +11,17 @@ MACRO validate_coords ENDC ENDM -DEF hlcoord EQUS "coord hl," -DEF bccoord EQUS "coord bc," -DEF decoord EQUS "coord de," +MACRO hlcoord + coord hl, \# +ENDM + +MACRO bccoord + coord bc, \# +ENDM + +MACRO decoord + coord de, \# +ENDM MACRO coord ; register, x, y[, origin] @@ -25,9 +33,17 @@ MACRO coord ENDC ENDM -DEF hlbgcoord EQUS "bgcoord hl," -DEF bcbgcoord EQUS "bgcoord bc," -DEF debgcoord EQUS "bgcoord de," +MACRO hlbgcoord + bgcoord hl, \# +ENDM + +MACRO bcbgcoord + bgcoord bc, \# +ENDM + +MACRO debgcoord + bgcoord de, \# +ENDM MACRO bgcoord ; register, x, y[, origin] @@ -39,9 +55,17 @@ MACRO bgcoord ENDC ENDM -DEF hlowcoord EQUS "owcoord hl," -DEF bcowcoord EQUS "owcoord bc," -DEF deowcoord EQUS "owcoord de," +MACRO hlowcoord + owcoord hl, \# +ENDM + +MACRO bcowcoord + owcoord bc, \# +ENDM + +MACRO deowcoord + owcoord de, \# +ENDM MACRO owcoord ; register, x, y, map width diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index b5799e64..2837d0c0 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -225,8 +225,14 @@ MACRO connection dw wOverworldMap + _win ENDM -DEF def_script_pointers EQUS "const_def" +MACRO def_script_pointers + const_def +ENDM -DEF def_text_pointers EQUS "const_def 1" +MACRO def_text_pointers + const_def 1 +ENDM -DEF object_const_def EQUS "const_def 1" +MACRO object_const_def + const_def 1 +ENDM diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index 418e839c..a848f587 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -1,13 +1,38 @@ -DEF text EQUS "db TX_START," ; Start writing text. -DEF next EQUS "db \"\"," ; Move a line down. -DEF line EQUS "db \"\"," ; Start writing at the bottom line. -DEF para EQUS "db \"\"," ; Start a new paragraph. -DEF cont EQUS "db \"\"," ; Scroll to the next line. -DEF done EQUS "db \"\"" ; End a text box. -DEF prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). - -DEF page EQUS "db \"\"," ; Start a new Pokédex page. -DEF dex EQUS "db \"\", \"@\"" ; End a Pokédex entry. +MACRO text + db TX_START, \# ; Start writing text +ENDM + +MACRO next + db "", \# ; Move a line down +ENDM + +MACRO line + db "", \# ; Start writing at the bottom line +ENDM + +MACRO para + db "", \# ; Start a new paragraph +ENDM + +MACRO cont + db "", \# ; Scroll to the next line +ENDM + +MACRO done + db "" ; End a text box +ENDM + +MACRO prompt + db "" ; Prompt the player to end a text box (initiating some other event) +ENDM + +MACRO page + db "", \# ; Start a new Pokédex page +ENDM + +MACRO dex + db "@" ; End a Pokédex entry +ENDM ; TextCommandJumpTable indexes (see home/text.asm) -- cgit v1.3.1-sl0p From a8e65bfda53254dfc21eb7555b53a9a2e20243fd Mon Sep 17 00:00:00 2001 From: mid-kid Date: Fri, 7 Mar 2025 16:17:50 +0100 Subject: Fix termux instructions to not use "sudo" --- INSTALL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 372337d0..3eb3b34b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -111,13 +111,13 @@ If you want to compile and install **rgbds** yourself instead, then follow the [ To install the software required for **pokered**: ```bash -sudo apt install make clang git sed +pkg install make clang git sed ``` To install **rgbds**: ```bash -sudo apt install rgbds +pkg install rgbds ``` If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. -- cgit v1.3.1-sl0p From 9383d36fe532adb9763193625e51dc4256b44518 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Fri, 7 Mar 2025 17:25:38 +0100 Subject: Use "command -v" instead of "which" The "which" command has been deprecated in debianutils, and while other distributions still ship it, "command -v" is in POSIX and implemented without external packages. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 08c4dd9b..e64c4254 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ pokeblue_vc_obj := $(rom_obj:.o=_blue_vc.o) ### Build tools -ifeq (,$(shell which sha1sum)) +ifeq (,$(shell command -v sha1sum 2>/dev/null)) SHA1 := shasum else SHA1 := sha1sum -- cgit v1.3.1-sl0p From 147914d179f29f0d5c08bad027040731e323ed92 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sat, 8 Mar 2025 11:16:42 -0500 Subject: Use constants for trade text indexes (#501) --- constants/script_constants.asm | 1 + engine/events/in_game_trades.asm | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 24ad93f2..8b59a6f6 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -38,6 +38,7 @@ DEF NUM_NPC_TRADES EQU const_value const TRADE_DIALOGSET_CASUAL const TRADE_DIALOGSET_EVOLUTION const TRADE_DIALOGSET_HAPPY +DEF NUM_TRADE_DIALOGSETS EQU const_value ; OaksAideScript results DEF OAKS_AIDE_BAG_FULL EQU $00 diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 228c6bf8..f69b829f 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 @@ -42,14 +51,15 @@ DoInGameTradeDialogue: predef FlagActionPredef ld a, c and a - ld a, $4 + ld a, TRADETEXT_AFTER_TRADE ld [wInGameTradeTextPointerTableIndex], a jr nz, .printText ; if the trade hasn't been done yet + ASSERT TRADETEXT_WANNA_TRADE == 0 xor a ld [wInGameTradeTextPointerTableIndex], a call .printText - ld a, $1 + ld a, TRADETEXT_NO_TRADE ld [wInGameTradeTextPointerTableIndex], a call YesNoChoice ld a, [wCurrentMenuItem] @@ -95,13 +105,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 @@ -142,7 +152,7 @@ InGameTrade_DoTrade: call InGameTrade_RestoreScreen farcall RedrawMapView and a - ld a, $3 + ld a, TRADETEXT_THANKS jr .tradeSucceeded .tradeFailed scf @@ -234,30 +244,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 -- cgit v1.3.1-sl0p From ca7b62fec33cc2f37def74d504ebc1588f81ac01 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Sat, 8 Mar 2025 17:19:17 +0100 Subject: Correct `vc_patch` length (#499) --- data/text/text_4.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/text/text_4.asm b/data/text/text_4.asm index f1c73a88..28373f13 100644 --- a/data/text/text_4.asm +++ b/data/text/text_4.asm @@ -216,7 +216,7 @@ IF DEF(_RED_VC) || DEF(_BLUE_VC) text "Please come again!" done text_start - text "sed because of" + db "osed because of" cont "inactivity." ELSE text "The link has been" -- cgit v1.3.1-sl0p From cfbd67a9f5d3469a616f83e33446d2e10b25f559 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sat, 8 Mar 2025 11:23:33 -0500 Subject: Support `<` and `>` prefixes for high and low bytes in VC patch templates (#502) --- tools/make_patch.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/make_patch.c b/tools/make_patch.c index d96bf216..9682af39 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -183,6 +183,16 @@ int parse_arg_value(const char *arg, bool absolute, const struct Symbol *symbols return parse_number(arg, 0); } + // Symbols may take the low or high part + enum { SYM_WHOLE, SYM_LOW, SYM_HIGH } part = SYM_WHOLE; + if (arg[0] == '<') { + part = SYM_LOW; + arg++; + } else if (arg[0] == '>') { + part = SYM_HIGH; + arg++; + } + // Symbols evaluate to their offset or address, plus an optional offset mod int offset_mod = 0; char *plus = strchr(arg, '+'); @@ -190,9 +200,13 @@ int parse_arg_value(const char *arg, bool absolute, const struct Symbol *symbols offset_mod = parse_number(plus, 0); *plus = '\0'; } + + // Symbols evaluate to their offset or address const char *sym_name = !strcmp(arg, "@") ? patch_name : arg; // "@" is the current patch label const struct Symbol *symbol = symbol_find(symbols, sym_name); - return (absolute ? symbol->offset : symbol->address) + offset_mod; + + int value = (absolute ? symbol->offset : symbol->address) + offset_mod; + return part == SYM_LOW ? value & 0xff : part == SYM_HIGH ? value >> 8 : value; } void interpret_command(char *command, const struct Symbol *current_hook, const struct Symbol *symbols, struct Buffer *patches, FILE *restrict new_rom, FILE *restrict orig_rom, FILE *restrict output) { @@ -344,6 +358,12 @@ struct Buffer *process_template(const char *template_filename, const char *patch // The ROM checksum will always differ buffer_append(patches, &(struct Patch){0x14e, 2}); + // The Stadium data (see stadium.c) will always differ + unsigned int rom_size = (unsigned int)xfsize("", orig_rom); + if (rom_size == 128 * 0x4000) { + unsigned int stadium_size = 24 + 6 + 2 + 128 * 2 * 2; + buffer_append(patches, &(struct Patch){rom_size - stadium_size, stadium_size}); + } // Fill in the template const struct Symbol *current_hook = NULL; @@ -413,7 +433,7 @@ struct Buffer *process_template(const char *template_filename, const char *patch int compare_patch(const void *patch1, const void *patch2) { unsigned int offset1 = ((const struct Patch *)patch1)->offset; unsigned int offset2 = ((const struct Patch *)patch2)->offset; - return offset1 > offset2 ? 1 : offset1 < offset2 ? -1 : 0; + return (offset1 > offset2) - (offset1 < offset2); } bool verify_completeness(FILE *restrict orig_rom, FILE *restrict new_rom, struct Buffer *patches) { -- cgit v1.3.1-sl0p From 18df084f92fdc7e8d144df0a7a653b92ea1edbe3 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 11 Mar 2025 11:30:03 -0400 Subject: Remove GSC-only Stadium data handling from make_patch.c --- tools/make_patch.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/make_patch.c b/tools/make_patch.c index 9682af39..82b018fd 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -358,12 +358,6 @@ struct Buffer *process_template(const char *template_filename, const char *patch // The ROM checksum will always differ buffer_append(patches, &(struct Patch){0x14e, 2}); - // The Stadium data (see stadium.c) will always differ - unsigned int rom_size = (unsigned int)xfsize("", orig_rom); - if (rom_size == 128 * 0x4000) { - unsigned int stadium_size = 24 + 6 + 2 + 128 * 2 * 2; - buffer_append(patches, &(struct Patch){rom_size - stadium_size, stadium_size}); - } // Fill in the template const struct Symbol *current_hook = NULL; -- cgit v1.3.1-sl0p From e1b7b8af0a431f4624fc668a58b535a8be438d72 Mon Sep 17 00:00:00 2001 From: edave64 Date: Wed, 2 Apr 2025 16:49:15 +0200 Subject: Use constants for PP masks instead of magic numbers (#504) --- constants/pokemon_data_constants.asm | 4 ++++ engine/battle/core.asm | 16 ++++++++-------- engine/battle/effects.asm | 2 +- engine/events/heal_party.asm | 2 +- engine/items/item_effects.asm | 10 +++++----- engine/pokemon/status_screen.asm | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 5cc2d344..e174f78d 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -98,3 +98,7 @@ DEF NUM_GROWTH_RATES EQU const_value ; wild data (see data/wild/maps/*.asm) DEF NUM_WILDMONS EQU 10 DEF WILDDATA_LENGTH EQU 1 + NUM_WILDMONS * 2 + +; PP in box_struct (see macros/ram.asm) +DEF PP_UP_MASK EQU %11000000 ; number of PP Up used +DEF PP_MASK EQU %00111111 ; currently remaining PP diff --git a/engine/battle/core.asm b/engine/battle/core.asm index f304af10..4fe7880f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2644,7 +2644,7 @@ SelectMenuItem: ld b, $0 add hl, bc ld a, [hl] - and $3f + and PP_MASK jr z, .noPP ld a, [wPlayerDisabledMove] swap a @@ -2724,7 +2724,7 @@ AnyMoveToSelect: or [hl] inc hl or [hl] - and $3f + and PP_MASK ret nz jr .noMovesLeft .handleDisabledMove @@ -2878,7 +2878,7 @@ PrintMenuItem: ld hl, wBattleMonPP add hl, bc ld a, [hl] - and $3f + and PP_MASK ld [wBattleMenuCurrentPP], a ; print TYPE/ and / hlcoord 1, 9 @@ -4071,18 +4071,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 @@ -4091,7 +4091,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 439e41e2..5782a3f0 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1332,7 +1332,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/items/item_effects.asm b/engine/items/item_effects.asm index 162e79a7..98f1b066 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -2058,7 +2058,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 @@ -2071,7 +2071,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 @@ -2403,7 +2403,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 @@ -2509,7 +2509,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 @@ -2521,7 +2521,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/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 447db8fd..0649949c 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -364,7 +364,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 -- cgit v1.3.1-sl0p From cf73d6ee0f1a9cf1e0886fc239c140ad9d761555 Mon Sep 17 00:00:00 2001 From: SatoMew Date: Wed, 9 Apr 2025 04:17:12 +0100 Subject: Further improve NPC trade labels and comments (#493) --- data/events/trades.asm | 7 +++++-- engine/events/evolve_trade.asm | 34 +++++++++------------------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/data/events/trades.asm b/data/events/trades.asm index f4963bde..e02177d5 100644 --- a/data/events/trades.asm +++ b/data/events/trades.asm @@ -4,8 +4,11 @@ TradeMons: ; give mon, get mon, dialog id, nickname ; The two instances of TRADE_DIALOGSET_EVOLUTION are a leftover ; from the Japanese Blue trades, which used species that evolve. - ; Japanese Red and Green used TRADE_DIALOGSET_CASUAL, and had - ; the same species as English Red and Blue. + ; TRADE_DIALOGSET_EVOLUTION did not refer to evolution in Japanese + ; Red/Green. Japanese Blue changed _AfterTrade2Text to say your Pokémon + ; "went and evolved" and also changed the trades to match. English + ; Red/Blue uses the original JP Red/Green trades but with the JP Blue + ; post-trade text. db NIDORINO, NIDORINA, TRADE_DIALOGSET_CASUAL, "TERRY@@@@@@" db ABRA, MR_MIME, TRADE_DIALOGSET_CASUAL, "MARCEL@@@@@" db BUTTERFREE, BEEDRILL, TRADE_DIALOGSET_HAPPY, "CHIKUCHIKU@" ; unused diff --git a/engine/events/evolve_trade.asm b/engine/events/evolve_trade.asm index 8daf2b05..8ec7ad5c 100644 --- a/engine/events/evolve_trade.asm +++ b/engine/events/evolve_trade.asm @@ -1,36 +1,20 @@ InGameTrade_CheckForTradeEvo: -; Verify the TradeMon's species name before -; attempting to initiate a trade evolution. - -; The names of the trade evolutions in Blue (JP) -; are checked. In that version, TradeMons that -; can evolve are Graveler and Haunter. - -; In localization, this check was translated -; before monster names were finalized. -; Then, Haunter's name was "Spectre". -; Since its name no longer starts with -; "SP", it is prevented from evolving. - -; This may have been why Red/Green's trades -; were used instead, where none can evolve. - -; This was fixed in Yellow. - +; In Japanese Blue, TradeMons include a Graveler and a Haunter, +; both of which have Japanese names that start with "ゴ", +; which is what this routine originally checked in that game. +; For English Red and Blue, this routine was adjusted for +; Graveler's English name and Haunter's early English name "Spectre". +; The final release replaced Graveler and Haunter in TradeMons. ld a, [wInGameTradeReceiveMonName] - - ; GRAVELER - cp "G" - jr z, .ok - + cp "G" ; GRAVELER + jr z, .nameMatched ; "SPECTRE" (HAUNTER) cp "S" ret nz ld a, [wInGameTradeReceiveMonName + 1] cp "P" ret nz - -.ok +.nameMatched ld a, [wPartyCount] dec a ld [wWhichPokemon], a -- cgit v1.3.1-sl0p From 0ecc36c83a6bf3ecfee45e9f62afc3ebfb97b024 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Wed, 9 Apr 2025 05:17:32 +0200 Subject: Use constants in `PrintBCDNumber` calls (#503) --- constants/text_constants.asm | 2 +- engine/events/prize_menu.asm | 11 ++++------- engine/menus/start_sub_menus.asm | 2 +- engine/menus/text_box.asm | 2 +- engine/movie/hall_of_fame.asm | 2 +- engine/slots/slot_machine.asm | 2 +- home/list_menu.asm | 4 ++-- scripts/GameCorner.asm | 2 +- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 5943457b..d4e259fe 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -2,7 +2,7 @@ DEF NAME_LENGTH EQU 11 DEF ITEM_NAME_LENGTH EQU 13 DEF NAME_BUFFER_LENGTH EQU 20 -; PrintNumber +; PrintNumber, PrintBCDNumber const_def 5 const BIT_MONEY_SIGN ; 5 const BIT_LEFT_ALIGN ; 6 diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index f2b24a3f..0e78653b 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -126,18 +126,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 INCLUDE "data/events/prizes.asm" @@ -156,7 +153,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/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 7b0455d0..a45dfc79 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -552,7 +552,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 1c078693..c21f8e6f 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -139,7 +139,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 aebe65f0..231f3369 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -237,7 +237,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/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 48cf27de..ac6e642f 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -645,7 +645,7 @@ SlotMachine_SubtractBetFromPlayerCoins: SlotMachine_PrintCreditCoins: hlcoord 5, 1 ld de, wPlayerCoins - ld c, $2 + ld c, 2 jp PrintBCDNumber SlotMachine_PrintPayoutCoins: diff --git a/home/list_menu.asm b/home/list_menu.asm index 646e7b7f..aae7caad 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -295,7 +295,7 @@ DisplayChooseQuantityMenu:: ld de, SpacesBetweenQuantityAndPriceText call PlaceString ld de, hMoney ; total price - ld c, $a3 + ld c, 3 | LEADING_ZEROES | MONEY_SIGN call PrintBCDNumber hlcoord 9, 10 .printQuantity @@ -420,7 +420,7 @@ PrintListMenuEntries:: pop hl ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right add hl, bc - ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes + ld c, 3 | LEADING_ZEROES | MONEY_SIGN call PrintBCDNumber .skipPrintingItemPrice ld a, [wListMenuID] diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index cac3170c..f95431d1 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -511,7 +511,7 @@ GameCornerDrawCoinBox: call PlaceString hlcoord 15, 5 ld de, wPlayerCoins - ld c, $82 + ld c, 2 | LEADING_ZEROES call PrintBCDNumber ld hl, wStatusFlags5 res BIT_NO_TEXT_DELAY, [hl] -- cgit v1.3.1-sl0p From d47f74ee1fed608f902dbc0fd51634dd7bafc6e4 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sun, 20 Apr 2025 10:39:32 -0400 Subject: Rename `Green1/2/3` to `Rival1/2/3` for consistency --- data/trainers/parties.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/trainers/parties.asm b/data/trainers/parties.asm index cf5eb151..fd5d6a3d 100644 --- a/data/trainers/parties.asm +++ b/data/trainers/parties.asm @@ -24,7 +24,7 @@ TrainerDataPointers: dw TamerData dw BirdKeeperData dw BlackbeltData - dw Green1Data + dw Rival1Data dw ProfOakData dw ChiefData dw ScientistData @@ -41,8 +41,8 @@ TrainerDataPointers: dw BlaineData dw SabrinaData dw GentlemanData - dw Green2Data - dw Green3Data + dw Rival2Data + dw Rival3Data dw LoreleiData dw ChannelerData dw AgathaData @@ -484,7 +484,7 @@ BlackbeltData: ; Victory Road 2F db 43, MACHOKE, MACHOP, MACHOKE, 0 -Green1Data: +Rival1Data: db 5, SQUIRTLE, 0 db 5, BULBASAUR, 0 db 5, CHARMANDER, 0 @@ -672,7 +672,7 @@ GentlemanData: ; SS Anne 2F Rooms db 17, GROWLITHE, PONYTA, 0 -Green2Data: +Rival2Data: ; SS Anne 2F db $FF, 19, PIDGEOTTO, 16, RATICATE, 18, KADABRA, 20, WARTORTLE, 0 db $FF, 19, PIDGEOTTO, 16, RATICATE, 18, KADABRA, 20, IVYSAUR, 0 @@ -690,7 +690,7 @@ Green2Data: db $FF, 47, PIDGEOT, 45, RHYHORN, 45, GYARADOS, 47, GROWLITHE, 50, ALAKAZAM, 53, VENUSAUR, 0 db $FF, 47, PIDGEOT, 45, RHYHORN, 45, EXEGGCUTE, 47, GYARADOS, 50, ALAKAZAM, 53, CHARIZARD, 0 -Green3Data: +Rival3Data: db $FF, 61, PIDGEOT, 59, ALAKAZAM, 61, RHYDON, 61, ARCANINE, 63, EXEGGUTOR, 65, BLASTOISE, 0 db $FF, 61, PIDGEOT, 59, ALAKAZAM, 61, RHYDON, 61, GYARADOS, 63, ARCANINE, 65, VENUSAUR, 0 db $FF, 61, PIDGEOT, 59, ALAKAZAM, 61, RHYDON, 61, EXEGGUTOR, 63, GYARADOS, 65, CHARIZARD, 0 -- cgit v1.3.1-sl0p From d7de1595c0a270dbee1efccae790c6992e514ccb Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Fri, 9 May 2025 18:47:29 -0400 Subject: Fix sprite data comment (#507) Reduces confusion if someone edits this file since the wrong byte was commented --- engine/overworld/turn_sprite.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/overworld/turn_sprite.asm b/engine/overworld/turn_sprite.asm index 7b34a03a..17fbaaa2 100644 --- a/engine/overworld/turn_sprite.asm +++ b/engine/overworld/turn_sprite.asm @@ -12,8 +12,8 @@ UpdateSpriteFacingOffsetAndDelayMovement:: ld a, [hld] ; x#SPRITESTATEDATA1_FACINGDIRECTION ld b, a xor a - ld [hld], a - ld [hl], a ; x#SPRITESTATEDATA1_ANIMFRAMECOUNTER + ld [hld], a ; x#SPRITESTATEDATA1_ANIMFRAMECOUNTER + ld [hl], a ; x#SPRITESTATEDATA1_INTRAANIMFRAMECOUNTER ldh a, [hCurrentSpriteOffset] add SPRITESTATEDATA1_IMAGEINDEX ld l, a -- cgit v1.3.1-sl0p From 617a729b0f21b542e80d8f45983d972f4c9d6ca2 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sat, 10 May 2025 12:47:40 -0400 Subject: Use features new to RGBDS 0.9.2 (#506) --- .github/workflows/main.yml | 2 +- INSTALL.md | 20 ++++++++++---------- macros/asserts.asm | 2 +- rgbdscheck.asm | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55ec218d..4f1e352f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@master with: path: rgbds - ref: v0.9.0 + ref: v0.9.2 repository: gbdev/rgbds - name: Install rgbds diff --git a/INSTALL.md b/INSTALL.md index 3eb3b34b..047dc211 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -42,9 +42,9 @@ Run setup and leave the default settings. At the "**Select Packages**" step, cho Double click on the text that says "**Skip**" next to each package to select the most recent version to install. -Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.9.0**. +Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.9.2**. -**Note:** If you already have an installed rgbds older than 0.9.0, you will need to update to 0.9.0. Ignore this if you have never installed rgbds before. If a version newer than 0.9.0 does not work, try downloading 0.9.0. +**Note:** If you already have an installed rgbds older than 0.9.2, you will need to update to 0.9.2. Ignore this if you have never installed rgbds before. If a version newer than 0.9.2 does not work, try downloading 0.9.2. Now open the **Cygwin terminal** and enter the following commands. @@ -67,7 +67,7 @@ Install [**Homebrew**](https://brew.sh/). Follow the official instructions. Open **Terminal** and prepare to enter commands. -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.9.0**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.9.2**. Now you're ready to [build **pokered**](#build-pokered). @@ -84,7 +84,7 @@ To install the software required for **pokered**: sudo apt-get install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### OpenSUSE @@ -94,7 +94,7 @@ To install the software required for **pokered**: sudo zypper install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### Arch Linux @@ -104,7 +104,7 @@ To install the software required for **pokered**: sudo pacman -S make gcc git rgbds ``` -If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### Termux @@ -120,7 +120,7 @@ To install **rgbds**: pkg install rgbds ``` -If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### Other distros @@ -131,7 +131,7 @@ If your distro is not listed here, try to find the required software in its repo - `git` - `rgbds` -If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. Now you're ready to [build **pokered**](#build-pokered). @@ -153,8 +153,8 @@ make ### Build with a local rgbds version -If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.9.0 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.9.0/`. Then specify it when you run `make`: +If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.9.2 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.9.2/`. Then specify it when you run `make`: ```bash -make RGBDS=rgbds-0.9.0/ +make RGBDS=rgbds-0.9.2/ ``` diff --git a/macros/asserts.asm b/macros/asserts.asm index 7fb7f96b..402d97dd 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -44,7 +44,7 @@ MACRO list_start ENDM MACRO li - ASSERT !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) + ASSERT STRFIND(\1, "@") == -1, STRCAT("String terminator \"@\" in list entry: ", \1) db \1, "@" DEF list_index += 1 ENDM diff --git a/rgbdscheck.asm b/rgbdscheck.asm index 7cc7b0d0..9b215d5d 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,6 +1,6 @@ IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__) - fail "pokered requires rgbds v0.9.0 or newer." + fail "pokered requires rgbds v0.9.2 or newer." ENDC -IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 9 - fail "pokered requires rgbds v0.9.0 or newer." +IF __RGBDS_MAJOR__ == 0 && (__RGBDS_MINOR__ < 9 || (__RGBDS_MINOR__ == 9 && __RGBDS_PATCH__ < 2)) + fail "pokered requires rgbds v0.9.2 or newer." ENDC -- cgit v1.3.1-sl0p