diff --git a/Makefile b/Makefile index ce6f9c66..e1235f4c 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,8 @@ rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call ASMFILES := $(call rwildcard, $(DIRS), *.asm) $(FILES) GOLD_OBJS := $(patsubst %.asm, $(BUILD)/%_gold.o, $(ASMFILES)) -GOLD_OBJS += $(BUILD)/shim_gold.o SILVER_OBJS := $(patsubst %.asm, $(BUILD)/%_silver.o, $(ASMFILES)) -SILVER_OBJS += $(BUILD)/shim_silver.o ### Build tools @@ -80,7 +78,7 @@ tidy: rm -rf $(ROMS) $(CORRECTEDROMS) \ $(ROMS:.gb=.sym) $(CORRECTEDROMS:.gb=.sym) \ $(ROMS:.gb=.map) $(CORRECTEDROMS:.gb=.map) \ - $(GOLD_OBJS) $(SILVER_OBJS) $(BUILD)/shim.asm rgbdscheck.o + $(GOLD_OBJS) $(SILVER_OBJS) rgbdscheck.o # Visualize disassembly progress. .PHONY: coverage @@ -127,9 +125,6 @@ baserom-silver.gb: @echo "Please obtain a copy of Silver_debug.sgb and put it in this directory as $@" @exit 1 -$(BUILD)/shim.asm: shim.sym | $$(dir $$@) - $(PYTHON) tools/make_shim.py $< > $@ - ### Misc file-specific graphics rules include gfx/gfx.mk diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index e284fad3..20c49ecb 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -44,6 +44,13 @@ DEF BREEDER_GAVE_EGG EQU 4 const PLAYERSTEP_STOP_F ; 6 const PLAYERSTEP_START_F ; 7 +; wInitListType:: +DEF INIT_ENEMYOT_LIST EQU 1 +DEF INIT_BAG_ITEM_LIST EQU 2 +DEF INIT_OTHER_ITEM_LIST EQU 3 +DEF INIT_PLAYEROT_LIST EQU 4 +DEF INIT_MON_LIST EQU 5 + ; wTextboxFrame:: const_def const FRAME_1 ; 0 diff --git a/data/maps/objects/UnusedGen1Colosseum.asm b/data/maps/objects/UnusedGen1Colosseum.asm new file mode 100644 index 00000000..fe51c56c --- /dev/null +++ b/data/maps/objects/UnusedGen1Colosseum.asm @@ -0,0 +1,8 @@ +INCLUDE "constants.asm" + +SECTION "data/maps/objects/UnusedGen1Colosseum.asm", ROMX + + UnusedGen1Colosseum_MapEvents: + + UnusedGen1Colosseum_Blocks: + INCBIN "maps/OldCityPokecenterBattle.blk" diff --git a/data/maps/objects/UnusedGen1TradeCenter.asm b/data/maps/objects/UnusedGen1TradeCenter.asm new file mode 100644 index 00000000..70c5cd79 --- /dev/null +++ b/data/maps/objects/UnusedGen1TradeCenter.asm @@ -0,0 +1,8 @@ +INCLUDE "constants.asm" + +SECTION "data/maps/objects/UnusedGen1TradeCenter.asm", ROMX + + UnusedGen1TradeCenter_MapEvents: + + UnusedGen1TradeCenter_Blocks: + INCBIN "maps/OldCityPokecenterTrade.blk" diff --git a/data/pokemon/gen1_base_special.asm b/data/pokemon/gen1_base_special.asm new file mode 100644 index 00000000..a0a2e187 --- /dev/null +++ b/data/pokemon/gen1_base_special.asm @@ -0,0 +1,160 @@ +INCLUDE "constants.asm" + +SECTION "data/pokemon/gen1_base_special.asm", ROMX + +; The original base Special stat for each Pokémon from Red/Blue + +KantoMonSpecials: + table_width 1 + db 65 ; BULBASAUR + db 80 ; IVYSAUR + db 100 ; VENUSAUR + db 50 ; CHARMANDER + db 65 ; CHARMELEON + db 85 ; CHARIZARD + db 50 ; SQUIRTLE + db 65 ; WARTORTLE + db 85 ; BLASTOISE + db 20 ; CATERPIE + db 25 ; METAPOD + db 80 ; BUTTERFREE + db 20 ; WEEDLE + db 25 ; KAKUNA + db 45 ; BEEDRILL + db 35 ; PIDGEY + db 50 ; PIDGEOTTO + db 70 ; PIDGEOT + db 25 ; RATTATA + db 50 ; RATICATE + db 31 ; SPEAROW + db 61 ; FEAROW + db 40 ; EKANS + db 65 ; ARBOK + db 50 ; PIKACHU + db 90 ; RAICHU + db 30 ; SANDSHREW + db 55 ; SANDSLASH + db 40 ; NIDORAN_F + db 55 ; NIDORINA + db 75 ; NIDOQUEEN + db 40 ; NIDORAN_M + db 55 ; NIDORINO + db 75 ; NIDOKING + db 60 ; CLEFAIRY + db 85 ; CLEFABLE + db 65 ; VULPIX + db 100 ; NINETALES + db 25 ; JIGGLYPUFF + db 50 ; WIGGLYTUFF + db 40 ; ZUBAT + db 75 ; GOLBAT + db 75 ; ODDISH + db 85 ; GLOOM + db 100 ; VILEPLUME + db 55 ; PARAS + db 80 ; PARASECT + db 40 ; VENONAT + db 90 ; VENOMOTH + db 45 ; DIGLETT + db 70 ; DUGTRIO + db 40 ; MEOWTH + db 65 ; PERSIAN + db 50 ; PSYDUCK + db 80 ; GOLDUCK + db 35 ; MANKEY + db 60 ; PRIMEAPE + db 50 ; GROWLITHE + db 80 ; ARCANINE + db 40 ; POLIWAG + db 50 ; POLIWHIRL + db 70 ; POLIWRATH + db 105 ; ABRA + db 120 ; KADABRA + db 135 ; ALAKAZAM + db 35 ; MACHOP + db 50 ; MACHOKE + db 65 ; MACHAMP + db 70 ; BELLSPROUT + db 85 ; WEEPINBELL + db 100 ; VICTREEBEL + db 100 ; TENTACOOL + db 120 ; TENTACRUEL + db 30 ; GEODUDE + db 45 ; GRAVELER + db 55 ; GOLEM + db 65 ; PONYTA + db 80 ; RAPIDASH + db 40 ; SLOWPOKE + db 80 ; SLOWBRO + db 95 ; MAGNEMITE + db 120 ; MAGNETON + db 58 ; FARFETCH_D + db 35 ; DODUO + db 60 ; DODRIO + db 70 ; SEEL + db 95 ; DEWGONG + db 40 ; GRIMER + db 65 ; MUK + db 45 ; SHELLDER + db 85 ; CLOYSTER + db 100 ; GASTLY + db 115 ; HAUNTER + db 130 ; GENGAR + db 30 ; ONIX + db 90 ; DROWZEE + db 115 ; HYPNO + db 25 ; KRABBY + db 50 ; KINGLER + db 55 ; VOLTORB + db 80 ; ELECTRODE + db 60 ; EXEGGCUTE + db 125 ; EXEGGUTOR + db 40 ; CUBONE + db 50 ; MAROWAK + db 35 ; HITMONLEE + db 35 ; HITMONCHAN + db 60 ; LICKITUNG + db 60 ; KOFFING + db 85 ; WEEZING + db 30 ; RHYHORN + db 45 ; RHYDON + db 105 ; CHANSEY + db 100 ; TANGELA + db 40 ; KANGASKHAN + db 70 ; HORSEA + db 95 ; SEADRA + db 50 ; GOLDEEN + db 80 ; SEAKING + db 70 ; STARYU + db 100 ; STARMIE + db 100 ; MR__MIME + db 55 ; SCYTHER + db 95 ; JYNX + db 85 ; ELECTABUZZ + db 85 ; MAGMAR + db 55 ; PINSIR + db 70 ; TAUROS + db 20 ; MAGIKARP + db 100 ; GYARADOS + db 95 ; LAPRAS + db 48 ; DITTO + db 65 ; EEVEE + db 110 ; VAPOREON + db 110 ; JOLTEON + db 110 ; FLAREON + db 75 ; PORYGON + db 90 ; OMANYTE + db 115 ; OMASTAR + db 45 ; KABUTO + db 70 ; KABUTOPS + db 60 ; AERODACTYL + db 65 ; SNORLAX + db 125 ; ARTICUNO + db 125 ; ZAPDOS + db 125 ; MOLTRES + db 50 ; DRATINI + db 70 ; DRAGONAIR + db 100 ; DRAGONITE + db 154 ; MEWTWO + db 100 ; MEW + assert_table_length NUM_KANTO_POKEMON \ No newline at end of file diff --git a/engine/debug/field/pokemart_menu.inc b/engine/debug/field/pokemart_menu.inc index 9b8c84f9..9b3d3187 100644 --- a/engine/debug/field/pokemart_menu.inc +++ b/engine/debug/field/pokemart_menu.inc @@ -59,7 +59,7 @@ DebugMart_BuyMenuHeader: db STATICMENU_WRAP db 4, 8 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL - dbw 0, wcd60 + dbw 0, wCurMartCount dba PlaceMenuItemName dba .PrintAmount dba UpdateItemDescription @@ -273,7 +273,7 @@ DebugMart_Sell: done DebugMart_LoadItems: - ld hl, wcd60 + ld hl, wCurMartCount .load_loop ld a, [de] inc de @@ -281,7 +281,7 @@ DebugMart_LoadItems: cp -1 jr nz, .load_loop ld hl, wcc3a - ld de, wcd60 + 1 + ld de, wCurMartCount + 1 .load_loop2 ld a, [de] inc de diff --git a/engine/debug/field/unused_flag_menu.inc b/engine/debug/field/unused_flag_menu.inc index 2959beb6..c3b07af7 100644 --- a/engine/debug/field/unused_flag_menu.inc +++ b/engine/debug/field/unused_flag_menu.inc @@ -61,7 +61,7 @@ ENDM unused_check_bit wcdc4 unused_check_bit wcdc5 unused_check_bit wcdc6 - unused_check_bit wcdc7 + unused_check_bit wLinkBattleRNPreamble ret .CheckBit: diff --git a/engine/dumps/bank14.asm b/engine/dumps/bank14.asm index fb593e50..d5ada255 100644 --- a/engine/dumps/bank14.asm +++ b/engine/dumps/bank14.asm @@ -1714,49 +1714,49 @@ ListMoves:: .asm_50c47 ret -Function50c48:: - ld a, [wce34] - cp $01 - jr nz, .asm_50c59 +InitList:: + ld a, [wInitListType] + cp INIT_ENEMYOT_LIST + jr nz, .check_party_ot_name ld hl, wOTPartyCount ld de, wOTPartyMonOT ld a, ENEMY_OT_NAME - jr .asm_50c8b + jr .done -.asm_50c59 - cp $04 - jr nz, .asm_50c67 +.check_party_ot_name + cp INIT_PLAYEROT_LIST + jr nz, .check_mon_name ld hl, wPartyCount ld de, wPartyMonOTs ld a, PARTY_OT_NAME - jr .asm_50c8b + jr .done -.asm_50c67 - cp $05 - jr nz, .asm_50c75 - ld hl, wcd60 +.check_mon_name + cp INIT_MON_LIST + jr nz, .check_item_name + ld hl, wCurMartCount ld de, PokemonNames ld a, MON_NAME - jr .asm_50c8b + jr .done -.asm_50c75 - cp $02 - jr nz, .asm_50c83 +.check_item_name + cp INIT_BAG_ITEM_LIST + jr nz, .check_ob_item_name ld hl, wItems ld de, ItemNames ld a, ITEM_NAME - jr .asm_50c8b + jr .done -.asm_50c83 - ld hl, wcd60 +.check_ob_item_name + ld hl, wCurMartCount ld de, ItemNames ld a, ITEM_NAME -.asm_50c8b +.done ld [wNamedObjectTypeBuffer], a ld a, l ld [wListPointer], a diff --git a/engine/link/link.asm b/engine/link/link.asm index 440d0489..a3dcfd0a 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -71,7 +71,7 @@ Gen2ToGen1LinkComms: call DelayFrames ld a, $08 ldh [rIE], a - ld hl, wcdc7 + ld hl, wLinkBattleRNPreamble ld de, wEnemyMon ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH call Serial_ExchangeBytes @@ -80,14 +80,14 @@ Gen2ToGen1LinkComms: ld hl, wLinkData ld de, wOTPlayerName - ld bc, $0161 + ld bc, PLAYER_NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (REDMON_STRUCT_LENGTH + PLAYER_NAME_LENGTH * 2) * PARTY_LENGTH + 3 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a - ld hl, wOptionsMenuCursorX + ld hl, wPlayerPatchLists ld de, wPlayerTrademon - ld bc, $00C8 + ld bc, SERIAL_PATCH_LIST_LENGTH call Serial_ExchangeBytes ld a, $1D @@ -99,7 +99,7 @@ Gen2ToGen1LinkComms: call Link_FindFirstNonControlCharacter_SkipZero ld de, wLinkData - ld bc, $0161 + ld bc, PLAYER_NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (REDMON_STRUCT_LENGTH + PLAYER_NAME_LENGTH * 2) * PARTY_LENGTH + 3 call Link_CopyOTData ld de, wPlayerTrademon @@ -224,7 +224,7 @@ Gen2ToGen2LinkComms: ld a, $08 ldh [rIE], a - ld hl, wcdc7 + ld hl, wLinkBattleRNPreamble ld de, wEnemyMon ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH call Serial_ExchangeBytes @@ -238,7 +238,7 @@ Gen2ToGen2LinkComms: ld a, SERIAL_NO_DATA_BYTE ld [de], a - ld hl, wOptionsMenuCursorX + ld hl, wPlayerPatchLists ld de, wPlayerTrademon ld bc, SERIAL_PATCH_LIST_LENGTH call Serial_ExchangeBytes @@ -248,7 +248,7 @@ Gen2ToGen2LinkComms: jr nz, .not_trading ld hl, wLinkPlayerMail ld de, wBattle - ld bc, $0118 + ld bc, wLinkPlayerMailEnd - wLinkPlayerMail call ExchangeBytes .not_trading ld a, $1D @@ -260,7 +260,7 @@ Gen2ToGen2LinkComms: ld hl, wOTPlayerName call Link_FindFirstNonControlCharacter_SkipZero ld de, wLinkData - ld bc, PLAYER_NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH * 2) * PARTY_LENGTH + ld bc, PLAYER_NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (PARTYMON_STRUCT_LENGTH + PLAYER_NAME_LENGTH * 2) * PARTY_LENGTH call Link_CopyOTData ld de, wPlayerTrademon @@ -427,13 +427,14 @@ ClearLinkData: ret FixDataForLinkTransfer: - ld hl, wcdc7 + ld hl, wLinkBattleRNPreamble ld a, SERIAL_PREAMBLE_BYTE ld b, SERIAL_RN_PREAMBLE_LENGTH .preamble_loop ld [hli], a dec b jr nz, .preamble_loop +; Initialize random seed, making sure special bytes are omitted ld b, SERIAL_RNS_LENGTH ld de, wLinkBattleRNs .rn_loop @@ -446,7 +447,8 @@ FixDataForLinkTransfer: dec b jr nz, .rn_loop - ld hl, wOptionsMenuCursorX +; Clear the patch list + ld hl, wPlayerPatchLists ld a, SERIAL_PREAMBLE_BYTE rept SERIAL_PATCH_PREAMBLE_LENGTH ld [hli], a @@ -459,7 +461,7 @@ endr jr nz, .clear_loop ld hl, wLinkData + SERIAL_PREAMBLE_LENGTH + PLAYER_NAME_LENGTH + (1 + PARTY_LENGTH + 1) - 1 - ld de, wDayOfWeekBuffer + ld de, wPlayerPatchLists + SERIAL_RNS_LENGTH lb bc, 0, 0 .patch_loop: ; Check if we've gone over the entire area @@ -744,8 +746,8 @@ Link_ConvertPartyStruct1to2: ld a, c ld [hli], a ld [hl], b - ld hl, wOTPartyMons - ld c, $06 + ld hl, wOTPartyMon1Species + ld c, PARTY_LENGTH .loop push bc call .ConvertToGen2 @@ -753,13 +755,13 @@ Link_ConvertPartyStruct1to2: dec c jr nz, .loop pop hl - ld bc, $0108 + ld bc, PARTY_LENGTH * REDMON_STRUCT_LENGTH add hl, bc ld de, wOTPartyMon1OT - ld bc, $0024 + ld bc, PARTY_LENGTH * PLAYER_NAME_LENGTH call CopyBytes ld de, wOTPartyMon1Nickname - ld bc, $0024 + ld bc, PARTY_LENGTH * MON_NAME_LENGTH call CopyBytes ret @@ -812,25 +814,25 @@ Link_ConvertPartyStruct1to2: ld h, d ld l, e pop de - ld bc, $001A + ld bc, MON_HAPPINESS - MON_ITEM call CopyBytes pop bc ld d, h ld e, l - ld hl, $001F + ld hl, MON_LEVEL add hl, bc ld a, [de] inc de ld [hl], a ld [wCurPartyLevel], a push bc - ld hl, $0024 + ld hl, MON_MAXHP add hl, bc push hl ld h, d ld l, e pop de - ld bc, $0008 + ld bc, MON_SAT - MON_MAXHP call CopyBytes pop bc call GetBaseData @@ -976,9 +978,9 @@ LinkTradeOTPartymonMenuLoop: jp z, LinkTradePartiesMenuMasterLoop bit A_BUTTON_F, a jr z, .not_a_button - ld a, $01 - ld [wce34], a - callfar Function50c48 + ld a, INIT_ENEMYOT_LIST + ld [wInitListType], a + callfar InitList ld hl, wOTPartyMons call LinkMonStatsScreen jp LinkTradePartiesMenuMasterLoop @@ -1034,10 +1036,10 @@ LinkTradePartymonMenuLoop: jr z, .not_a_button jp LinkTrade_TradeStatsMenu -.unreferenced: - ld a, $04 - ld [wce34], a - callfar Function50c48 +.unreferenced_check_party_ot_name: + ld a, INIT_PLAYEROT_LIST + ld [wInitListType], a + callfar InitList call LinkMonStatsScreen jp LinkTradePartiesMenuMasterLoop @@ -1143,9 +1145,9 @@ LinkTrade_TradeStatsMenu: .show_stats: pop af ld [wMenuCursorY], a - ld a, 4 - ld [wce34], a - callfar Function50c48 + ld a, INIT_PLAYEROT_LIST + ld [wInitListType], a + callfar InitList call LinkMonStatsScreen call ReloadTilesFromBuffer jp LinkTrade_PlayerPartyMenu @@ -1155,13 +1157,13 @@ LinkTrade_TradeStatsMenu: pop af ld [wMenuCursorY], a dec a - ld [wBattleMenuRows], a + ld [wCurTradePartyMon], a ld [wLinkPlayerSyncBuffer], a call Serial_PrintWaitingTextAndSyncAndExchangeNybble ld a, [wLinkReceivedSyncBuffer] cp $f jp z, InitTradeMenuDisplay - ld [wBattleMenuColumns], a + ld [wCurOTTradePartyMon], a call LinkTradePlaceArrow ld c, 100 call DelayFrames @@ -1170,7 +1172,7 @@ LinkTrade_TradeStatsMenu: xor a ld [wLinkPlayerSyncBuffer + 1], a ld [wBattleAction], a - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld c, a ld b, $00 @@ -1293,12 +1295,12 @@ LinkMonStatsScreen: jp PlaceTradeScreenFooter ValidateOTTrademon: - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMons ld bc, $0030 call AddNTimes push hl - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] inc a ld c, a ld b, $00 @@ -1310,7 +1312,7 @@ ValidateOTTrademon: jr nz, .Function28990 ld b, h ld c, l - ld hl, $001F + ld hl, MON_LEVEL add hl, bc ld a, [hl] cp $65 @@ -1319,7 +1321,7 @@ ValidateOTTrademon: cp $01 jr nz, .Function2898E ld hl, wOTPartySpecies - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld c, a ld b, $00 add hl, bc @@ -1397,7 +1399,7 @@ LinkTrade: ld b, $04 ld c, $12 call LinkTextboxAtHL - ld a, [wBattleMenuRows] + ld a, [wCurTradePartyMon] ld hl, wPartySpecies ld c, a ld b, $00 @@ -1409,7 +1411,7 @@ LinkTrade: ld de, wMovementBufferPointerBank ld bc, MON_NAME_LENGTH call CopyBytes - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld c, a ld b, $00 @@ -1487,7 +1489,7 @@ LinkTrade: .do_trade: ld hl, sPartyMail - ld a, [wBattleMenuRows] + ld a, [wCurTradePartyMon] ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld a, $02 @@ -1496,7 +1498,7 @@ LinkTrade: ld e, l ld bc, MAIL_STRUCT_LENGTH add hl, bc - ld a, [wBattleMenuRows] + ld a, [wCurTradePartyMon] ld c, a .copy_mail inc c @@ -1517,75 +1519,87 @@ LinkTrade: call AddNTimes push hl ld hl, wLinkPlayerMail - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld bc, MAIL_STRUCT_LENGTH call AddNTimes pop de ld bc, MAIL_STRUCT_LENGTH call CopyBytes call CloseSRAM +; Buffer player data +; nickname ld hl, wPlayerName ld de, wPlayerTrademonSenderName ld bc, PLAYER_NAME_LENGTH call CopyBytes - ld a, [wBattleMenuRows] +; species + ld a, [wCurTradePartyMon] ld hl, wPartySpecies - ld b, $00 + ld b, 0 ld c, a add hl, bc ld a, [hl] +; OT name ld [wPlayerTrademon], a - ld a, [wBattleMenuRows] + ld a, [wCurTradePartyMon] ld hl, wPartyMon1OT call SkipNames ld de, wPlayerTrademonOTName ld bc, PLAYER_NAME_LENGTH call CopyBytes +; ID ld hl, wPartyMon1ID - ld a, [wBattleMenuRows] + ld a, [wCurTradePartyMon] ld bc, $0030 call AddNTimes ld a, [hli] ld [wPlayerTrademonID], a ld a, [hl] ld [wPlayerTrademonID + 1], a + +; Buffer other player data +; nickname ld hl, wOTPlayerName ld de, wOTTrademonSenderName ld bc, PLAYER_NAME_LENGTH call CopyBytes - ld a, [wBattleMenuColumns] +; species + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies - ld b, $00 + ld b, 0 ld c, a add hl, bc ld a, [hl] ld [wOTTrademon], a - ld a, [wBattleMenuColumns] +; OT name + ld a, [wCurOTTradePartyMon] ld hl, wOTPartyMon1OT call SkipNames ld de, wOTTrademonOTName ld bc, PLAYER_NAME_LENGTH call CopyBytes +; ID ld hl, wOTPartyMon1ID - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld bc, $0030 call AddNTimes ld a, [hli] ld [wOTTrademonID], a ld a, [hl] - ld [wPokerTurnNumber], a - ld a, [wBattleMenuRows] + ld [wOTTrademonID + 1], a + + ld a, [wCurTradePartyMon] ld [wCurPartyMon], a ld hl, wPartySpecies ld b, $00 ld c, a add hl, bc ld a, [hl] - ld [wBattleMenuRows], a + ld [wCurTradePartyMon], a xor a ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld c, a ld [wCurPartyMon], a ld hl, wOTPartySpecies @@ -1607,13 +1621,13 @@ LinkTrade: ld [wCurPartyMon], a ld a, $01 ld [wForceEvolution], a - ld a, [wBattleMenuColumns] + ld a, [wCurOTTradePartyMon] ld hl, wOTPartySpecies ld b, $00 ld c, a add hl, bc ld a, [hl] - ld [wBattleMenuColumns], a + ld [wCurOTTradePartyMon], a ld c, 100 call DelayFrames call ClearTileMap @@ -1714,15 +1728,3 @@ LoadTradeScreenBorderGFX: ld hl, vChars2 tile $76 lb bc, BANK(LinkCommsBorderGFX), 9 jp Request2bpp - -UnreferencedData28CD7: - db $41, $50, $64, $32, $41, $55, $32, $41, $55, $14, $19, $50, $14, $19, $2D, $23 - db $32, $46, $19, $32, $1F, $3D, $28, $41, $32, $5A, $1E, $37, $28, $37, $4B, $28 - db $37, $4B, $3C, $55, $41, $64, $19, $32, $28, $4B, $4B, $55, $64, $37, $50, $28 - db $5A, $2D, $46, $28, $41, $32, $50, $23, $3C, $32, $50, $28, $32, $46, $69, $78 - db $87, $23, $32, $41, $46, $55, $64, $64, $78, $1E, $2D, $37, $41, $50, $28, $50 - db $5F, $78, $3A, $23, $3C, $46, $5F, $28, $41, $2D, $55, $64, $73, $82, $1E, $5A - db $73, $19, $32, $37, $50, $3C, $7D, $28, $32, $23, $23, $3C, $3C, $55, $1E, $2D - db $69, $64, $28, $46, $5F, $32, $50, $46, $64, $64, $37, $5F, $55, $55, $37, $46 - db $14, $64, $5F, $30, $41, $6E, $6E, $6E, $4B, $5A, $73, $2D, $46, $3C, $41, $7D - db $7D, $7D, $32, $46, $64, $9A, $64 diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index 6fa1f1c3..28e25d7f 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -1257,56 +1257,3 @@ TradeGameBoyGFX: INCBIN "gfx/trade/game_boy.2bpp" TradeLinkCableGFX: INCBIN "gfx/trade/link_cable.2bpp" TradeCableGFX: INCBIN "gfx/trade/cable.2bpp" TradeBubbleGFX: INCBIN "gfx/trade/bubble.2bpp" - -MACRO map_attributes_old -;\1: map name -;\2: map id -;\3: map tileset -;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none -DEF CURRENT_MAP_WIDTH = \2_WIDTH -DEF CURRENT_MAP_HEIGHT = \2_HEIGHT -\1_MapAttributes:: - db TILESET_\3 - db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH - dw \1_Blocks - dw \1_TextPointers - dw \1_ScriptLoader - db \4 - dw \1_MapEvents -ENDM - -; earlier and unreferenced versions of the Trade and Battle areas. - -UnreferencedMapPokecenterTrade: - map_attributes_old UnreferencedMapPokecenterTrade, OLD_CITY_POKECENTER_TRADE, OFFICE, 0 ; OFFICE occupies the id that CLUB used to be in. - - UnreferencedMapPokecenterTrade_ScriptLoader: - ret - - UnreferencedMapPokecenterTrade_TextPointers: - dw UnreferencedMapPokecenterTradeText1 - - UnreferencedMapPokecenterTradeText1: - text "!" - done - - UnreferencedMapPokecenterTrade_MapEvents: - UnreferencedMapPokecenterTrade_Blocks: - INCBIN "maps/OldCityPokecenterTrade.blk" - -UnreferencedMapPokecenterBattle: - map_attributes_old UnreferencedMapPokecenterBattle, OLD_CITY_POKECENTER_BATTLE, OFFICE, 0 ; OFFICE occupies the id that CLUB used to be in. - - UnreferencedMapPokecenterBattle_ScriptLoader: - jp UnreferencedMapPokecenterTrade_ScriptLoader - - UnreferencedMapPokecenterBattle_TextPointers: - dw UnreferencedMapPokecenterBattleText1 - - UnreferencedMapPokecenterBattleText1: - text "!" - done - - UnreferencedMapPokecenterBattle_MapEvents: - UnreferencedMapPokecenterBattle_Blocks: - INCBIN "maps/OldCityPokecenterBattle.blk" diff --git a/layout.link b/layout.link index 37464ef5..3c26c3b6 100644 --- a/layout.link +++ b/layout.link @@ -219,7 +219,12 @@ ROMX $09 ROMX $0a "engine/link/link.asm" + "data/pokemon/gen1_base_special.asm" "engine/movie/trade_animation.asm" + "scripts/UnusedGen1TradeCenter.asm" + "data/maps/objects/UnusedGen1TradeCenter.asm" + "scripts/UnusedGen1Colosseum.asm" + "data/maps/objects/UnusedGen1Colosseum.asm" "engine/link/link_2.asm" "slack.asm@Bank 0a Padding" diff --git a/macros/maps.asm b/macros/maps.asm index 1cd836bd..9d48b30b 100644 --- a/macros/maps.asm +++ b/macros/maps.asm @@ -10,12 +10,23 @@ MACRO map_attributes DEF CURRENT_MAP_WIDTH = \2_WIDTH DEF CURRENT_MAP_HEIGHT = \2_HEIGHT \1_MapAttributes:: +if _NARG <= 3 db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH dw \1_Blocks dw \1_TextPointers dw \1_ScriptLoader dw \1_MapEvents db \3 + else +; Gen 1 Map Attributes + db TILESET_\3 + db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH + dw \1_Blocks + dw \1_TextPointers + dw \1_ScriptLoader + db \4 + dw \1_MapEvents + endc ENDM ; Connections go in order: north, south, west, east diff --git a/ram/wram.asm b/ram/wram.asm index 56a39278..84ad26b2 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -155,6 +155,10 @@ wOptionsBattleAnimCursorX:: db wOptionsBattleStyleCursorX:: db wOptionsAudioSettingsCursorX:: db wOptionsBottomRowCursorX:: db +NEXTU +; link patch lists +wPlayerPatchLists:: ds SERIAL_PATCH_LIST_LENGTH +wOTPatchLists:: ds SERIAL_PATCH_LIST_LENGTH NEXTU ds 7 @@ -348,7 +352,7 @@ NEXTU wLinkPlayerMail:: wLinkPlayerMailPreamble:: ds SERIAL_MAIL_PREAMBLE_LENGTH wLinkPlayerMailMessages:: ds MAIL_STRUCT_LENGTH * PARTY_LENGTH -wLinkPlayerMailPatchSet:: ds 33 +wLinkPlayerMailPatchSet:: ds 35 wLinkPlayerMailEnd:: ds 10 @@ -1034,6 +1038,12 @@ NEXTU wBattleMenuRows:: db wBattleMenuColumns:: db +NEXTU +; trade +wCurTradePartyMon:: db +wCurOTTradePartyMon:: db +wBufferTrademonNickname:: ds MON_NAME_LENGTH + NEXTU wTempBoxName:: ds BOX_NAME_LENGTH @@ -1220,7 +1230,7 @@ wBattleResult:: db ds 1 wChosenStarter:: db -wcd60:: db +wCurMartCount:: db SECTION "CD70", WRAM0[$CD70] wListPointer:: dw @@ -1329,7 +1339,7 @@ wcdc4:: db wcdc5:: db wcdc6:: db -wcdc7:: db +wLinkBattleRNPreamble:: db wcdc8:: db ds 1 wEnemyItemUsed:: db @@ -1454,7 +1464,7 @@ wRepelEffect:: db wListMoves_MoveIndicesBuffer:: ds NUM_MOVES wPutativeTMHMMove:: db wce33:: ds 1 -wce34:: ds 1 +wInitListType:: ds 1 wWildMon:: db wBattleHasJustStarted:: db diff --git a/scripts/UnusedGen1Colosseum.asm b/scripts/UnusedGen1Colosseum.asm new file mode 100644 index 00000000..ac442bb5 --- /dev/null +++ b/scripts/UnusedGen1Colosseum.asm @@ -0,0 +1,15 @@ +INCLUDE "constants.asm" + +SECTION "scripts/UnusedGen1Colosseum.asm", ROMX + + map_attributes UnusedGen1Colosseum, OLD_CITY_POKECENTER_BATTLE, OFFICE, 0 + + UnusedGen1Colosseum_ScriptLoader: + jp UnusedGen1TradeCenter_ScriptLoader + + UnusedGen1Colosseum_TextPointers: + dw UnusedGen1ColosseumText1 + + UnusedGen1ColosseumText1: + text "!" + done diff --git a/scripts/UnusedGen1TradeCenter.asm b/scripts/UnusedGen1TradeCenter.asm new file mode 100644 index 00000000..5aa37840 --- /dev/null +++ b/scripts/UnusedGen1TradeCenter.asm @@ -0,0 +1,15 @@ +INCLUDE "constants.asm" + +SECTION "scripts/UnusedGen1TradeCenter.asm", ROMX + + map_attributes UnusedGen1TradeCenter, OLD_CITY_POKECENTER_TRADE, OFFICE, 0 ; OFFICE occupies the id that CLUB used to be in. + + UnusedGen1TradeCenter_ScriptLoader: + ret + + UnusedGen1TradeCenter_TextPointers: + dw UnusedGen1TradeCenterText1 + + UnusedGen1TradeCenterText1: + text "!" + done diff --git a/shim.sym b/shim.sym deleted file mode 100644 index 684e5887..00000000 --- a/shim.sym +++ /dev/null @@ -1,39 +0,0 @@ -; Link cable-related functions. -; all these probably print text -;0A:4000 Function28000 -;0A:4C98 LinkTextboxAtHL -;0A:4D6E TradeAnimation -;0A:4DA4 TradeAnimationPlayer2 -;0A:533B TradeAnim_AnimateTrademonInTube -;0A:5A1F CheckTimeCapsuleCompatibility ; prints text -;0A:5ABF Link_Receptionist_Intro ; prints text - -;23:4940 EnterMapAnim_Old -;23:49C6 Function8c9c6 -;23:4b6d FishingAnim_Old - -;38:48A2 PokerMinigame - -;38:4E5F PokerMinigame_BetAmount -;38:4EA8 PokerMinigame_YesOrNo - -; Poker Cursor AnimSeq Function -;38:5054 PokerMinigame_CursorAction - -;38:5AE3 FifteenPuzzleMinigame - -;3F:40E9 InGameDebugMenu -;3F:4E3E Functionfce3e -;3F:5B66 FightDebugMenu -;3F:64CE MonsterTest -;3F:654E MonsterTest_List -;3F:6750 MonsterTest_Cursor - -; Filler. TODO: Determine the position of all filler and preferably extract it to binary files. -;0a:5f3e Bank0a_FillerStart -;0B:786F Bank0b_FillerStart -;0e:59bc Bank0e_FillerStart -;14:7274 Bank14_FillerStart -;23:7325 Bank23_FillerStart -;3c:664e Bank3c_FillerStart -;3f:682d Bank3f_FillerStart diff --git a/tools/make_shim.py b/tools/make_shim.py deleted file mode 100755 index fe620ec8..00000000 --- a/tools/make_shim.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -from sys import argv, stderr - -def warn(s): - print("WARNING:", s.rstrip(), file=stderr) - -for i, line in enumerate(open(argv[1])): - content = line.split(";", 1)[0].strip() - - bankaddr_name = content.split(" ", 1) - if len(bankaddr_name) != 2: - continue - name = bankaddr_name[1].strip() - - bank_addr = bankaddr_name[0].split(":") - if len(bank_addr) != 2: - warn("Can't shim line %d: %s" % (i+1, line)) - continue - bank = int(bank_addr[0], 16) - addr = int(bank_addr[1], 16) - - if 0x0000 <= addr < 0x4000 and bank == 0: - section = "ROM0" - bank = None - elif 0x4000 <= addr < 0x8000 and 1 <= bank < 128: - section = "ROMX" - elif 0x8000 <= addr < 0xA000 and 0 <= bank < 2: - section = "VRAM" - elif 0xA000 <= addr < 0xC000 and 0 <= bank < 16: - section = "SRAM" - elif 0xC000 <= addr < 0xD000 and bank == 0: - section = "WRAM0" - bank = None - elif 0xD000 <= addr < 0xE000 and 0 <= bank < 16: - section = "WRAMX" - elif 0xFE00 <= addr < 0xFEA0 and bank == 0: - section = "OAM" - bank = None - elif 0xFF80 <= addr < 0xFFFF and bank == 0: - section = "HRAM" - bank = None - else: - warn("Invalid bank/address on line %d: %s" % (i+1, line)) - continue - - bankdec = ", BANK[$%x]" % bank if bank is not None else "" - print('SECTION "Shim %s", %s[$%x]%s' % (name, section, addr, bankdec)) - print("%s::" % name)