diff --git a/.github/webhook.sh b/.github/webhook.sh deleted file mode 100755 index ce454a49..00000000 --- a/.github/webhook.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -# Report unnamed symbols -content="$(tools/unnamed.py -r . pokered.sym | head)" - -curl -H 'Content-Type: application/json' -X POST "$DISCORD_WEBHOOK_URL" -d@- << EOF -{ - "username": "OK", - "avatar_url": "https://i.imgur.com/38BQHdd.png", - "content": "\`\`\`$(echo "$content" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')\`\`\`" -} -EOF diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a0da0f3..7ac61def 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,13 +48,6 @@ jobs: return 1 fi - - name: Discord webhook - if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }} - env: - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - run: | - .github/webhook.sh - - name: Checkout symbols if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }} uses: actions/checkout@master diff --git a/data/text/text_2.asm b/data/text/text_2.asm index 8c38b5b4..2dfbc7f6 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -1868,7 +1868,7 @@ _WillBeTradedText:: done _TextIDErrorText:: - text_decimal hSpriteIndexOrTextID,1,2 + text_decimal hTextID,1,2 text " ERREUR." done diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index c3ff7337..605cb1b3 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -694,7 +694,7 @@ DoBallTossSpecialEffects: ld a, [wIsInBattle] cp 2 ; is it a trainer battle? jr z, .isTrainerBattle - ld a, [wd11e] + ld a, [wPokeBallAnimData] cp $10 ; is the enemy pokemon the Ghost Marowak? ret nz ; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames @@ -2025,7 +2025,7 @@ ChangeMonPic: jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a xor a ld [wSpriteFlipped], a call GetMonHeader @@ -2037,7 +2037,7 @@ ChangeMonPic: push af ld a, [wChangeMonPicPlayerTurnSpecies] ld [wBattleMonSpecies2], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader predef LoadMonBackPic xor a ; TILEMAP_MON_PIC diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 16311f48..5956d875 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -11,7 +11,7 @@ BattleTransition: ; Determine which OAM block is being used by the enemy trainer sprite (if there ; is one). ld hl, wSpritePlayerStateData1ImageIndex - ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle) + ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle) ld c, a ld b, 0 ld de, $10 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5ba48148..9c2d177b 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1421,7 +1421,7 @@ EnemySendOutFirstMon: call PrintText ld a, [wEnemyMonSpecies2] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -1642,7 +1642,7 @@ LoadBattleMonFromParty: ld bc, wBattleMonPP - wBattleMonLevel call CopyData ld a, [wBattleMonSpecies2] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMonNicks ld a, [wPlayerMonNumber] @@ -1686,7 +1686,7 @@ LoadEnemyMonFromParty: ld bc, wEnemyMonPP - wEnemyMonLevel call CopyData ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonNicks ld a, [wWhichPokemon] @@ -2237,7 +2237,7 @@ DisplayBagMenu: UseBagItem: ; either use an item from the bag or use a safari zone item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer xor a @@ -2380,7 +2380,7 @@ PartyMenuOrRockOrRun: ; enemy mon is not minimised ld a, [wEnemyMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -3565,7 +3565,7 @@ CheckPlayerStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkPlayerStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -3655,7 +3655,7 @@ PrintMoveIsDisabledText: res CHARGING_UP, a ; end the pokemon's ld [de], a ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, MoveIsDisabledText jp PrintText @@ -3729,13 +3729,13 @@ MonName1Text: ld hl, wEnemyUsedMove .playerTurn ld [hl], a - ld [wd11e], a + ld [wMoveGrammar], a call DetermineExclamationPointTextNum ld a, [wMonIsDisobedient] and a ld hl, Used2Text ret nz - ld a, [wd11e] + ld a, [wMoveGrammar] cp 3 ld hl, Used2Text ret c @@ -3772,7 +3772,7 @@ _PrintMoveName: text_far _MoveNameText text_asm ld hl, ExclamationPointPointerTable - ld a, [wd11e] ; exclamation point num + ld a, [wMoveGrammar] add a push bc ld b, $0 @@ -3820,7 +3820,7 @@ ExclamationPoint5Text: ; but the functionality didn't get removed DetermineExclamationPointTextNum: push bc - ld a, [wd11e] ; move ID + ld a, [wMoveGrammar] ; move ID ld c, a ld b, $0 ld hl, ExclamationPointMoveSets @@ -3836,7 +3836,7 @@ DetermineExclamationPointTextNum: jr .loop .done ld a, b - ld [wd11e], a ; exclamation point num + ld [wMoveGrammar], a pop bc ret @@ -4407,7 +4407,7 @@ GetEnemyMonStat: ld a, [wEnemyMonLevel] ld [wCurEnemyLevel], a ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonDVs ld de, wLoadedMonSpeedExp @@ -4611,7 +4611,7 @@ CriticalHitTest: jr nz, .handleEnemy ld a, [wBattleMonSpecies] .handleEnemy - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHBaseSpeed] ld b, a @@ -5121,7 +5121,7 @@ MirrorMoveFailedText: ; function used to reload move data for moves like Mirror Move and Metronome ReloadMoveData: - ld [wd11e], a + ld [wNamedObjectIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -5626,7 +5626,7 @@ EnemyCanExecuteChargingMove: res CHARGING_UP, [hl] ; no longer charging up for attack res INVULNERABLE, [hl] ; no longer invulnerable to typical attacks ld a, [wEnemyMoveNum] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME @@ -6068,7 +6068,7 @@ CheckEnemyStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkEnemyStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -6099,7 +6099,7 @@ GetCurrentMove: jr nz, .selected ld a, [wPlayerSelectedMove] .selected - ld [wd0b5], a + ld [wNameListIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -6121,7 +6121,7 @@ LoadEnemyMonData: jp z, LoadEnemyMonFromParty ld a, [wEnemyMonSpecies2] ld [wEnemyMonSpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wEnemyBattleStatus3] bit TRANSFORMED, a ; is enemy mon transformed? @@ -6246,16 +6246,16 @@ LoadEnemyMonData: ld a, [hl] ; base exp ld [de], a ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wEnemyMonNick ld bc, NAME_LENGTH call CopyData ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 643afeb2..6fba347f 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1262,7 +1262,7 @@ MimicEffect: add hl, bc ld a, d ld [hl], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText @@ -1309,7 +1309,7 @@ DisableEffect: pop hl and a jr z, .pickMoveToDisable ; loop until a non-00 move slot is found - ld [wd11e], a ; store move number + ld [wNamedObjectIndex], a ; store move number push hl ldh a, [hWhoseTurn] and a @@ -1354,7 +1354,7 @@ DisableEffect: jr nz, .printDisableText inc hl ; wEnemyDisabledMoveNumber .printDisableText - ld a, [wd11e] ; move number + ld a, [wNamedObjectIndex] ; move number ld [hl], a call GetMoveName ld hl, MoveWasDisabledText diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 798d7ce1..57d37f01 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -113,8 +113,8 @@ GainExperience: ld b, 0 ld hl, wPartySpecies add hl, bc - ld a, [hl] ; species - ld [wd0b5], a + ld a, [hl] + ld [wCurSpecies], a call GetMonHeader ld d, MAX_LEVEL callfar CalcExperience ; get max exp @@ -168,9 +168,9 @@ GainExperience: ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc - ld a, [hl] ; species - ld [wd0b5], a - ld [wd11e], a + ld a, [hl] + ld [wCurSpecies], a + ld [wPokedexNum], a call GetMonHeader ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species add hl, bc @@ -251,8 +251,8 @@ GainExperience: call LoadScreenTilesFromBuffer1 xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef LearnMoveFromLevelUp ld hl, wCanEvolveFlags ld a, [wWhichPokemon] @@ -306,7 +306,7 @@ DivideExpDataByNumMonsGainingExp: jr nz, .countSetBitsLoop cp $2 ret c ; return if only one mon is gaining exp - ld [wd11e], a ; store number of mons gaining exp + ld [wTempByteValue], a ; store number of mons gaining exp ld hl, wEnemyMonBaseStats ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats .divideLoop @@ -314,7 +314,7 @@ DivideExpDataByNumMonsGainingExp: ldh [hDividend], a ld a, [hl] ldh [hDividend + 1], a - ld a, [wd11e] + ld a, [wTempByteValue] ldh [hDivisor], a ld b, $2 call Divide ; divide value by number of mons gaining exp diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index 82be49e0..a0e869fc 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -1,5 +1,5 @@ GetTrainerName_:: - ld hl, wGrassRate + ld hl, wLinkEnemyTrainerName ld a, [wLinkState] and a jr nz, .foundName @@ -11,7 +11,7 @@ GetTrainerName_:: jr z, .foundName cp RIVAL3 jr z, .foundName - ld [wd0b5], a + ld [wNameListIndex], a ld a, TRAINER_NAME ld [wNameListType], a ld a, BANK(TrainerNames) diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 1fa84e15..66675dbf 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -8,7 +8,7 @@ FormatMovesString: and a ; end of move list? jr z, .printDashLoop ; print dashes when no moves are left push hl - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 56dda7f4..6f2e705c 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -116,7 +116,7 @@ TransformEffect_: ; original (unmodified) stats and stat mods pop hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wEnemyMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack diff --git a/engine/battle/print_type.asm b/engine/battle/print_type.asm index 7da0dc8c..e7c6729c 100644 --- a/engine/battle/print_type.asm +++ b/engine/battle/print_type.asm @@ -1,4 +1,4 @@ -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID ; hl = dest addr PrintMonType: call GetPredefRegisters diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index a61f402f..ca3ff8a2 100644 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -16,7 +16,7 @@ PrintSafariZoneBattleText: jr nz, .done push hl ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHCatchRate] ld [wEnemyMonActualCatchRate], a diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index e21a3492..5eed1ae5 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -732,7 +732,7 @@ AIPrintItemUse: AIPrintItemUse_: ; print "x used [wAIItem] on z!" ld a, [wAIItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, AIBattleUseItemText jp PrintText diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index ea451bcf..b5cf9f51 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -90,7 +90,7 @@ TryDoWildEncounter: .lastRepelStep ld [wRepelRemainingSteps], a ld a, TEXT_REPEL_WORE_OFF - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call EnableAutoTextBoxDrawing call DisplayTextID .CantEncounter2 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index b052d3e2..1597e12b 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -28,7 +28,7 @@ PrintCardKeyText: call GetCoordsInFrontOfPlayer push de tx_pre_id CardKeySuccessText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call PrintPredefTextID pop de srl d @@ -55,7 +55,7 @@ PrintCardKeyText: jp PlaySound .noCardKey tx_pre_id CardKeyFailText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp PrintPredefTextID INCLUDE "data/events/card_key_maps.asm" diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 171fa99a..d8066fb8 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -98,7 +98,7 @@ PrintFossilsInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] @@ -114,10 +114,10 @@ PrintFossilsInBag: ; loads the names of the fossil item and the resulting mon LoadFossilItemAndMonName:: ld a, [wFossilMon] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName call CopyToStringBuffer ld a, [wFossilItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ret diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index 68d48bb3..46b45d77 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -8,7 +8,7 @@ _DisplayPokedex:: ld c, 10 call DelayFrames predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm index 9472f49f..9e80bdfc 100644 --- a/engine/events/give_pokemon.asm +++ b/engine/events/give_pokemon.asm @@ -54,16 +54,16 @@ _GivePokemon:: SetPokedexOwnedFlag: ld a, [wCurPartySpecies] push af - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld hl, wPokedexOwned ld b, FLAG_SET predef FlagActionPredef pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, GotMonText jp PrintText diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm index 0c6ec1ea..8bf162a7 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -84,7 +84,7 @@ HealParty: .done xor a ld [wWhichPokemon], a - ld [wd11e], a + ld [wUsingPPUp], a ld a, [wPartyCount] ld b, a diff --git a/engine/events/hidden_items.asm b/engine/events/hidden_items.asm index 97bb0b71..e42f60f9 100644 --- a/engine/events/hidden_items.asm +++ b/engine/events/hidden_items.asm @@ -14,7 +14,7 @@ HiddenItems: ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, [wHiddenObjectFunctionArgument] ; item ID - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName tx_pre_jump FoundHiddenItemText diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index e996e471..df74293f 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -35,7 +35,7 @@ DisplayMonFrontSpriteInBox: call DisplayTextBoxID call UpdateSprites ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vChars1 tile $31 call LoadMonFrontSprite diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index 6fac1afa..fc014ce0 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -41,7 +41,7 @@ SafariZoneGameOver: cp SFX_SAFARI_ZONE_PA jr nz, .waitForMusicToPlay ld a, TEXT_SAFARI_GAME_OVER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wPlayerMovingDirection], a diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index d3575689..ce4ffe3c 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -77,7 +77,7 @@ DoInGameTradeDialogue: ; copies name of species a to hl InGameTrade_GetMonName: push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer pop de diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 548db5be..8fbdcfa2 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -1,7 +1,7 @@ PickUpItem: call EnableAutoTextBoxDrawing - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld b, a ld hl, wMissableObjectList .missableObjectsListLoop @@ -18,7 +18,7 @@ PickUpItem: ldh [hMissableObjectIndex], a ld hl, wMapSpriteExtraData - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] dec a add a ld d, 0 diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 513d08a7..752899f7 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -44,7 +44,7 @@ ApplyOutOfBattlePoisonDamage: inc hl ld [hl], a ld a, [de] - ld [wd11e], a + ld [wPokedexNum], a push de ld a, [wWhichPokemon] ld hl, wPartyMonNicks @@ -53,7 +53,7 @@ ApplyOutOfBattlePoisonDamage: ld [wJoyIgnore], a call EnableAutoTextBoxDrawing ld a, TEXT_MON_FAINTED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID pop de pop hl @@ -100,7 +100,7 @@ ApplyOutOfBattlePoisonDamage: jr nz, .noBlackOut call EnableAutoTextBoxDrawing ld a, TEXT_BLACKED_OUT - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags4 set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index 10b6dba2..b280c711 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -157,7 +157,7 @@ DisplayPokemartDialogue_:: inc a jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button ld a, [wCurItem] - ld [wd11e], a ; store item ID for GetItemName + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, PokemartTellBuyPriceText diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index 579c2147..9e99ac3a 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -56,17 +56,14 @@ WhichPrizeTextPtr: text_end GetPrizeMenuId: -; determine which one among the three -; prize-texts has been selected -; using the text ID (stored in [hSpriteIndexOrTextID]) -; load the three prizes at wd13d-wd13f -; load the three prices at wd141-wd146 -; display the three prizes' names -; (distinguishing between Pokemon names -; and Items (specifically TMs) names) - ldh a, [hSpriteIndexOrTextID] - sub 3 ; prize-texts' id are 3, 4 and 5 - ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) +; determine which one among the three prize texts has been selected using the text ID (stored in [hTextID]) +; prize texts' IDs are TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1-TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3 +; load the three prizes at wPrize1-wPrice3 +; load the three prices at wPrize1Price-wPrize3Price +; display the three prizes' names, distinguishing between Pokemon names and item names (specifically TMs) + ldh a, [hTextID] + sub TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 + ld [wWhichPrizeWindow], a ; prize texts' relative ID (i.e. 0-2) add a add a ld d, 0 @@ -88,37 +85,37 @@ GetPrizeMenuId: ld bc, 6 call CopyData ld a, [wWhichPrizeWindow] - cp 2 ;is TM_menu? + cp 2 ; is TM_menu? jr nz, .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 8 call PlaceString jr .putNoThanksText .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 8 call PlaceString @@ -189,7 +186,7 @@ HandlePrizeChoice: ld hl, wPrize1 add hl, de ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a ld a, [wWhichPrizeWindow] cp 2 ; is prize a TM? jr nz, .getMonName @@ -208,9 +205,9 @@ HandlePrizeChoice: call HasEnoughCoins jr c, .notEnoughCoins ld a, [wWhichPrizeWindow] - cp $02 + cp 2 ; is prize a TM? jr nz, .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld b, a ld a, 1 ld c, a @@ -218,7 +215,7 @@ HandlePrizeChoice: jr nc, .bagFull jr .subtractCoins .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurPartySpecies], a push af call GetPrizeMonLevel diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 53fabc6d..e7016a1d 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -258,9 +258,9 @@ WriteMonPartySpriteOAM: jp CopyData GetPartyMonSpriteID: - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] ld c, a dec a srl a diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index f0ffc5e8..892a5698 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -275,13 +275,13 @@ DeterminePaletteID: ret nz ld a, [hl] DeterminePaletteIDOutOfBattle: - ld [wd11e], a + ld [wPokedexNum], a and a ; is the mon index 0? jr z, .skipDexNumConversion push bc predef IndexToPokedex pop bc - ld a, [wd11e] + ld a, [wPokedexNum] .skipDexNumConversion ld e, a ld d, 0 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 195f4d94..b3f01d12 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -510,7 +510,7 @@ ItemUseBall: ld a, [wEnemyMonSpecies] ld [wCapturedMonSpecies], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, [wBattleType] dec a ; is this the old man battle? jr z, .oldManCaughtMon ; if so, don't give the player the caught Pokémon @@ -520,7 +520,7 @@ ItemUseBall: ; Add the caught Pokémon to the Pokédex. predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -528,7 +528,7 @@ ItemUseBall: predef FlagActionPredef ld a, c push af - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -542,7 +542,7 @@ ItemUseBall: call PrintText call ClearSprites ld a, [wEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef ShowPokedexData .skipShowingPokedexData @@ -688,11 +688,11 @@ ItemUseSurfboard: jp PrintText .tryToStopSurfing xor a - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 res 7, [hl] - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing ld hl, TilePairCollisionsWater @@ -842,7 +842,7 @@ ItemUseMedicine: ld d, a ld a, [wCurPartySpecies] ld e, a - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurItem], a pop af @@ -1254,8 +1254,8 @@ ItemUseMedicine: .useVitamin push hl ld a, [hl] - ld [wd0b5], a - ld [wd11e], a + ld [wCurSpecies], a + ld [wPokedexNum], a ld bc, wPartyMon1Level - wPartyMon1 add hl, bc ; hl now points to level ld a, [hl] ; a = level @@ -1396,7 +1396,7 @@ ItemUseMedicine: ld a, d ld [wWhichPokemon], a ld a, e - ld [wd11e], a + ld [wPokedexNum], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData @@ -1988,7 +1988,7 @@ ItemUsePPRestore: call GetSelectedMoveOffset push hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer pop hl @@ -2009,7 +2009,7 @@ ItemUsePPRestore: add 1 << 6 ; increase PP Up count by 1 ld [hl], a ld a, 1 ; 1 PP Up used - ld [wd11e], a + ld [wUsingPPUp], a call RestoreBonusPP ; add the bonus PP to current PP ld hl, PPIncreasedText call PrintText @@ -2162,9 +2162,9 @@ ItemUseTMHM: add NUM_TMS + NUM_HMS ; adjust HM IDs to come after TM IDs .skipAdding inc a - ld [wd11e], a + ld [wTempTMHM], a predef TMToMove ; get move ID from TM/HM ID - ld a, [wd11e] + ld a, [wTempTMHM] ld [wMoveNum], a call GetMoveName call CopyToStringBuffer @@ -2512,9 +2512,10 @@ GetMaxPP: and %11000000 ; get PP Up count pop bc or b ; place normal max PP in 6 lower bits of a + assert wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP ld h, d ld l, e - inc hl ; hl = wcd73 + inc hl ; hl = wPPUpCountAndMaxPP ld [hl], a xor a ; add the bonus for the existing PP Up count ld [wUsingPPUp], a @@ -2557,7 +2558,7 @@ TossItem_:: jr nz, .tooImportantToToss push hl ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, IsItOKToTossItemText @@ -2577,7 +2578,7 @@ TossItem_:: ld a, [wWhichPokemon] call RemoveItemFromInventory ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, ThrewAwayItemText @@ -2650,7 +2651,7 @@ SendNewMonToBox: inc a ld [de], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a ld c, a .loop inc de @@ -2892,7 +2893,7 @@ ItemUseReloadOverworldData: call LoadCurrentMapView jp UpdateSprites -; creates a list at wBuffer of maps where the mon in [wd11e] can be found. +; creates a list at wBuffer of maps where the mon in [wPokedexNum] can be found. ; this is used by the pokedex to display locations the mon can be found on the map. FindWildLocationsOfMon: ld hl, WildDataPointers @@ -2927,7 +2928,7 @@ CheckMapForMon: inc hl ld b, NUM_WILDMONS .loop - ld a, [wd11e] + ld a, [wPokedexNum] cp [hl] jr nz, .nextEntry ld a, c diff --git a/engine/items/tms.asm b/engine/items/tms.asm index f3c6db98..2da15fab 100644 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -1,7 +1,7 @@ ; tests if mon [wCurPartySpecies] can learn move [wMoveNum] CanLearnTM: ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHLearnset push hl @@ -20,17 +20,17 @@ CanLearnTM: ld b, FLAG_TEST predef_jump FlagActionPredef -; converts TM/HM number in wd11e into move number +; converts TM/HM number in [wTempTMHM] into move number ; HMs start at 51 TMToMove: - ld a, [wd11e] + ld a, [wTempTMHM] dec a ld hl, TechnicalMachines ld b, $0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wTempTMHM], a ret INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 3a714d3a..a6631d48 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -660,7 +660,7 @@ TradeCenter_PrintPartyListNames: ld a, [de] cp $ff ret z - ld [wd11e], a + ld [wNamedObjectIndex], a push bc push hl push de @@ -697,7 +697,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wNameOfPlayerMonToBeTraded @@ -709,7 +709,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, WillBeTradedText bccoord 1, 14 diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index 7f2c1a59..a89696fb 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -5,7 +5,7 @@ DisplayTextIDInit:: ld a, [wAutoTextBoxDrawingControl] bit 0, a jr nz, .skipDrawingTextBoxBorder - ldh a, [hSpriteIndexOrTextID] ; text ID (or sprite ID) + ldh a, [hTextID] and a jr nz, .notStartMenu ; if text ID is 0 (i.e. the start menu) diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 95107210..91a44ba8 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -84,7 +84,7 @@ LeaguePCShowMon: ld a, [hli] ld [wHoFMonSpecies], a ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [hli] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 08ff26b0..833fb783 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -9,7 +9,7 @@ AskName: ld c, 11 call z, ClearScreenArea ; only if in wild battle ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, DoYouWantToNicknameText call PrintText @@ -466,7 +466,7 @@ PrintNamingText: push af farcall WriteMonPartySpriteOAMBySpecies pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 4, 1 call PlaceString diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index fb1aa65e..b2ac916b 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -9,7 +9,7 @@ ShowPokedexMenu: ld [wListScrollOffset], a ld [wLastMenuItem], a inc a - ld [wd11e], a + ld [wPokedexNum], a ldh [hJoy7], a .setUpGraphics ld b, SET_PAL_GENERIC @@ -68,8 +68,8 @@ HandlePokedexSideMenu: push af add b inc a - ld [wd11e], a - ld a, [wd11e] + ld [wPokedexNum], a + ld a, [wPokedexNum] push af ld a, [wDexMaxSeenMon] push af ; this doesn't need to be preserved @@ -111,7 +111,7 @@ HandlePokedexSideMenu: pop af ld [wDexMaxSeenMon], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop af ld [wListScrollOffset], a pop af @@ -142,7 +142,7 @@ HandlePokedexSideMenu: ; play pokemon cry .choseCry - ld a, [wd11e] + ld a, [wPokedexNum] call GetCryData call PlaySound jr .handleMenuInput @@ -222,7 +222,7 @@ HandlePokedexListMenu: call ClearScreenArea hlcoord 1, 3 ld a, [wListScrollOffset] - ld [wd11e], a + ld [wPokedexNum], a ld d, 7 ld a, [wDexMaxSeenMon] cp 7 @@ -233,17 +233,17 @@ HandlePokedexListMenu: ; loop to print pokemon pokedex numbers and names ; if the player has owned the pokemon, it puts a pokeball beside the name .printPokemonLoop - ld a, [wd11e] + ld a, [wPokedexNum] inc a - ld [wd11e], a + ld [wPokedexNum], a push af push de push hl ld de, -SCREEN_WIDTH add hl, de - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 - call PrintNumber ; print the pokedex number + call PrintNumber ld de, SCREEN_WIDTH add hl, de dec hl @@ -276,7 +276,7 @@ HandlePokedexListMenu: add hl, bc pop de pop af - ld [wd11e], a + ld [wPokedexNum], a dec d jr nz, .printPokemonLoop ld a, 01 @@ -376,10 +376,10 @@ PokedexMenuItemsText: ; tests if a pokemon's bit is set in the seen or owned pokemon bit fields ; INPUT: -; [wd11e] = pokedex number +; [wPokedexNum] = pokedex number ; hl = address of bit field IsPokemonBitSet: - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -403,13 +403,13 @@ ShowPokedexDataInternal: ldh [rNR50], a call GBPalWhiteOut ; zero all palettes call ClearScreen - ld a, [wd11e] ; pokemon ID + ld a, [wPokedexNum] ld [wCurPartySpecies], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand pop af - ld [wd11e], a + ld [wPokedexNum], a ldh a, [hTileAnimations] push af xor a @@ -455,7 +455,7 @@ ShowPokedexDataInternal: call PlaceString ld hl, PokedexEntryPointers - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld e, a ld d, 0 @@ -471,7 +471,7 @@ ShowPokedexDataInternal: ld h, b ld l, c push de - ld a, [wd11e] + ld a, [wPokedexNum] push af call IndexToPokedex @@ -480,16 +480,16 @@ ShowPokedexDataInternal: ld [hli], a ld a, "" ld [hli], a - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number ld hl, wPokedexOwned call IsPokemonBitSet pop af - ld [wd11e], a + ld [wPokedexNum], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a pop de push af @@ -626,10 +626,10 @@ DrawTileLine: INCLUDE "data/pokemon/dex_entries.asm" PokedexToIndex: - ; converts the Pokédex number at wd11e to an index + ; converts the Pokédex number at [wPokedexNum] to an index push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] ld b, a ld c, 0 ld hl, PokedexOrder @@ -641,23 +641,23 @@ PokedexToIndex: jr nz, .loop ld a, c - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret IndexToPokedex: - ; converts the index number at wd11e to a Pokédex number + ; converts the index number at [wPokedexNum] to a Pokédex number push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, PokedexOrder ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index a83c2be3..e74933a3 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -365,7 +365,7 @@ StartMenu_Item:: jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld a, [wCurItem] diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index d449eb98..d9cc4156 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -60,7 +60,7 @@ DisplayCreditsMon: add hl, bc ; go that far in the list of monsters and get the next one ld a, [hl] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 8, 6 call GetMonHeader call LoadFrontSpriteByMonIndex diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index d7a47885..69463bfa 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -4,7 +4,7 @@ EvolveMon: push bc ld a, [wCurPartySpecies] push af - ld a, [wd0b5] + ld a, [wCurSpecies] push af xor a ld [wLowHealthAlarm], a @@ -26,7 +26,7 @@ EvolveMon: call EvolutionSetWholeScreenPalette ld a, [wEvoNewSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld de, vFrontPic ld hl, vBackPic @@ -34,7 +34,7 @@ EvolveMon: call CopyVideoData ld a, [wEvoOldSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld a, $1 ldh [hAutoBGTransferEnabled], a @@ -75,7 +75,7 @@ EvolveMon: ld c, 0 call EvolutionSetWholeScreenPalette pop af - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurPartySpecies], a pop bc diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 46d536bc..df1478d5 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -102,7 +102,7 @@ HoFShowMonOrPlayer: ldh [hSCX], a ld a, [wHoFMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [wHoFMonOrPlayer] @@ -171,7 +171,7 @@ HoFDisplayMonInfo: hlcoord 8, 7 call PrintLevelCommon ld a, [wHoFMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 3, 9 predef PrintMonType ld a, [wHoFMonSpecies] diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index ded8a7c3..44b236c8 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -73,7 +73,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld a, NIDORINO - ld [wd0b5], a + ld [wCurSpecies], a ld [wCurPartySpecies], a call GetMonHeader hlcoord 6, 4 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index e26a31bc..92641b92 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -362,7 +362,7 @@ ClearBothBGMaps: LoadTitleMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 5, 10 call GetMonHeader jp LoadFrontSpriteByMonIndex diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index a7ccb6b8..14a53a24 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -186,14 +186,14 @@ LoadTradingGFXAndMonNames: xor a ldh [hAutoBGTransferEnabled], a ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wStringBuffer ld bc, NAME_LENGTH call CopyData ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a jp GetMonName Trade_LoadMonPartySpriteGfx: @@ -728,7 +728,7 @@ Trade_CircleOAM3: ; a = species Trade_LoadMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wWholeScreenPaletteMonSpecies], a ld b, SET_PAL_POKEMON_WHOLE_SCREEN ld c, 0 diff --git a/engine/movie/trade2.asm b/engine/movie/trade2.asm index 81ab29ea..b18130b5 100644 --- a/engine/movie/trade2.asm +++ b/engine/movie/trade2.asm @@ -3,10 +3,10 @@ Trade_PrintPlayerMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 0 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 2 @@ -25,10 +25,10 @@ Trade_PrintEnemyMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 10 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 12 diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 7eee844c..ff481439 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -6,15 +6,15 @@ TryPushingBoulder:: bit BIT_BOULDER_DUST, a ret nz xor a - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call IsSpriteInFrontOfPlayer - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wBoulderSpriteIndex], a and a jp z, ResetBoulderPushFlags ld hl, wSpritePlayerStateData1MovementStatus ld d, $0 - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] swap a ld e, a add hl, de diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index ab167a24..7eaca222 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -65,7 +65,7 @@ _AddPartyMon:: ld d, h push hl ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHeader ld a, [hli] @@ -81,11 +81,11 @@ _AddPartyMon:: ; If the mon is being added to the player's party, update the pokedex. ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a push de predef IndexToPokedex pop de - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -93,7 +93,7 @@ _AddPartyMon:: call FlagAction ld a, c ; whether the mon was already flagged as owned ld [wUnusedAlreadyOwnedFlag], a - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -323,9 +323,9 @@ _AddEnemyMonToPlayerParty:: ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index aae6cb87..268e522a 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -135,7 +135,7 @@ Evolution_PartyMonLoop: ; loop over party mons call PrintText pop hl ld a, [hl] - ld [wd0b5], a + ld [wCurSpecies], a ld [wLoadedMonSpecies], a ld [wEvoNewSpecies], a ld a, MONSTER_NAME @@ -153,22 +153,22 @@ Evolution_PartyMonLoop: ; loop over party mons call DelayFrames call ClearScreen call RenameEvolvedMon - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, BaseStats ld bc, BASE_DATA_SIZE call AddNTimes ld de, wMonHeader call CopyData - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 @@ -203,8 +203,8 @@ Evolution_PartyMonLoop: ; loop over party mons dec hl pop bc call CopyData - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a xor a ld [wMonDataLocation], a call LearnMoveFromLevelUp @@ -214,7 +214,7 @@ Evolution_PartyMonLoop: ; loop over party mons and a call z, Evolution_ReloadTilesetTilePatterns predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -260,13 +260,14 @@ Evolution_PartyMonLoop: ; loop over party mons RenameEvolvedMon: ; Renames the mon to its new, evolved form's standard name unless it had a ; nickname, in which case the nickname is kept. - ld a, [wd0b5] + assert wCurSpecies == wNameListIndex ; save+restore wCurSpecies while using wNameListIndex + ld a, [wCurSpecies] push af ld a, [wMonHIndex] - ld [wd0b5], a + ld [wNameListIndex], a call GetName pop af - ld [wd0b5], a + ld [wCurSpecies], a ld hl, wNameBuffer ld de, wStringBuffer .compareNamesLoop @@ -319,7 +320,7 @@ Evolution_ReloadTilesetTilePatterns: LearnMoveFromLevelUp: ld hl, EvosMovesPointerTable - ld a, [wd11e] ; species + ld a, [wPokedexNum] ; species ld [wCurPartySpecies], a dec a ld bc, 0 @@ -366,13 +367,13 @@ LearnMoveFromLevelUp: jr nz, .checkCurrentMovesLoop ld a, d ld [wMoveNum], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer predef LearnMove .done ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a ret ; writes the moves a mon has at level [wCurEnemyLevel] to [de] diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 427d2a7f..d651321a 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -1,7 +1,7 @@ ; calculates the level a mon should be based on its current exp CalcLevelFromExperience:: ld a, [wLoadedMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld d, $1 ; init level to 1 .loop diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 981fe13a..2df9964e 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -29,7 +29,7 @@ DontAbandonLearning: jp c, AbandonLearning push hl push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, OneTwoAndText call PrintText diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index 3d0548e0..7a39f083 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -19,7 +19,7 @@ LoadMonData_:: .GetMonHeader ld a, [wCurPartySpecies] - ld [wd0b5], a ; input for GetMonHeader + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMons diff --git a/engine/pokemon/set_types.asm b/engine/pokemon/set_types.asm index e9235f13..2cf8f14c 100644 --- a/engine/pokemon/set_types.asm +++ b/engine/pokemon/set_types.asm @@ -1,10 +1,10 @@ -; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in wd11e +; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in [wPokedexNum] SetPartyMonTypes: call GetPredefRegisters ld bc, wPartyMon1Type - wPartyMon1 ; $5 add hl, bc - ld a, [wd11e] - ld [wd0b5], a + ld a, [wPokedexNum] + ld [wCurSpecies], a push hl call GetMonHeader pop hl diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 35a175ed..3f2065d6 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -139,11 +139,11 @@ StatusScreen: hlcoord 14, 2 call PrintLevel ; Pokémon level ld a, [wMonHIndex] - ld [wd11e], a - ld [wd0b5], a + ld [wPokedexNum], a + ld [wCurSpecies], a predef IndexToPokedex hlcoord 3, 7 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; Pokémon no. hlcoord 11, 10 @@ -420,7 +420,7 @@ StatusScreen2: hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 9, 1 call PlaceString diff --git a/home/give.asm b/home/give.asm index 8ede4ea4..9f51450a 100644 --- a/home/give.asm +++ b/home/give.asm @@ -3,7 +3,7 @@ GiveItem:: ; and copy the item's name to wStringBuffer. ; Return carry on success. ld a, b - ld [wd11e], a + ld [wNamedObjectIndex], a ld [wCurItem], a ld a, c ld [wItemQuantity], a diff --git a/home/list_menu.asm b/home/list_menu.asm index ce64ecff..61c5aece 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -141,7 +141,7 @@ DisplayListMenuIDLoop:: ld [wMaxItemQuantity], a .skipGettingQuantity ld a, [wCurItem] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(ItemNames) ld [wPredefBank], a call GetName @@ -369,7 +369,7 @@ PrintListMenuEntries:: ld a, b ld [wWhichPokemon], a ld a, [de] - ld [wd11e], a + ld [wNamedObjectIndex], a cp $ff jp z, .printCancelMenuItem push bc @@ -430,7 +430,7 @@ PrintListMenuEntries:: and a ; PCPOKEMONLISTMENU? jr nz, .skipPrintingPokemonLevel .printPokemonLevel - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af push hl ld hl, wPartyCount @@ -463,7 +463,7 @@ PrintListMenuEntries:: add hl, bc call PrintLevel pop af - ld [wd11e], a + ld [wNamedObjectIndex], a .skipPrintingPokemonLevel pop hl pop de @@ -472,7 +472,7 @@ PrintListMenuEntries:: cp ITEMLISTMENU jr nz, .nextListEntry .printItemQuantity - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurItem], a call IsKeyItem ; check if item is unsellable ld a, [wIsKeyItem] @@ -483,18 +483,18 @@ PrintListMenuEntries:: add hl, bc ld a, "×" ld [hli], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af ld a, [de] ld [wMaxItemQuantity], a push de - ld de, wd11e + ld de, wTempByteValue ld [de], a lb bc, 1, 2 call PrintNumber pop de pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop hl .skipPrintingItemQuantity inc de diff --git a/home/map_objects.asm b/home/map_objects.asm index 01dd8b6a..342139dd 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -71,7 +71,7 @@ IsItemInBag:: ret DisplayPokedex:: - ld [wd11e], a + ld [wPokedexNum], a farjp _DisplayPokedex SetSpriteFacingDirectionAndDelay:: diff --git a/home/names.asm b/home/names.asm index 20034c75..a5915c41 100644 --- a/home/names.asm +++ b/home/names.asm @@ -5,7 +5,7 @@ GetMonName:: ld a, BANK(MonsterNames) ldh [hLoadedROMBank], a ld [MBC1RomBank], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] dec a ld hl, MonsterNames ld c, NAME_LENGTH - 1 @@ -25,14 +25,14 @@ GetMonName:: ret GetItemName:: -; given an item ID at [wd11e], store the name of the item in wNameBuffer +; given an item ID at [wNamedObjectIndex], store the name of the item in wNameBuffer push hl push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] cp HM01 ; is this a TM/HM? jr nc, .Machine - ld [wd0b5], a + ld [wNameListIndex], a ld a, ITEM_NAME ld [wNameListType], a ld a, BANK(ItemNames) @@ -49,18 +49,18 @@ GetItemName:: ret GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wNameBuffer +; copies the name of the TM/HM in [wNamedObjectIndex] to wNameBuffer push hl push de push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af cp TM01 ; is this a TM? [not HM] jr nc, .WriteTM ; if HM, then write "HM" and add NUM_HMS to the item ID, so we can reuse the ; TM printing code add NUM_HMS - ld [wd11e], a + ld [wNamedObjectIndex], a ld hl, HiddenPrefix ; points to "HM" ld bc, 2 jr .WriteMachinePrefix @@ -72,7 +72,7 @@ GetMachineName:: call CopyData ; now get the machine number and convert it to text - ld a, [wd11e] + ld a, [wNamedObjectIndex] sub TM01 - 1 ld b, "0" .FirstDigit @@ -94,7 +94,7 @@ GetMachineName:: ld a, "@" ld [de], a pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop bc pop de pop hl @@ -130,8 +130,8 @@ GetMoveName:: push hl ld a, MOVE_NAME ld [wNameListType], a - ld a, [wd11e] - ld [wd0b5], a + ld a, [wNamedObjectIndex] + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a call GetName diff --git a/home/names2.asm b/home/names2.asm index cd3823fd..3bb6980c 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -10,13 +10,13 @@ NamePointers:: GetName:: ; arguments: -; [wd0b5] = which name +; [wNameListIndex] = which name ; [wNameListType] = which list ; [wPredefBank] = bank of list ; ; returns pointer to name in de - ld a, [wd0b5] - ld [wd11e], a + ld a, [wNameListIndex] + ld [wNamedObjectIndex], a ; TM names are separate from item names. ; BUG: This applies to all names instead of just items. @@ -67,7 +67,7 @@ GetName:: ld h, a ldh a, [hSwapTemp + 1] ld l, a - ld a, [wd0b5] + ld a, [wNameListIndex] ld b, a ; wanted entry ld c, 0 ; entry counter .nextName diff --git a/home/overworld.asm b/home/overworld.asm index 805a1b60..1595fdf0 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -76,7 +76,7 @@ OverworldLoopLessDelay:: jr z, .startButtonNotPressed ; if START is pressed xor a ; TEXT_START_MENU - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp .displayDialogue .startButtonNotPressed bit BIT_A_BUTTON, a @@ -92,7 +92,7 @@ OverworldLoopLessDelay:: and a jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found call IsSpriteOrSignInFrontOfPlayer - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] and a jp z, OverworldLoop .displayDialogue @@ -1072,11 +1072,11 @@ LoadEastWestConnectionsTileMap:: ret ; function to check if there is a sign or sprite in front of the player -; if so, it is stored in [hSpriteIndexOrTextID] -; if not, [hSpriteIndexOrTextID] is set to 0 +; if so, it is stored in [hTextID] +; if not, [hTextID] is set to 0 IsSpriteOrSignInFrontOfPlayer:: xor a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ld a, [wNumSigns] and a jr z, .extendRangeOverCounter @@ -1106,7 +1106,7 @@ IsSpriteOrSignInFrontOfPlayer:: dec c add hl, bc ld a, [hl] - ldh [hSpriteIndexOrTextID], a ; store sign text ID + ldh [hTextID], a ; store sign text ID pop bc pop hl ret @@ -1127,7 +1127,7 @@ IsSpriteOrSignInFrontOfPlayer:: jr nz, .counterTilesLoop ; part of the above function, but sometimes its called on its own, when signs are irrelevant -; the caller must zero [hSpriteIndexOrTextID] +; the caller must zero [hTextID] IsSpriteInFrontOfPlayer:: ld d, $10 ; talking range in pixels (normal range) IsSpriteInFrontOfPlayer2:: @@ -1212,7 +1212,7 @@ IsSpriteInFrontOfPlayer2:: ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS set 7, [hl] ; set flag to make the sprite face the player ld a, e - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ret ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) @@ -1231,9 +1231,9 @@ CollisionCheckOnLand:: and d ; check if a sprite is in the direction the player is trying to go jr nz, .collision xor a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision? - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] and a ; was there a sprite collision? jr nz, .collision ; if no sprite collision diff --git a/home/pokemon.asm b/home/pokemon.asm index d1be0f43..39b7d0ec 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -99,12 +99,12 @@ LoadFlippedFrontSpriteByMonIndex:: LoadFrontSpriteByMonIndex:: push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld hl, wd11e + ld hl, wPokedexNum ld a, [hl] pop bc ld [hl], b @@ -353,8 +353,8 @@ PrintLevelFull:: ld a, [wLoadedMonLevel] ; level PrintLevelCommon:: - ld [wd11e], a - ld de, wd11e + ld [wTempByteValue], a + ld de, wTempByteValue ld b, LEFT_ALIGN | 1 ; 1 byte jp PrintNumber @@ -369,7 +369,7 @@ GetwMoves:: ; copies the base stat data of a pokemon to wMonHeader ; INPUT: -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID GetMonHeader:: ldh a, [hLoadedROMBank] push af @@ -379,10 +379,10 @@ GetMonHeader:: push bc push de push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a ld de, FossilKabutopsPic ld b, $66 ; size of Kabutops fossil and Ghost sprites cp FOSSIL_KABUTOPS ; Kabutops fossil @@ -396,8 +396,8 @@ GetMonHeader:: jr z, .specialID cp MEW jr z, .mew - predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a, [wd11e] + predef IndexToPokedex + ld a, [wPokedexNum] dec a ld bc, BASE_DATA_SIZE ld hl, BaseStats @@ -421,10 +421,10 @@ GetMonHeader:: ld a, BANK(MewBaseStats) call FarCopyData .done - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop hl pop de pop bc diff --git a/home/predef_text.asm b/home/predef_text.asm index 1537ad5b..bdecd3cf 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -1,5 +1,5 @@ PrintPredefTextID:: - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag diff --git a/home/text.asm b/home/text.asm index 83bf97ee..bdb7adb6 100644 --- a/home/text.asm +++ b/home/text.asm @@ -117,13 +117,13 @@ NullChar:: ; unused pop hl ; A "" character in a printed string ; displays an error message with the current value - ; of hSpriteIndexOrTextID in decimal format. + ; of hTextID in decimal format. ; This is a debugging leftover. ld de, TextIDErrorText dec de ret -TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR." +TextIDErrorText:: ; "[hTextID] ERROR." text_far _TextIDErrorText text_end diff --git a/home/text_script.asm b/home/text_script.asm index 6df4a0a1..f83fced1 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -1,6 +1,7 @@ ; this function is used to display sign messages, sprite dialog, etc. -; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID +; INPUT: [hSpriteIndex] = sprite ID or [hTextID] = text ID DisplayTextID:: + assert hSpriteIndex == hTextID ; these are at the same memory location ldh a, [hLoadedROMBank] push af farcall DisplayTextIDInit ; initialization @@ -18,7 +19,7 @@ DisplayTextID:: ld h, [hl] ld l, a ; hl = map text pointer ld d, $00 - ldh a, [hSpriteIndexOrTextID] ; text ID + ldh a, [hTextID] ld [wSpriteIndex], a dict TEXT_START_MENU, DisplayStartMenu @@ -29,7 +30,7 @@ DisplayTextID:: ld a, [wNumSprites] ld e, a - ldh a, [hSpriteIndexOrTextID] ; sprite ID + ldh a, [hSpriteIndex] ; sprite ID cp e jr z, .spriteHandling jr nc, .skipSpriteHandling @@ -42,7 +43,7 @@ DisplayTextID:: pop bc pop de ld hl, wMapSpriteData ; NPC text entries - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] dec a add a add l diff --git a/home/trainers.asm b/home/trainers.asm index 0038d48c..0a466cc1 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -7,7 +7,7 @@ StoreTrainerHeaderPointer:: ret ; executes the current map script from the function pointer array provided in de. -; a: map script index to execute (unless overridden by [wd733] bit 4) +; a: map script index to execute (unless overridden by [wStatusFlags7] BIT_USE_CUR_MAP_SCRIPT) ; hl: trainer header pointer ExecuteCurMapScriptInTable:: push af @@ -165,7 +165,7 @@ DisplayEnemyTrainerTextAndStartBattle:: ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite ld [wJoyIgnore], a ld a, [wSpriteIndex] - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call DisplayTextID ; fall through diff --git a/home/uncompress.asm b/home/uncompress.asm index d3d84b26..0e609f1c 100644 --- a/home/uncompress.asm +++ b/home/uncompress.asm @@ -52,7 +52,7 @@ _UncompressSpriteData:: ; bit 0 decides in which one the first chunk is placed ; fall through -; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2 +; uncompresses a chunk from the sprite input data stream (pointed to by wSpriteInputPtr) into sSpriteBuffer1 or sSpriteBuffer2 ; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards ; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack UncompressSpriteDataLoop:: diff --git a/ram/hram.asm b/ram/hram.asm index 1a781da4..e7c3ef3c 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -16,7 +16,7 @@ hPreviousTileset:: hRLEByteValue:: db -hSpriteIndexOrTextID:: ; DisplayTextID's argument +hTextID:: ; DisplayTextID's argument hPartyMonIndex:: db diff --git a/ram/wram.asm b/ram/wram.asm index e3c9a1ad..4b49669f 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -882,6 +882,7 @@ wNameBuffer:: ds NAME_BUFFER_LENGTH NEXTU ; data copied from Moves for one move wMoveData:: ds MOVE_LENGTH +wPPUpCountAndMaxPP:: db NEXTU ; amount of money made from one use of Pay Day @@ -1495,8 +1496,10 @@ wSpriteDecodeTable0Ptr:: dw ; pointer to differential decoding table (assuming initial value 1) wSpriteDecodeTable1Ptr:: dw -wd0b5:: db ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things - +; input for GetMonHeader +wCurSpecies:: +; input for GetName +wNameListIndex:: db wNameListType:: db wPredefBank:: db @@ -1561,19 +1564,22 @@ wCapturedMonSpecies:: db ; which will be the first mon sent out. wFirstMonsNotOutYet:: db -wPokeBallCaptureCalcTemp:: -; lower nybble: number of shakes -; upper nybble: number of animations to play -wPokeBallAnimData:: +wNamedObjectIndex:: +wTempByteValue:: +wNumSetBits:: +wTypeEffectiveness:: +wMoveType:: +wPokedexNum:: +wTempTMHM:: wUsingPPUp:: wMaxPP:: +wMoveGrammar:: ; 0 for player, non-zero for enemy wCalculateWhoseStats:: -wTypeEffectiveness:: -wMoveType:: -wNumSetBits:: -; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wd11e:: +wPokeBallCaptureCalcTemp:: +; lower nybble: number of shakes +; upper nybble: number of animations to play +wPokeBallAnimData:: db ; When this value is non-zero, the player isn't allowed to exit the party menu diff --git a/scripts/AgathasRoom.asm b/scripts/AgathasRoom.asm index cf5254ac..0f3acc18 100644 --- a/scripts/AgathasRoom.asm +++ b/scripts/AgathasRoom.asm @@ -75,7 +75,7 @@ AgathasRoomDefaultScript: jr z, AgathaScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_AGATHASROOM_AGATHA_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -111,7 +111,7 @@ AgathasRoomAgathaEndBattleScript: cp $ff jp z, ResetAgathaScript ld a, TEXT_AGATHASROOM_AGATHA - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SCRIPT_CHAMPIONSROOM_PLAYER_ENTERS ld [wChampionsRoomCurScript], a diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index cf87ea64..86f79cb3 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -110,7 +110,7 @@ BillsHouseCleanupScript: BillsHousePCScript: ld a, TEXT_BILLSHOUSE_ACTIVATE_PC - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SCRIPT_BILLSHOUSE_DEFAULT ld [wBillsHouseCurScript], a diff --git a/scripts/BrunosRoom.asm b/scripts/BrunosRoom.asm index 2a4ed6e6..94ec7d17 100644 --- a/scripts/BrunosRoom.asm +++ b/scripts/BrunosRoom.asm @@ -75,7 +75,7 @@ BrunosRoomDefaultScript: jr z, BrunoScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_BRUNOSROOM_BRUNO_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -111,7 +111,7 @@ BrunosRoomBrunoEndBattleScript: cp $ff jp z, ResetBrunoScript ld a, TEXT_BRUNOSROOM_BRUNO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID BrunosRoom_TextPointers: diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index cd8f7e89..8eee1c5a 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -45,20 +45,20 @@ CeladonGymErikaPostBattleScript: CeladonGymReceiveTM21: ld a, TEXT_CELADONGYM_RAINBOWBADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_ERIKA lb bc, TM_MEGA_DRAIN, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CELADONGYM_RECEIVED_TM21 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM21 jr .gymVictory .BagFull ld a, TEXT_CELADONGYM_TM21_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index b5960c81..d06fc4a2 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -13,15 +13,16 @@ CeladonMartRoofScript_GetDrinksInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de pop hl ld a, b and a - jr z, .loop ; if the item isn't in the bag - ld a, [wd11e] + jr z, .loop + ; A drink is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl @@ -192,7 +193,7 @@ CeladonMartRoofScript_PrintDrinksInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 2ff5f3be..9cf44891 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -28,7 +28,7 @@ CeruleanCityRocketDefeatedScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF ld a, TEXT_CERULEANCITY_ROCKET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ; SCRIPT_CERULEANCITY_DEFAULT ld [wJoyIgnore], a @@ -58,7 +58,7 @@ ENDC ld [wSprite02StateData1FacingDirection], a call Delay3 ld a, TEXT_CERULEANCITY_ROCKET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .skipRocketThiefEncounter CheckEvent EVENT_BEAT_CERULEAN_RIVAL @@ -131,7 +131,7 @@ CeruleanCityRivalBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_CERULEANCITY_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -174,7 +174,7 @@ CeruleanCityRivalDefeatedScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_RIVAL ld a, TEXT_CERULEANCITY_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a @@ -295,7 +295,7 @@ CeruleanCityRocketText: ld hl, .IGiveUpText ld de, .IGiveUpText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 57460a2e..d38df543 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -45,20 +45,20 @@ CeruleanGymMistyPostBattleScript: CeruleanGymReceiveTM11: ld a, TEXT_CERULEANGYM_MISTY_CASCADE_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_MISTY lb bc, TM_BUBBLEBEAM, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CERULEANGYM_MISTY_RECEIVED_TM11 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM11 jr .gymVictory .BagFull ld a, TEXT_CERULEANGYM_MISTY_TM11_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index f3c9818d..46814138 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -56,7 +56,7 @@ ChampionsRoomRivalReadyToBattleScript: ld hl, wOptions res BIT_BATTLE_ANIMATION, [hl] ld a, TEXT_CHAMPIONSROOM_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld hl, wStatusFlags3 @@ -99,7 +99,7 @@ ChampionsRoomRivalDefeatedScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_CHAMPIONSROOM_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_RIVAL ldh [hSpriteIndex], a @@ -111,7 +111,7 @@ ChampionsRoomRivalDefeatedScript: ChampionsRoomOakArrivesScript: farcall Music_Cities1AlternateTempo ld a, TEXT_CHAMPIONSROOM_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_OAK ldh [hSpriteIndex], a @@ -152,7 +152,7 @@ ChampionsRoomOakCongratulatesPlayerScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_CONGRATULATES_PLAYER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL ld [wChampionsRoomCurScript], a @@ -165,7 +165,7 @@ ChampionsRoomOakDisappointedWithRivalScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_COME_WITH_ME ld [wChampionsRoomCurScript], a @@ -178,7 +178,7 @@ ChampionsRoomOakComeWithMeScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_COME_WITH_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld de, OakExitChampionsRoomMovement ld a, CHAMPIONSROOM_OAK @@ -281,7 +281,7 @@ ChampionsRoomOakText: ChampionsRoomOakCongratulatesPlayerText: text_asm ld a, [wPlayerStarter] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, .Text call PrintText diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index 3999478c..c864a4b6 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -38,7 +38,7 @@ CinnabarGymResetScripts: ret CinnabarGymSetTrainerHeader: - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] ld [wTrainerHeaderFlagBit], a ret @@ -88,7 +88,7 @@ CinnabarGymGetOpponentTextScript: ld [wJoyIgnore], a ld a, [wOpponentAfterWrongAnswer] ld [wTrainerHeaderFlagBit], a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID CinnabarGymFlagAction: @@ -145,20 +145,20 @@ CinnabarGymBlainePostBattleScript: ; fallthrough CinnabarGymReceiveTM38: ld a, TEXT_CINNABARGYM_BLAINE_VOLCANO_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_BLAINE lb bc, TM_FIRE_BLAST, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CINNABARGYM_BLAINE_RECEIVED_TM38 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM38 jr .gymVictory .BagFull ld a, TEXT_CINNABARGYM_BLAINE_TM38_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges @@ -190,7 +190,7 @@ CinnabarGym_TextPointers: dw_const CinnabarGymBlaineTM38NoRoomText, TEXT_CINNABARGYM_BLAINE_TM38_NO_ROOM CinnabarGymStartBattleScript: - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index aca1b995..ed38f690 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -26,7 +26,7 @@ CinnabarIslandDefaultScript: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a ld a, TEXT_CINNABARISLAND_DOOR_IS_LOCKED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a diff --git a/scripts/CinnabarLabFossilRoom.asm b/scripts/CinnabarLabFossilRoom.asm index 4a2ff51f..e5928144 100644 --- a/scripts/CinnabarLabFossilRoom.asm +++ b/scripts/CinnabarLabFossilRoom.asm @@ -18,7 +18,7 @@ Lab4Script_GetFossilsInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de @@ -26,9 +26,8 @@ Lab4Script_GetFossilsInBag: ld a, b and a jr z, .loop - - ; A fossil's in the bag - ld a, [wd11e] + ; A fossil is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index 4522b906..bffa4554 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -49,7 +49,7 @@ FightingDojoDefaultScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_FIGHTINGDOJO_KARATE_MASTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ret @@ -72,7 +72,7 @@ FightingDojoKarateMasterPostBattleScript: ld [wJoyIgnore], a SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3 ld a, TEXT_FIGHTINGDOJO_KARATE_MASTER_I_WILL_GIVE_YOU_A_POKEMON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ; SCRIPT_FIGHTINGDOJO_DEFAULT ld [wJoyIgnore], a @@ -117,7 +117,7 @@ FightingDojoKarateMasterText: ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index b560cd47..def3530f 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -47,20 +47,20 @@ FuchsiaGymKogaPostBattleScript: ; fallthrough FuchsiaGymReceiveTM06: ld a, TEXT_FUCHSIAGYM_KOGA_SOUL_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_KOGA lb bc, TM_TOXIC, 1 call GiveItem jr nc, .BagFull ld a, TEXT_FUCHSIAGYM_KOGA_RECEIVED_TM06 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM06 jr .gymVictory .BagFull ld a, TEXT_FUCHSIAGYM_KOGA_TM06_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index cbd442da..45f51764 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -58,7 +58,7 @@ GameCornerRocketBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_GAMECORNER_ROCKET_AFTER_BATTLE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, GAMECORNER_ROCKET ldh [hSpriteIndex], a diff --git a/scripts/GameCornerPrizeRoom.asm b/scripts/GameCornerPrizeRoom.asm index 443e0260..8e3bc0a6 100644 --- a/scripts/GameCornerPrizeRoom.asm +++ b/scripts/GameCornerPrizeRoom.asm @@ -8,6 +8,7 @@ GameCornerPrizeRoom_TextPointers: dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_2 dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3 + EXPORT TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 ; used by engine/events/prize_menu.asm GameCornerPrizeRoomBaldingGuyText: text_far _GameCornerPrizeRoomBaldingGuyText diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index 46298813..ed3d2a73 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -92,7 +92,7 @@ HallOfFameOakCongratulationsScript: inc a ; PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, TEXT_HALLOFFAME_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a diff --git a/scripts/LancesRoom.asm b/scripts/LancesRoom.asm index fd1401c2..31b0f240 100644 --- a/scripts/LancesRoom.asm +++ b/scripts/LancesRoom.asm @@ -63,7 +63,7 @@ LancesRoomDefaultScript: cp $3 ; Is player standing next to Lance's sprite? jr nc, .notStandingNextToLance ld a, TEXT_LANCESROOM_LANCE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .notStandingNextToLance cp $5 ; Is player standing on the entrance staircase? @@ -90,7 +90,7 @@ LancesRoomLanceEndBattleScript: cp $ff jp z, ResetLanceScript ld a, TEXT_LANCESROOM_LANCE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID WalkToLance: diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index 52d79b15..ec88f73e 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -77,7 +77,7 @@ LoreleisRoomDefaultScript: jr z, LoreleiScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_LORELEISROOM_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -113,7 +113,7 @@ LoreleisRoomLoreleiEndBattleScript: cp $ff jp z, ResetLoreleiScript ld a, TEXT_LORELEISROOM_LORELEI - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID LoreleisRoom_TextPointers: diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 3afd14c8..d17d13fe 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -65,7 +65,7 @@ MtMoonB2FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_MTMOONB2F_SUPER_NERD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID MtMoonB2FCheckGotAFossil: @@ -137,7 +137,7 @@ MtMoonB2FSuperNerdTakesOtherFossilScript: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, TEXT_MTMOONB2F_SUPER_NERD_THEN_THIS_IS_MINE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckEvent EVENT_GOT_DOME_FOSSIL jr z, .got_dome_fossil diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 2939f51b..600c03c7 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -26,7 +26,7 @@ Museum1FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_MUSEUM1F_SCIENTIST1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID Museum1FNoopScript: diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 087e6a37..89d6ef80 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -129,19 +129,19 @@ OaksLabOakChooseMonSpeechScript: ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_OAKSLAB_RIVAL_FED_UP_WITH_WAITING - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_OAK_CHOOSE_MON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_RIVAL_WHAT_ABOUT_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_OAK_BE_PATIENT - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON xor a @@ -167,7 +167,7 @@ OaksLabPlayerDontGoAwayScript: call SetSpriteFacingDirectionAndDelay call UpdateSprites ld a, TEXT_OAKSLAB_OAK_DONT_GO_AWAY_YET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a @@ -301,7 +301,7 @@ OaksLabRivalChoosesStarterScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_OAKSLAB_RIVAL_ILL_TAKE_THIS_ONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, [wRivalStarterBallSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL @@ -322,7 +322,7 @@ OaksLabRivalChoosesStarterScript: ld a, [wRivalStarterTemp] ld [wRivalStarter], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, OAKSLAB_RIVAL ldh [hSpriteIndex], a @@ -330,7 +330,7 @@ OaksLabRivalChoosesStarterScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_OAKSLAB_RIVAL_RECEIVED_MON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_STARTER xor a @@ -355,7 +355,7 @@ OaksLabRivalChallengesPlayerScript: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, TEXT_OAKSLAB_RIVAL_ILL_TAKE_YOU_ON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ldh [hNPCPlayerRelativePosPerspective], a @@ -440,7 +440,7 @@ OaksLabRivalStartsExitScript: ld c, 20 call DelayFrames ld a, TEXT_OAKSLAB_RIVAL_SMELL_YOU_LATER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID farcall Music_RivalAlternateStart ld a, OAKSLAB_RIVAL @@ -516,7 +516,7 @@ OaksLabRivalArrivesAtOaksRequestScript: call PlaySound farcall Music_RivalAlternateStart ld a, TEXT_OAKSLAB_RIVAL_GRAMPS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call OaksLabCalcRivalMovementScript ld a, HS_OAKS_LAB_RIVAL @@ -561,21 +561,21 @@ OaksLabOakGivesPokedexScript: ld [wJoyIgnore], a call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_RIVAL_WHAT_DID_YOU_CALL_ME_FOR - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_I_HAVE_A_REQUEST - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_MY_INVENTION_POKEDEX - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame ld a, TEXT_OAKSLAB_OAK_GOT_POKEDEX - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, HS_POKEDEX_1 @@ -586,7 +586,7 @@ OaksLabOakGivesPokedexScript: predef HideObject call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_THAT_WAS_MY_DREAM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, OAKSLAB_RIVAL ldh [hSpriteIndex], a @@ -595,7 +595,7 @@ OaksLabOakGivesPokedexScript: call SetSpriteFacingDirectionAndDelay call Delay3 ld a, TEXT_OAKSLAB_RIVAL_LEAVE_IT_ALL_TO_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_POKEDEX SetEvent EVENT_OAK_GOT_PARCEL @@ -825,7 +825,7 @@ OaksLabBulbasaurPokeBallText: OaksLabSelectedPokeBallScript: ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, b ld [wSpriteIndex], a CheckEvent EVENT_GOT_STARTER @@ -899,7 +899,7 @@ OaksLabMonChoiceMenu: jr nz, OaksLabMonChoiceEnd ld a, [wCurPartySpecies] ld [wPlayerStarter], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, [wSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL @@ -927,7 +927,7 @@ OaksLabMonChoiceMenu: ld a, 5 ld [wCurEnemyLevel], a ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a call AddPartyMon ld hl, wStatusFlags4 set BIT_GOT_STARTER, [hl] diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index a787fcc4..14c5a840 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -47,7 +47,7 @@ PalletTownOakHeyWaitScript: xor a ld [wOakWalkedToPlayer], a ld a, TEXT_PALLETTOWN_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -101,7 +101,7 @@ PalletTownOakNotSafeComeWithMeScript: ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_PALLETTOWN_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; set up movement script that causes the player to follow Oak to his lab ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index ce43af78..9d15adec 100644 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -34,7 +34,7 @@ ENDC ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_PEWTERCITY_YOUNGSTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PewterCityPlayerLeavingEastCoords: @@ -60,7 +60,7 @@ PewterCitySuperNerd1ShowsPlayerMuseumScript: ld hl, wMiscFlags set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_SUPER_NERD1_ITS_RIGHT_HERE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $3c ldh [hSpriteScreenYCoord], a @@ -128,7 +128,7 @@ PewterCityYoungsterShowsPlayerGymScript: ld hl, wMiscFlags set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_YOUNGSTER_GO_TAKE_ON_BROCK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $3c ldh [hSpriteScreenYCoord], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index f50557b8..63f8806d 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -45,20 +45,20 @@ PewterGymBrockPostBattle: ; fallthrough PewterGymScriptReceiveTM34: ld a, TEXT_PEWTERGYM_BROCK_WAIT_TAKE_THIS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_BROCK lb bc, TM_BIDE, 1 call GiveItem jr nc, .BagFull ld a, TEXT_PEWTERGYM_RECEIVED_TM34 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM34 jr .gymVictory .BagFull ld a, TEXT_PEWTERGYM_TM34_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index b294a247..a93bd33b 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -52,7 +52,7 @@ Mansion1Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION1F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion1F_ScriptPointers: diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index bc3d78e9..df424a19 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -48,7 +48,7 @@ Mansion2Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION2F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion2F_ScriptPointers: diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index fab06bbd..f5347446 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -80,7 +80,7 @@ Mansion3Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION3F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion3F_TextPointers: diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index 74f1648e..e359621d 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -50,7 +50,7 @@ Mansion4Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSIONB1F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansionB1F_ScriptPointers: diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 00f83fc5..6b3fe4ae 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -51,7 +51,7 @@ ENDC ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_POKEMONTOWER2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -71,7 +71,7 @@ PokemonTower2FDefeatedRivalScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL ld a, TEXT_POKEMONTOWER2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld de, PokemonTower2FRivalDownThenRightMovement CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT diff --git a/scripts/PokemonTower5F.asm b/scripts/PokemonTower5F.asm index 8e256b1e..b35a2f0a 100644 --- a/scripts/PokemonTower5F.asm +++ b/scripts/PokemonTower5F.asm @@ -36,7 +36,7 @@ PokemonTower5FDefaultScript: call Delay3 call GBFadeInFromWhite ld a, TEXT_POKEMONTOWER5F_PURIFIEDZONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a diff --git a/scripts/PokemonTower6F.asm b/scripts/PokemonTower6F.asm index 9e2f4118..cf246c56 100644 --- a/scripts/PokemonTower6F.asm +++ b/scripts/PokemonTower6F.asm @@ -31,7 +31,7 @@ PokemonTower6FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONTOWER6F_BEGONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, RESTLESS_SOUL ld [wCurOpponent], a @@ -63,7 +63,7 @@ PokemonTower6FMarowakBattleScript: jr nz, .did_not_defeat SetEvent EVENT_BEAT_GHOST_MAROWAK ld a, TEXT_POKEMONTOWER6F_MAROWAK_DEPARTED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index be9aacd9..41fba59c 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -32,7 +32,7 @@ PokemonTower7FEndBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, [wSpriteIndex] - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call DisplayTextID call PokemonTower7FRocketLeaveMovementScript ld a, SCRIPT_POKEMONTOWER7F_HIDE_NPC diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 02ddcdd5..920aa089 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -53,7 +53,7 @@ RocketHideoutB4FBeatGiovanniScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI ld a, TEXT_ROCKETHIDEOUTB4F_GIOVANNI_HOPE_WE_MEET_AGAIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call GBFadeOutToBlack ld a, HS_ROCKET_HIDEOUT_B4F_GIOVANNI diff --git a/scripts/Route11Gate2F.asm b/scripts/Route11Gate2F.asm index 9c223c87..bc1e2e90 100644 --- a/scripts/Route11Gate2F.asm +++ b/scripts/Route11Gate2F.asm @@ -24,7 +24,7 @@ Route11Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, ITEMFINDER ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld h, d ld l, e diff --git a/scripts/Route12.asm b/scripts/Route12.asm index 660b8a2d..ea9fc567 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -28,7 +28,7 @@ Route12DefaultScript: ResetEventReuseHL EVENT_FIGHT_ROUTE12_SNORLAX jp z, CheckFightingMapTrainers ld a, TEXT_ROUTE12_SNORLAX_WOKE_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SNORLAX ld [wCurOpponent], a @@ -51,7 +51,7 @@ Route12SnorlaxPostBattleScript: cp $2 jr z, .caught_snorlax ld a, TEXT_ROUTE12_SNORLAX_CALMED_DOWN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .caught_snorlax SetEvent EVENT_BEAT_ROUTE12_SNORLAX diff --git a/scripts/Route15Gate2F.asm b/scripts/Route15Gate2F.asm index ad1434dc..831b66e6 100644 --- a/scripts/Route15Gate2F.asm +++ b/scripts/Route15Gate2F.asm @@ -14,7 +14,7 @@ Route15Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, EXP_ALL ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName diff --git a/scripts/Route16.asm b/scripts/Route16.asm index ec33adf1..6e3da97c 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -28,7 +28,7 @@ Route16DefaultScript: ResetEventReuseHL EVENT_FIGHT_ROUTE16_SNORLAX jp z, CheckFightingMapTrainers ld a, TEXT_ROUTE16_SNORLAX_WOKE_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SNORLAX ld [wCurOpponent], a @@ -52,7 +52,7 @@ Route16SnorlaxPostBattleScript: cp $2 jr z, .caught ld a, TEXT_ROUTE16_SNORLAX_RETURNED_TO_MOUNTAINS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .caught SetEvent EVENT_BEAT_ROUTE16_SNORLAX diff --git a/scripts/Route16Gate1F.asm b/scripts/Route16Gate1F.asm index d42a80d4..a8bf2f0f 100644 --- a/scripts/Route16Gate1F.asm +++ b/scripts/Route16Gate1F.asm @@ -20,7 +20,7 @@ Route16Gate1FDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_ROUTE16GATE1F_GUARD_WAIT_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -60,7 +60,7 @@ Route16Gate1FPlayerMovingUpScript: Route16Gate1FGuardScript: ld a, TEXT_ROUTE16GATE1F_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/Route18Gate1F.asm b/scripts/Route18Gate1F.asm index 79d982d7..a2b4dcdf 100644 --- a/scripts/Route18Gate1F.asm +++ b/scripts/Route18Gate1F.asm @@ -20,7 +20,7 @@ Route18Gate1FDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_ROUTE18GATE1F_GUARD_EXCUSE_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -60,7 +60,7 @@ Route18Gate1FPlayerMovingUpScript: Route18Gate1FGuardScript: ld a, TEXT_ROUTE18GATE1F_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/Route22.asm b/scripts/Route22.asm index ad02b4c7..1a2602fd 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -124,7 +124,7 @@ Route22Rival1StartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_ROUTE22_RIVAL1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -166,7 +166,7 @@ Route22Rival1AfterBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE ld a, TEXT_ROUTE22_RIVAL1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a @@ -280,7 +280,7 @@ Route22Rival2StartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_ROUTE22_RIVAL2 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -325,7 +325,7 @@ Route22Rival2AfterBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE ld a, TEXT_ROUTE22_RIVAL2 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/Route22Gate.asm b/scripts/Route22Gate.asm index 9bca889d..d6160ad8 100644 --- a/scripts/Route22Gate.asm +++ b/scripts/Route22Gate.asm @@ -25,7 +25,7 @@ Route22GateDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_ROUTE22GATE_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID Route22GateScriptCoords: diff --git a/scripts/Route23.asm b/scripts/Route23.asm index 2acd3896..f5a4c3d7 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -46,7 +46,7 @@ Route23DefaultScript: ret nc .not_past_victory_road ld a, e - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a ld a, c ld [wWhichBadge], a ld b, FLAG_TEST diff --git a/scripts/Route24.asm b/scripts/Route24.asm index 6f8f0250..53185147 100644 --- a/scripts/Route24.asm +++ b/scripts/Route24.asm @@ -31,7 +31,7 @@ Route24DefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_ROUTE24_COOLTRAINER_M1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckAndResetEvent EVENT_NUGGET_REWARD_AVAILABLE ret z @@ -68,7 +68,7 @@ Route24AfterRocketBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE24_ROCKET ld a, TEXT_ROUTE24_COOLTRAINER_M1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a @@ -125,7 +125,7 @@ Route24CooltrainerM1Text: ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/Route2Gate.asm b/scripts/Route2Gate.asm index 8522a149..795b210e 100644 --- a/scripts/Route2Gate.asm +++ b/scripts/Route2Gate.asm @@ -14,7 +14,7 @@ Route2GateOaksAideText: ldh [hOaksAideRequirement], a ld a, HM_FLASH ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName diff --git a/scripts/Route5Gate.asm b/scripts/Route5Gate.asm index a0913c85..0ccf9fae 100644 --- a/scripts/Route5Gate.asm +++ b/scripts/Route5Gate.asm @@ -32,7 +32,7 @@ Route5GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE5GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route5GateMovePlayerUpScript ld a, SCRIPT_ROUTE5GATE_PLAYER_MOVING @@ -40,7 +40,7 @@ Route5GateDefaultScript: ret .have_drink ld a, TEXT_ROUTE5GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] diff --git a/scripts/Route6Gate.asm b/scripts/Route6Gate.asm index 7afba23e..48228c7d 100644 --- a/scripts/Route6Gate.asm +++ b/scripts/Route6Gate.asm @@ -26,7 +26,7 @@ Route6GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE6GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route6GateMovePlayerDownScript ld a, SCRIPT_ROUTE6GATE_PLAYER_MOVING @@ -36,7 +36,7 @@ Route6GateDefaultScript: ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE6GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .PlayerInCoordsArray: diff --git a/scripts/Route7Gate.asm b/scripts/Route7Gate.asm index 813fab21..e599e147 100644 --- a/scripts/Route7Gate.asm +++ b/scripts/Route7Gate.asm @@ -38,7 +38,7 @@ Route7DefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE7GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route7GateMovePlayerLeftScript ld a, SCRIPT_ROUTE7GATE_PLAYER_MOVING @@ -46,7 +46,7 @@ Route7DefaultScript: ret .have_drink ld a, TEXT_ROUTE7GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] diff --git a/scripts/Route8Gate.asm b/scripts/Route8Gate.asm index 51dd6f1a..44e94a0c 100644 --- a/scripts/Route8Gate.asm +++ b/scripts/Route8Gate.asm @@ -37,7 +37,7 @@ Route8GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE8GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route8GateMovePlayerRightScript ld a, SCRIPT_ROUTE8GATE_PLAYER_MOVING @@ -47,7 +47,7 @@ Route8GateDefaultScript: ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .PlayerInCoordsArray: diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 1c7c6b5b..5bd5589d 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -94,7 +94,7 @@ SSAnne2FRivalStartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_SSANNE2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, OPP_RIVAL2 @@ -129,7 +129,7 @@ SSAnne2FRivalAfterBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SSANNE2F_RIVAL_CUT_MASTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SSANNE2F_RIVAL ldh [hSpriteIndex], a diff --git a/scripts/SafariZoneGate.asm b/scripts/SafariZoneGate.asm index 14a8a79b..74a7baa1 100644 --- a/scripts/SafariZoneGate.asm +++ b/scripts/SafariZoneGate.asm @@ -20,7 +20,7 @@ SafariZoneGateDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -58,7 +58,7 @@ SafariZoneGateWouldYouLikeToJoinScript: ld [wJoyIgnore], a call UpdateSprites ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_WOULD_YOU_LIKE_TO_JOIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -83,7 +83,7 @@ SafariZoneGateLeavingSafariScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_GOOD_HAUL_COME_AGAIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wNumSafariBalls], a @@ -95,7 +95,7 @@ SafariZoneGateLeavingSafariScript: jr .return .leaving_early ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_LEAVING_EARLY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .return ret diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 2b47fb75..733da92c 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -45,20 +45,20 @@ SaffronGymSabrinaPostBattle: SaffronGymSabrinaReceiveTM46Script: ld a, TEXT_SAFFRONGYM_SABRINA_MARSH_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_SABRINA lb bc, TM_PSYWAVE, 1 call GiveItem jr nc, .BagFull ld a, TEXT_SAFFRONGYM_SABRINA_RECEIVED_TM46 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM46 jr .gymVictory .BagFull ld a, TEXT_SAFFRONGYM_SABRINA_TM46_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 9caf2a70..d5e4cb08 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -176,7 +176,7 @@ SilphCo11FDefaultScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SILPHCO11F_GIOVANNI - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SILPHCO11F_GIOVANNI ldh [hSpriteIndex], a @@ -223,7 +223,7 @@ SilphCo11FGiovanniAfterBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SILPHCO11F_GIOVANNI_YOU_RUINED_OUR_PLANS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call GBFadeOutToBlack call SilphCo11FTeamRocketLeavesScript diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index de9e689d..381eff7a 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -138,7 +138,7 @@ SilphCo7FDefaultScript: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, TEXT_SILPHCO7F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SILPHCO7F_RIVAL ldh [hSpriteIndex], a @@ -175,7 +175,7 @@ SilphCo7FRivalStartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_SILPHCO7F_RIVAL_WAITED_HERE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld hl, wStatusFlags3 @@ -218,7 +218,7 @@ SilphCo7FRivalAfterBattleScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_SILPHCO7F_RIVAL_GOOD_LUCK_TO_YOU - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/VermilionCity.asm b/scripts/VermilionCity.asm index 9d800233..fd5905df 100644 --- a/scripts/VermilionCity.asm +++ b/scripts/VermilionCity.asm @@ -49,7 +49,7 @@ VermilionCityDefaultScript: ldh [hJoyHeld], a ld [wSavedCoordIndex], a ; unnecessary ld a, TEXT_VERMILIONCITY_SAILOR1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckEvent EVENT_SS_ANNE_LEFT jr nz, .ship_departed diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index d7940c22..a59a55e6 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -64,20 +64,20 @@ VermilionGymLTSurgeAfterBattleScript: VermilionGymLTSurgeReceiveTM24Script: ld a, TEXT_VERMILIONGYM_LT_SURGE_THUNDER_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_LT_SURGE lb bc, TM_THUNDERBOLT, 1 call GiveItem jr nc, .bag_full ld a, TEXT_VERMILIONGYM_LT_SURGE_RECEIVED_TM24 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM24 jr .gym_victory .bag_full ld a, TEXT_VERMILIONGYM_LT_SURGE_TM24_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gym_victory ld hl, wObtainedBadges diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm index 0059bc60..473b7ee5 100644 --- a/scripts/ViridianCity.asm +++ b/scripts/ViridianCity.asm @@ -31,7 +31,7 @@ ViridianCityCheckGymOpenScript: cp 32 ret nz ld a, TEXT_VIRIDIANCITY_GYM_LOCKED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -50,7 +50,7 @@ ViridianCityCheckGotPokedexScript: cp 19 ret nz ld a, TEXT_VIRIDIANCITY_OLD_MAN_SLEEPY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -96,7 +96,7 @@ ViridianCityOldManEndCatchTrainingScript: xor a ld [wJoyIgnore], a ld a, TEXT_VIRIDIANCITY_OLD_MAN_YOU_NEED_TO_WEAKEN_THE_TARGET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wBattleType], a diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index 14c790ce..626e1b17 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -137,20 +137,20 @@ ViridianGymGiovanniPostBattle: ; fallthrough ViridianGymReceiveTM27: ld a, TEXT_VIRIDIANGYM_GIOVANNI_EARTH_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI lb bc, TM_FISSURE, 1 call GiveItem jr nc, .bag_full ld a, TEXT_VIRIDIANGYM_GIOVANNI_RECEIVED_TM27 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM27 jr .gym_victory .bag_full ld a, TEXT_VIRIDIANGYM_GIOVANNI_TM27_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gym_victory ld hl, wObtainedBadges diff --git a/scripts/ViridianMart.asm b/scripts/ViridianMart.asm index 8f91afd6..f54f3c26 100644 --- a/scripts/ViridianMart.asm +++ b/scripts/ViridianMart.asm @@ -28,7 +28,7 @@ ViridianMart_ScriptPointers: ViridianMartDefaultScript: call UpdateSprites ld a, TEXT_VIRIDIANMART_CLERK_YOU_CAME_FROM_PALLET_TOWN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wSimulatedJoypadStatesEnd ld de, .PlayerMovement @@ -51,7 +51,7 @@ ViridianMartOaksParcelScript: ret nz call Delay3 ld a, TEXT_VIRIDIANMART_CLERK_PARCEL_QUEST - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID lb bc, OAKS_PARCEL, 1 call GiveItem diff --git a/scripts/WardensHouse.asm b/scripts/WardensHouse.asm index 1851e341..aa6be6ca 100644 --- a/scripts/WardensHouse.asm +++ b/scripts/WardensHouse.asm @@ -95,7 +95,7 @@ WardensHouseWardenText: WardensHouseDisplayText: text_asm - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] cp TEXT_WARDENSHOUSE_DISPLAY_LEFT ld hl, .MerchandiseText jr nz, .print_text diff --git a/tools/unnamed.py b/tools/unnamed.py deleted file mode 100755 index f3081e97..00000000 --- a/tools/unnamed.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -Usage: unnamed.py [-h] [-r rootdir] [-l count] pokered.sym - -Parse the symfile to find unnamed symbols. -""" - -import sys -import argparse -import subprocess -import struct -import enum -import signal - -class symtype(enum.Enum): - LOCAL = 0 - IMPORT = 1 - EXPORT = 2 - -def unpack_from(fmt, file): - size = struct.calcsize(fmt) - return struct.unpack(fmt, file.read(size)) - -def read_string(file): - buf = bytearray() - while True: - b = file.read(1) - if b is None or b == b'\0': - return buf.decode() - buf += b - -# Fix broken pipe when using `head` -signal.signal(signal.SIGPIPE, signal.SIG_DFL) - -parser = argparse.ArgumentParser(description='Parse the symfile to find unnamed symbols') -parser.add_argument('symfile', type=argparse.FileType('r'), - help='the list of symbols') -parser.add_argument('-r', '--rootdir', type=str, - help='scan the output files to obtain a list of files with unnamed symbols (note: will rebuild objects as necessary)') -parser.add_argument('-l', '--list', type=int, default=0, - help="output this many of each file's unnamed symbols (note: requires -r)") -args = parser.parse_args() - -# Get list of object files -objects = None -if args.rootdir: - for line in subprocess.Popen(['make', '-C', args.rootdir, '-s', '-p', 'DEBUG=1'], - stdout=subprocess.PIPE).stdout.read().decode().split('\n'): - if line.startswith('pokered_obj :='): - objects = line[len('pokered_obj :='):].strip().split() - break - else: - print('Error: Object files not found!', file=sys.stderr) - sys.exit(1) - -# Scan all unnamed symbols from the symfile -symbols_total = 0 -symbols = set() -for line in args.symfile: - line = line.split(';')[0].strip() - split = line.split(' ') - if len(split) < 2: - continue - - symbols_total += 1 - - symbol = ' '.join(split[1:]).strip() - if symbol[-3:].lower() == split[0][-3:].lower(): - symbols.add(symbol) - -# If no object files were provided, just print what we know and exit -unnamed_percent = 100 * (symbols_total - len(symbols)) / symbols_total -print(f'Unnamed pokered symbols: {len(symbols)} ({unnamed_percent:.2f}% complete)') -if not objects: - for sym in symbols: - print(sym) - sys.exit() - -# Count the amount of symbols in each file -file_symbols = {} -for objfile in objects: - with open(objfile, 'rb') as file: - obj_ver = None - - magic = unpack_from('4s', file)[0] - if magic == b'RGB6': - obj_ver = 6 - elif magic == b'RGB9': - obj_ver = 10 + unpack_from('