diff options
Diffstat (limited to 'engine/items')
| -rwxr-xr-x | engine/items/items.asm | 70 | ||||
| -rwxr-xr-x | engine/items/tmhm.asm | 8 | ||||
| -rwxr-xr-x | engine/items/tms.asm | 4 | 
3 files changed, 42 insertions, 40 deletions
| diff --git a/engine/items/items.asm b/engine/items/items.asm index d8b7f9e3..c1268cd5 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -430,7 +430,7 @@ ItemUseBall: ; d687 (3:5687)  	jr .End  .sendToBox	;$5907  	call ClearSprites -	call Func_e7a4 +	call SendNewMonToBox  	ld hl,ItemUseBallText07  	ld a,[wd7f1]  	bit 0,a		;already met Bill? @@ -777,7 +777,7 @@ ItemUseMedicine: ; dabb (3:5abb)  	ld de,wBattleMonMaxHP  	ld bc,10  	call CopyData ; copy party stats to in-battle stat data -	predef Func_3ed02 +	predef DoubleOrHalveSelectedStats  	jp .doneHealing  .healHP  	inc hl ; hl = address of current HP @@ -919,15 +919,15 @@ ItemUseMedicine: ; dabb (3:5abb)  	call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled  	ld a,(SFX_02_3d - SFX_Headers_02) / 3  	call PlaySoundWaitForCurrent ; play sound -	ld a,[$fff6] +	ld a,[hFlags_0xFFF6]  	set 0,a -	ld [$fff6],a +	ld [hFlags_0xFFF6],a  	ld a,$02 -	ld [wListMenuID],a +	ld [wHPBarType],a  	predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled -	ld a,[$fff6] +	ld a,[hFlags_0xFFF6]  	res 0,a -	ld [$fff6],a +	ld [hFlags_0xFFF6],a  	pop af  	ld b,a ; store heal amount (1/5 of max HP)  	ld hl,wHPBarOldHP + 1 @@ -1069,15 +1069,15 @@ ItemUseMedicine: ; dabb (3:5abb)  	jr z,.playStatusAilmentCuringSound  	ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound  	call PlaySoundWaitForCurrent ; play sound -	ld a,[$fff6] +	ld a,[hFlags_0xFFF6]  	set 0,a -	ld [$fff6],a +	ld [hFlags_0xFFF6],a  	ld a,$02 -	ld [wListMenuID],a +	ld [wHPBarType],a  	predef UpdateHPBar2 ; animate the HP bar lengthening -	ld a,[$fff6] +	ld a,[hFlags_0xFFF6]  	res 0,a -	ld [$fff6],a +	ld [hFlags_0xFFF6],a  	ld a,$f7 ; revived message  	ld [wd07d],a  	ld a,[wcf91] @@ -1090,7 +1090,7 @@ ItemUseMedicine: ; dabb (3:5abb)  	jr .showHealingItemMessage  .playStatusAilmentCuringSound  	ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound -	call PlaySoundWaitForCurrent ; play sound +	call PlaySoundWaitForCurrent  .showHealingItemMessage  	xor a  	ld [H_AUTOBGTRANSFERENABLED],a @@ -1102,7 +1102,7 @@ ItemUseMedicine: ; dabb (3:5abb)  	ld [H_AUTOBGTRANSFERENABLED],a  	ld c,50  	call DelayFrames -	call WaitForTextScrollButtonPress ; wait for a button press +	call WaitForTextScrollButtonPress  	jr .done  .canceledItemUse  	xor a @@ -1118,7 +1118,7 @@ ItemUseMedicine: ; dabb (3:5abb)  	ld a,[W_ISINBATTLE]  	and a  	ret nz -	jp ReloadMapData ; restore saved screen +	jp ReloadMapData  .useVitamin  	push hl  	ld a,[hl] @@ -2084,7 +2084,7 @@ ItemUseTMHM: ; e479 (3:6479)  	ld [wd11e],a  	predef TMToMove ; get move ID from TM/HM ID  	ld a,[wd11e] -	ld [wd0e0],a +	ld [wMoveNum],a  	call GetMoveName  	call CopyStringToCF4B ; copy name to wcf4b  	pop af @@ -2097,7 +2097,7 @@ ItemUseTMHM: ; e479 (3:6479)  	call PrintText  	hlCoord 14, 7  	ld bc,$080f -	ld a,$14 +	ld a,TWO_OPTION_MENU  	ld [wTextBoxID],a  	call DisplayTextBoxID ; yes/no menu  	ld a,[wCurrentMenuItem] @@ -2488,7 +2488,7 @@ TossItem_: ; e6f1 (3:66f1)  	call PrintText  	hlCoord 14, 7  	ld bc,$080f -	ld a,$14 +	ld a,TWO_OPTION_MENU  	ld [wTextBoxID],a  	call DisplayTextBoxID ; yes/no menu  	ld a,[wd12e] @@ -2567,7 +2567,7 @@ IsKeyItem_: ; e764 (3:6764)  INCLUDE "data/key_items.asm" -Func_e7a4: ; e7a4 (3:67a4) +SendNewMonToBox: ; e7a4 (3:67a4)  	ld de, W_NUMINBOX ; wda80  	ld a, [de]  	inc a @@ -2818,49 +2818,51 @@ ItemUseReloadOverworldData: ; e9c5 (3:69c5)  	call LoadCurrentMapView  	jp UpdateSprites -Func_e9cb: ; e9cb (3:69cb) -	ld hl, WildDataPointers ; $4eeb -	ld de, wHPBarMaxHP +; creates a list at wBuffer of maps where the mon in [wd11e] can be found. +; this is used by the pokedex to display locations the mon can be found on the map. +FindWildLocationsOfMon: ; e9cb (3:69cb) +	ld hl, WildDataPointers +	ld de, wBuffer  	ld c, $0 -.asm_e9d3 +.loop  	inc hl  	ld a, [hld]  	inc a -	jr z, .asm_e9ec +	jr z, .done  	push hl  	ld a, [hli]  	ld h, [hl]  	ld l, a  	ld a, [hli]  	and a -	call nz, Func_e9f0 +	call nz, CheckMapForMon ; land  	ld a, [hli]  	and a -	call nz, Func_e9f0 +	call nz, CheckMapForMon ; water  	pop hl  	inc hl  	inc hl  	inc c -	jr .asm_e9d3 -.asm_e9ec -	ld a, $ff +	jr .loop +.done +	ld a, $ff ; list terminator  	ld [de], a  	ret -Func_e9f0: ; e9f0 (3:69f0) +CheckMapForMon: ; e9f0 (3:69f0)  	inc hl  	ld b, $a -.asm_e9f3 +.loop  	ld a, [wd11e]  	cp [hl] -	jr nz, .asm_e9fc +	jr nz, .nextEntry  	ld a, c  	ld [de], a  	inc de -.asm_e9fc +.nextEntry  	inc hl  	inc hl  	dec b -	jr nz, .asm_e9f3 +	jr nz, .loop  	dec hl  	ret diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 01a48ebb..0fcc5710 100755 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -1,12 +1,12 @@ -; checks if the mon in wWhichPokemon already knows the move in wd0e0 +; checks if the mon in [wWhichPokemon] already knows the move in [wMoveNum]  CheckIfMoveIsKnown: ; 2fe18 (b:7e18)  	ld a, [wWhichPokemon]  	ld hl, wPartyMon1Moves -	ld bc, $2c +	ld bc, wPartyMon2 - wPartyMon1  	call AddNTimes -	ld a, [wd0e0] +	ld a, [wMoveNum]  	ld b, a -	ld c, $4 ; nubmer of moves +	ld c, NUM_MOVES  .loop  	ld a, [hli]  	cp b diff --git a/engine/items/tms.asm b/engine/items/tms.asm index ef427860..511aab5b 100755 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -1,11 +1,11 @@ -; tests if mon [wcf91] can learn move [wd0e0] +; tests if mon [wcf91] can learn move [wMoveNum]  CanLearnTM: ; 1373e (4:773e)  	ld a, [wcf91]  	ld [wd0b5], a  	call GetMonHeader  	ld hl, W_MONHLEARNSET  	push hl -	ld a, [wd0e0] +	ld a, [wMoveNum]  	ld b, a  	ld c, $0  	ld hl, TechnicalMachines | 
