From 5a5f5ececdde2c4c62bdee649d8b1d3edba96fed Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 21 Mar 2020 13:07:18 -0400 Subject: Miscellaneous fixes from #694 --- engine/battle_anims/anim_commands.asm | 4 ++-- engine/pokemon/stats_screen.asm | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 113e9df37..c0424088e 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -237,12 +237,12 @@ BattleAnim_ClearOAM: bit BATTLEANIM_KEEPSPRITES_F, a jr z, .delete - ; Instead of deleting the sprites, make them all use palette 0 (monochrome) + ; Instead of deleting the sprites, make them all use PAL_BATTLE_OB_ENEMY ld hl, wVirtualOAMSprite00Attributes ld c, NUM_SPRITE_OAM_STRUCTS .loop ld a, [hl] - and $ff ^ (PALETTE_MASK | VRAM_BANK_1) + and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0) ld [hli], a rept SPRITEOAMSTRUCT_LENGTH + -1 inc hl diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index cb066317d..ae7e71cf2 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -4,6 +4,8 @@ const BLUE_PAGE ; 3 NUM_STAT_PAGES EQU const_value + -1 +STAT_PAGE_MASK EQU %00000011 + BattleStatsScreenInit: ld a, [wLinkMode] cp LINK_MOBILE @@ -63,15 +65,15 @@ StatsScreenMain: ; ??? ld [wcf64], a ld a, [wcf64] - and %11111100 - or 1 + and $ff ^ STAT_PAGE_MASK + or PINK_PAGE ; first_page ld [wcf64], a .loop ld a, [wJumptableIndex] and $ff ^ (1 << 7) ld hl, StatsScreenPointerTable rst JumpTable - call StatsScreen_WaitAnim ; check for keys? + call StatsScreen_WaitAnim ld a, [wJumptableIndex] bit 7, a jr z, .loop @@ -83,13 +85,13 @@ StatsScreenMobile: ; ??? ld [wcf64], a ld a, [wcf64] - and %11111100 - or 1 + and $ff ^ STAT_PAGE_MASK + or PINK_PAGE ; first_page ld [wcf64], a .loop farcall Mobile_SetOverworldDelay ld a, [wJumptableIndex] - and $ff ^ (1 << 7) + and $7f ld hl, StatsScreenPointerTable rst JumpTable call StatsScreen_WaitAnim @@ -355,7 +357,7 @@ StatsScreen_JoypadAction: .set_page ld a, [wcf64] - and %11111100 + and $ff ^ STAT_PAGE_MASK or c ld [wcf64], a ld h, 4 @@ -759,7 +761,7 @@ StatsScreen_LoadGFX: jr z, .done cp $7f jr z, .done - and $80 + and CAUGHT_GENDER_MASK ld a, "♂" jr z, .got_gender ld a, "♀" -- cgit v1.2.3 From 6a6ba10315baf4b0092c6d952a2f0cb502b6ac8e Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 21 Mar 2020 14:01:05 -0400 Subject: rgbds supports 'X - 1' instead of 'X + -1' --- engine/battle_anims/anim_commands.asm | 2 +- engine/events/battle_tower/battle_tower.asm | 4 ++-- engine/events/bug_contest/judging.asm | 2 +- engine/events/celebi.asm | 2 +- engine/events/field_moves.asm | 2 +- engine/events/print_unown_2.asm | 4 ++-- engine/games/slot_machine.asm | 2 +- engine/gfx/pic_animation.asm | 2 +- engine/menus/options_menu.asm | 2 +- engine/movie/crystal_intro.asm | 6 +++--- engine/movie/evolution_animation.asm | 2 +- engine/movie/title.asm | 2 +- engine/pokemon/bills_pc.asm | 4 ++-- engine/pokemon/move_mon.asm | 4 ++-- engine/pokemon/search.asm | 2 +- engine/pokemon/stats_screen.asm | 2 +- 16 files changed, 22 insertions(+), 22 deletions(-) (limited to 'engine') diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index c0424088e..bbfc1240e 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -244,7 +244,7 @@ BattleAnim_ClearOAM: ld a, [hl] and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0) ld [hli], a -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 3e3bbb57f..9d10d7289 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -395,10 +395,10 @@ ValidateBTParty: ld a, [hl] and a x = $ff -rept ($ff + -NUM_POKEMON) +rept ($ff - NUM_POKEMON) jr z, .invalid cp x -x = x + -1 +x = x - 1 endr jr nz, .valid diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 9f8c0c5c2..9945f2031 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -211,7 +211,7 @@ DetermineContestWinners: CopyTempContestant: ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID -rept BUG_CONTESTANT_SIZE + -1 +rept BUG_CONTESTANT_SIZE - 1 ld a, [de] inc de ld [hli], a diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 2e497c86e..d53fa8589 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -57,7 +57,7 @@ CelebiShrineEvent: ld c, 4 .OAMloop: ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr inc a diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index c898c6690..6413840cc 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -383,7 +383,7 @@ FlyToAnim: ld c, 4 .OAMloop ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr inc a diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 77eb050a1..5dc7b1b94 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -98,10 +98,10 @@ RotateUnownFrontpic: gbprinterrect: MACRO y = 0 rept \1 -x = \1 * (\2 + -1) + y +x = \1 * (\2 - 1) + y rept \2 dw wGameboyPrinterRAM tile x -x = x + -\2 +x = x - \2 endr y = y + 1 endr diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index 2765dd870..eaf7999bd 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -261,7 +261,7 @@ Unreferenced_Function9282c: ld a, [hl] xor %00100000 ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index 8eff13ad1..fda39e5c6 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -538,7 +538,7 @@ PokeAnim_CopyBitmaskToBuffer: poke_anim_box: MACRO y = 7 rept \1 -x = 7 + -\1 +x = 7 - \1 rept \1 db x + y x = x + 1 diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index d1aa563f6..9a6b0fdc7 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -114,7 +114,7 @@ Options_TextSpeed: ld a, c ; right pressed cp OPT_TEXT_SPEED_SLOW jr c, .Increase - ld c, OPT_TEXT_SPEED_FAST + -1 + ld c, OPT_TEXT_SPEED_FAST - 1 .Increase: inc c diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm index eeab51062..9fbd67078 100644 --- a/engine/movie/crystal_intro.asm +++ b/engine/movie/crystal_intro.asm @@ -1796,16 +1796,16 @@ endr hue = 31 rept 8 RGB hue, hue, hue -hue = hue + -1 +hue = hue - 1 RGB hue, hue, hue -hue = hue + -2 +hue = hue - 2 endr .SlowFadePalettes: hue = 31 rept 16 RGB hue, hue, hue -hue = hue + -1 +hue = hue - 1 endr Intro_LoadTilemap: diff --git a/engine/movie/evolution_animation.asm b/engine/movie/evolution_animation.asm index ed500d1f8..0960fb3e7 100644 --- a/engine/movie/evolution_animation.asm +++ b/engine/movie/evolution_animation.asm @@ -339,7 +339,7 @@ EvolutionAnimation: ld a, [hl] or b ld [hli], a ; attributes -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 50c8721d0..dce02804f 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -356,7 +356,7 @@ AnimateTitleCrystal: ld a, [hl] add 2 ld [hli], a ; y -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index dd4977f1b..d3d7c9922 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1472,7 +1472,7 @@ BillsPC_UpdateSelectionCursor: inc hl ld [de], a ; y inc de -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 ld a, [hli] ld [de], a inc de @@ -1520,7 +1520,7 @@ BillsPC_UpdateInsertCursor: inc hl ld [de], a ; y inc de -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 ld a, [hli] ld [de], a inc de diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 8133e2671..bfd2f91f2 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -117,7 +117,7 @@ GeneratePartyMonStats: and a jr nz, .randomlygeneratemoves ld de, wEnemyMonMoves -rept NUM_MOVES + -1 +rept NUM_MOVES - 1 ld a, [de] inc de ld [hli], a @@ -128,7 +128,7 @@ endr .randomlygeneratemoves xor a -rept NUM_MOVES + -1 +rept NUM_MOVES - 1 ld [hli], a endr ld [hl], a diff --git a/engine/pokemon/search.asm b/engine/pokemon/search.asm index 2ea1beacf..bc3e6ae3b 100644 --- a/engine/pokemon/search.asm +++ b/engine/pokemon/search.asm @@ -216,7 +216,7 @@ CheckOwnMon: ld hl, wPlayerName -rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 +rept NAME_LENGTH_JAPANESE - 2 ; should be PLAYER_NAME_LENGTH - 2 ld a, [de] cp [hl] jr nz, .notfound diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index ae7e71cf2..62db2e851 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -2,7 +2,7 @@ const PINK_PAGE ; 1 const GREEN_PAGE ; 2 const BLUE_PAGE ; 3 -NUM_STAT_PAGES EQU const_value + -1 +NUM_STAT_PAGES EQU const_value - 1 STAT_PAGE_MASK EQU %00000011 -- cgit v1.2.3 From 0345e4fb0e3f39a038e9eced72380a5a1ab6694f Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 21 Mar 2020 17:50:44 -0400 Subject: Add suffixes to some constants to avoid ambiguity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `PSYCHIC` → `PSYCHIC_TYPE` (not the trainer `PSYCHIC_T` or the move `PSYCHIC_M`) - `BLACKBELT` → `BLACKBELT_I` (not the trainer `BLACKBELT_T`) - `CURSE_T` → `CURSE_TYPE` (not the move `CURSE`) - `TOWN_MAP_D` → `TOWN_MAP_POSTER` (not the item `TOWN_MAP`) This also uncovered a misidentified event: `EVENT_DECO_PLANT_4` → `EVENT_DECO_POSTER_1`. (There are three plants and four posters.) --- engine/battle/move_effects/conversion.asm | 4 ++-- engine/battle/move_effects/conversion2.asm | 2 +- engine/events/std_scripts.asm | 2 +- engine/items/item_effects.asm | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/battle/move_effects/conversion.asm b/engine/battle/move_effects/conversion.asm index eaa3d6c9c..b6081a6bd 100644 --- a/engine/battle/move_effects/conversion.asm +++ b/engine/battle/move_effects/conversion.asm @@ -46,7 +46,7 @@ BattleCommand_Conversion: ld a, [hl] cp -1 jr z, .fail - cp CURSE_T + cp CURSE_TYPE jr z, .next ld a, [de] cp [hl] @@ -75,7 +75,7 @@ BattleCommand_Conversion: ld a, [hl] cp -1 jr z, .loop3 - cp CURSE_T + cp CURSE_TYPE jr z, .loop3 ld a, [de] cp [hl] diff --git a/engine/battle/move_effects/conversion2.asm b/engine/battle/move_effects/conversion2.asm index 802b57b53..bc8667278 100644 --- a/engine/battle/move_effects/conversion2.asm +++ b/engine/battle/move_effects/conversion2.asm @@ -20,7 +20,7 @@ BattleCommand_Conversion2: call GetMoveAttr ld d, a pop hl - cp CURSE_T + cp CURSE_TYPE jr z, .failed call AnimateCurrentMove call BattleCommand_SwitchTurn diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index b7426caec..b3a0082e1 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -535,7 +535,7 @@ InitializeEventsScript: setevent EVENT_PLAYERS_HOUSE_2F_DOLL_2 setevent EVENT_PLAYERS_HOUSE_2F_BIG_DOLL setevent EVENT_DECO_BED_1 - setevent EVENT_DECO_PLANT_4 + setevent EVENT_DECO_POSTER_1 setevent EVENT_GOLDENROD_TRAIN_STATION_GENTLEMAN setevent EVENT_OLIVINE_GYM_JASMINE setevent EVENT_BLACKTHORN_CITY_GRAMPS_NOT_BLOCKING_DRAGONS_DEN diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 11928cd63..b92181d91 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -110,7 +110,7 @@ ItemEffects: dw NoEffect ; MYSTIC_WATER dw NoEffect ; TWISTEDSPOON dw NoEffect ; WHT_APRICORN - dw NoEffect ; BLACKBELT + dw NoEffect ; BLACKBELT_I dw NoEffect ; BLK_APRICORN dw NoEffect ; ITEM_64 dw NoEffect ; PNK_APRICORN -- cgit v1.2.3