From b272c0c3754012f83129c23c2c546013cd1e80ef Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 Jan 2016 12:25:12 -0500 Subject: [PATCH] Fix marts using hard-coded bank number --- .gitattributes | 12 +- audio/engine.asm | 1 - battle/objects/functions.asm | 8 +- constants/sfx_constants.asm | 414 +++++++++++------------ constants/tilemap_constants.asm | 2 +- engine/battle_start.asm | 31 +- engine/events_3.asm | 2 +- engine/mart.asm | 4 +- engine/namingscreen.asm | 2 +- engine/player_movement.asm | 2 +- extras | 2 +- home.asm | 12 +- items/item_effects.asm | 4 +- main.asm | 564 +------------------------------- maps/KrissHouse1F.asm | 2 +- sram.asm | 2 +- wram.asm | 46 +-- 17 files changed, 286 insertions(+), 824 deletions(-) diff --git a/.gitattributes b/.gitattributes index f84c0ae6a..c0197ac4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,10 +2,10 @@ * -text # hexdump binary files -*.png diff=hex -*.lz diff=hex -*.2bpp diff=hex -*.1bpp diff=hex -*.bin diff=hex -*.blk diff=hex +*.png binary diff=hex +*.lz binary diff=hex +*.2bpp binary diff=hex +*.1bpp binary diff=hex +*.bin binary diff=hex +*.blk binary diff=hex diff --git a/audio/engine.asm b/audio/engine.asm index 44bdfcc7c..ad03c16a5 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -2260,7 +2260,6 @@ GetFrequency: ; e8a5d add hl, bc ld a, [hl] and $f ; lo nybble - ; ld l, a ; ok ld d, 0 ld h, d diff --git a/battle/objects/functions.asm b/battle/objects/functions.asm index 7c1aa3764..474b332ef 100755 --- a/battle/objects/functions.asm +++ b/battle/objects/functions.asm @@ -274,7 +274,7 @@ BattleAnimFunction_12: ; cd15c (33:515c) dw .ten dw .eleven .zero - call GetBallAnimFunction + call GetBallAnimPal call BattleAnim_IncAnonJumptableIndex ret @@ -342,7 +342,7 @@ BattleAnimFunction_12: ; cd15c (33:515c) ret .seven - call GetBallAnimFunction + call GetBallAnimPal ld a, $a call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex @@ -382,7 +382,7 @@ BattleAnimFunction_13: ; cd212 (33:5212) dw .one dw .two .zero - call GetBallAnimFunction + call GetBallAnimPal call BattleAnim_IncAnonJumptableIndex ret @@ -415,7 +415,7 @@ BattleAnimFunction_13: ; cd212 (33:5212) call DeinitBattleAnimation ret -GetBallAnimFunction: ; cd249 (33:5249) +GetBallAnimPal: ; cd249 (33:5249) ld hl, .balls ld a, [rSVBK] push af diff --git a/constants/sfx_constants.asm b/constants/sfx_constants.asm index d8567542e..65abfc3ca 100644 --- a/constants/sfx_constants.asm +++ b/constants/sfx_constants.asm @@ -1,210 +1,210 @@ const_def - const SFX_DEX_FANFARE_50_79 - const SFX_ITEM - const SFX_CAUGHT_MON - const SFX_POKEBALLS_PLACED_ON_TABLE - const SFX_POTION - const SFX_FULL_HEAL - const SFX_MENU - const SFX_READ_TEXT - const SFX_READ_TEXT_2 - const SFX_DEX_FANFARE_20_49 - const SFX_DEX_FANFARE_80_109 - const SFX_POISON - const SFX_GOT_SAFARI_BALLS - const SFX_BOOT_PC - const SFX_SHUT_DOWN_PC - const SFX_CHOOSE_PC_OPTION - const SFX_ESCAPE_ROPE - const SFX_PUSH_BUTTON - const SFX_SECOND_PART_OF_ITEMFINDER - const SFX_WARP_TO - const SFX_WARP_FROM - const SFX_CHANGE_DEX_MODE - const SFX_JUMP_OVER_LEDGE - const SFX_GRASS_RUSTLE - const SFX_FLY - const SFX_WRONG - const SFX_SQUEAK - const SFX_STRENGTH - const SFX_BOAT - const SFX_WALL_OPEN - const SFX_PLACE_PUZZLE_PIECE_DOWN - const SFX_ENTER_DOOR - const SFX_SWITCH_POKEMON - const SFX_TALLY - const SFX_TRANSACTION - const SFX_EXIT_BUILDING - const SFX_BUMP - const SFX_SAVE - const SFX_POKEFLUTE - const SFX_ELEVATOR_END - const SFX_THROW_BALL - const SFX_BALL_POOF - const SFX_FAINT - const SFX_RUN - const SFX_SLOT_MACHINE_START - const SFX_FANFARE - const SFX_PECK - const SFX_KINESIS - const SFX_LICK - const SFX_POUND - const SFX_MOVE_PUZZLE_PIECE - const SFX_COMET_PUNCH - const SFX_MEGA_PUNCH - const SFX_SCRATCH - const SFX_VICEGRIP - const SFX_RAZOR_WIND - const SFX_CUT - const SFX_WING_ATTACK - const SFX_WHIRLWIND - const SFX_BIND - const SFX_VINE_WHIP - const SFX_DOUBLE_KICK - const SFX_MEGA_KICK - const SFX_HEADBUTT - const SFX_HORN_ATTACK - const SFX_TACKLE - const SFX_POISON_STING - const SFX_POWDER - const SFX_DOUBLESLAP - const SFX_BITE - const SFX_JUMP_KICK - const SFX_STOMP - const SFX_TAIL_WHIP - const SFX_KARATE_CHOP - const SFX_SUBMISSION - const SFX_WATER_GUN - const SFX_SWORDS_DANCE - const SFX_THUNDER - const SFX_SUPERSONIC - const SFX_LEER - const SFX_EMBER - const SFX_BUBBLEBEAM - const SFX_HYDRO_PUMP - const SFX_SURF - const SFX_PSYBEAM - const SFX_CHARGE - const SFX_THUNDERSHOCK - const SFX_PSYCHIC - const SFX_SCREECH - const SFX_BONE_CLUB - const SFX_SHARPEN - const SFX_EGG_BOMB - const SFX_SING - const SFX_HYPER_BEAM - const SFX_SHINE - const SFX_UNKNOWN_5F - const SFX_UNKNOWN_60 - const SFX_UNKNOWN_61 - const SFX_SWITCH_POCKETS - const SFX_UNKNOWN_63 - const SFX_BURN - const SFX_TITLE_SCREEN_ENTRANCE - const SFX_UNKNOWN_66 - const SFX_GET_COIN_FROM_SLOTS - const SFX_PAY_DAY - const SFX_METRONOME - const SFX_CALL - const SFX_HANG_UP - const SFX_NO_SIGNAL - const SFX_SANDSTORM - const SFX_ELEVATOR - const SFX_PROTECT - const SFX_SKETCH - const SFX_RAIN_DANCE - const SFX_AEROBLAST - const SFX_SPARK - const SFX_CURSE - const SFX_RAGE - const SFX_THIEF - const SFX_THIEF_2 - const SFX_SPIDER_WEB - const SFX_MIND_READER - const SFX_NIGHTMARE - const SFX_SNORE - const SFX_SWEET_KISS - const SFX_SWEET_KISS_2 - const SFX_BELLY_DRUM - const SFX_UNKNOWN_7F - const SFX_SLUDGE_BOMB - const SFX_FORESIGHT - const SFX_SPITE - const SFX_OUTRAGE - const SFX_PERISH_SONG - const SFX_GIGA_DRAIN - const SFX_ATTRACT - const SFX_KINESIS_2 - const SFX_ZAP_CANNON - const SFX_MEAN_LOOK - const SFX_HEAL_BELL - const SFX_RETURN - const SFX_EXP_BAR - const SFX_MILK_DRINK - const SFX_PRESENT - const SFX_MORNING_SUN - const SFX_LEVEL_UP - const SFX_KEY_ITEM - const SFX_FANFARE_2 - const SFX_REGISTER_PHONE_NUMBER - const SFX_3RD_PLACE - const SFX_GET_EGG_FROM_DAYCARE_MAN - const SFX_GET_EGG_FROM_DAYCARE_LADY - const SFX_MOVE_DELETED - const SFX_2ND_PLACE - const SFX_1ST_PLACE - const SFX_CHOOSE_A_CARD - const SFX_GET_TM - const SFX_GET_BADGE - const SFX_QUIT_SLOTS - const SFX_EGG_CRACK - const SFX_DEX_FANFARE_LESS_THAN_20 - const SFX_DEX_FANFARE_140_169 - const SFX_DEX_FANFARE_170_199 - const SFX_DEX_FANFARE_200_229 - const SFX_DEX_FANFARE_230_PLUS - const SFX_EVOLVED - const SFX_MASTER_BALL - const SFX_EGG_HATCH - const SFX_GS_INTRO_CHARIZARD_FIREBALL - const SFX_GS_INTRO_POKEMON_APPEARS - const SFX_FLASH - const SFX_GAME_FREAK_LOGO_GS - const SFX_NOT_VERY_EFFECTIVE - const SFX_DAMAGE - const SFX_SUPER_EFFECTIVE - const SFX_BALL_BOUNCE - const SFX_MOONLIGHT - const SFX_ENCORE - const SFX_BEAT_UP - const SFX_BATON_PASS - const SFX_BALL_WIGGLE - const SFX_SWEET_SCENT - const SFX_SWEET_SCENT_2 - const SFX_HIT_END_OF_EXP_BAR - const SFX_GIVE_TRADEMON - const SFX_GET_TRADEMON - const SFX_TRAIN_ARRIVED - const SFX_STOP_SLOT - const SFX_2_BOOPS - const SFX_GLASS_TING - const SFX_GLASS_TING_2 + const SFX_DEX_FANFARE_50_79 ; 00 + const SFX_ITEM ; 01 + const SFX_CAUGHT_MON ; 02 + const SFX_POKEBALLS_PLACED_ON_TABLE ; 03 + const SFX_POTION ; 04 + const SFX_FULL_HEAL ; 05 + const SFX_MENU ; 06 + const SFX_READ_TEXT ; 07 + const SFX_READ_TEXT_2 ; 08 + const SFX_DEX_FANFARE_20_49 ; 09 + const SFX_DEX_FANFARE_80_109 ; 0a + const SFX_POISON ; 0b + const SFX_GOT_SAFARI_BALLS ; 0c + const SFX_BOOT_PC ; 0d + const SFX_SHUT_DOWN_PC ; 0e + const SFX_CHOOSE_PC_OPTION ; 0f + const SFX_ESCAPE_ROPE ; 10 + const SFX_PUSH_BUTTON ; 11 + const SFX_SECOND_PART_OF_ITEMFINDER ; 12 + const SFX_WARP_TO ; 13 + const SFX_WARP_FROM ; 14 + const SFX_CHANGE_DEX_MODE ; 15 + const SFX_JUMP_OVER_LEDGE ; 16 + const SFX_GRASS_RUSTLE ; 17 + const SFX_FLY ; 18 + const SFX_WRONG ; 19 + const SFX_SQUEAK ; 1a + const SFX_STRENGTH ; 1b + const SFX_BOAT ; 1c + const SFX_WALL_OPEN ; 1d + const SFX_PLACE_PUZZLE_PIECE_DOWN ; 1e + const SFX_ENTER_DOOR ; 1f + const SFX_SWITCH_POKEMON ; 20 + const SFX_TALLY ; 21 + const SFX_TRANSACTION ; 22 + const SFX_EXIT_BUILDING ; 23 + const SFX_BUMP ; 24 + const SFX_SAVE ; 25 + const SFX_POKEFLUTE ; 26 + const SFX_ELEVATOR_END ; 27 + const SFX_THROW_BALL ; 28 + const SFX_BALL_POOF ; 29 + const SFX_FAINT ; 2a + const SFX_RUN ; 2b + const SFX_SLOT_MACHINE_START ; 2c + const SFX_FANFARE ; 2d + const SFX_PECK ; 2e + const SFX_KINESIS ; 2f + const SFX_LICK ; 30 + const SFX_POUND ; 31 + const SFX_MOVE_PUZZLE_PIECE ; 32 + const SFX_COMET_PUNCH ; 33 + const SFX_MEGA_PUNCH ; 34 + const SFX_SCRATCH ; 35 + const SFX_VICEGRIP ; 36 + const SFX_RAZOR_WIND ; 37 + const SFX_CUT ; 38 + const SFX_WING_ATTACK ; 39 + const SFX_WHIRLWIND ; 3a + const SFX_BIND ; 3b + const SFX_VINE_WHIP ; 3c + const SFX_DOUBLE_KICK ; 3d + const SFX_MEGA_KICK ; 3e + const SFX_HEADBUTT ; 3f + const SFX_HORN_ATTACK ; 40 + const SFX_TACKLE ; 41 + const SFX_POISON_STING ; 42 + const SFX_POWDER ; 43 + const SFX_DOUBLESLAP ; 44 + const SFX_BITE ; 45 + const SFX_JUMP_KICK ; 46 + const SFX_STOMP ; 47 + const SFX_TAIL_WHIP ; 48 + const SFX_KARATE_CHOP ; 49 + const SFX_SUBMISSION ; 4a + const SFX_WATER_GUN ; 4b + const SFX_SWORDS_DANCE ; 4c + const SFX_THUNDER ; 4d + const SFX_SUPERSONIC ; 4e + const SFX_LEER ; 4f + const SFX_EMBER ; 50 + const SFX_BUBBLEBEAM ; 51 + const SFX_HYDRO_PUMP ; 52 + const SFX_SURF ; 53 + const SFX_PSYBEAM ; 54 + const SFX_CHARGE ; 55 + const SFX_THUNDERSHOCK ; 56 + const SFX_PSYCHIC ; 57 + const SFX_SCREECH ; 58 + const SFX_BONE_CLUB ; 59 + const SFX_SHARPEN ; 5a + const SFX_EGG_BOMB ; 5b + const SFX_SING ; 5c + const SFX_HYPER_BEAM ; 5d + const SFX_SHINE ; 5e + const SFX_UNKNOWN_5F ; 5f + const SFX_UNKNOWN_60 ; 60 + const SFX_UNKNOWN_61 ; 61 + const SFX_SWITCH_POCKETS ; 62 + const SFX_UNKNOWN_63 ; 63 + const SFX_BURN ; 64 + const SFX_TITLE_SCREEN_ENTRANCE ; 65 + const SFX_UNKNOWN_66 ; 66 + const SFX_GET_COIN_FROM_SLOTS ; 67 + const SFX_PAY_DAY ; 68 + const SFX_METRONOME ; 69 + const SFX_CALL ; 6a + const SFX_HANG_UP ; 6b + const SFX_NO_SIGNAL ; 6c + const SFX_SANDSTORM ; 6d + const SFX_ELEVATOR ; 6e + const SFX_PROTECT ; 6f + const SFX_SKETCH ; 70 + const SFX_RAIN_DANCE ; 71 + const SFX_AEROBLAST ; 72 + const SFX_SPARK ; 73 + const SFX_CURSE ; 74 + const SFX_RAGE ; 75 + const SFX_THIEF ; 76 + const SFX_THIEF_2 ; 77 + const SFX_SPIDER_WEB ; 78 + const SFX_MIND_READER ; 79 + const SFX_NIGHTMARE ; 7a + const SFX_SNORE ; 7b + const SFX_SWEET_KISS ; 7c + const SFX_SWEET_KISS_2 ; 7d + const SFX_BELLY_DRUM ; 7e + const SFX_UNKNOWN_7F ; 7f + const SFX_SLUDGE_BOMB ; 80 + const SFX_FORESIGHT ; 81 + const SFX_SPITE ; 82 + const SFX_OUTRAGE ; 83 + const SFX_PERISH_SONG ; 84 + const SFX_GIGA_DRAIN ; 85 + const SFX_ATTRACT ; 86 + const SFX_KINESIS_2 ; 87 + const SFX_ZAP_CANNON ; 88 + const SFX_MEAN_LOOK ; 89 + const SFX_HEAL_BELL ; 8a + const SFX_RETURN ; 8b + const SFX_EXP_BAR ; 8c + const SFX_MILK_DRINK ; 8d + const SFX_PRESENT ; 8e + const SFX_MORNING_SUN ; 8f + const SFX_LEVEL_UP ; 90 + const SFX_KEY_ITEM ; 91 + const SFX_FANFARE_2 ; 92 + const SFX_REGISTER_PHONE_NUMBER ; 93 + const SFX_3RD_PLACE ; 94 + const SFX_GET_EGG_FROM_DAYCARE_MAN ; 95 + const SFX_GET_EGG_FROM_DAYCARE_LADY ; 96 + const SFX_MOVE_DELETED ; 97 + const SFX_2ND_PLACE ; 98 + const SFX_1ST_PLACE ; 99 + const SFX_CHOOSE_A_CARD ; 9a + const SFX_GET_TM ; 9b + const SFX_GET_BADGE ; 9c + const SFX_QUIT_SLOTS ; 9d + const SFX_EGG_CRACK ; 9e + const SFX_DEX_FANFARE_LESS_THAN_20 ; 9f + const SFX_DEX_FANFARE_140_169 ; a0 + const SFX_DEX_FANFARE_170_199 ; a1 + const SFX_DEX_FANFARE_200_229 ; a2 + const SFX_DEX_FANFARE_230_PLUS ; a3 + const SFX_EVOLVED ; a4 + const SFX_MASTER_BALL ; a5 + const SFX_EGG_HATCH ; a6 + const SFX_GS_INTRO_CHARIZARD_FIREBALL ; a7 + const SFX_GS_INTRO_POKEMON_APPEARS ; a8 + const SFX_FLASH ; a9 + const SFX_GAME_FREAK_LOGO_GS ; aa + const SFX_NOT_VERY_EFFECTIVE ; ab + const SFX_DAMAGE ; ac + const SFX_SUPER_EFFECTIVE ; ad + const SFX_BALL_BOUNCE ; ae + const SFX_MOONLIGHT ; af + const SFX_ENCORE ; b0 + const SFX_BEAT_UP ; b1 + const SFX_BATON_PASS ; b2 + const SFX_BALL_WIGGLE ; b3 + const SFX_SWEET_SCENT ; b4 + const SFX_SWEET_SCENT_2 ; b5 + const SFX_HIT_END_OF_EXP_BAR ; b6 + const SFX_GIVE_TRADEMON ; b7 + const SFX_GET_TRADEMON ; b8 + const SFX_TRAIN_ARRIVED ; b9 + const SFX_STOP_SLOT ; ba + const SFX_2_BOOPS ; bb + const SFX_GLASS_TING ; bc + const SFX_GLASS_TING_2 ; bd - const SFX_INTRO_UNOWN_1 - const SFX_INTRO_UNOWN_2 - const SFX_INTRO_UNOWN_3 - const SFX_DITTO_POP_UP - const SFX_DITTO_TRANSFORM - const SFX_INTRO_SUICUNE_1 - const SFX_INTRO_PICHU - const SFX_INTRO_SUICUNE_2 - const SFX_INTRO_SUICUNE_3 - const SFX_DITTO_BOUNCE - const SFX_INTRO_SUICUNE_4 - const SFX_GAME_FREAK_PRESENTS - const SFX_TINGLE - const SFX_UNKNOWN_CB - const SFX_TWO_PC_BEEPS - const SFX_4_NOTE_DITTY - const SFX_TWINKLE + const SFX_INTRO_UNOWN_1 ; be + const SFX_INTRO_UNOWN_2 ; bf + const SFX_INTRO_UNOWN_3 ; c0 + const SFX_DITTO_POP_UP ; c1 + const SFX_DITTO_TRANSFORM ; c2 + const SFX_INTRO_SUICUNE_1 ; c3 + const SFX_INTRO_PICHU ; c4 + const SFX_INTRO_SUICUNE_2 ; c5 + const SFX_INTRO_SUICUNE_3 ; c6 + const SFX_DITTO_BOUNCE ; c7 + const SFX_INTRO_SUICUNE_4 ; c8 + const SFX_GAME_FREAK_PRESENTS ; c9 + const SFX_TINGLE ; ca + const SFX_UNKNOWN_CB ; cb + const SFX_TWO_PC_BEEPS ; cc + const SFX_4_NOTE_DITTY ; cd + const SFX_TWINKLE ; ce diff --git a/constants/tilemap_constants.asm b/constants/tilemap_constants.asm index b130b5de3..9307a22ad 100644 --- a/constants/tilemap_constants.asm +++ b/constants/tilemap_constants.asm @@ -36,7 +36,7 @@ const_value SET 1 const TILESET_ICE_PATH ; 1d const TILESET_WHIRL_ISLANDS ; 1e const TILESET_ILEX_FOREST ; 1f - const TILESET_20 ; 20 + const TILESET_32 ; 20 const TILESET_HO_OH_WORD_ROOM ; 21 const TILESET_KABUTO_WORD_ROOM ; 22 const TILESET_OMANYTE_WORD_ROOM ; 23 diff --git a/engine/battle_start.asm b/engine/battle_start.asm index bd8b6cc28..6fb64e9b1 100644 --- a/engine/battle_start.asm +++ b/engine/battle_start.asm @@ -120,7 +120,7 @@ Function8c2cf: ; 8c2cf ld [rSVBK], a push hl ld hl, wDecompressScratch - ld bc, $28 * $10 + ld bc, $28 tiles .loop ld [hl], -1 @@ -568,7 +568,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f) StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) ld a, [OtherTrainerClass] and a - jp z, .nextscene + jp z, .nextscene ; don't need to be here if wild xor a ld [hBGMapMode], a @@ -579,6 +579,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) jr .enter_loop_midway .loop +; set all pals to 7 ld a, [hl] or %00000111 ld [hli], a @@ -588,7 +589,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) dec b jr nz, .loop - call .loadpokeballgfx ; load a, [OtherTrainerClass] \ ld de, PokeBallTransition + call .loadpokeballgfx ; ld a, [OtherTrainerClass] \ ld de, PokeBallTransition \ ret hlcoord 2, 1 ld b, SCREEN_WIDTH - 4 @@ -605,7 +606,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) jr z, .done sla a jr nc, .no_load - ld [hl], $fe ; "8" + ld [hl], $fe .no_load inc hl jr .loop4 @@ -650,12 +651,12 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) ld [rSVBK], a call .copypals push hl - ld de, UnknBGPals + 8 * 7 - ld bc, $8 + ld de, UnknBGPals + 7 palettes + ld bc, 1 palettes call CopyBytes pop hl - ld de, BGPals + 8 * 7 - ld bc, $8 + ld de, BGPals + 7 palettes + ld bc, 1 palettes call CopyBytes pop af ld [rSVBK], a @@ -669,21 +670,21 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) ret .copypals: ; 8c677 (23:4677) - ld de, UnknBGPals + 8 * 7 + ld de, UnknBGPals + 7 palettes call .copy - ld de, BGPals + 8 * 7 + ld de, BGPals + 7 palettes call .copy - ld de, UnknOBPals + 8 * 6 + ld de, UnknOBPals + 6 palettes call .copy - ld de, OBPals + 8 * 6 + ld de, OBPals + 6 palettes call .copy - ld de, UnknOBPals + 8 * 7 + ld de, UnknOBPals + 7 palettes call .copy - ld de, OBPals + 8 * 7 + ld de, OBPals + 7 palettes .copy: ; 8c698 (23:4698) push hl - ld bc, $8 + ld bc, 1 palettes call CopyBytes pop hl ret diff --git a/engine/events_3.asm b/engine/events_3.asm index 55dc59a1a..68e6e0d34 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -4,7 +4,7 @@ ReturnFromMapSetupScript:: ; b8000 ; For some reson, GameFreak chose to use a callba here instead of just falling through. ; No other function in the game references the function at 2E:400A, here labeled ; ReturnFromMapSetupScript.inefficientcallba. - callba .inefficientcallba ; this is a waste of 6 ROM bytes and 2 stack bytes + callba .inefficientcallba ; this is a waste of 6 ROM bytes and 6 stack bytes ret ; b800a diff --git a/engine/mart.asm b/engine/mart.asm index 143ba38cd..5ee700951 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -139,7 +139,7 @@ GetMart: ; 15b31 ld a, e cp (MartsEnd - Marts) / 2 jr c, .IsAMart - ld b, $5 + ld b, BANK(DefaultMart) ld de, DefaultMart ret @@ -151,7 +151,7 @@ endr ld e, [hl] inc hl ld d, [hl] - ld b, $5 + ld b, BANK(Marts) ret ; 15b47 diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index aac059a18..ac56ec250 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -971,7 +971,7 @@ BoxNameInputLower: db "1 2 3 4 5 6 7 8 9" db "UPPER DEL END " -NameInputUpper: ; Unreferenced? +NameInputUpper: db "A B C D E F G H I" db "J K L M N O P Q R" db "S T U V W X Y Z " diff --git a/engine/player_movement.asm b/engine/player_movement.asm index 4bc4c483e..80c5e6edc 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -446,7 +446,7 @@ DoPlayerMovement:: ; 80000 db $70, $78, $76, $7e ; 8025f -.DoStep: ; 8025f +.DoStep ld e, a ld d, 0 ld hl, .Steps diff --git a/extras b/extras index 3a6ef54a5..adbc204d7 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 3a6ef54a5e26644699b98d9b73998df5673f4e72 +Subproject commit adbc204d741bec7a68c1e6cd67751f226d0347cb diff --git a/home.asm b/home.asm index 42feefde4..8cb0d25b3 100644 --- a/home.asm +++ b/home.asm @@ -569,7 +569,7 @@ LoadEDTile:: ; 323d jr .LoadEDTile ; 323f -.unreferenced_323f ; 323f +; XXX callba Function104000 ret ; 3246 @@ -661,18 +661,18 @@ SetPalettes:: ; 32f9 ld a, [hCGB] and a jr nz, .SetPalettesForGameBoyColor - ld a, $e4 + ld a, %11100100 ld [rBGP], a - ld a, $d0 + ld a, %11010000 ld [rOBP0], a ld [rOBP1], a ret .SetPalettesForGameBoyColor push de - ld a, $e4 + ld a, %11100100 call DmgToCgbBGPals - ld de, $e4e4 + lb de, %11100100, %11100100 call DmgToCgbObjPals pop de ret @@ -702,7 +702,7 @@ ClearPalettes:: ; 3317 ; Fill BGPals and OBPals with $ffff (white) ld hl, BGPals - ld bc, $80 + ld bc, 16 palettes ld a, $ff call ByteFill diff --git a/items/item_effects.asm b/items/item_effects.asm index 5ba74eb8c..aa6c8f795 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -403,7 +403,7 @@ endr jr c, .not_kurt_ball ld a, POKE_BALL .not_kurt_ball - ld [wKickCounter], a + ld [wBattleAnimParam], a ld de, ANIM_THROW_POKE_BALL ld a, e @@ -2955,7 +2955,7 @@ UseBallInTrainerBattle: ; f7a0 ld a, d ld [FXAnimIDHi], a xor a - ld [wKickCounter], a + ld [wBattleAnimParam], a ld [hBattleTurn], a ld [wNumHits], a predef PlayBattleAnim diff --git a/main.asm b/main.asm index f16f61dac..1440d7933 100644 --- a/main.asm +++ b/main.asm @@ -2473,9 +2473,9 @@ SurfFunction: ; c909 jr nz, .cannotsurf ld a, [PlayerState] cp PLAYER_SURF - jr z, .alreadysurfing + jr z, .alreadyfail cp PLAYER_SURF_PIKA - jr z, .alreadysurfing + jr z, .alreadyfail call GetFacingTileCoord call GetTileCollision cp $1 @@ -2489,7 +2489,7 @@ SurfFunction: ; c909 .asm_c956 ld a, $80 ret -.alreadysurfing +.alreadyfail ld a, $3 ret .cannotsurf @@ -2603,9 +2603,9 @@ CheckDirection: ; c9cb TrySurfOW:: ; c9e7 ; Checking a tile in the overworld. -; Return carry if surfing is allowed. +; Return carry if fail is allowed. -; Don't ask to surf if already surfing. +; Don't ask to surf if already fail. ld a, [PlayerState] cp PLAYER_SURF_PIKA jr z, .quit @@ -3577,21 +3577,20 @@ FishFunction: ; cf8e dw .TryFish dw .FishNoBite dw .FishGotSomething - dw .SurfingFish dw .FailFish + dw .FishNoFish .TryFish: ; cfaf ld a, [PlayerState] cp PLAYER_SURF - jr z, .surfing + jr z, .fail cp PLAYER_SURF_PIKA - jr z, .surfing + jr z, .fail call GetFacingTileCoord call GetTileCollision cp $1 jr z, .facingwater - -.surfing +.fail ld a, $3 ret @@ -3622,7 +3621,7 @@ FishFunction: ; cf8e ld a, $1 ret -.SurfingFish: ; cff1 +.FailFish: ; cff1 ld a, $80 ret @@ -3642,7 +3641,7 @@ FishFunction: ; cf8e ld a, $81 ret -.FailFish: ; d010 +.FishNoFish: ; d010 ld a, $0 ld [Buffer6], a ld hl, Script_NotEvenANibble2 @@ -5405,55 +5404,7 @@ UpdateItemDescription: ; 0x244c3 callba PrintItemDescription ret -Pokepic:: ; 244e3 - ld hl, PokepicMenuDataHeader - call CopyMenuDataHeader - call MenuBox - call UpdateSprites - call ApplyTilemap - ld b, SCGB_POKEPIC - call GetSGBLayout - xor a - ld [hBGMapMode], a - ld a, [CurPartySpecies] - ld [CurSpecies], a - call GetBaseData - ld de, VTiles1 - predef GetFrontpic - ld a, [wMenuBorderTopCoord] - inc a - ld b, a - ld a, [wMenuBorderLeftCoord] - inc a - ld c, a - call Coord2Tile - ld a, $80 - ld [hGraphicStartTile], a - lb bc, 7, 7 - predef PlaceGraphic - call WaitBGMap - ret - -ClosePokepic:: ; 24528 - ld hl, PokepicMenuDataHeader - call CopyMenuDataHeader - call ClearMenuBoxInterior - call WaitBGMap - call GetMemSGBLayout - xor a - ld [hBGMapMode], a - call OverworldTextModeSwitch - call ApplyTilemap - call UpdateSprites - call LoadStandardFont - ret - -PokepicMenuDataHeader: ; 0x24547 - db $40 ; flags - db 04, 06 ; start coords - db 13, 14 ; end coords - dw NULL - db 1 ; default option +INCLUDE "engine/pokepic.asm" LoadObjectMasks: ; 2454f ld hl, wObjectMasks @@ -10089,496 +10040,7 @@ _SwitchPartyMons: call CopyBytes ret -GetUnownLetter: ; 51040 -; Return Unown letter in UnownLetter based on DVs at hl - -; Take the middle 2 bits of each DV and place them in order: -; atk def spd spc -; .ww..xx. .yy..zz. - - ; atk - ld a, [hl] - and %01100000 - sla a - ld b, a - ; def - ld a, [hli] - and %00000110 - swap a - srl a - or b - ld b, a - - ; spd - ld a, [hl] - and %01100000 - swap a - sla a - or b - ld b, a - ; spc - ld a, [hl] - and %00000110 - srl a - or b - -; Divide by 10 to get 0-25 - ld [hDividend + 3], a - xor a - ld [hDividend], a - ld [hDividend + 1], a - ld [hDividend + 2], a - ld a, 10 - ld [hDivisor], a - ld b, 4 - call Divide - -; Increment to get 1-26 - ld a, [hQuotient + 2] - inc a - ld [UnownLetter], a - ret - -GetFrontpic: ; 51077 - ld a, [CurPartySpecies] - ld [CurSpecies], a - call IsAPokemon - ret c - ld a, [rSVBK] - push af - call _GetFrontpic - pop af - ld [rSVBK], a - ret - -FrontpicPredef: ; 5108b - ld a, [CurPartySpecies] - ld [CurSpecies], a - call IsAPokemon - ret c - ld a, [rSVBK] - push af - xor a - ld [hBGMapMode], a - call _GetFrontpic - call Function51103 - pop af - ld [rSVBK], a - ret - -_GetFrontpic: ; 510a5 - push de - call GetBaseData - ld a, [BasePicSize] - and $f - ld b, a - push bc - call GetFrontpicPointer - ld a, $6 - ld [rSVBK], a - ld a, b - ld de, wDecompressScratch + $800 - call FarDecompress - pop bc - ld hl, wDecompressScratch - ld de, wDecompressScratch + $800 - call Function512ab - pop hl - push hl - ld de, wDecompressScratch - ld c, 7 * 7 - ld a, [hROMBank] - ld b, a - call Get2bpp - pop hl - ret - -GetFrontpicPointer: ; 510d7 -GLOBAL PicPointers, UnownPicPointers - - ld a, [CurPartySpecies] - cp UNOWN - jr z, .unown - ld a, [CurPartySpecies] - ld d, BANK(PicPointers) - jr .ok - -.unown - ld a, [UnownLetter] - ld d, BANK(UnownPicPointers) - -.ok - ld hl, PicPointers ; UnownPicPointers - dec a - ld bc, 6 - call AddNTimes - ld a, d - call GetFarByte - call FixPicBank - push af - inc hl - ld a, d - call GetFarHalfword - pop bc - ret - -Function51103: ; 51103 - ld a, $1 - ld [rVBK], a - push hl - ld de, wDecompressScratch - ld c, 7 * 7 - ld a, [hROMBank] - ld b, a - call Get2bpp - pop hl - ld de, 7 * 7 tiles - add hl, de - push hl - ld a, $1 - ld hl, BasePicSize - call GetFarWRAMByte - pop hl - and $f - ld de, w6_d800 + 5 * 5 tiles - ld c, 5 * 5 - cp 5 - jr z, .got_dims - ld de, w6_d800 + 6 * 6 tiles - ld c, 6 * 6 - cp 6 - jr z, .got_dims - ld de, w6_d800 + 7 * 7 tiles - ld c, 7 * 7 -.got_dims - - push hl - push bc - call Function5114f - pop bc - pop hl - ld de, wDecompressScratch - ld a, [hROMBank] - ld b, a - call Get2bpp - xor a - ld [rVBK], a - ret - -Function5114f: ; 5114f - ld hl, wDecompressScratch - swap c - ld a, c - and $f - ld b, a - ld a, c - and $f0 - ld c, a - push bc - call LoadFrontpic - pop bc -.asm_51161 - push bc - ld c, $0 - call LoadFrontpic - pop bc - dec b - jr nz, .asm_51161 - ret - -GetBackpic: ; 5116c - ld a, [CurPartySpecies] - call IsAPokemon - ret c - - ld a, [CurPartySpecies] - ld b, a - ld a, [UnownLetter] - ld c, a - ld a, [rSVBK] - push af - ld a, $6 - ld [rSVBK], a - push de - - ; These are assumed to be at the same - ; address in their respective banks. - GLOBAL PicPointers, UnownPicPointers - ld hl, PicPointers ; UnownPicPointers - ld a, b - ld d, BANK(PicPointers) - cp UNOWN - jr nz, .ok - ld a, c - ld d, BANK(UnownPicPointers) -.ok - dec a - ld bc, 6 - call AddNTimes - ld bc, 3 - add hl, bc - ld a, d - call GetFarByte - call FixPicBank - push af - inc hl - ld a, d - call GetFarHalfword - ld de, wDecompressScratch - pop af - call FarDecompress - ld hl, wDecompressScratch - ld c, 6 * 6 - call FixBackpicAlignment - pop hl - ld de, wDecompressScratch - ld a, [hROMBank] - ld b, a - call Get2bpp - pop af - ld [rSVBK], a - ret - -FixPicBank: ; 511c5 -; This is a thing for some reason. - push hl - push bc - sub PICS_1 - PICS_FIX - ld c, a - ld b, 0 - ld hl, .PicsBanks - add hl, bc - ld a, [hl] - pop bc - pop hl - ret - -.PicsBanks: ; 511d4 - db PICS_1 - db PICS_2 - db PICS_3 - db PICS_4 - db PICS_5 - db PICS_6 - db PICS_7 - db PICS_8 - db PICS_9 - db PICS_10 - db PICS_11 - db PICS_12 - db PICS_13 - db PICS_14 - db PICS_15 - db PICS_16 - db PICS_17 - db PICS_18 - db PICS_19 - db PICS_19 + 1 - db PICS_19 + 2 - db PICS_19 + 3 - db PICS_19 + 4 - db PICS_19 + 5 - -Function511ec: ; 511ec - ld a, c - push de - ld hl, PicPointers - dec a - ld bc, 6 - call AddNTimes - ld a, BANK(PicPointers) - call GetFarByte - call FixPicBank - push af - inc hl - ld a, BANK(PicPointers) - call GetFarHalfword - pop af - pop de - call FarDecompress - ret - -GetTrainerPic: ; 5120d - ld a, [TrainerClass] - and a - ret z - cp NUM_TRAINER_CLASSES - ret nc - call WaitBGMap - xor a - ld [hBGMapMode], a - ld hl, TrainerPicPointers - ld a, [TrainerClass] - dec a - ld bc, 3 - call AddNTimes - ld a, [rSVBK] - push af - ld a, $6 - ld [rSVBK], a - push de - ld a, BANK(TrainerPicPointers) - call GetFarByte - call FixPicBank - push af - inc hl - ld a, BANK(TrainerPicPointers) - call GetFarHalfword - pop af - ld de, wDecompressScratch - call FarDecompress - pop hl - ld de, wDecompressScratch - ld c, 7 * 7 - ld a, [hROMBank] - ld b, a - call Get2bpp - pop af - ld [rSVBK], a - call WaitBGMap - ld a, $1 - ld [hBGMapMode], a - ret - -DecompressPredef: ; 5125d -; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de. - - ld a, [rSVBK] - push af - ld a, 6 - ld [rSVBK], a - - push de - push bc - ld a, b - ld de, wDecompressScratch - call FarDecompress - pop bc - ld de, wDecompressScratch - pop hl - ld a, [hROMBank] - ld b, a - call Get2bpp - - pop af - ld [rSVBK], a - ret - -FixBackpicAlignment: ; 5127c - push de - push bc - ld a, [wBoxAlignment] - and a - jr z, .keep_dims - ld a, c - cp 7 * 7 - ld de, 7 * 7 tiles - jr z, .got_dims - cp 6 * 6 - ld de, 6 * 6 tiles - jr z, .got_dims - ld de, 5 * 5 tiles - -.got_dims - ld a, [hl] - ld b, $0 - ld c, $8 -.loop - rra - rl b - dec c - jr nz, .loop - ld a, b - ld [hli], a - dec de - ld a, e - or d - jr nz, .got_dims - -.keep_dims - pop bc - pop de - ret - -Function512ab: ; 512ab - ld a, b - cp 6 - jr z, .six - cp 5 - jr z, .five - -.seven_loop - ld c, $70 - call LoadFrontpic - dec b - jr nz, .seven_loop - ret - -.six - ld c, $70 - xor a - call .Fill -.six_loop - ld c, $10 - xor a - call .Fill - ld c, $60 - call LoadFrontpic - dec b - jr nz, .six_loop - ret - -.five - ld c, $70 - xor a - call .Fill -.five_loop - ld c, $20 - xor a - call .Fill - ld c, $50 - call LoadFrontpic - dec b - jr nz, .five_loop - ld c, $70 - xor a - call .Fill - ret - -.Fill - ld [hli], a - dec c - jr nz, .Fill - ret - -LoadFrontpic: ; 512f2 - ld a, [wBoxAlignment] - and a - jr nz, .x_flip -.left_loop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .left_loop - ret - -.x_flip - push bc -.right_loop - ld a, [de] - inc de - ld b, a - xor a - rept 8 - rr b - rla - endr - ld [hli], a - dec c - jr nz, .right_loop - pop bc - ret +INCLUDE "gfx/load_pics.asm" Function51322: ; 51322 ld a, BANK(sBoxCount) diff --git a/maps/KrissHouse1F.asm b/maps/KrissHouse1F.asm index 4538bf41b..5a8500989 100644 --- a/maps/KrissHouse1F.asm +++ b/maps/KrissHouse1F.asm @@ -44,7 +44,7 @@ UnknownScript_0x7a4f6: scall UnknownScript_0x7a57e setflag ENGINE_POKEGEAR setflag ENGINE_PHONE_CARD - addcellnum $1 + addcellnum PHONE_MOM dotrigger $1 setevent EVENT_KRISS_HOUSE_MOM_1 clearevent EVENT_KRISS_HOUSE_MOM_2 diff --git a/sram.asm b/sram.asm index 7e52d92c1..f28ed939e 100644 --- a/sram.asm +++ b/sram.asm @@ -190,7 +190,7 @@ sHallOfFame:: ; b2c0 ; endr sHallOfFameEnd:: -sMobileEventIndex:: ds 1 +sMobileEventIndex:: ds 1 ; be3c sCrystalData:: ds wCrystalDataEnd - wCrystalData diff --git a/wram.asm b/wram.asm index 4fa8e282c..01394f364 100644 --- a/wram.asm +++ b/wram.asm @@ -391,12 +391,12 @@ BattleMon:: battle_struct BattleMon ; c62c ds 2 -wWildMon:: ds 1 +wWildMon:: ds 1 ; c64e ds 1 -wEnemyTrainerItem1:: ds 1 -wEnemyTrainerItem2:: ds 1 -wEnemyTrainerBaseReward:: ds 1 -wEnemyTrainerAIFlags:: ds 3 +wEnemyTrainerItem1:: ds 1 ; c650 +wEnemyTrainerItem2:: ds 1 ; c651 +wEnemyTrainerBaseReward:: ds 1 ; c652 +wEnemyTrainerAIFlags:: ds 3 ; c653 OTClassName:: ds NAME_LENGTH ; c656 ds 2 @@ -1875,11 +1875,11 @@ wd182:: ds 1 wd191:: ds 1 wd192:: ds 1 wd193:: ds 1 -wOverworldMapAnchor:: dw -wMetatileStandingY:: ds 1 -wMetatileStandingX:: ds 1 -wSecondMapHeaderBank:: ds 1 -wTileset:: ds 1 +wOverworldMapAnchor:: dw ; d194 +wMetatileStandingY:: ds 1 ; d196 +wMetatileStandingX:: ds 1 ; d197 +wSecondMapHeaderBank:: ds 1 ; d198 +wTileset:: ds 1 ; d199 wPermission:: ds 1 ; d19a wSecondMapHeaderAddr:: dw ; d19b @@ -2256,25 +2256,25 @@ wScriptTextBank:: wPriorityScriptAddr:: wScriptTextAddr:: ds 2 ; d44f ds 1 -wWildEncounterCooldown:: ds 1 -wXYComparePointer:: ds 2 +wWildEncounterCooldown:: ds 1 ; d452 +wXYComparePointer:: ds 2 ; d453 ds 4 -wBattleScriptFlags:: ds 2 -wPlayerSpriteSetupFlags:: ds 1 +wBattleScriptFlags:: ds 2 ; d459 +wPlayerSpriteSetupFlags:: ds 1 ; d45b ; bit 7: if set, cancel PlayerAction ; bit 5: if set, set facing according to bits 0-1 ; bits 0-1: direction facing -wMapReentryScriptQueueFlag:: ds 1 ; MemScriptFlag -wMapReentryScriptBank:: ds 1 ; MemScriptBank -wMapReentryScriptAddress:: ds 2 ; MemScriptAddr +wMapReentryScriptQueueFlag:: ds 1 ; d45c MemScriptFlag +wMapReentryScriptBank:: ds 1 ; d45d MemScriptBank +wMapReentryScriptAddress:: ds 2 ; d45e MemScriptAddr ds 4 ; ????????????? -wTimeCyclesSinceLastCall:: ds 1 -wReceiveCallDelay_MinsRemaining:: ds 1 -wReceiveCallDelay_StartTime:: ds 3 +wTimeCyclesSinceLastCall:: ds 1 ; d464 +wReceiveCallDelay_MinsRemaining:: ds 1 ; d465 +wReceiveCallDelay_StartTime:: ds 3 ; d466 ds 3 -wBugContestMinsRemaining:: ds 1 -wBugContestSecsRemaining:: ds 1 +wBugContestMinsRemaining:: ds 1 ; d46c +wBugContestSecsRemaining:: ds 1 ; d46d ds 2 wMapStatusEnd:: ds 2 ; d470 @@ -2753,7 +2753,7 @@ wLuckyNumberDayBuffer:: ds 2 ds 2 wSpecialPhoneCallID:: ds 1 ds 3 -wBugContestStartTime:: ds 4 ; day, hour, min, sec +wBugContestStartTime:: ds 4 ; day, hour, min, sec ; dc35 wUnusedTwoDayTimerOn:: ds 1 ; dc39 wUnusedTwoDayTimer:: ds 1 wUnusedTwoDayTimerStartDate:: ds 1