diff options
Diffstat (limited to 'engine')
70 files changed, 408 insertions, 401 deletions
| diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 29bc23b20..4eead5fd3 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD:  PrintText_UsedItemOn:  	ld a, [wCurEnemyItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ld hl, wStringBuffer1  	ld de, wMonOrItemNameBuffer diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 3cd0e56c4..752796892 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -171,10 +171,10 @@ AI_Types:  	pop bc  	pop hl -	ld a, [wd265] +	ld a, [wTypeMatchup]  	and a  	jr z, .immune -	cp 10 ; 1.0 +	cp EFFECTIVE  	jr z, .checkmove  	jr c, .noteffective @@ -415,8 +415,8 @@ AI_Smart_LeechHit:  	pop hl  ; 60% chance to discourage this move if not very effective. -	ld a, [wd265] -	cp 10 ; 1.0 +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	jr c, .asm_38815  ; Do nothing if effectiveness is neutral. @@ -491,8 +491,8 @@ AI_Smart_LockOn:  	push hl  	push bc  	farcall BattleCheckTypeMatchup -	ld a, [wd265] -	cp $a +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	pop bc  	pop hl  	jr c, .asm_3884f @@ -1292,8 +1292,8 @@ AI_Smart_Mimic:  	ld [hBattleTurn], a  	callfar BattleCheckTypeMatchup -	ld a, [wd265] -	cp $a +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	pop hl  	jr c, .asm_38bef  	jr z, .asm_38bd4 @@ -1408,8 +1408,8 @@ AI_Smart_Encore:  	predef CheckTypeMatchup  	pop hl -	ld a, [wd265] -	cp $a +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	jr nc, .asm_38c68  	and a @@ -1679,8 +1679,8 @@ AI_Smart_Conversion2:  	callfar BattleCheckTypeMatchup -	ld a, [wd265] -	cp $a +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	pop hl  	jr c, .asm_38dc9  	ret z @@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower:  	pop hl  ; Discourage Hidden Power if not very effective. -	ld a, [wd265] -	cp 10 +	ld a, [wTypeMatchup] +	cp EFFECTIVE  	jr c, .bad  ; Discourage Hidden Power if its base power	is lower than 50. @@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower:  	jr c, .bad  ; Encourage Hidden Power if super-effective. -	ld a, [wd265] -	cp 11 +	ld a, [wTypeMatchup] +	cp EFFECTIVE + 1  	jr nc, .good  ; Encourage Hidden Power if its base power is 70. @@ -3125,7 +3125,7 @@ AI_Status:  	pop bc  	pop hl -	ld a, [wd265] +	ld a, [wTypeMatchup]  	and a  	jr nz, .checkmove diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 8a0ca3289..2d5e85cef 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -373,7 +373,7 @@ HandleBerserkGene:  	push bc  	callfar GetUserItem  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	sub BERSERK_GENE  	pop bc  	pop de @@ -447,7 +447,7 @@ DetermineMoveOrder:  	sub BATTLEACTION_SWITCH1  	jr c, .use_move  	ld a, [wBattlePlayerAction] -	cp $2 +	cp BATTLEPLAYERACTION_SWITCH  	jr nz, .switch  	ld a, [hSerialConnectionStatus]  	cp USING_INTERNAL_CLOCK @@ -472,7 +472,7 @@ DetermineMoveOrder:  .use_move  	ld a, [wBattlePlayerAction] -	and a +	and a ; BATTLEPLAYERACTION_USEMOVE?  	jp nz, .player_first  	call CompareMovePriority  	jr z, .equal_priority @@ -611,7 +611,7 @@ ParsePlayerAction:  .not_encored  	ld a, [wBattlePlayerAction] -	cp $2 +	cp BATTLEPLAYERACTION_SWITCH  	jr z, .reset_rage  	and a  	jr nz, .reset_bide @@ -900,7 +900,7 @@ Battle_EnemyFirst:  	call ResidualDamage  	jp z, HandlePlayerMonFaint  	call RefreshBattleHuds -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ret @@ -949,7 +949,7 @@ Battle_PlayerFirst:  	call ResidualDamage  	jp z, HandleEnemyMonFaint  	call RefreshBattleHuds -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ret @@ -1161,7 +1161,7 @@ HandlePerishSong:  	ret z  	dec [hl]  	ld a, [hl] -	ld [wd265], a +	ld [wDeciramBuffer], a  	push af  	ld hl, PerishCountText  	call StdBattleTextBox @@ -1235,7 +1235,7 @@ HandleWrap:  	ret nz  	ld a, [de] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wFXAnimID], a  	call GetMoveName  	dec [hl] @@ -1288,7 +1288,7 @@ HandleLeftovers:  	callfar GetUserItem  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ld a, b  	cp HELD_LEFTOVERS @@ -1397,7 +1397,7 @@ HandleMysteryberry:  	push bc  	push bc  	ld a, [hl] -	ld [wd265], a +	ld [wTempByteValue], a  	ld de, wBattleMonMoves - 1  	ld hl, wBattleMonPP  	ld a, [hBattleTurn] @@ -1417,7 +1417,7 @@ HandleMysteryberry:  	pop de  	pop bc -	ld a, [wd265] +	ld a, [wTempByteValue]  	cp [hl]  	jr nz, .skip_checks  	ld a, [hBattleTurn] @@ -1434,7 +1434,7 @@ HandleMysteryberry:  .skip_checks  	callfar GetUserItem  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	xor a  	ld [hl], a  	call GetPartymonItem @@ -2048,18 +2048,18 @@ HandleEnemyMonFaint:  	call CheckMobileBattleError  	jp c, WildFled_EnemyFled_LinkBattleCanceled -	ld a, $1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	call HandleEnemySwitch  	jp z, WildFled_EnemyFled_LinkBattleCanceled  	jr DoubleSwitch  .player_mon_not_fainted -	ld a, $1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	call HandleEnemySwitch  	jp z, WildFled_EnemyFled_LinkBattleCanceled -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ret @@ -2088,7 +2088,7 @@ DoubleSwitch:  	call PlayerPartyMonEntrance  .done -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ret @@ -2636,7 +2636,7 @@ HandlePlayerMonFaint:  	ld a, c  	and a  	ret nz -	ld a, $1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	call HandleEnemySwitch  	jp z, WildFled_EnemyFled_LinkBattleCanceled @@ -2716,12 +2716,12 @@ ForcePlayerMonChoice:  	ld a, [wLinkMode]  	and a  	jr z, .skip_link -	ld a, $1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	call LinkBattleSendReceiveAction  .skip_link -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	call CheckMobileBattleError  	jr c, .enemy_fainted_mobile_error @@ -3287,8 +3287,8 @@ LookUpTheEffectivenessOfEveryMove:  	pop bc  	pop de  	pop hl -	ld a, [wd265] ; Get The Effectiveness Modifier -	cp 10 + 1 ; 1.0 + 0.1 +	ld a, [wTypeMatchup] +	cp EFFECTIVE + 1  	jr c, .loop  	ld hl, wBuffer1  	set 0, [hl] @@ -3319,14 +3319,14 @@ IsThePlayerMonTypesEffectiveAgainstOTMon:  	ld [wPlayerMoveStruct + MOVE_TYPE], a  	call SetPlayerTurn  	callfar BattleCheckTypeMatchup -	ld a, [wd265] -	cp 10 + 1 ; 1.0 + 0.1 +	ld a, [wTypeMatchup] +	cp EFFECTIVE + 1  	jr nc, .super_effective  	ld a, [wBattleMonType2]  	ld [wPlayerMoveStruct + MOVE_TYPE], a  	callfar BattleCheckTypeMatchup -	ld a, [wd265] -	cp 10 + 1 ; 1.0 + 0.1 +	ld a, [wTypeMatchup] +	cp EFFECTIVE + 1  	jr nc, .super_effective  	pop bc  	ret @@ -3695,7 +3695,7 @@ TryToRunAwayFromBattle:  	push hl  	push de  	ld a, [wBattleMonItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld b, a  	callfar GetItemHeldEffect  	ld a, b @@ -3732,7 +3732,7 @@ TryToRunAwayFromBattle:  	xor a  	ld [hMultiplicand], a -	ld a, $20 +	ld a, 32  	ld [hMultiplier], a  	call Multiply  	ld a, [hProduct + 2] @@ -3772,7 +3772,7 @@ TryToRunAwayFromBattle:  	ld a, [hQuotient + 2]  	cp b  	jr nc, .can_escape -	ld a, $1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	ld hl, BattleText_CantEscape2  	jr .print_inescapable_text @@ -3786,7 +3786,7 @@ TryToRunAwayFromBattle:  .print_inescapable_text  	call StdBattleTextBox -	ld a, $1 +	ld a, TRUE  	ld [wFailedToFlee], a  	call LoadTileMapToTempTileMap  	and a @@ -3798,7 +3798,7 @@ TryToRunAwayFromBattle:  	ld a, DRAW  	jr z, .fled  	call LoadTileMapToTempTileMap -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ld a, $f  	ld [wCurMoveNum], a @@ -4429,7 +4429,7 @@ UseConfusionHealingItem:  .heal_status  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld a, BATTLE_VARS_SUBSTATUS3_OPP  	call GetBattleVarAddr  	res SUBSTATUS_CONFUSED, [hl] @@ -4496,7 +4496,7 @@ HandleStatBoostingHeldItems:  	jr nz, .loop  	pop bc  	ld a, [bc] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	push bc  	dec hl  	dec hl @@ -4952,7 +4952,7 @@ BattleMenu_Pack:  	farcall BattlePack  	ld a, [wBattlePlayerAction] -	and a +	and a ; BATTLEPLAYERACTION_USEMOVE?  	jr z, .didnt_use_item  	jr .got_item @@ -5157,7 +5157,7 @@ TryPlayerSwitch:  	jp z, BattleMenuPKMN_Loop  	ld a, [wCurBattleMon]  	ld [wLastPlayerMon], a -	ld a, $2 +	ld a, BATTLEPLAYERACTION_SWITCH  	ld [wBattlePlayerAction], a  	call ClearPalettes  	call DelayFrame @@ -5270,8 +5270,8 @@ PassedBattleMonEntrance:  	ld [wCurBattleMon], a  	call AddBattleParticipant  	call InitBattleMon -	xor a -	ld [wd265], a +	xor a ; FALSE +	ld [wApplyStatLevelMultipliersToEnemy], a  	call ApplyStatLevelMultiplierOnAllStats  	call SendOutPlayerMon  	call EmptyBattleTextBox @@ -5286,11 +5286,11 @@ BattleMenu_Run:  	ld hl, wBattleMonSpeed  	ld de, wEnemyMonSpeed  	call TryToRunAwayFromBattle -	ld a, $0 +	ld a, FALSE  	ld [wFailedToFlee], a  	ret c  	ld a, [wBattlePlayerAction] -	and a +	and a ; BATTLEPLAYERACTION_USEMOVE?  	ret nz  	jp BattleMenu @@ -5770,7 +5770,7 @@ ParseEnemyAction:  	call EmptyBattleTextBox  	call LoadTileMapToTempTileMap  	ld a, [wBattlePlayerAction] -	and a +	and a ; BATTLEPLAYERACTION_USEMOVE?  	call z, LinkBattleSendReceiveAction  	call Call_LoadTempTileMapToTileMap  	ld a, [wBattleAction] @@ -5989,7 +5989,7 @@ LoadEnemyMon:  ; Used for Ho-Oh, Lugia and Snorlax encounters  	ld a, [wBattleType]  	cp BATTLETYPE_FORCEITEM -	ld a, [wBaseItems] +	ld a, [wBaseItem1]  	jr z, .UpdateItem  ; Failing that, it's all up to chance @@ -6007,9 +6007,9 @@ LoadEnemyMon:  ; From there, an 8% chance for Item2  	call BattleRandom  	cp 8 percent ; 8% of 25% = 2% Item2 -	ld a, [wBaseItems] +	ld a, [wBaseItem1]  	jr nc, .UpdateItem -	ld a, [wBaseItems+1] +	ld a, [wBaseItem2]  .UpdateItem:  	ld [wEnemyMonItem], a @@ -6375,7 +6375,7 @@ LoadEnemyMon:  	ld [de], a  	ld a, [wTempEnemyMonSpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName @@ -6661,14 +6661,14 @@ ApplyStatLevelMultiplierOnAllStats:  	call ApplyStatLevelMultiplier  	inc c  	ld a, c -	cp 5 +	cp NUM_BATTLE_STATS  	jr nz, .stat_loop  	ret  ApplyStatLevelMultiplier:  	push bc  	push bc -	ld a, [wd265] +	ld a, [wApplyStatLevelMultipliersToEnemy]  	and a  	ld a, c  	ld hl, wBattleMonAttack @@ -6718,7 +6718,7 @@ ApplyStatLevelMultiplier:  	call Multiply  	ld a, [hl]  	ld [hDivisor], a -	ld b, $4 +	ld b, 4  	call Divide  	pop hl @@ -7192,7 +7192,7 @@ GiveExperiencePoints:  	add hl, bc  	ld a, [hl]  	ld [wCurSpecies], a -	ld [wd265], a +	ld [wTempSpecies], a ; unused?  	call GetBaseData  	ld hl, MON_MAXHP + 1  	add hl, bc @@ -7256,8 +7256,8 @@ GiveExperiencePoints:  	call CopyBytes  .transformed -	xor a -	ld [wd265], a +	xor a ; FALSE +	ld [wApplyStatLevelMultipliersToEnemy], a  	call ApplyStatLevelMultiplierOnAllStats  	callfar ApplyStatusEffectOnPlayerStats  	callfar BadgeStatBoosts @@ -7299,7 +7299,7 @@ GiveExperiencePoints:  	xor a ; PARTYMON  	ld [wMonType], a  	ld a, [wCurSpecies] -	ld [wd265], a +	ld [wTempSpecies], a ; unused?  	ld a, [wCurPartyLevel]  	push af  	ld c, a @@ -7359,7 +7359,7 @@ GiveExperiencePoints:  	cp 2  	ret c -	ld [wd265], a +	ld [wTempByteValue], a  	ld hl, wEnemyMonBaseStats  	ld c, wEnemyMonEnd - wEnemyMonBaseStats  .count_loop2 @@ -7367,7 +7367,7 @@ GiveExperiencePoints:  	ld [hDividend + 0], a  	ld a, [hl]  	ld [hDividend + 1], a -	ld a, [wd265] +	ld a, [wTempByteValue]  	ld [hDivisor], a  	ld b, 2  	call Divide diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 825ca9709..32cc65e35 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -2,7 +2,7 @@ DoPlayerTurn:  	call SetPlayerTurn  	ld a, [wBattlePlayerAction] -	and a +	and a ; BATTLEPLAYERACTION_USEMOVE?  	ret nz  	jr DoTurn @@ -1248,7 +1248,7 @@ BattleCommand_Stab:  .go  	ld a, BATTLE_VARS_MOVE_TYPE  	call GetBattleVarAddr -	ld [wTypeMatchup], a +	ld [wCurType], a  	push hl  	push de @@ -1264,7 +1264,7 @@ BattleCommand_Stab:  	pop bc  	pop de -	ld a, [wTypeMatchup] +	ld a, [wCurType]  	cp b  	jr z, .stab  	cp c @@ -3583,7 +3583,7 @@ UpdateMoveData:  	ld a, BATTLE_VARS_MOVE  	call GetBattleVar -	ld [wCurMove], a +	ld [wCurSpecies], a  	ld [wNamedObjectIndexBuffer], a  	dec a diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 48062f643..8985385a0 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -53,13 +53,13 @@ DoWeatherModifiers:  	ld de, WeatherTypeModifiers  	ld a, [wBattleWeather]  	ld b, a -	ld a, [wd265] ; move type +	ld a, [wCurType]  	ld c, a  .CheckWeatherType:  	ld a, [de]  	inc de -	cp $ff +	cp -1  	jr z, .done_weather_types  	cp b @@ -84,7 +84,7 @@ DoWeatherModifiers:  .CheckWeatherMove:  	ld a, [de]  	inc de -	cp $ff +	cp -1  	jr z, .done  	cp b @@ -116,7 +116,7 @@ DoWeatherModifiers:  	ld a, 10  	ld [hDivisor], a -	ld b, $4 +	ld b, 4  	call Divide  	ld a, [hQuotient + 0] @@ -176,7 +176,7 @@ DoBadgeTypeBoosts:  	rr c  	jr nc, .NextBadge -	ld a, [wd265] ; move type +	ld a, [wCurType]  	cp [hl]  	jr z, .ApplyBoost diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm index 5d9f19838..7f922b214 100644 --- a/engine/battle/move_effects/baton_pass.asm +++ b/engine/battle/move_effects/baton_pass.asm @@ -68,8 +68,8 @@ BattleCommand_BatonPass:  	call CallBattleCore  	ld hl, ResetBattleParticipants  	call CallBattleCore -	ld a, 1 -	ld [wTypeMatchup], a +	ld a, TRUE +	ld [wApplyStatLevelMultipliersToEnemy], a  	ld hl, ApplyStatLevelMultiplierOnAllStats  	call CallBattleCore @@ -83,7 +83,7 @@ BatonPass_LinkPlayerSwitch:  	and a  	ret z -	ld a, 1 +	ld a, BATTLEPLAYERACTION_USEITEM  	ld [wBattlePlayerAction], a  	call LoadStandardMenuHeader @@ -91,7 +91,7 @@ BatonPass_LinkPlayerSwitch:  	call CallBattleCore  	call CloseWindow -	xor a +	xor a ; BATTLEPLAYERACTION_USEMOVE  	ld [wBattlePlayerAction], a  	ret diff --git a/engine/battle/move_effects/magnitude.asm b/engine/battle/move_effects/magnitude.asm index 4dcf919d7..eaa0c2a3a 100644 --- a/engine/battle/move_effects/magnitude.asm +++ b/engine/battle/move_effects/magnitude.asm @@ -18,7 +18,7 @@ BattleCommand_GetMagnitude:  	push de  	inc hl  	ld a, [hl] -	ld [wTypeMatchup], a +	ld [wDeciramBuffer], a  	call BattleCommand_MoveDelay  	ld hl, MagnitudeText  	call StdBattleTextBox diff --git a/engine/battle/move_effects/mirror_move.asm b/engine/battle/move_effects/mirror_move.asm index 089403839..89879c825 100644 --- a/engine/battle/move_effects/mirror_move.asm +++ b/engine/battle/move_effects/mirror_move.asm @@ -24,7 +24,7 @@ BattleCommand_MirrorMove:  .use  	ld a, b  	ld [hl], a -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	push af  	ld a, BATTLE_VARS_MOVE_ANIM diff --git a/engine/battle/move_effects/sketch.asm b/engine/battle/move_effects/sketch.asm index 4c15dbe02..a5b0d1c03 100644 --- a/engine/battle/move_effects/sketch.asm +++ b/engine/battle/move_effects/sketch.asm @@ -34,7 +34,7 @@ BattleCommand_Sketch:  .get_last_move  	ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP  	call GetBattleVar -	ld [wTypeMatchup], a +	ld [wNamedObjectIndexBuffer], a  	ld b, a  ; Fail if move is invalid or is Struggle.  	and a diff --git a/engine/battle/move_effects/spite.asm b/engine/battle/move_effects/spite.asm index 8aba187a4..71252fe22 100644 --- a/engine/battle/move_effects/spite.asm +++ b/engine/battle/move_effects/spite.asm @@ -24,7 +24,7 @@ BattleCommand_Spite:  	ld a, [hli]  	cp b  	jr nz, .loop -	ld [wTypeMatchup], a +	ld [wNamedObjectIndexBuffer], a  	dec hl  	ld b, 0  	push bc @@ -78,7 +78,7 @@ BattleCommand_Spite:  	call AnimateCurrentMove  	pop de  	ld a, d -	ld [wTypeMatchup], a +	ld [wDeciramBuffer], a  	ld hl, SpiteEffectText  	jp StdBattleTextBox diff --git a/engine/battle/move_effects/thief.asm b/engine/battle/move_effects/thief.asm index 64de1a4fe..34a9699fc 100644 --- a/engine/battle/move_effects/thief.asm +++ b/engine/battle/move_effects/thief.asm @@ -21,7 +21,7 @@ BattleCommand_Thief:  ; Can't steal mail. -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld d, a  	farcall ItemIsMail  	ret c @@ -45,7 +45,7 @@ BattleCommand_Thief:  	ld [de], a  	call .playeritem -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [hl], a  	ld [de], a  	jr .stole @@ -68,7 +68,7 @@ BattleCommand_Thief:  ; Can't steal mail! -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld d, a  	farcall ItemIsMail  	ret c @@ -86,7 +86,7 @@ BattleCommand_Thief:  	ld [de], a  	call .enemyitem -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [hl], a  	ld [de], a diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 3930549b2..7a971e21f 100644 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -101,7 +101,7 @@ StageBallTilesData:  DrawPlayerHUDBorder:  	ld hl, .tiles  	ld de, wTrainerHUDTiles -	ld bc, 4 +	ld bc, .tiles_end - .tiles  	call CopyBytes  	hlcoord 18, 10  	ld de, -1 ; start on right @@ -112,11 +112,12 @@ DrawPlayerHUDBorder:  	db $77 ; bottom right  	db $6f ; bottom left  	db $76 ; bottom side +.tiles_end  DrawPlayerPartyIconHUDBorder:  	ld hl, .tiles  	ld de, wTrainerHUDTiles -	ld bc, 4 +	ld bc, .tiles_end - .tiles  	call CopyBytes  	hlcoord 18, 10  	ld de, -1 ; start on right @@ -127,11 +128,12 @@ DrawPlayerPartyIconHUDBorder:  	db $5c ; bottom right  	db $6f ; bottom left  	db $76 ; bottom side +.tiles_end  DrawEnemyHUDBorder:  	ld hl, .tiles  	ld de, wTrainerHUDTiles -	ld bc, 4 +	ld bc, .tiles_end - .tiles  	call CopyBytes  	hlcoord 1, 2  	ld de, 1 ; start on left @@ -152,23 +154,24 @@ DrawEnemyHUDBorder:  	db $74 ; bottom left  	db $78 ; bottom right  	db $76 ; bottom side +.tiles_end  PlaceHUDBorderTiles: -	ld a, [wTrainerHUDTiles] +	ld a, [wTrainerHUDTiles + 0]  	ld [hl], a  	ld bc, SCREEN_WIDTH  	add hl, bc -	ld a, [wStartFlypoint] +	ld a, [wTrainerHUDTiles + 1]  	ld [hl], a -	ld b, $8 +	ld b, 8  .loop  	add hl, de -	ld a, [wMovementBuffer] +	ld a, [wTrainerHUDTiles + 3]  	ld [hl], a  	dec b  	jr nz, .loop  	add hl, de -	ld a, [wEndFlypoint] +	ld a, [wTrainerHUDTiles + 2]  	ld [hl], a  	ret @@ -181,7 +184,7 @@ LinkBattle_TrainerHuds:  	ld a, 10 * 8  	ld [hli], a  	ld [hl], 8 * 8 -	ld a, $8 +	ld a, 8  	ld [wPlaceBallsDirection], a  	ld hl, wVirtualOAMSprite00  	call LoadTrainerHudOAM diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index 9307a1a1e..8166094f2 100644 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -26,7 +26,7 @@ UsedMoveText:  	ld a, BATTLE_VARS_MOVE_ANIM  	call GetBattleVar -	ld [wd265], a +	ld [wMoveGrammar], a  	push hl  	farcall CheckUserIsCharging @@ -34,13 +34,12 @@ UsedMoveText:  	jr nz, .grammar  	; update last move -	ld a, [wd265] +	ld a, [wMoveGrammar]  	ld [hl], a  	ld [de], a  .grammar -	call GetMoveGrammar -; wd265 now contains MoveGrammar +	call GetMoveGrammar ; convert move id to grammar index  ; everything except 'instead' made redundant in localization @@ -51,7 +50,7 @@ UsedMoveText:  	ret nz  	; check move grammar -	ld a, [wd265] +	ld a, [wMoveGrammar]  	cp $3  	ld hl, UsedMove2Text  	ret c @@ -89,14 +88,14 @@ MoveNameText:  	ld hl, .endusedmovetexts  ; get move id -	ld a, [wd265] +	ld a, [wMoveGrammar]  ; 2-byte pointer  	add a  ; seek  	push bc -	ld b, $0 +	ld b, 0  	ld c, a  	add hl, bc  	pop bc @@ -132,13 +131,13 @@ EndUsedMove5Text:  	db "@"  GetMoveGrammar: -; store move grammar type in wd265 +; store move grammar type in wMoveGrammar  	push bc -; c = move id -	ld a, [wd265] -	ld c, a -	ld b, $0 +; wMoveGrammar contains move id +	ld a, [wMoveGrammar] +	ld c, a ; move id +	ld b, 0 ; grammar index  ; read grammar table  	ld hl, MoveGrammar @@ -158,9 +157,9 @@ GetMoveGrammar:  	jr .loop  .end -; wd265 now contains move grammar +; wMoveGrammar now contains move grammar  	ld a, b -	ld [wd265], a +	ld [wMoveGrammar], a  ; we're done  	pop bc diff --git a/engine/events/bug_contest/caught_mon.asm b/engine/events/bug_contest/caught_mon.asm index 45212ae3e..fc170cf28 100644 --- a/engine/events/bug_contest/caught_mon.asm +++ b/engine/events/bug_contest/caught_mon.asm @@ -2,7 +2,7 @@ BugContest_SetCaughtContestMon:  	ld a, [wContestMon]  	and a  	jr z, .firstcatch -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	farcall DisplayAlreadyCaughtText  	farcall DisplayCaughtContestMonStats  	lb bc, 14, 7 @@ -12,7 +12,7 @@ BugContest_SetCaughtContestMon:  .firstcatch  	call .generatestats  	ld a, [wTempEnemyMonSpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, .caughttext  	call PrintText diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 94a5e9511..9d92f8fe3 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -36,7 +36,7 @@ DisplayCaughtContestMonStats:  	call PlaceString  	ld a, [wContestMon] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld de, wStringBuffer1  	hlcoord 1, 2 diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 5904a476d..4e98c5382 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -558,7 +558,7 @@ DayCare_InitBreeding:  	bit DAYCAREMAN_HAS_MON_F, a  	ret z  	callfar CheckBreedmonCompatibility -	ld a, [wd265] +	ld a, [wBreedingCompatibility]  	and a  	ret z  	inc a diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 6adb80ba6..a6edbc08c 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -407,7 +407,7 @@ FlyFunction_InitGFX:  	ld d, 0  	add hl, de  	ld a, [hl] -	ld [wd265], a +	ld [wTempIconSpecies], a  	ld e, FIELDMOVE_FLY  	farcall FlyFunction_GetMonIcon  	xor a diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index fcbcc1593..752ec965b 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -462,7 +462,7 @@ DisplayHOFMon:  	call TextBox  	ld a, [wTempMonSpecies]  	ld [wCurPartySpecies], a -	ld [wd265], a +	ld [wDeciramBuffer], a  	ld hl, wTempMonDVs  	predef GetUnownLetter  	xor a @@ -477,7 +477,7 @@ DisplayHOFMon:  	ld [hli], a  	ld [hl], "<DOT>"  	hlcoord 3, 13 -	ld de, wd265 +	ld de, wDeciramBuffer  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3  	call PrintNum  	call GetBasePokemonName diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 41f9a4411..1d33edb74 100644 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -11,7 +11,7 @@ GetFirstPokemonHappiness:  	jr .loop  .done -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld a, [hl]  	ld [wScriptVar], a  	call GetPokemonName @@ -19,9 +19,9 @@ GetFirstPokemonHappiness:  CheckFirstMonIsEgg:  	ld a, [wPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	cp EGG -	ld a, 1 +	ld a, TRUE  	jr z, .egg  	xor a @@ -196,15 +196,15 @@ DayCareStep::  	call Random  	ld [hl], a  	callfar CheckBreedmonCompatibility -	ld a, [wd265] +	ld a, [wBreedingCompatibility]  	cp 230  	ld b, 32 percent - 1  	jr nc, .okay -	ld a, [wd265] +	ld a, [wBreedingCompatibility]  	cp 170  	ld b, 16 percent  	jr nc, .okay -	ld a, [wd265] +	ld a, [wBreedingCompatibility]  	cp 110  	ld b, 12 percent  	jr nc, .okay diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index c5d6d18e0..1c3a8dc02 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -1,7 +1,7 @@  CheckForLuckyNumberWinners:  	xor a  	ld [wScriptVar], a -	ld [wFoundMatchingIDInParty], a +	ld [wTempByteValue], a  	ld a, [wPartyCount]  	and a  	ret z @@ -34,8 +34,8 @@ CheckForLuckyNumberWinners:  	jr z, .SkipOpenBoxMon  	call .CompareLuckyNumberToMonID  	jr nc, .SkipOpenBoxMon -	ld a, 1 -	ld [wFoundMatchingIDInParty], a +	ld a, TRUE +	ld [wTempByteValue], a  .SkipOpenBoxMon:  	push bc @@ -81,8 +81,8 @@ CheckForLuckyNumberWinners:  	call .CompareLuckyNumberToMonID ; sets wScriptVar and wCurPartySpecies appropriately  	jr nc, .SkipBoxMon -	ld a, 1 -	ld [wFoundMatchingIDInParty], a +	ld a, TRUE +	ld [wTempByteValue], a  .SkipBoxMon:  	push bc @@ -104,7 +104,7 @@ CheckForLuckyNumberWinners:  	and a  	ret z ; found nothing  	farcall StubbedTrainerRankings_LuckyNumberShow -	ld a, [wFoundMatchingIDInParty] +	ld a, [wTempByteValue]  	and a  	push af  	ld a, [wCurPartySpecies] @@ -127,14 +127,14 @@ CheckForLuckyNumberWinners:  	ld hl, wBuffer1  	lb bc, PRINTNUM_LEADINGZEROS | 2, 5  	call PrintNum -	ld hl, wLuckyNumberDigit1Buffer +	ld hl, wLuckyNumberDigitsBuffer  	ld de, wLuckyIDNumber  	lb bc, PRINTNUM_LEADINGZEROS | 2, 5  	call PrintNum  	ld b, 5  	ld c, 0 -	ld hl, wLuckyNumberDigit5Buffer -	ld de, wBuffer5 +	ld hl, wLuckyNumberDigitsBuffer + 4 +	ld de, wBuffer1 + 4  .loop  	ld a, [de]  	cp [hl] diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index cf8ad80ba..db415c65e 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -185,7 +185,7 @@ CalcMagikarpLength:  	ld hl, MagikarpLengths  	ld a, 2 -	ld [wd265], a +	ld [wTempByteValue], a  .read  	ld a, [hli] @@ -214,7 +214,7 @@ CalcMagikarpLength:  	ld [hMultiplicand + 1], a  	ld a, 100  	ld [hMultiplicand + 2], a -	ld a, [wd265] +	ld a, [wTempByteValue]  	ld [hMultiplier], a  	call Multiply  	ld b, 0 @@ -228,9 +228,9 @@ CalcMagikarpLength:  .next  	inc hl ; align to next triplet -	ld a, [wd265] +	ld a, [wTempByteValue]  	inc a -	ld [wd265], a +	ld [wTempByteValue], a  	cp 16  	jr c, .read diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index f2b827227..2f0df5162 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -28,7 +28,7 @@ MoveDeletion:  	ld a, [wMenuCursorY]  	push af  	ld a, [wCurSpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	ld hl, .ConfirmDeleteText  	call PrintText diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index 67d0ca528..681dc6adc 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -8,7 +8,7 @@ MoveTutor:  	xor a  	ld [wItemAttributeParamBuffer], a  	call .GetMoveTutorMove -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wPutativeTMHMMove], a  	call GetMoveName  	call CopyName1 diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index 593d51c69..2cdff4bdd 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -29,7 +29,7 @@ _NameRater:  	xor a ; PARTYMON  	ld [wMonType], a  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wCurSpecies], a  	call GetBaseData  	ld b, 0 diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm index 9cff40a2b..bb71941ed 100644 --- a/engine/events/npc_trade.asm +++ b/engine/events/npc_trade.asm @@ -301,7 +301,7 @@ Trade_GetAttributeOfLastPartymon:  GetTradeMonName:  	push de -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetBasePokemonName  	ld hl, wStringBuffer1  	pop de diff --git a/engine/events/specials.asm b/engine/events/specials.asm index 35d32dde6..be554f1bc 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -34,7 +34,7 @@ GameCornerPrizeMonCheckDex:  	call SetSeenAndCaughtMon  	call FadeToMenu  	ld a, [wScriptVar] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	farcall NewPokedexEntry  	call ExitAllMenus  	ret @@ -153,7 +153,7 @@ GetMysteryGiftItem:  	ld [sMysteryGiftItem], a  	call CloseSRAM  	ld a, [wCurItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ld hl, .ReceiveItemText  	call PrintText diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 5ae2fbf8b..c4bb7294c 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -34,13 +34,14 @@ LoadMenuMonIcon:  	jp hl  .Jumptable: -	dw PartyMenu_InitAnimatedMonIcon ; party menu -	dw NamingScreen_InitAnimatedMonIcon ; naming screen -	dw MoveList_InitAnimatedMonIcon ; moves (?) -	dw Trade_LoadMonIconGFX ; trade -	dw Mobile_InitAnimatedMonIcon ; mobile -	dw Mobile_InitPartyMenuBGPal71 ; mobile -	dw .GetPartyMenuMonIcon ; unused +; entries correspond to MONICON_* constants +	dw PartyMenu_InitAnimatedMonIcon    ; MONICON_PARTYMENU +	dw NamingScreen_InitAnimatedMonIcon ; MONICON_NAMINGSCREEN +	dw MoveList_InitAnimatedMonIcon     ; MONICON_MOVES +	dw Trade_LoadMonIconGFX             ; MONICON_TRADE +	dw Mobile_InitAnimatedMonIcon       ; MONICON_MOBILE1 +	dw Mobile_InitPartyMenuBGPal71      ; MONICON_MOBILE2 +	dw .GetPartyMenuMonIcon             ; MONICON_UNUSED  .GetPartyMenuMonIcon:  	call InitPartyMenuIcon @@ -65,14 +66,14 @@ LoadMenuMonIcon:  	pop bc  	pop hl  	jr c, .not_mail -	ld a, $6 +	ld a, $06  	jr .got_tile  .not_mail -	ld a, $5 -	; jr .got_tile +	ld a, $05 +	; fallthrough  .no_item -	ld a, $4 +	ld a, $04  .got_tile  	ld hl, SPRITEANIMSTRUCT_FRAMESET_ID  	add hl, bc @@ -156,7 +157,7 @@ InitPartyMenuIcon:  	ld a, [hObjectStructIndexBuffer]  	ld hl, wPartySpecies  	ld e, a -	ld d, $0 +	ld d, 0  	add hl, de  	ld a, [hl]  	call ReadMonMenuIcon @@ -214,7 +215,7 @@ SetPartyMonIconAnimSpeed:  	db $80 ; HP_RED  NamingScreen_InitAnimatedMonIcon: -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	xor a @@ -228,7 +229,7 @@ NamingScreen_InitAnimatedMonIcon:  	ret  MoveList_InitAnimatedMonIcon: -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	xor a @@ -243,7 +244,7 @@ MoveList_InitAnimatedMonIcon:  	ret  Trade_LoadMonIconGFX: -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	ld a, $62 @@ -254,7 +255,7 @@ Trade_LoadMonIconGFX:  GetSpeciesIcon:  ; Load species icon into VRAM at tile a  	push de -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	pop de @@ -264,7 +265,7 @@ GetSpeciesIcon:  FlyFunction_GetMonIcon:  	push de -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	pop de @@ -274,7 +275,7 @@ FlyFunction_GetMonIcon:  Unreferenced_GetMonIcon2:  	push de -	ld a, [wd265] +	ld a, [wTempIconSpecies]  	call ReadMonMenuIcon  	ld [wCurIcon], a  	pop de diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1439b2c6d..ee5c4d254 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1,6 +1,6 @@  _DoItemEffect::  	ld a, [wCurItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	call CopyName1  	ld a, 1 @@ -489,7 +489,7 @@ PokeBallEffect:  	ld a, [wEnemyMonSpecies]  	ld [wWildMon], a  	ld [wCurPartySpecies], a -	ld [wd265], a +	ld [wTempSpecies], a  	ld a, [wBattleType]  	cp BATTLETYPE_TUTORIAL  	jp z, .FinishTutorial @@ -501,13 +501,13 @@ PokeBallEffect:  	call ClearSprites -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckCaughtMon  	ld a, c  	push af -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call SetSeenAndCaughtMon  	pop af @@ -523,7 +523,7 @@ PokeBallEffect:  	call ClearSprites  	ld a, [wEnemyMonSpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	predef NewPokedexEntry  .skip_pokedex @@ -566,7 +566,7 @@ PokeBallEffect:  	call PrintText  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	call YesNoBox @@ -626,7 +626,7 @@ PokeBallEffect:  	call PrintText  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	call YesNoBox @@ -1276,7 +1276,7 @@ Table_eeeb:  RareCandy_StatBooster_GetParameters:  	ld a, [wCurPartySpecies]  	ld [wCurSpecies], a -	ld [wd265], a +	ld [wTempSpecies], a  	ld a, MON_LEVEL  	call GetPartyParamLocation  	ld a, [hl] @@ -1368,7 +1368,7 @@ RareCandyEffect:  	xor a ; PARTYMON  	ld [wMonType], a  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	predef LearnLevelMoves  	xor a @@ -2344,7 +2344,7 @@ RestorePPEffect:  	push hl  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	call CopyName1  	pop hl @@ -2373,8 +2373,8 @@ RestorePPEffect:  	ld a, [hl]  	add PP_UP_ONE  	ld [hl], a -	ld a, $1 -	ld [wd265], a +	ld a, TRUE +	ld [wUsePPUp], a  	call ApplyPPUp  	call Play_SFX_FULL_HEAL @@ -2492,7 +2492,7 @@ RestorePP:  	ld hl, wPartyMon1PP  	ld bc, PARTYMON_STRUCT_LENGTH  	call GetMthMoveOfNthPartymon -	ld a, [wd265] +	ld a, [wTempPP]  	ld b, a  	ld a, [hl]  	and PP_MASK @@ -2765,8 +2765,8 @@ ApplyPPUp:  	ld a, b  	cp NUM_MOVES + 1  	ret z -	ld a, [wd265] -	dec a +	ld a, [wUsePPUp] +	dec a ; FALSE?  	jr nz, .use  	ld a, [wMenuCursorY]  	inc a @@ -2822,7 +2822,7 @@ ComputeMaxPP:  .okay  	add b  	ld b, a -	ld a, [wd265] +	ld a, [wTempPP]  	dec a  	jr z, .NoPPUp  	dec c @@ -2857,7 +2857,7 @@ RestoreAllPP:  	ld a, [de]  	and PP_UP_MASK  	ld b, a -	ld a, [wd265] +	ld a, [wTempPP]  	add b  	ld [de], a  	inc de @@ -2933,12 +2933,12 @@ GetMaxPPOfMove:  	ld hl, wStringBuffer1 + 1  	ld [hl], a  	xor a -	ld [wd265], a +	ld [wTempPP], a  	ld a, b ; this gets lost anyway  	call ComputeMaxPP  	ld a, [hl]  	and PP_MASK -	ld [wd265], a +	ld [wTempPP], a  	pop af  	ld [wStringBuffer1 + 1], a diff --git a/engine/items/print_item_description.asm b/engine/items/print_item_description.asm index b0a3a0b33..5d944e206 100644 --- a/engine/items/print_item_description.asm +++ b/engine/items/print_item_description.asm @@ -9,7 +9,7 @@ PrintItemDescription:  	push de  	farcall GetTMHMItemMove  	pop hl -	ld a, [wd265] +	ld a, [wTempTMHM]  	ld [wCurSpecies], a  	predef PrintMoveDesc  	ret diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 4958d2afc..38ffa865e 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -33,7 +33,7 @@ ConvertCurItemIntoCurTMHM:  	ld c, a  	callfar GetTMHMNumber  	ld a, c -	ld [wCurTMHM], a +	ld [wTempTMHM], a  	ret  GetTMHMItemMove: @@ -50,7 +50,7 @@ AskTeachTMHM:  	cp TM01  	jr c, .NotTMHM  	call GetTMHMItemMove -	ld a, [wCurTMHM] +	ld a, [wTempTMHM]  	ld [wPutativeTMHMMove], a  	call GetMoveName  	call CopyName1 @@ -251,9 +251,9 @@ TMHM_ShowTMMoveDescription:  	ld a, [wCurItem]  	cp NUM_TMS + NUM_HMS + 1  	jr nc, TMHM_JoypadLoop -	ld [wd265], a +	ld [wTempTMHM], a  	predef GetTMHMMove -	ld a, [wd265] +	ld a, [wTempTMHM]  	ld [wCurSpecies], a  	hlcoord 1, 14  	call PrintMoveDesc @@ -261,14 +261,14 @@ TMHM_ShowTMMoveDescription:  TMHM_ChooseTMorHM:  	call TMHM_PlaySFX_ReadText2 -	call CountTMsHMs ; This stores the count to wd265. +	call CountTMsHMs ; This stores the count to wTempTMHM.  	ld a, [wMenuCursorY]  	dec a  	ld b, a  	ld a, [wTMHMPocketScrollPosition]  	add b  	ld b, a -	ld a, [wd265] +	ld a, [wTempTMHM]  	cp b  	jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL  TMHM_CheckHoveringOverCancel: @@ -354,16 +354,16 @@ TMHM_DisplayPocketItems:  	jr z, .loop2  	ld b, a  	ld a, c -	ld [wd265], a +	ld [wTempTMHM], a  	push hl  	push de  	push bc  	call TMHMPocket_GetCurrentLineCoord  	push hl -	ld a, [wd265] +	ld a, [wTempTMHM]  	cp NUM_TMS + 1  	jr nc, .HM -	ld de, wd265 +	ld de, wTempTMHM  	lb bc, PRINTNUM_LEADINGZEROS | 1, 2  	call PrintNum  	jr .okay @@ -371,17 +371,17 @@ TMHM_DisplayPocketItems:  .HM:  	push af  	sub NUM_TMS -	ld [wd265], a +	ld [wTempTMHM], a  	ld [hl], "H"  	inc hl -	ld de, wd265 +	ld de, wTempTMHM  	lb bc, PRINTNUM_RIGHTALIGN | 1, 2  	call PrintNum  	pop af -	ld [wd265], a +	ld [wTempTMHM], a  .okay  	predef GetTMHMMove -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [wPutativeTMHMMove], a  	call GetMoveName  	pop hl @@ -403,8 +403,8 @@ TMHM_DisplayPocketItems:  	pop bc  	push bc  	ld a, b -	ld [wd265], a -	ld de, wd265 +	ld [wTempTMHM], a +	ld de, wTempTMHM  	lb bc, 1, 2  	call PrintNum  .hm2 @@ -445,7 +445,7 @@ Unreferenced_Function2ca95:  	ld bc, 3  	add hl, bc  	predef GetTMHMMove -	ld a, [wd265] +	ld a, [wTempTMHM]  	ld [wPutativeTMHMMove], a  	call GetMoveName  	push hl @@ -508,7 +508,7 @@ Unreferenced_Function2cadf:  	db "@"  .CheckHaveRoomForTMHM: -	ld a, [wd265] +	ld a, [wTempTMHM]  	dec a  	ld hl, wTMsHMs  	ld b, 0 @@ -523,7 +523,7 @@ Unreferenced_Function2cadf:  ConsumeTM:  	call ConvertCurItemIntoCurTMHM -	ld a, [wd265] +	ld a, [wTempTMHM]  	dec a  	ld hl, wTMsHMs  	ld b, 0 @@ -555,7 +555,7 @@ CountTMsHMs:  	dec c  	jr nz, .loop  	ld a, b -	ld [wd265], a +	ld [wTempTMHM], a  	ret  PrintMoveDesc: diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm index 10206d36b..057d0b346 100644 --- a/engine/items/tmhm2.asm +++ b/engine/items/tmhm2.asm @@ -33,14 +33,14 @@ CanLearnTMHMMove:  	ret  GetTMHMMove: -	ld a, [wd265] +	ld a, [wTempTMHM]  	dec a  	ld hl, TMHMMoves  	ld b, 0  	ld c, a  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wTempTMHM], a  	ret  INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/link.asm b/engine/link/link.asm index 5be738b23..5363a3047 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -149,13 +149,13 @@ Gen2ToGen1LinkComms:  	ld a, [hli]  	cp -1  	jr z, .done_party -	ld [wd265], a +	ld [wTempSpecies], a  	push hl  	push de  	callfar ConvertMon_1to2  	pop de  	pop hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [de], a  	inc de  	jr .party_loop @@ -651,13 +651,13 @@ Link_PrepPartyData_Gen1:  	ld a, [hli]  	cp -1  	jr z, .done_party -	ld [wd265], a +	ld [wTempSpecies], a  	push hl  	push de  	callfar ConvertMon_2to1  	pop de  	pop hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [de], a  	inc de  	jr .loop2 @@ -692,11 +692,11 @@ Link_PrepPartyData_Gen1:  	push de  	push bc  	ld a, [hl] -	ld [wd265], a +	ld [wTempSpecies], a  	callfar ConvertMon_2to1  	pop bc  	pop de -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [de], a  	inc de  	ld hl, MON_HP @@ -976,11 +976,11 @@ Function2868a:  	inc de  	push bc  	push de -	ld [wd265], a +	ld [wTempSpecies], a  	callfar ConvertMon_1to2  	pop de  	pop bc -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [bc], a  	ld [wCurSpecies], a  	ld hl, MON_HP @@ -1461,7 +1461,7 @@ Function28926:  	ld b, 0  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	hlcoord 0, 12  	ld b, 4 @@ -1619,7 +1619,7 @@ LinkTrade:  	ld b, 0  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wStringBuffer1  	ld de, wd004 @@ -1631,7 +1631,7 @@ LinkTrade:  	ld b, 0  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, UnknownText_0x28eb8  	bccoord 1, 14 @@ -2047,14 +2047,14 @@ CheckTimeCapsuleCompatibility:  	jr .done  .mon_too_new -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld a, $1  	jr .done  .move_too_new  	push bc -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	call CopyName1  	pop bc @@ -2079,7 +2079,7 @@ Function29c67:  	ld hl, wPartyCount  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ret @@ -2146,13 +2146,13 @@ WaitForOtherPlayerToExit:  SetBitsForLinkTradeRequest:  	ld a, LINK_TRADECENTER - 1  	ld [wPlayerLinkAction], a -	ld [wd265], a +	ld [wChosenCableClubRoom], a  	ret  SetBitsForBattleRequest:  	ld a, LINK_COLOSSEUM - 1  	ld [wPlayerLinkAction], a -	ld [wd265], a +	ld [wChosenCableClubRoom], a  	ret  SetBitsForTimeCapsuleRequest: @@ -2166,7 +2166,7 @@ SetBitsForTimeCapsuleRequest:  	ld [rSC], a  	xor a ; LINK_TIMECAPSULE - 1  	ld [wPlayerLinkAction], a -	ld [wd265], a +	ld [wChosenCableClubRoom], a  	ret  WaitForLinkedFriend: @@ -2373,7 +2373,7 @@ Link_CheckCommunicationError:  	ret  TryQuickSave: -	ld a, [wd265] +	ld a, [wChosenCableClubRoom]  	push af  	farcall Link_SaveGame  	ld a, TRUE @@ -2384,11 +2384,11 @@ TryQuickSave:  	ld c, 30  	call DelayFrames  	pop af -	ld [wd265], a +	ld [wChosenCableClubRoom], a  	ret  CheckBothSelectedSameRoom: -	ld a, [wd265] +	ld a, [wChosenCableClubRoom]  	call Link_EnsureSync  	push af  	call LinkDataReceived @@ -2396,10 +2396,10 @@ CheckBothSelectedSameRoom:  	call LinkDataReceived  	pop af  	ld b, a -	ld a, [wd265] +	ld a, [wChosenCableClubRoom]  	cp b  	jr nz, .fail -	ld a, [wd265] +	ld a, [wChosenCableClubRoom]  	inc a  	ld [wLinkMode], a  	xor a diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 0a5dfcec3..6fba91619 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -1430,7 +1430,7 @@ Function105688:  	ld de, wMysteryGiftTrainerData  	farcall Function8ac70  	ld a, c -	ld [wd265], a +	ld [wDeciramBuffer], a  	ld hl, Text_CardNotRegistered  	jr c, PrintTextAndExit_JP  	ld hl, Text_ListedCardAsNumber diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm index c1b258724..b9c7eccb4 100644 --- a/engine/link/mystery_gift_2.asm +++ b/engine/link/mystery_gift_2.asm @@ -24,7 +24,7 @@ PrepMysteryGiftDataToSend:  	call CountSetBits  	pop de  	pop bc -	ld a, [wd265] +	ld a, [wNumSetBits]  	ld [de], a  	inc de ; wc80f  	call CloseSRAM diff --git a/engine/link/time_capsule.asm b/engine/link/time_capsule.asm index 195062c1e..499e9fc34 100644 --- a/engine/link/time_capsule.asm +++ b/engine/link/time_capsule.asm @@ -122,7 +122,7 @@ PlaceTradePartnerNamesAndParty:  	ld a, [de]  	cp -1  	ret z -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	push bc  	push hl  	push de diff --git a/engine/link/time_capsule_2.asm b/engine/link/time_capsule_2.asm index be7027f34..6640f6b03 100644 --- a/engine/link/time_capsule_2.asm +++ b/engine/link/time_capsule_2.asm @@ -1,8 +1,10 @@  ConvertMon_2to1: -; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265. +; Takes the Gen 2 Pokemon number stored in wTempSpecies, +; finds it in the Pokered_MonIndices table, +; and returns its index in wTempSpecies.  	push bc  	push hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld b, a  	ld c, 0  	ld hl, Pokered_MonIndices @@ -12,23 +14,24 @@ ConvertMon_2to1:  	cp b  	jr nz, .loop  	ld a, c -	ld [wd265], a +	ld [wTempSpecies], a  	pop hl  	pop bc  	ret  ConvertMon_1to2: -; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265. +; Takes the Gen 1 Pokemon number stored in wTempSpecies +; and returns the corresponding value from Pokered_MonIndices in wTempSpecies.  	push bc  	push hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	ld hl, Pokered_MonIndices  	ld b, 0  	ld c, a  	add hl, bc  	ld a, [hl] -	ld [wd265], a +	ld [wTempSpecies], a  	pop hl  	pop bc  	ret diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm index a48322488..efee45e59 100644 --- a/engine/menus/debug.asm +++ b/engine/menus/debug.asm @@ -311,9 +311,9 @@ Function81adb:  	ld a, [wcf66]  	inc a  	ld [wCurPartySpecies], a -	ld [wd265], a +	ld [wDeciramBuffer], a  	hlcoord 0, 1 -	ld de, wd265 +	ld de, wDeciramBuffer  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3  	call PrintNum  	ld a, [wd002] @@ -353,7 +353,7 @@ Function81adb:  	jr .asm_81ba9  .asm_81b7a -	ld a, [wd265] +	ld a, [wDeciramBuffer]  	ld [wTrainerClass], a  	callfar GetTrainerAttributes  	ld de, wStringBuffer1 @@ -738,9 +738,9 @@ Function81df4:  	call Function81e5e  	ld a, [wd004]  	inc a -	ld [wd265], a +	ld [wTempTMHM], a  	predef GetTMHMMove -	ld a, [wd265] +	ld a, [wTempTMHM]  	ld [wPutativeTMHMMove], a  	call GetMoveName  	hlcoord 10, 12 diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 9652dd73e..4e145664a 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -593,7 +593,7 @@ Continue_DisplayBadgeCount:  	ld b, 2  	call CountSetBits  	pop hl -	ld de, wd265 +	ld de, wNumSetBits  	lb bc, 1, 2  	jp PrintNum @@ -610,7 +610,7 @@ else  endc  	call CountSetBits  	pop hl -	ld de, wd265 +	ld de, wNumSetBits  	lb bc, 1, 3  	jp PrintNum diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index b039b590f..94732d60b 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -170,7 +170,7 @@ StartMenu_PrintBugContestStatus:  	and a  	ld de, .None  	jr z, .no_contest_mon -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  .no_contest_mon diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 8a8303067..aa8ccddf8 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -84,13 +84,13 @@ NamingScreen:  .Pokemon:  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempIconSpecies], a  	ld hl, LoadMenuMonIcon  	ld a, BANK(LoadMenuMonIcon) -	ld e, $1 -	rst FarCall ;  ; indirect jump to LoadMenuMonIcon (8e83f (23:683f)) +	ld e, MONICON_NAMINGSCREEN +	rst FarCall  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	hlcoord 5, 2  	call PlaceString diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 3813cd55a..ad9f0b5b2 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -133,12 +133,12 @@ StartMoveMonWOMail_SaveGame:  	ret  PauseGameLogic: -	ld a, $1 +	ld a, TRUE  	ld [wGameLogicPaused], a  	ret  ResumeGameLogic: -	xor a +	xor a ; FALSE  	ld [wGameLogicPaused], a  	ret @@ -230,13 +230,13 @@ _SavingDontTurnOffThePower:  SavedTheGame:  	call _SaveGameData  	; wait 32 frames -	ld c, $20 +	ld c, 32  	call DelayFrames  	; copy the original text speed setting to the stack  	ld a, [wOptions]  	push af -	; set text speed super slow -	ld a, 3 +	; set text speed to medium +	ld a, TEXT_DELAY_MED  	ld [wOptions], a  	; <PLAYER> saved the game!  	ld hl, Text_PlayerSavedTheGame @@ -248,7 +248,7 @@ SavedTheGame:  	call WaitPlaySFX  	call WaitSFX  	; wait 30 frames -	ld c, $1e +	ld c, 30  	call DelayFrames  	ret @@ -332,8 +332,8 @@ SavingDontTurnOffThePower:  	; Save the text speed setting to the stack  	ld a, [wOptions]  	push af -	; Set the text speed to super slow -	ld a, $3 +	; Set the text speed to medium +	ld a, TEXT_DELAY_MED  	ld [wOptions], a  	; SAVING... DON'T TURN OFF THE POWER.  	ld hl, Text_SavingDontTurnOffThePower @@ -342,7 +342,7 @@ SavingDontTurnOffThePower:  	pop af  	ld [wOptions], a  	; Wait for 16 frames -	ld c, $10 +	ld c, 16  	call DelayFrames  	ret diff --git a/engine/menus/start_menu.asm b/engine/menus/start_menu.asm index 54f468497..f6854740e 100644 --- a/engine/menus/start_menu.asm +++ b/engine/menus/start_menu.asm @@ -639,7 +639,7 @@ CantUseItemText:  PartyMonItemName:  	ld a, [wCurItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	call CopyName1  	ret @@ -842,17 +842,17 @@ TryGiveItemToPartymon:  	ret  .already_holding_item -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ld hl, SwitchAlreadyHoldingText  	call StartMenuYesNo  	jr c, .abort  	call GiveItemToPokemon -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	push af  	ld a, [wCurItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	pop af  	ld [wCurItem], a  	call ReceiveItemFromPokemon @@ -860,13 +860,13 @@ TryGiveItemToPartymon:  	ld hl, TookAndMadeHoldText  	call MenuTextBoxBackup -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [wCurItem], a  	call GivePartyItem  	ret  .bag_full -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [wCurItem], a  	call ReceiveItemFromPokemon  	ld hl, ItemStorageIsFullText @@ -901,7 +901,7 @@ TakePartyItem:  	farcall ItemIsMail  	call GetPartyItemLocation  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [hl], NO_ITEM  	call GetItemName  	ld hl, TookFromText @@ -1654,8 +1654,8 @@ SetUpMoveScreenBG:  	ld hl, wPartySpecies  	add hl, de  	ld a, [hl] -	ld [wd265], a -	ld e, $2 +	ld [wTempIconSpecies], a +	ld e, MONICON_MOVES  	farcall LoadMenuMonIcon  	hlcoord 0, 1  	ld b, 9 @@ -1724,7 +1724,7 @@ PrepareToPlaceMoveData:  	ld b, $0  	add hl, bc  	ld a, [hl] -	ld [wCurMove], a +	ld [wCurSpecies], a  	hlcoord 1, 12  	lb bc, 5, 18  	jp ClearBox @@ -1741,11 +1741,11 @@ PlaceMoveData:  	hlcoord 12, 12  	ld de, String_MoveAtk  	call PlaceString -	ld a, [wCurMove] +	ld a, [wCurSpecies]  	ld b, a  	hlcoord 2, 12  	predef PrintMoveType -	ld a, [wCurMove] +	ld a, [wCurSpecies]  	dec a  	ld hl, Moves + MOVE_POWER  	ld bc, MOVE_LENGTH @@ -1755,8 +1755,8 @@ PlaceMoveData:  	hlcoord 16, 12  	cp 2  	jr c, .no_power -	ld [wd265], a -	ld de, wd265 +	ld [wDeciramBuffer], a +	ld de, wDeciramBuffer  	lb bc, 1, 3  	call PrintNum  	jr .description diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index f48636f67..a1b7fcd64 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -276,7 +276,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime:  	ld hl, wPokedexCaught  	ld b, wEndPokedexCaught - wPokedexCaught  	call CountSetBits -	ld de, wd265 +	ld de, wNumSetBits  	hlcoord 15, 10  	lb bc, 1, 3  	call PrintNum diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 97828ab58..76154a1aa 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -377,7 +377,7 @@ ParseCredits:  	push de  	ld a, [wCreditsPos]  	ld e, a -	ld a, [wCreditsPos+1] +	ld a, [wCreditsPos + 1]  	ld d, a  	ld hl, CreditsScript  	add hl, de @@ -386,7 +386,7 @@ ParseCredits:  	ld a, e  	ld [wCreditsPos], a  	ld a, d -	ld [wCreditsPos+1], a +	ld [wCreditsPos + 1], a  	ld a, [hl]  	pop de  	pop hl diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index e60344430..a225e9721 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -317,7 +317,7 @@ TradeAnim_TubeToOT1:  	ld a, TRADEANIM_RIGHT_ARROW  	call TradeAnim_PlaceTrademonStatsOnTubeAnim  	ld a, [wLinkTradeSendmonSpecies] -	ld [wd265], a +	ld [wTempIconSpecies], a  	xor a  	depixel 5, 11, 4, 0  	ld b, $0 @@ -327,7 +327,7 @@ TradeAnim_TubeToPlayer1:  	ld a, TRADEANIM_LEFT_ARROW  	call TradeAnim_PlaceTrademonStatsOnTubeAnim  	ld a, [wLinkTradeGetmonSpecies] -	ld [wd265], a +	ld [wTempIconSpecies], a  	ld a, TRADEANIMSTATE_2  	depixel 9, 18, 4, 4  	ld b, $4 @@ -820,7 +820,7 @@ TradeAnim_GetFrontpic:  TradeAnim_GetNickname:  	push de -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wStringBuffer1  	pop de @@ -1373,7 +1373,7 @@ LoadTradeBallAndCableGFX:  LoadTradeBubbleGFX:  	call DelayFrame -	ld e, $3 +	ld e, MONICON_TRADE  	callfar LoadMenuMonIcon  	ld de, TradeBubbleGFX  	ld hl, vTiles0 tile $72 diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index bea2e0cdb..673d7f272 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -559,7 +559,7 @@ GetDecoName:  .getpokename  	push bc -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	pop bc  	jr .copy diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index e4defbc2b..063265e4d 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -972,17 +972,18 @@ DoPlayerEvent:  	ret  PlayerEventScriptPointers: -	dba Invalid_0x96c2d          ; 0 -	dba SeenByTrainerScript      ; 1 -	dba TalkToTrainerScript      ; 2 -	dba FindItemInBallScript     ; 3 -	dba EdgeWarpScript           ; 4 -	dba WarpToNewMapScript       ; 5 -	dba FallIntoMapScript        ; 6 -	dba Script_OverworldWhiteout ; 7 -	dba HatchEggScript           ; 8 -	dba ChangeDirectionScript    ; 9 -	dba Invalid_0x96c2d          ; 10 +; entries correspond to PLAYEREVENT_* constants +	dba Invalid_0x96c2d          ; PLAYEREVENT_NONE +	dba SeenByTrainerScript      ; PLAYEREVENT_SEENBYTRAINER +	dba TalkToTrainerScript      ; PLAYEREVENT_TALKTOTRAINER +	dba FindItemInBallScript     ; PLAYEREVENT_ITEMBALL +	dba EdgeWarpScript           ; PLAYEREVENT_CONNECTION +	dba WarpToNewMapScript       ; PLAYEREVENT_WARP +	dba FallIntoMapScript        ; PLAYEREVENT_FALL +	dba Script_OverworldWhiteout ; PLAYEREVENT_WHITEOUT +	dba HatchEggScript           ; PLAYEREVENT_HATCH +	dba ChangeDirectionScript    ; PLAYEREVENT_JOYCHANGEFACING +	dba Invalid_0x96c2d          ; (NUM_PLAYER_EVENTS)  Invalid_0x96c2d:  	end diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index f8e702eb9..248ff9978 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -623,7 +623,7 @@ INCLUDE "data/items/pocket_names.asm"  CurItemName:  	ld a, [wCurItem] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ret @@ -1863,7 +1863,7 @@ Script_pokenamemem:  	jr nz, .gotit  	ld a, [wScriptVar]  .gotit -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld de, wStringBuffer1 @@ -1890,7 +1890,7 @@ Script_itemtotext:  	jr nz, .ok  	ld a, [wScriptVar]  .ok -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ld de, wStringBuffer1  	jr ConvertMemToText diff --git a/engine/overworld/variables.asm b/engine/overworld/variables.asm index 9b5e3846c..da4b18812 100644 --- a/engine/overworld/variables.asm +++ b/engine/overworld/variables.asm @@ -72,7 +72,7 @@ _GetVarAction::  	ld hl, wPokedexCaught  	ld b, wEndPokedexCaught - wPokedexCaught  	call CountSetBits -	ld a, [wd265] +	ld a, [wNumSetBits]  	jp .loadstringbuffer2  .CountSeenMons: @@ -80,7 +80,7 @@ _GetVarAction::  	ld hl, wPokedexSeen  	ld b, wEndPokedexSeen - wPokedexSeen  	call CountSetBits -	ld a, [wd265] +	ld a, [wNumSetBits]  	jp .loadstringbuffer2  .CountBadges: @@ -88,7 +88,7 @@ _GetVarAction::  	ld hl, wBadges  	ld b, 2  	call CountSetBits -	ld a, [wd265] +	ld a, [wNumSetBits]  	jp .loadstringbuffer2  .PlayerFacing: diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index 787645823..188462bb5 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -465,7 +465,7 @@ DexEntryScreen_MenuActionJumptable:  .Cry:  	call Pokedex_GetSelectedMon -	ld a, [wd265] +	ld a, [wTempSpecies]  	call GetCryIndex  	ld e, c  	ld d, b @@ -1088,7 +1088,7 @@ Pokedex_DrawMainScreenBG:  	ld hl, wPokedexSeen  	ld b, wEndPokedexSeen - wPokedexSeen  	call CountSetBits -	ld de, wd265 +	ld de, wNumSetBits  	hlcoord 5, 12  	lb bc, 1, 3  	call PrintNum @@ -1098,7 +1098,7 @@ Pokedex_DrawMainScreenBG:  	ld hl, wPokedexCaught  	ld b, wEndPokedexCaught - wPokedexCaught  	call CountSetBits -	ld de, wd265 +	ld de, wNumSetBits  	hlcoord 5, 15  	lb bc, 1, 3  	call PrintNum @@ -1492,7 +1492,7 @@ Pokedex_PrintListing:  .loop  	push af  	ld a, [de] -	ld [wd265], a +	ld [wTempSpecies], a ; also sets wNamedObjectIndexBuffer  	push de  	push hl  	call .PrintEntry @@ -1531,7 +1531,7 @@ Pokedex_PrintNumberIfOldMode:  	push hl  	ld de, -SCREEN_WIDTH  	add hl, de -	ld de, wd265 +	ld de, wTempSpecies  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3  	call PrintNum  	pop hl @@ -1585,13 +1585,13 @@ Pokedex_GetSelectedMon:  	ld hl, wPokedexOrder  	add hl, de  	ld a, [hl] -	ld [wd265], a +	ld [wTempSpecies], a  	ret  Pokedex_CheckCaught:  	push de  	push hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckCaughtMon  	pop hl @@ -1601,7 +1601,7 @@ Pokedex_CheckCaught:  Pokedex_CheckSeen:  	push de  	push hl -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckSeenMon  	pop hl @@ -1654,7 +1654,7 @@ Pokedex_OrderMonsByMode:  	ld e, d  .loopfindend  	ld a, [hld] -	ld [wd265], a +	ld [wTempSpecies], a  	call Pokedex_CheckSeen  	jr nz, .foundend  	dec d @@ -1674,10 +1674,10 @@ Pokedex_ABCMode:  .loop1abc  	push bc  	ld a, [de] -	ld [wd265], a +	ld [wTempSpecies], a  	call Pokedex_CheckSeen  	jr z, .skipabc -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [hli], a  	ld a, [wDexListingEnd]  	inc a @@ -1898,7 +1898,7 @@ Pokedex_SearchForMons:  	ld a, [hl]  	and a  	jr z, .next_mon -	ld [wd265], a +	ld [wTempSpecies], a  	ld [wCurSpecies], a  	call Pokedex_CheckCaught  	jr z, .next_mon @@ -1917,7 +1917,7 @@ Pokedex_SearchForMons:  	jr nz, .next_mon  .match_found -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [de], a  	inc de  	ld a, [wDexSearchResultCount] @@ -2138,40 +2138,40 @@ Pokedex_PutScrollbarOAM:  	ld hl, wDexListingScrollOffset  	add [hl]  	cp e -	jr z, .asm_4133f -	ld hl, $0 -	ld bc, $79 +	jr z, .max +	ld hl, 0 +	ld bc, 121 ; max y - min y  	call AddNTimes  	ld e, l  	ld d, h -	ld b, $0 +	ld b, 0  	ld a, d  	or e -	jr z, .asm_41341 +	jr z, .done  	ld a, [wDexListingEnd]  	ld c, a -.asm_41333 +.loop  	ld a, e  	sub c  	ld e, a  	ld a, d -	sbc $0 +	sbc 0  	ld d, a -	jr c, .asm_41341 +	jr c, .done  	inc b -	jr .asm_41333 -.asm_4133f -	ld b, $79 -.asm_41341 -	ld a, $14 +	jr .loop +.max +	ld b, 121 ; max y - min y +.done +	ld a, 20 ; min y  	add b  	pop hl  	ld [hli], a -	ld a, $a1 +	ld a, 161 ; x  	ld [hli], a -	ld a, $f +	ld a, $0f ; tile id  	ld [hli], a -	ld [hl], $0 +	ld [hl], 0 ; attributes  	ret  Pokedex_InitArrowCursor: @@ -2354,7 +2354,7 @@ Pokedex_LoadSelectedMonTiles:  	jr z, .QuestionMark  	ld a, [wFirstUnownSeen]  	ld [wUnownLetter], a -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [wCurPartySpecies], a  	call GetBaseData  	ld de, vTiles2 @@ -2378,7 +2378,7 @@ Pokedex_LoadCurrentFootprint:  	call Pokedex_GetSelectedMon  Pokedex_LoadAnyFootprint: -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	and %11111000  	srl a @@ -2386,7 +2386,7 @@ Pokedex_LoadAnyFootprint:  	srl a  	ld e, 0  	ld d, a -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	and %111  	swap a ; * $10 @@ -2524,7 +2524,7 @@ _NewPokedexEntry:  	call LoadFontsExtra  	call Pokedex_LoadGFX  	call Pokedex_LoadAnyFootprint -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [wCurPartySpecies], a  	call Pokedex_DrawDexEntryScreenBG  	call Pokedex_DrawFootprint diff --git a/engine/pokedex/pokedex_2.asm b/engine/pokedex/pokedex_2.asm index 8105a080a..62e7e853b 100644 --- a/engine/pokedex/pokedex_2.asm +++ b/engine/pokedex/pokedex_2.asm @@ -80,7 +80,7 @@ DisplayDexEntry:  	call GetPokemonName  	hlcoord 9, 3  	call PlaceString ; mon species -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld b, a  	call GetDexEntryPointer  	ld a, b @@ -96,11 +96,11 @@ DisplayDexEntry:  	ld [hli], a  	ld a, $5d ; .  	ld [hli], a -	ld de, wd265 +	ld de, wTempSpecies  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3  	call PrintNum  ; Check to see if we caught it.  Get out of here if we haven't. -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckCaughtMon  	pop hl diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm index 8fc5ffa3d..8dda3a237 100644 --- a/engine/pokegear/pokegear.asm +++ b/engine/pokegear/pokegear.asm @@ -1287,12 +1287,12 @@ PokegearPhoneContactSubmenu:  	cp 12  	jr c, .am  	sub 12 -	ld [wd265], a +	ld [wTempByteValue], a  	scf  	ret  .am -	ld [wd265], a +	ld [wTempByteValue], a  	and a  	ret @@ -2741,7 +2741,7 @@ TownMapMon:  	ld d, $0  	add hl, de  	ld a, [hl] -	ld [wd265], a +	ld [wTempIconSpecies], a  ; Get FlyMon icon  	ld e, $08 ; starting tile in VRAM  	farcall GetSpeciesIcon diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 65621192d..f0ddc0ba8 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1035,7 +1035,7 @@ PCMonInfo:  	cp -1  	ret z -	ld [wd265], a +	ld [wTempSpecies], a  	hlcoord 1, 4  	xor a  	ld b, 7 @@ -1057,7 +1057,7 @@ PCMonInfo:  	jr nz, .row  	call BillsPC_LoadMonStats -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [wCurPartySpecies], a  	ld [wCurSpecies], a  	ld hl, wTempMonDVs @@ -1068,7 +1068,7 @@ PCMonInfo:  	xor a  	ld [wBillsPC_MonHasMail], a  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	cp EGG  	ret z @@ -1676,9 +1676,9 @@ StatsScreenDPad:  	and a  	jr z, .did_nothing  	call BillsPC_GetSelectedPokemonSpecies -	ld [wd265], a +	ld [wTempSpecies], a  	call BillsPC_LoadMonStats -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [wCurPartySpecies], a  	ld [wCurSpecies], a  	ld hl, wTempMonDVs @@ -1893,7 +1893,7 @@ ReleasePKMN_ByePKMN:  .skip_cry  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	call GetPokemonName  	hlcoord 1, 16  	ld de, PCString_ReleasedPKMN @@ -2314,9 +2314,9 @@ BillsPC_PrintBoxCountAndCapacity:  	ld de, .Pokemon  	call PlaceString  	call GetBoxCount -	ld [wd265], a +	ld [wDeciramBuffer], a  	hlcoord 13, 11 -	ld de, wd265 +	ld de, wDeciramBuffer  	lb bc, 1, 2  	call PrintNum  	ld de, .out_of_20 diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index 7e7f0e097..dfebcd9f9 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -81,7 +81,7 @@ CheckBreedmonCompatibility:  .done  	ld a, c -	ld [wd265], a +	ld [wBreedingCompatibility], a  	ret  .CheckDVs: @@ -250,7 +250,7 @@ HatchEggs:  	ld a, [wCurPartySpecies]  	dec de  	ld [de], a -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wCurSpecies], a  	call GetPokemonName  	xor a @@ -676,7 +676,7 @@ EggHatch_DoAnimFrame:  	ret  EggHatch_AnimationSequence: -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld [wJumptableIndex], a  	ld a, [wCurSpecies]  	push af @@ -910,7 +910,7 @@ DayCareMonCompatibilityText:  	call CopyBytes  	call CheckBreedmonCompatibility  	pop bc -	ld a, [wd265] +	ld a, [wBreedingCompatibility]  	ld hl, .AllAlone  	cp -1  	jr z, .done diff --git a/engine/pokemon/caught_data.asm b/engine/pokemon/caught_data.asm index 89d22fdf6..31cfe7e75 100644 --- a/engine/pokemon/caught_data.asm +++ b/engine/pokemon/caught_data.asm @@ -38,7 +38,7 @@ CheckPartyFullAfterContest:  	ld hl, wPlayerName  	call CopyBytes  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wStringBuffer1  	ld de, wMonOrItemNameBuffer @@ -105,7 +105,7 @@ CheckPartyFullAfterContest:  	call CopyBytes  	callfar InsertPokemonIntoBox  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	call GiveANickname_YesNo  	ld hl, wStringBuffer1 diff --git a/engine/pokemon/correct_party_errors.asm b/engine/pokemon/correct_party_errors.asm index 50a9f3562..717893b36 100644 --- a/engine/pokemon/correct_party_errors.asm +++ b/engine/pokemon/correct_party_errors.asm @@ -123,7 +123,7 @@ Unreferenced_CorrectPartyErrors:  	cp EGG  	ld hl, .TAMAGO  	jr z, .got_nickname -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wStringBuffer1  .got_nickname diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm index f2006bcf6..eb2645e00 100644 --- a/engine/pokemon/evolve.asm +++ b/engine/pokemon/evolve.asm @@ -236,7 +236,7 @@ EvolveAfterBattle_MasterLoop:  	ld [wCurSpecies], a  	ld [wTempMonSpecies], a  	ld [wEvolutionNewSpecies], a -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	push hl @@ -293,15 +293,15 @@ EvolveAfterBattle_MasterLoop:  	call CopyBytes  	ld a, [wCurSpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	xor a  	ld [wMonType], a  	call LearnLevelMoves -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call SetSeenAndCaughtMon -	ld a, [wd265] +	ld a, [wTempSpecies]  	cp UNOWN  	jr nz, .skip_unown @@ -348,7 +348,7 @@ UpdateSpeciesNameIfNotNicknamed:  	ld a, [wCurSpecies]  	push af  	ld a, [wBaseDexNo] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	pop af  	ld [wCurSpecies], a @@ -369,7 +369,7 @@ UpdateSpeciesNameIfNotNicknamed:  	call AddNTimes  	push hl  	ld a, [wCurSpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wStringBuffer1  	pop de @@ -415,7 +415,7 @@ Text_WhatEvolving:  	db "@"  LearnLevelMoves: -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld [wCurPartySpecies], a  	dec a  	ld b, 0 @@ -466,7 +466,7 @@ LearnLevelMoves:  .learn  	ld a, d  	ld [wPutativeTMHMMove], a -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	call CopyName1  	predef LearnMove @@ -475,7 +475,7 @@ LearnLevelMoves:  .done  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	ret  FillMoves: diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm index 20294c878..9031c6857 100644 --- a/engine/pokemon/learn.asm +++ b/engine/pokemon/learn.asm @@ -36,7 +36,7 @@ LearnMove:  	push hl  	push de -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld b, a  	ld a, [wBattleMode] diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm index 359d2ac8e..2c66ab72a 100644 --- a/engine/pokemon/mail.asm +++ b/engine/pokemon/mail.asm @@ -149,7 +149,7 @@ CheckPokeMail::  ; Compare the mail message, byte for byte, with the expected message.  	ld a, MAIL_MSG_LENGTH -	ld [wd265], a +	ld [wTempByteValue], a  .loop  	ld a, [de]  	ld c, a @@ -162,9 +162,9 @@ CheckPokeMail::  	jr nz, .close_sram_return  	inc hl  	inc de -	ld a, [wd265] +	ld a, [wTempByteValue]  	dec a -	ld [wd265], a +	ld [wTempByteValue], a  	jr nz, .loop  .done diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 2d14bd603..926c35f5d 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -100,7 +100,7 @@ GetMonMenuString:  	jr z, .NotMove  	inc hl  	ld a, [hl] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	ret diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index 76f09b461..74e3d2a95 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -295,7 +295,7 @@ ListMovePP:  	call PrintNum  	ld a, "/"  	ld [hli], a -	ld de, wd265 +	ld de, wTempPP  	lb bc, 1, 2  	call PrintNum  	pop hl diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 128bbf200..377268ecb 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -52,7 +52,7 @@ TryAddMonToParty:  	and a  	jr nz, .skipnickname  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld hl, wPartyMonNicknames  	ld a, [hMoveMon] @@ -185,11 +185,11 @@ endr  .registerpokedex  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wTempSpecies], a  	dec a  	push de  	call CheckCaughtMon -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call SetSeenAndCaughtMon  	pop de @@ -750,7 +750,7 @@ RestorePPofDepositedPokemon:  	farcall GetMaxPPOfMove  	pop de  	pop hl -	ld a, [wd265] +	ld a, [wTempPP]  	ld b, a  	ld a, [de]  	and %11000000 @@ -970,7 +970,7 @@ SendMonIntoBox:  	call CopyBytes  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	ld de, sBoxMonNicknames @@ -1669,7 +1669,7 @@ GivePoke::  .done  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wTempEnemyMonSpecies], a  	call GetPokemonName  	ld hl, wStringBuffer1 diff --git a/engine/pokemon/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm index 1dab879c7..c76b43763 100644 --- a/engine/pokemon/move_mon_wo_mail.asm +++ b/engine/pokemon/move_mon_wo_mail.asm @@ -5,21 +5,21 @@ InsertPokemonIntoBox:  	call InsertSpeciesIntoBoxOrParty  	ld a, [sBoxCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, sBoxMonNicknames  	ld bc, MON_NAME_LENGTH  	ld de, wBufferMonNick  	call InsertDataIntoBoxOrParty  	ld a, [sBoxCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, sBoxMonOT  	ld bc, NAME_LENGTH  	ld de, wBufferMonOT  	call InsertDataIntoBoxOrParty  	ld a, [sBoxCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, sBoxMons  	ld bc, BOXMON_STRUCT_LENGTH  	ld de, wBufferMon @@ -42,21 +42,21 @@ InsertPokemonIntoParty:  	call InsertSpeciesIntoBoxOrParty  	ld a, [wPartyCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, wPartyMonNicknames  	ld bc, MON_NAME_LENGTH  	ld de, wBufferMonNick  	call InsertDataIntoBoxOrParty  	ld a, [wPartyCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, wPartyMonOT  	ld bc, NAME_LENGTH  	ld de, wBufferMonOT  	call InsertDataIntoBoxOrParty  	ld a, [wPartyCount]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	ld hl, wPartyMons  	ld bc, PARTYMON_STRUCT_LENGTH  	ld de, wBufferMon @@ -85,7 +85,7 @@ InsertDataIntoBoxOrParty:  	push de  	push hl  	push bc -	ld a, [wd265] +	ld a, [wNextBoxOrPartyIndex]  	dec a  	call AddNTimes  	push hl @@ -95,7 +95,7 @@ InsertDataIntoBoxOrParty:  	pop hl  .loop  	push bc -	ld a, [wd265] +	ld a, [wNextBoxOrPartyIndex]  	ld b, a  	ld a, [wCurPartyMon]  	cp b @@ -116,9 +116,9 @@ InsertDataIntoBoxOrParty:  	sbc b  	ld h, a  	pop de -	ld a, [wd265] +	ld a, [wNextBoxOrPartyIndex]  	dec a -	ld [wd265], a +	ld [wNextBoxOrPartyIndex], a  	jr .loop  .insert diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index c3a70dbdc..814e6be55 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -596,7 +596,7 @@ InitPartyMenuGFX:  	push hl  	ld hl, LoadMenuMonIcon  	ld a, BANK(LoadMenuMonIcon) -	ld e, $0 +	ld e, MONICON_PARTYMENU  	rst FarCall  	ld a, [hObjectStructIndexBuffer]  	inc a diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index dfc704f1a..72f895269 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -377,7 +377,7 @@ StatsScreen_InitUpperHalf:  	xor a  	ld [hBGMapMode], a  	ld a, [wBaseDexNo] -	ld [wd265], a +	ld [wDeciramBuffer], a  	ld [wCurSpecies], a  	hlcoord 8, 0  	ld [hl], "№" @@ -386,7 +386,7 @@ StatsScreen_InitUpperHalf:  	inc hl  	hlcoord 10, 0  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3 -	ld de, wd265 +	ld de, wDeciramBuffer  	call PrintNum  	hlcoord 14, 0  	call PrintLevel @@ -401,7 +401,7 @@ StatsScreen_InitUpperHalf:  	ld a, "/"  	ld [hli], a  	ld a, [wBaseDexNo] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetPokemonName  	call PlaceString  	call StatsScreen_PlaceHorizontalDivider @@ -483,7 +483,7 @@ StatsScreen_PlaceShinyIcon:  StatsScreen_LoadGFX:  	ld a, [wBaseDexNo] -	ld [wd265], a +	ld [wTempSpecies], a  	ld [wCurSpecies], a  	xor a  	ld [hBGMapMode], a @@ -708,7 +708,7 @@ StatsScreen_LoadGFX:  	ld b, a  	farcall TimeCapsule_ReplaceTeruSama  	ld a, b -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetItemName  	ret diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index d612a3472..6d68ec88d 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -1,5 +1,5 @@  _SwitchPartyMons: -	ld a, [wd0e3] +	ld a, [wSwitchMon]  	dec a  	ld [wBuffer3], a  	ld b, a diff --git a/engine/pokemon/types.asm b/engine/pokemon/types.asm index 4e2ca3e45..abeeda840 100644 --- a/engine/pokemon/types.asm +++ b/engine/pokemon/types.asm @@ -74,9 +74,9 @@ PrintType:  	jp PlaceString  GetTypeName: -; Copy the name of type [wd265] to wStringBuffer1. +; Copy the name of type [wNamedObjectIndexBuffer] to wStringBuffer1. -	ld a, [wd265] +	ld a, [wNamedObjectIndexBuffer]  	ld hl, TypeNames  	ld e, a  	ld d, 0 diff --git a/engine/printer/print_party.asm b/engine/printer/print_party.asm index eeb694d62..9aca79378 100644 --- a/engine/printer/print_party.asm +++ b/engine/printer/print_party.asm @@ -26,11 +26,11 @@ PrintPage1:  	hlcoord 2, 11, wPrinterTileMapBuffer  	lb bc, 5, 18  	call ClearBox -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckCaughtMon  	push af -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld b, a  	ld c, 1 ; get page 1  	farcall GetDexEntryPagePointer @@ -75,11 +75,11 @@ PrintPage2:  	ld bc, SCREEN_WIDTH  	ld a, $32  	call ByteFill -	ld a, [wd265] +	ld a, [wTempSpecies]  	dec a  	call CheckCaughtMon  	push af -	ld a, [wd265] +	ld a, [wTempSpecies]  	ld b, a  	ld c, 2 ; get page 2  	farcall GetDexEntryPagePointer @@ -170,7 +170,7 @@ PrintPartyMonPage1:  	lb bc, 2, 3  	call PrintNum  	ld a, [wCurPartySpecies] -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wCurSpecies], a  	ld hl, wPartyMonNicknames  	call Function1dc50e @@ -186,7 +186,7 @@ PrintPartyMonPage1:  	inc hl  	ld [hl], "."  	inc hl -	ld de, wd265 +	ld de, wNamedObjectIndexBuffer  	lb bc, PRINTNUM_LEADINGZEROS | 1, 3  	call PrintNum  	hlcoord 1, 9 @@ -297,7 +297,7 @@ Function1dc51a:  	and a  	jr z, .no_move -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	call GetMoveName  	jr .got_string diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index 06325407c..8477ce88a 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -725,7 +725,7 @@ Printer_PrintBoxListSegment:  	ld a, [de]  	cp $ff  	jp z, .finish -	ld [wd265], a +	ld [wNamedObjectIndexBuffer], a  	ld [wCurPartySpecies], a  	push bc diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm index 06f800c45..0b05f9c03 100644 --- a/engine/rtc/timeset.asm +++ b/engine/rtc/timeset.asm @@ -694,8 +694,8 @@ PrintHour:  	inc hl  	pop bc  	call AdjustHourForAMorPM -	ld [wd265], a -	ld de, wd265 +	ld [wDeciramBuffer], a +	ld de, wDeciramBuffer  	call PrintTwoDigitNumberRightAlign  	ret | 
