diff options
Diffstat (limited to 'engine')
30 files changed, 859 insertions, 350 deletions
| diff --git a/engine/billspctop.asm b/engine/billspctop.asm index c3fe6322..65403656 100644 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -15,7 +15,7 @@ BillsPC_CheckHavePokemon: ; e3e5 (3:63e5)  	ret  Text_GottaHavePokemon: -	text_jump Text_GottaHavePokemon_ +	text_far Text_GottaHavePokemon_  	db "@"  BillsPC_LogIn: ; e3f7 (3:63f7) @@ -35,7 +35,7 @@ BillsPC_LogIn: ; e3f7 (3:63f7)  	ret  Text_BillsPCWhat: -	text_jump Text_BillsPCWhat_ +	text_far Text_BillsPCWhat_  	db "@"  BillsPC_LogOut: ; e41a (3:641a) @@ -105,16 +105,16 @@ BillsPC_SeeYa:  BillsPC_MovePKMNMenu:  	call LoadStandardMenuDataHeader -	callba IsAnyPokemonHoldingMail ; 11:488c +	farcall IsAnyPokemonHoldingMail ; 11:488c  	jr nc, .asm_e4bb  	ld hl, Text_PleaseRemoveMailBeforeMovePkmnWOMail  	call PrintText  	jr .asm_e4cf  .asm_e4bb -	callba StartMovePkmnWOMail_SaveGame ; 5:4bd2 +	farcall StartMovePkmnWOMail_SaveGame ; 5:4bd2  	jr c, .asm_e4cf -	callba MovePKMNWithoutMail_ ; 38:6f47 +	farcall MovePKMNWithoutMail_ ; 38:6f47  	call ReturnToMapFromSubmenu  	call Functione566  .asm_e4cf @@ -123,12 +123,12 @@ BillsPC_MovePKMNMenu:  	ret  Text_PleaseRemoveMailBeforeMovePkmnWOMail: -	text_jump Text_PleaseRemoveMailBeforeMovePkmnWOMail_ +	text_far Text_PleaseRemoveMailBeforeMovePkmnWOMail_  	db "@"  BillsPC_DepositMenu:  	call LoadStandardMenuDataHeader -	callba DepositPokemon_ ; 38:6b9e +	farcall DepositPokemon_ ; 38:6b9e  	call ReturnToMapFromSubmenu  	call Functione566  	call CloseWindow @@ -157,11 +157,11 @@ Functione4ed:  	ret  Text_YouDontHaveASinglePokemon: -	text_jump Text_YouDontHaveASinglePokemon_ +	text_far Text_YouDontHaveASinglePokemon_  	db "@"  Text_ItsYourLastPokemon: -	text_jump Text_ItsYourLastPokemon_ +	text_far Text_ItsYourLastPokemon_  	db "@"  CheckCurPartyMonFainted: ; e513 (3:6513) @@ -194,7 +194,7 @@ CheckCurPartyMonFainted: ; e513 (3:6513)  BillsPC_WithdrawMenu:  	call LoadStandardMenuDataHeader -	callba WithdrawPokemon_ ; 38:6d71 +	farcall WithdrawPokemon_ ; 38:6d71  	call ReturnToMapFromSubmenu  	call Functione566  	call CloseWindow @@ -215,11 +215,11 @@ Functione548:  	ret  Text_CantTakeAnyMorePokemon: -	text_jump Text_CantTakeAnyMorePokemon_ +	text_far Text_CantTakeAnyMorePokemon_  	db "@"  BillsPC_ChangeBoxMenu: -	callba ChangeBox_ ; 38:7d25 +	farcall ChangeBox_ ; 38:7d25  	and a  	ret @@ -235,10 +235,10 @@ Functione566: ; e566 (3:6566)  	call ByteFill  	hlcoord 0, 0  	lb bc, 10, 18 -	call TextBox +	call Textbox  	hlcoord 0, 12  	ld bc, IncGradGBPalTable_13 -	call TextBox +	call Textbox  	call Function3456  	call SetPalettes  	ret diff --git a/engine/color.asm b/engine/color.asm index 057c48a4..25f7179b 100755 --- a/engine/color.asm +++ b/engine/color.asm @@ -31,7 +31,7 @@ CheckShininess:  	and a  	ret -CheckContestMon: ; 9072 (2:5072) +Unused_CheckShininess: ; 9072 (2:5072)  	ld a, [hl]  	cp $a0  	jr c, .asm_908c @@ -634,7 +634,7 @@ Function9b9c: ; 9b9c (2:5b9c)  Function9ba9: ; 9ba9 (2:5ba9)  	push de -	callba Function3d8f5 +	farcall Function3d8f5  	ld c, l  	ld b, h  	ld a, [wd0ee] @@ -644,7 +644,7 @@ Function9ba9: ; 9ba9 (2:5ba9)  Function9bba: ; 9bba (2:5bba)  	push de -	callba Function3d907 +	farcall Function3d907  	ld c, l  	ld b, h  	ld a, [wTempEnemyMonSpecies] diff --git a/engine/events/bug_contest/contest.asm b/engine/events/bug_contest/contest.asm new file mode 100755 index 00000000..88c300e9 --- /dev/null +++ b/engine/events/bug_contest/contest.asm @@ -0,0 +1,41 @@ +GiveParkBalls: +	xor a +	ld [wContestMon], a +	ld a, 20 +	ld [wParkBalls], a +	farcall StartBugContestTimer +	ret + +BugCatchingContestBattleScript:: +	writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST +	randomwildmon +	startbattle +	reloadmapafterbattle +	copybytetovar wParkBalls +	iffalse BugCatchingContestOutOfBallsScript +	end + +BugCatchingContestOverScript:: +	playsound SFX_ELEVATOR_END +	opentext +	writetext BugCatchingContestTimeUpText +	waitbutton +	jump $79CD +	 +BugCatchingContestOutOfBallsScript: +	playsound SFX_ELEVATOR_END +	opentext +	writetext BugCatchingContestIsOverText +	waitbutton +	 +BugCatchingContestReturnToGateScript: +	closetext +	jumpstd bugcontestresultswarp +	 +BugCatchingContestTimeUpText: +	text_far _BugCatchingContestTimeUpText +	db "@" + +BugCatchingContestIsOverText: +	text_far _BugCatchingContestIsOverText +	db "@"
\ No newline at end of file diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index 32a7665d..4cd12087 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -162,7 +162,7 @@ DayCareAskDepositPokemon:  .DummyText:  	; -	text_jump _DaycareDummyText +	text_far _DaycareDummyText  	db "@"  DayCare_DepositPokemonText: @@ -291,102 +291,102 @@ PrintDayCareText:  .DayCareManIntro:  	; I'm the DAY-CARE MAN. Want me to raise a #MON? -	text_jump _DayCareManIntroText +	text_far _DayCareManIntroText  	db "@"  .DayCareManOddEgg:  	; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON? -	text_jump _DayCareManOddEggText +	text_far _DayCareManOddEggText  	db "@"  .DayCareLadyIntro:  	; I'm the DAY-CARE LADY. Should I raise a #MON for you? -	text_jump _DayCareLadyIntroText +	text_far _DayCareLadyIntroText  	db "@"  .DayCareLadyOddEgg:  	; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you? -	text_jump _DayCareLadyOddEggText +	text_far _DayCareLadyOddEggText  	db "@"  .WhichOne:  	; What should I raise for you? -	text_jump _WhatShouldIRaiseText +	text_far _WhatShouldIRaiseText  	db "@"  .JustOneMon:  	; Oh? But you have just one #MON. -	text_jump _OnlyOneMonText +	text_far _OnlyOneMonText  	db "@"  .CantAcceptEgg:  	; Sorry, but I can't accept an EGG. -	text_jump _CantRaiseEggText +	text_far _CantRaiseEggText  	db "@"  .RemoveMail:  	; Remove MAIL before you come see me. -	text_jump _RemoveMailText +	text_far _RemoveMailText  	db "@"  .LastHealthyMon:  	; If you give me that, what will you battle with? -	text_jump _LastHealthyMonText +	text_far _LastHealthyMonText  	db "@"  .OkayIllRaiseYourMon:  	; OK. I'll raise your @ . -	text_jump _IllRaiseYourMonText +	text_far _IllRaiseYourMonText  	db "@"  .ComeBackForItLater:  	; Come back for it later. -	text_jump _ComeBackLaterText +	text_far _ComeBackLaterText  	db "@"  .AreWeGeniusesOrWhat:  	; Are we geniuses or what? Want to see your @ ? -	text_jump _AreWeGeniusesText +	text_far _AreWeGeniusesText  	db "@"  .AskRetrieveMon:  	; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ . -	text_jump _YourMonHasGrownText +	text_far _YourMonHasGrownText  	db "@"  .PerfectHeresYourMon:  	; Perfect! Here's your #MON. -	text_jump _PerfectHeresYourMonText +	text_far _PerfectHeresYourMonText  	db "@"  .GotBackMon:  	; got back @ . -	text_jump _GotBackMonText +	text_far _GotBackMonText  	db "@"  .ImmediatelyWithdrawMon:  	; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100. -	text_jump _BackAlreadyText +	text_far _BackAlreadyText  	db "@"  .PartyFull:  	; You have no room for it. -	text_jump _HaveNoRoomText +	text_far _HaveNoRoomText  	db "@"  .NotEnoughMoney:  	; You don't have enough money. -	text_jump _DCNotEnoughMoneyText +	text_far _DCNotEnoughMoneyText  	db "@"  .OhFineThen:  	; Oh, fine then. -	text_jump _OhFineThenText +	text_far _OhFineThenText  	db "@"  .ComeAgain:  	; Come again. -	text_jump _ComeAgainText +	text_far _ComeAgainText  	db "@"  DayCareManOutside: @@ -399,7 +399,7 @@ DayCareManOutside:  .NotYet:  	; Not yet… -	text_jump _NotYetText +	text_far _NotYetText  	db "@"  .AskGiveEgg: @@ -441,27 +441,27 @@ DayCareManOutside:  .IntroText:  	; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it? -	text_jump _FoundAnEggText +	text_far _FoundAnEggText  	db "@"  .GotEggText:  	; received the EGG! -	text_jump _ReceivedEggText +	text_far _ReceivedEggText  	db "@"  .TakeGoodCareOfItText:  	; Take good care of it. -	text_jump _TakeGoodCareOfEggText +	text_far _TakeGoodCareOfEggText  	db "@"  .IllKeepItThanksText:  	; Well then, I'll keep it. Thanks! -	text_jump _RefuseEggText +	text_far _RefuseEggText  	db "@"  .PartyFullText:  	; You have no room in your party. Come back later. -	text_jump _NoRoomForEggText +	text_far _NoRoomForEggText  	db "@"  DayCare_GiveEgg: @@ -522,7 +522,7 @@ DayCare_GiveEgg:  	pop hl  	push bc  	ld b, FALSE -	predef CalcPkmnStats +	predef CalcMonStats  	pop bc  	ld hl, MON_HP  	add hl, bc diff --git a/engine/events/forced_movement.asm b/engine/events/forced_movement.asm new file mode 100755 index 00000000..69f27bfe --- /dev/null +++ b/engine/events/forced_movement.asm @@ -0,0 +1,51 @@ +Script_ForcedMovement:: +	checkcode VAR_FACING +	ifequal DOWN, .down +	ifequal UP, .up +	ifequal LEFT, .left +	ifequal RIGHT, .right +	end + +.up +	applymovement PLAYER, .MovementData_up +	end + +.down +	applymovement PLAYER, .MovementData_down +	end + +.right +	applymovement PLAYER, .MovementData_right +	end + +.left +	applymovement PLAYER, .MovementData_left +	end + +.MovementData_up: +	step_dig 16 +	turn_in DOWN +	step_dig 16 +	turn_head DOWN +	step_end + +.MovementData_down: +	step_dig 16 +	turn_in UP +	step_dig 16 +	turn_head UP +	step_end + +.MovementData_right: +	step_dig 16 +	turn_in LEFT +	step_dig 16 +	turn_head LEFT +	step_end + +.MovementData_left: +	step_dig 16 +	turn_in RIGHT +	step_dig 16 +	turn_head RIGHT +	step_end diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 5281691d..6c8b918c 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -193,7 +193,7 @@ DaycareStep::  	call Random  	ld [hl], a -	callab CheckBreedmonCompatibility +	callfar CheckBreedmonCompatibility  	ld a, [wd151]  	cp 230  	ld b, -1 + 32 percent diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm new file mode 100755 index 00000000..9770c35b --- /dev/null +++ b/engine/events/heal_machine_anim.asm @@ -0,0 +1,262 @@ +; HealMachineAnim.Jumptable indexes +	const_def +	const HEALMACHINESTATE_LOADGFX +	const HEALMACHINESTATE_PCLOADBALLS +	const HEALMACHINESTATE_HOFLOADBALLS +	const HEALMACHINESTATE_PLAYMUSIC +	const HEALMACHINESTATE_HOFPLAYSFX +	const HEALMACHINESTATE_FINISH + +HealMachineAnim: +	; If you have no Pokemon, don't change the buffer.  This can lead to some glitchy effects if you have no Pokemon. +	ld a, [wPartyCount] +	and a +	ret z +	; The location of the healing machine relative to the player is stored in wScriptVar. +	; 0: Up and left (Pokemon Center) +	; 1: Left (Elm's Lab) +	; 2: Up (Hall of Fame) +	ld a, [wScriptVar] +	ld [wBuffer1], a +	ldh a, [rOBP1] +	ld [wBuffer2], a +	call .DoJumptableFunctions +	ld a, [wBuffer2] +	call DmgToCgbObjPal1 +	ret + +.DoJumptableFunctions: +	xor a +	ld [wBuffer3], a +.jumpable_loop +	ld a, [wBuffer1] +	ld e, a +	ld d, 0 +	ld hl, .Pointers +	add hl, de +	add hl, de +	ld a, [hli] +	ld h, [hl] +	ld l, a +	ld a, [wBuffer3] +	ld e, a +	inc a +	ld [wBuffer3], a +	add hl, de +	ld a, [hl] +	cp HEALMACHINESTATE_FINISH +	jr z, .finish +	ld hl, .Jumptable +	rst JumpTable +	jr .jumpable_loop + +.finish +	ret + +.Pointers: +; entries correspond to HEALMACHINE_* constants +	dw .Pokecenter +	dw .ElmLab +	dw .HallOfFame + +healmachineanimseq: MACRO +rept _NARG +	db HEALMACHINESTATE_\1 +	shift +endr +ENDM + +.Pokecenter: +	healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH +.ElmLab: +	healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH +.HallOfFame: +	healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH + +.Jumptable: +; entries correspond to HEALMACHINESTATE_* constants +	dw .LoadGFX +	dw .PC_LoadBallsOntoMachine +	dw .HOF_LoadBallsOntoMachine +	dw .PlayHealMusic +	dw .HOF_PlaySFX +	dw .dummy_5 ; never encountered + +.LoadGFX: +	call .LoadPalettes +	ld de, .HealMachineGFX +	ld hl, vTiles0 tile $7c +	lb bc, BANK(.HealMachineGFX), 2 +	call Request2bpp +	ret + +.PC_LoadBallsOntoMachine: +	ld hl, wVirtualOAMSprite32 +	ld de, .PC_ElmsLab_OAM +	call .PlaceHealingMachineTile +	call .PlaceHealingMachineTile +	jr .LoadBallsOntoMachine + +.HOF_LoadBallsOntoMachine: +	ld hl, wVirtualOAMSprite32 +	ld de, .HOF_OAM + +.LoadBallsOntoMachine: +	ld a, [wPartyCount] +	ld b, a +.party_loop +	call .PlaceHealingMachineTile +	push de +	ld de, SFX_SECOND_PART_OF_ITEMFINDER +	call PlaySFX +	pop de +	ld c, 30 +	call DelayFrames +	dec b +	jr nz, .party_loop +	ret + +.PlayHealMusic: +	ld de, MUSIC_HEAL +	call PlayMusic +	jp .FlashPalettes8Times + +.HOF_PlaySFX: +	ld de, SFX_GAME_FREAK_LOGO_GS +	call PlaySFX +	call .FlashPalettes8Times +	call WaitSFX +	ld de, SFX_BOOT_PC +	call PlaySFX +	ret + +.dummy_5 +	ret + +.PC_ElmsLab_OAM: +	dsprite   4, 0,   4, 2, $7c, PAL_OW_TREE | OBP_NUM +	dsprite   4, 0,   4, 6, $7c, PAL_OW_TREE | OBP_NUM +	dsprite   4, 6,   4, 0, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   4, 6,   5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP +	dsprite   5, 3,   4, 0, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   5, 3,   5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP +	dsprite   6, 0,   4, 0, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   6, 0,   5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP + +.HealMachineGFX: +INCBIN "gfx/overworld/heal_machine.2bpp" + +.HOF_OAM: +	dsprite   7, 4,  10, 1, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   7, 4,  10, 6, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   7, 3,   9, 5, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   7, 3,  11, 2, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   7, 1,   9, 1, $7d, PAL_OW_TREE | OBP_NUM +	dsprite   7, 1,  11, 5, $7d, PAL_OW_TREE | OBP_NUM + +.LoadPalettes: +	call IsCGB +	jr nz, .cgb +	ld a, %11100000 +	ldh [rOBP1], a +	ret + +.cgb +	ld hl, .palettes +	ld de, wOBPal6 +	ld bc, 1 palettes +	call CopyBytes +	ld a, $1 +	ldh [hCGBPalUpdate], a +	ret + +.palettes +	rst $38 +	ld a, a +	ld a, a +	ld a, [hl+] +	rst $38 +	inc b +	nop +	nop +;INCLUDE "gfx/overworld/heal_machine.pal" + +.FlashPalettes8Times: +	ld c, 8 +.palette_loop +	push bc +	call .FlashPalettes +	ld c, 10 +	call DelayFrames +	pop bc +	dec c +	jr nz, .palette_loop +	ret + +.FlashPalettes: +	call IsCGB +	jr nz, .go +	ldh a, [rOBP1] +	xor %00101000 +	ldh [rOBP1], a +	ret + +.go +	ld hl, wOBPal6 +	ld a, [hli] +	ld e, a +	ld a, [hli] +	ld d, a +	push de +	ld c, $3 +.palette_loop_2 +	ld a, [hli] +	ld e, a +	ld a, [hld] +	ld d, a +	dec hl +	ld a, d +	ld [hld], a +	ld a, e +	ld [hli], a +	inc hl +	inc hl +	inc hl +	dec c +	jr nz, .palette_loop_2 +	pop de +	dec hl +	ld a, d +	ld [hld], a +	ld a, e +	ld [hl], a + +	ld a, $1 +	ldh [hCGBPalUpdate], a +	ret + +.PlaceHealingMachineTile: +	push bc +	ld a, [wBuffer1] +	bcpixel 2, 4 +	cp HEALMACHINE_ELMS_LAB +	jr z, .okay +	bcpixel 0, 0 + +.okay +	ld a, [de] +	add c +	inc de +	ld [hli], a ; y +	ld a, [de] +	add b +	inc de +	ld [hli], a ; x +	ld a, [de] +	inc de +	ld [hli], a ; tile id +	ld a, [de] +	inc de +	ld [hli], a ; attributes +	pop bc +	ret diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm new file mode 100755 index 00000000..f9ba459f --- /dev/null +++ b/engine/events/misc_scripts.asm @@ -0,0 +1,55 @@ +Script_AbortBugContest: +	checkflag ENGINE_BUG_CONTEST_TIMER +	iffalse .finish +	setflag ENGINE_DAILY_BUG_CONTEST +	special ContestReturnMons +.finish +	end + +FindItemInBallScript:: +	callasm .TryReceiveItem +	iffalse .no_room +	disappear LAST_TALKED +	opentext +	writetext .FoundItemText +	playsound SFX_ITEM +	pause 60 +	itemnotify +	closetext +	end + +.no_room +	opentext +	writetext .FoundItemText +	waitbutton +	writetext .CantCarryItemText +	waitbutton +	closetext +	end + +.FoundItemText: +	text_far _FoundItemText +	db "@" + +.CantCarryItemText: +	text_far _CantCarryItemText +	db "@" + +.TryReceiveItem: +	xor a +	ld [wScriptVar], a +	ld a, [wcf29] +	ld [wDeciramBuffer], a +	call GetItemName +	ld hl, wStringBuffer3 +	call CopyName2 +	ld a, [wcf29] +	ld [wd002], a +	ld a, [wcf2a] +	ld [wItemQuantityChangeBuffer], a +	ld hl, wNumItems +	call ReceiveItem +	ret nc +	ld a, $1 +	ld [wScriptVar], a +	ret
\ No newline at end of file diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm new file mode 100755 index 00000000..ac0f7e31 --- /dev/null +++ b/engine/events/misc_scripts_2.asm @@ -0,0 +1,48 @@ +RepelWoreOffScript:: +	opentext +	writetext .RepelWoreOffText +	waitbutton +	closetext +	end + +.RepelWoreOffText: +	text_far _RepelWoreOffText +	db "@" + +HiddenItemScript:: +	opentext +	copybytetovar wcf2b +	itemtotext MEM_BUFFER_0, USE_SCRIPT_VAR +	writetext .PlayerFoundItemText +	giveitem ITEM_FROM_MEM +	iffalse .bag_full +	callasm SetMemEvent +	specialsound +	itemnotify +	jump .finish + +.bag_full +	buttonsound +	writetext .ButNoSpaceText +	waitbutton + +.finish +	closetext +	end + +.PlayerFoundItemText: +	text_far _PlayerFoundItemText +	db "@" + +.ButNoSpaceText: +	text_far _ButNoSpaceText +	db "@" + +SetMemEvent: +	ld hl, wcf29 +	ld a, [hli] +	ld d, [hl] +	ld e, a +	ld b, SET_FLAG +	call EventFlagAction +	ret diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index f12aad03..c4967028 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -33,7 +33,7 @@ FieldMoveGetPartyNick: ; c74b (3:474b)  FieldMoveEngineFlagCheck: ; c766 (3:4766)  	ld b, CHECK_FLAG -	callba EngineFlagAction ; same bank +	farcall EngineFlagAction ; same bank  	ld a, c  	and a  	jr nz, .asm_c774 @@ -53,7 +53,7 @@ FieldMoveBadgeCheck: ; c776 (3:4776)  	ret  .BadgeRequiredText: -	text_jump BadgeRequiredText_ +	text_far BadgeRequiredText_  	db "@"  FieldMovePartyCheck: ; c787 (3:4787) @@ -103,7 +103,7 @@ FieldMoveFailed: ; c7be (3:47be)  	ret  .CantUseHereText: -	text_jump CantUseFieldMoveHereText_ +	text_far CantUseFieldMoveHereText_  	db "@"  CutFunction:: @@ -151,18 +151,18 @@ FailToCut:  	ret  Text_UsedCut: -	text_jump Text_UsedCut_ +	text_far Text_UsedCut_  	db "@"  Text_NothingToCut: -	text_jump Text_NothingToCut_ +	text_far Text_NothingToCut_  	db "@"  CheckMapForSomethingToCut: ; c813 (3:4813)  	call GetFacingTileCoord  	ld c, a  	push de -	callba CheckCutCollision +	farcall CheckCutCollision  	pop de  	jr nc, .asm_c841  	call GetBlockLocation @@ -212,7 +212,7 @@ CutDownTreeOrGrass:  	call DelayFrame  	ld a, [wBuffer6]  	ld e, a -	callba OWCutAnimation +	farcall OWCutAnimation  	call BufferScreen  	call GetMovementPermissions  	ret @@ -297,7 +297,7 @@ FlashFunction:  CheckUseFlash: ; c8f1 (3:48f1)  	ld de, ENGINE_ZEPHYRBADGE -	callba FieldMoveBadgeCheck ; same bank +	farcall FieldMoveBadgeCheck ; same bank  	jr c, .asm_c90f  	ld a, [wd56e]  	cp $ff @@ -328,8 +328,8 @@ Script_UseFlash:  	end  Text_UsedFlash: -	text_jump Text_UsedFlash_ -	start_asm +	text_far Text_UsedFlash_ +	text_asm  	call WaitSFX  	ld de, SFX_FLASH  	call PlaySFX @@ -422,15 +422,15 @@ UsedSurfScript:  	end  UsedSurfText: -	text_jump UsedSurfText_ +	text_far UsedSurfText_  	db "@"  CantSurfText: -	text_jump CantSurfText_ +	text_far CantSurfText_  	db "@"  AlreadySurfingText: -	text_jump AlreadySurfingText_ +	text_far AlreadySurfingText_  	db "@"  GetSurfType: ; c9d7 (3:49d7) @@ -513,7 +513,7 @@ AskSurfScript:  	end  AskSurfText: -	text_jump AskSurfText_ +	text_far AskSurfText_  	db "@"  FlyFunction: @@ -588,7 +588,7 @@ FlyScript:  	callasm HideSprites  	special UpdateTimePals  	callasm FlyFromAnimation -	farscall AbortBugCatchingContest +	farscall Script_AbortBugContest  	special WarpToSpawnPoint  	callasm DelayLoadingNewSprites ; 1560c  	writecode VAR_MOVEMENT, PLAYER_NORMAL @@ -607,7 +607,7 @@ WaterfallFunction: ; caed  TryWaterfall: ; caf6 (3:4af6)  	ld de, ENGINE_RISINGBADGE -	callba FieldMoveBadgeCheck ; same bank +	farcall FieldMoveBadgeCheck ; same bank  	ld a, $80  	ret c  	call CheckMapCanWaterfall @@ -667,7 +667,7 @@ CheckContinueWaterfall: ;cb49  	ret  Text_UsedWaterfall: -	text_jump Text_UsedWaterfall_ +	text_far Text_UsedWaterfall_  	db "@"  TryWaterfallOW: @@ -696,7 +696,7 @@ Script_CantDoWaterfall:;cb87  	jumptext Text_CantDoWaterfall  Text_CantDoWaterfall: -	text_jump Text_CantDoWaterfall_ +	text_far Text_CantDoWaterfall_  	db "@"  Script_AskWaterfall: @@ -708,7 +708,7 @@ Script_AskWaterfall:  	end  Text_AskUseWaterfall: -	text_jump Text_AskUseWaterfall_ +	text_far Text_AskUseWaterfall_  	db "@"  EscapeRopeFunction: @@ -791,15 +791,15 @@ FailToEscapeFromDungeon:  	ret  Text_UsedDig: ; cc1f -	text_jump Text_UsedDig_ +	text_far Text_UsedDig_  	db "@"  Text_UsedEscapeRope: -	text_jump Text_UsedEscapeRope_ +	text_far Text_UsedEscapeRope_  	db "@"  Text_CantUseDigEscapeRopeHere: -	text_jump Text_CantUseDigEscapeRopeHere_ +	text_far Text_CantUseDigEscapeRopeHere_  	db "@"  UsedEscapeRopeScript: ; cc2e	reloadmappart @@ -817,7 +817,7 @@ ContinueDigEscapeRopeScript:  	closetext  	playsound SFX_WARP_TO  	applymovement PLAYER, DigOutMovementData -	farscall AbortBugCatchingContest +	farscall Script_AbortBugContest  	special WarpToSpawnPoint  	writecode VAR_MOVEMENT, PLAYER_NORMAL  	newloadmap MAPSETUP_DOOR @@ -887,11 +887,11 @@ FailTeleport:  	ret  Text_ReturnToLastMonCenter: -	text_jump Text_ReturnToLastMonCenter_ +	text_far Text_ReturnToLastMonCenter_  	db "@"  Text_CantUseTeleportHere: -	text_jump Text_CantUseTeleportHere_ +	text_far Text_CantUseTeleportHere_  	db "@"  TeleportScript: ; ccbe @@ -903,7 +903,7 @@ TeleportScript: ; ccbe  	closetext  	playsound SFX_WARP_TO  	applymovement PLAYER, TeleportFromMovementData -	farscall AbortBugCatchingContest +	farscall Script_AbortBugContest  	special WarpToSpawnPoint  	writecode VAR_MOVEMENT, PLAYER_NORMAL  	newloadmap MAPSETUP_TELEPORT @@ -937,7 +937,7 @@ Functionccf1: ; ccf1 (3:4cf1)  	ret  Text_AlreadyUsingStrength: -	text_jump Text_AlreadyUsingStrength_ +	text_far Text_AlreadyUsingStrength_  	db "@"  asm_cd09 @@ -976,11 +976,11 @@ Script_UsedStrength:  	end  Text_UsedStrength: ; cd44 -	text_jump Text_UsedStrength_ +	text_far Text_UsedStrength_  	db "@"  Text_AllowedToMoveBoulders: -	text_jump Text_AllowedToMoveBoulders_ +	text_far Text_AllowedToMoveBoulders_  	db "@"  AskStrengthScript: ; cd4e @@ -1004,15 +1004,15 @@ AskStrengthScript: ; cd4e  	end  Text_AskStrength: -	text_jump Text_AskStrength_ +	text_far Text_AskStrength_  	db "@"  Text_BouldersMayNowBeMoved: -	text_jump Text_BouldersMayNowBeMoved_ +	text_far Text_BouldersMayNowBeMoved_  	db "@"  Text_MonMayBeAbleToMove: -	text_jump Text_MonMayBeAbleToMove_ +	text_far Text_MonMayBeAbleToMove_  	db "@"  TryStrengthOW: @@ -1083,7 +1083,7 @@ FailWhirlpool:  	ret  Text_UsedWhirlpool: -	text_jump Text_UsedWhirlpool_ +	text_far Text_UsedWhirlpool_  	db "@"  TryWhirlpoolMenu: ; cde1 (3:4de1) @@ -1138,7 +1138,7 @@ DisappearWhirlpool: ; 4e20  	call OverworldTextModeSwitch  	ld a, [wBuffer6]  	ld e, a -	callba PlayWhirlpoolSound +	farcall PlayWhirlpoolSound  	call BufferScreen  	call GetMovementPermissions  	ret @@ -1169,7 +1169,7 @@ Script_MightyWhirlpool:  	jumptext Text_MightyWhirlpool  Text_MightyWhirlpool: -	text_jump Text_MightyWhirlpool_ +	text_far Text_MightyWhirlpool_  	db "@"  Script_AskWhirlpoolOW: ; ce71 @@ -1181,7 +1181,7 @@ Script_AskWhirlpoolOW: ; ce71  	end  Text_AskWhirlpool: ; ce7b -	text_jump Text_AskWhirlpool_ +	text_far Text_AskWhirlpool_  	db "@"  HeadbuttFunction: @@ -1206,11 +1206,11 @@ TryHeadbuttFromMenu: ; ce89 (3:4e89)  ; ceaa  Text_DidAHeadbutt: -	text_jump Text_DidAHeadbutt_ +	text_far Text_DidAHeadbutt_  	db "@"  Text_NothingFromHeadbutt: -	text_jump Text_NothingFromHeadbutt_ +	text_far Text_NothingFromHeadbutt_  	db "@"  HeadbuttFromMenuScript: @@ -1258,7 +1258,7 @@ AskHeadbuttScript:  	end  Text_AskHeadbutt: ; cee9 -	text_jump Text_AskHeadbutt_ +	text_far Text_AskHeadbutt_  	db "@"  	call TryRockSmashFromMenu @@ -1283,7 +1283,7 @@ TryRockSmashFromMenu: ; cef7 (3:4ef7)  	ret  GetFacingObject: ; cf10 (3:4f10) -	callba CheckFacingObject +	farcall CheckFacingObject  	jr nc, .asm_cf2f  	ld a, [hObjectStructIndexBuffer]  	call GetObjectStruct @@ -1329,7 +1329,7 @@ RockSmashMovementData:  	step_end  Text_UsedRockSmash: -	text_jump Text_UsedRockSmash_ +	text_far Text_UsedRockSmash_  	db "@"  ; cf60  AskRockSmashScript: @@ -1345,11 +1345,11 @@ AskRockSmashScript:  	jumptext Text_MayBeBreakable  Text_MayBeBreakable: -	text_jump Text_MayBeBreakable_ +	text_far Text_MayBeBreakable_  	db "@"  Text_AskRockSmash: -	text_jump Text_AskRockSmash_ +	text_far Text_AskRockSmash_  	db "@"  TryRockSmashOW: ; cf7f @@ -1555,15 +1555,15 @@ PutTheRodAway: ; d096  	ret  Text_OhABite: -	text_jump Text_OhABite_ +	text_far Text_OhABite_  	db "@"  Text_NotEvenANibble: -	text_jump Text_NotEvenANibble_ +	text_far Text_NotEvenANibble_  	db "@"  Text_NothingHereToFish: -	text_jump Text_NothingHereToFish_ +	text_far Text_NothingHereToFish_  	db "@"  BicycleFunction: @@ -1694,15 +1694,15 @@ Script_CantGetOffBike: ; d17e  	end  Text_CantGetOffBike: -	text_jump Text_CantGetOffBike_ +	text_far Text_CantGetOffBike_  	db "@"  Text_GotOnTheBike: -	text_jump Text_GotOnTheBike_ +	text_far Text_GotOnTheBike_  	db "@"  Text_GotOffTheBike: -	text_jump Text_GotOffTheBike_ +	text_far Text_GotOffTheBike_  	db "@" @@ -1747,12 +1747,12 @@ CheckMapForSomethingToCut_: ; d1c7  	ret  Text_AskCut: -	text_jump Text_AskCut_ +	text_far Text_AskCut_  	db "@"  CantCutScript: ; d1da  	jumptext Text_MonCanCutThis  Text_MonCanCutThis: -	text_jump Text_MonCanCutThis_ +	text_far Text_MonCanCutThis_  	db "@" diff --git a/engine/events/std_collision.asm b/engine/events/std_collision.asm new file mode 100755 index 00000000..932f4db8 --- /dev/null +++ b/engine/events/std_collision.asm @@ -0,0 +1,29 @@ +CheckFacingTileForStdScript:: +; Checks to see if the tile you're facing has a std script associated with it.  If so, executes the script and returns carry. +	ld a, c +	ld de, 3 +	ld hl, TileCollisionStdScripts +	call IsInArray +	jr nc, .notintable + +	ld a, jumpstd_command +	ld [wcf2a], a +	inc hl +	ld a, [hli] +	ld [wcf2b], a +	ld a, [hli] +	ld [wTempTrainerHeader], a +	ld a, BANK(Script_JumpStdFromRAM) +	ld hl, Script_JumpStdFromRAM +	call CallScript +	scf +	ret + +.notintable +	xor a +	ret + +INCLUDE "data/events/collision_stdscripts.asm" + +Script_JumpStdFromRAM: +	jump wcf2a
\ No newline at end of file diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm new file mode 100755 index 00000000..33098f13 --- /dev/null +++ b/engine/events/whiteout.asm @@ -0,0 +1,76 @@ +Script_BattleWhiteout:: +	callasm BattleBGMap +	jump Script_Whiteout + +Script_OverworldWhiteout:: +	refreshscreen +	callasm OverworldBGMap + +Script_Whiteout: +	writetext .WhitedOutText +	waitbutton +	special FadeOutPalettes +	pause 40 +	special HealParty +	checkflag ENGINE_BUG_CONTEST_TIMER +	iftrue .bug_contest +	callasm HalveMoney +	callasm GetWhiteoutSpawn +	farscall Script_AbortBugContest +	special WarpToSpawnPoint +	newloadmap MAPSETUP_WARP +	endall + +.bug_contest +	jumpstd bugcontestresultswarp + +.WhitedOutText: +	; is out of useable #MON!  whited out! +	text_far UnknownText_0x1c0a4e +	db "@" + +OverworldBGMap: +	call ClearPalettes +	call FillScreenWithTextboxPal +	call Function3456 +	call HideSprites +	call RotateThreePalettesLeft +	ret + +BattleBGMap: +	ld b, SCGB_BATTLE_GRAYSCALE +	call GetSGBLayout +	call SetPalettes +	ret + +HalveMoney: +; Halve the player's money. +	ld hl, wMoney +	ld a, [hl] +	srl a +	ld [hli], a +	ld a, [hl] +	rra +	ld [hli], a +	ld a, [hl] +	rra +	ld [hl], a +	ret + +GetWhiteoutSpawn: +	ld a, [wd9fb] +	ld d, a +	ld a, [wd9fc] +	ld e, a + +	ld a, $05 +	ld hl, $5465 +	rst $08 + +	ld a, c +	jr c, .yes +	xor a ; SPAWN_HOME + +.yes +	ld [wceec], a +	ret diff --git a/engine/facings.asm b/engine/facings.asm index 871b0985..a5669c2b 100644 --- a/engine/facings.asm +++ b/engine/facings.asm @@ -42,11 +42,8 @@ NUM_FACINGS EQU (FacingsEnd - Facings) / 2  ;	db y, x, attributes, tile index  ; Attributes: -X_FLIP    EQU 1 << OAM_X_FLIP -Y_FLIP    EQU 1 << OAM_Y_FLIP  BEHIND_BG EQU 1 << OAM_PRIORITY -  Facing00:  Facing02:  Facing24: diff --git a/engine/health.asm b/engine/health.asm index 83fea353..506d5a9d 100755 --- a/engine/health.asm +++ b/engine/health.asm @@ -41,7 +41,7 @@ Functionc6bc: ; c6bc (3:46bc)  	inc bc  	ld a, [hl]  	ld [bc], a -	callba Functionf900 +	farcall Functionf900  	ret  ComputeHPBarPixels: ; c6de (3:46de) diff --git a/engine/learn.asm b/engine/learn.asm index f6e06572..d285d326 100644 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -121,7 +121,7 @@ LearnMove:  	hlcoord 5, 2  	ld b, $8  	ld c, $d -	call TextBox +	call Textbox  	hlcoord 7, 4  	ld a, $28  	ld [wBuffer1], a @@ -182,28 +182,28 @@ LearnMove:  	ret  Text_LearnedMove: -	text_jump Text_LearnedMove_ +	text_far Text_LearnedMove_  	db "@"  Text_ForgetWhich: -	text_jump Text_ForgetWhich_ +	text_far Text_ForgetWhich_  	db "@"  Text_StopLearning: -	text_jump Text_StopLearning_ +	text_far Text_StopLearning_  	db "@"  Text_DidNotLearn: -	text_jump Text_DidNotLearn_ +	text_far Text_DidNotLearn_  	db "@"  Text_TryingToLearn: -	text_jump Text_TryingToLearn_ +	text_far Text_TryingToLearn_  	db "@"  Text_1_2_and_Poof: -	text_jump Text_1_2_and_Poof_ -	start_asm +	text_far Text_1_2_and_Poof_ +	text_asm  	push de  	ld de, SFX_SWITCH_POKEMON  	call PlaySFX @@ -212,9 +212,9 @@ Text_1_2_and_Poof:  	ret  .PoofForgot: -	text_jump Text_PoofForgot_ +	text_far Text_PoofForgot_  	db "@"  Text_CantForgetHM: -	text_jump Text_CantForgetHM_ +	text_far Text_CantForgetHM_  	db "@" diff --git a/engine/learn_tm.asm b/engine/learn_tm.asm index 3116a6db..530ecf41 100755 --- a/engine/learn_tm.asm +++ b/engine/learn_tm.asm @@ -22,7 +22,7 @@ CanLearnTMHMMove: ; 11a25 (4:5a25)  	ld b, CHECK_FLAG  	push de  	ld d, $0 -	predef FlagPredef +	predef SmallFarFlagAction  	pop de  	ret diff --git a/engine/link/place_waiting_text.asm b/engine/link/place_waiting_text.asm new file mode 100755 index 00000000..dc1fe215 --- /dev/null +++ b/engine/link/place_waiting_text.asm @@ -0,0 +1,24 @@ +PlaceWaitingText:: +	hlcoord 3, 10 +	ld b, 1 +	ld c, 11 + +	ld a, [wBattleMode] +	and a +	jr z, .notinbattle + +	call Textbox +	jr .proceed + +.notinbattle +	predef LinkTextboxAtHL + +.proceed +	hlcoord 4, 11 +	ld de, .Waiting +	call PlaceString +	ld c, 50 +	jp DelayFrames + +.Waiting: +	db "Waiting...!@" diff --git a/engine/main_menu.asm b/engine/main_menu.asm index 73debf65..0bd56b1a 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -152,11 +152,11 @@ Function5b45: ; 5b45 (1:5b45)  	hlcoord 0, 12  	ld b, $4  	ld c, $d -	call TextBox +	call Textbox  	ret  .asm_5b57 -	call SpeechTextBox +	call SpeechTextbox  	ret  Function5b5b: ; 5b5b (1:5b5b) @@ -177,7 +177,7 @@ Function5b5b: ; 5b5b (1:5b5b)  	decoord 4, 16  	ld a, [hHours]  	ld c, a -	callba PrintHour +	farcall PrintHour  	ld [hl], $9c  	inc hl  	ld de, hMinutes @@ -198,7 +198,7 @@ Function5b9c: ; 5b9c (1:5b9c)  	db "TIME NOT SET@"  .UnusedText -	text_jump _ClockTimeUnknownText +	text_far _ClockTimeUnknownText  	db "@"  Function5bb8: ; 5bb8 (1:5bb8) @@ -238,12 +238,12 @@ Function5bf7: ; 5bf7 (1:5bf7)  MainMenu_MysteryGift:  	call UpdateTime -	callba Function11934 -	callba Function29dff +	farcall Function11934 +	farcall Function29dff  	ret  MainMenu_Options: -	callba OptionsMenu +	farcall OptionsMenu  	ret  MainMenu_NewGame: @@ -366,9 +366,9 @@ ENDC  	call Function5d5d -	callba InitDecorations +	farcall InitDecorations -	callba DeletePartyMonMail +	farcall DeletePartyMonMail  	call ResetGameTime  	ret @@ -446,8 +446,8 @@ Function5d5d: ; 5d5d (1:5d5d)  InitializeWorld: ; 5d97 (1:5d97)  	call ShrinkPlayer -	callba SpawnPlayer -	callba InitializeStartDay_ +	farcall SpawnPlayer +	farcall InitializeStartDay_  	ret  LoadOrRegenerateLuckyIDNumber: ; 5da7 (1:5da7) @@ -476,7 +476,7 @@ LoadOrRegenerateLuckyIDNumber: ; 5da7 (1:5da7)  	jp CloseSRAM  MainMenu_Continue: -	callba TryLoadSaveFile +	farcall TryLoadSaveFile  	jr c, .asm_5e41  	call LoadStandardMenuDataHeader  	call DisplaySaveInfoOnContinue @@ -507,9 +507,9 @@ MainMenu_Continue:  	call ClearTileMap  	ld c, 20  	call DelayFrames -	callba JumpRoamMons -	callba MysteryGift_CopyReceivedDecosToPC -	callba ClockContinue +	farcall JumpRoamMons +	farcall MysteryGift_CopyReceivedDecosToPC +	farcall ClockContinue  	ld a, [wd1db]  	cp $1  	jr z, .asm_5e42 @@ -572,7 +572,7 @@ FinishContinueFunction: ; 5e84 (1:5e84)  	ld [wDontPlayMapMusicOnReload], a  	ld hl, wGameTimerPause  	set 0, [hl] -	callba OverworldLoop +	farcall OverworldLoop  	ld a, [wd1db]  	cp $2  	jr z, .asm_5e9d @@ -721,7 +721,7 @@ Continue_DisplayGameTime: ; 5f90 (1:5f90)  	jp PrintNum  OakSpeech: ; 5fa5 (1:5fa5) -	callba InitClock ; What time is it? +	farcall InitClock ; What time is it?  	call RotateFourPalettesLeft  	call ClearTileMap @@ -812,12 +812,12 @@ OakSpeech: ; 5fa5 (1:5fa5)  	ret  OakText1: -	text_jump _OakText1 +	text_far _OakText1  	db "@"  OakText2: -	text_jump _OakText2 -	start_asm +	text_far _OakText2 +	text_asm  	ld a, MARILL  	call PlayMonCry  	call WaitSFX @@ -825,23 +825,23 @@ OakText2:  	ret  OakText3: -	text_jump _OakText3 +	text_far _OakText3  	db "@"  OakText4: -	text_jump _OakText4 +	text_far _OakText4  	db "@"  OakText5: -	text_jump _OakText5 +	text_far _OakText5  	db "@"  OakText6: -	text_jump _OakText6 +	text_far _OakText6  	db "@"  OakText7: -	text_jump _OakText7 +	text_far _OakText7  	db "@"  NamePlayer: ; 6085 (1:6085) @@ -853,14 +853,14 @@ NamePlayer: ; 6085 (1:6085)  	jr z, .NewName  	ld de, wPlayerName  	call StorePlayerName -	callba ApplyMonOrTrainerPals +	farcall ApplyMonOrTrainerPals  	call MovePlayerPicLeft  	ret  .NewName  	ld b, $1  	ld de, wPlayerName -	callba NamingScreen +	farcall NamingScreen  	call RotateThreePalettesRight  	call ClearTileMap  	call LoadFontsExtra @@ -929,7 +929,7 @@ ShrinkPlayer: ; 6123 (1:6123)  	ld a, e  	ld [wMusicFadeID], a  	ld a, d -	ld [wMusicFadeIDHi], a +	ld [wMusicFadeID + 1], a  	ld de, SFX_ESCAPE_ROPE  	call PlaySFX @@ -1051,7 +1051,7 @@ Intro_PrepTrainerPic: ; 61df, 61e0 (1:61df, 1:61e0)  ShrinkFrame: ; 61f7 (1:61f7)  	ld de, $9000  	ld c, $31 -	predef DecompressPredef +	predef DecompressGet2bpp  	xor a  	ld [hGraphicStartTile], a  	hlcoord 6, 4 diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 28cda6ef..bbfea25e 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -126,7 +126,7 @@ GeneratePartyMonStats:  	push de  	ld a, [wCurPartyLevel]  	ld d, a -	callab CalcExpAtLevel ; 14:5550 +	callfar CalcExpAtLevel ; 14:5550  	pop de  	ld a, [hPrintNum2]  	ld [de], a @@ -150,7 +150,7 @@ GeneratePartyMonStats:  	and $f  	jr z, .asm_d998  	push hl -	callba GetTrainerDVs ; 9:7271 +	farcall GetTrainerDVs ; 9:7271  	pop hl  	jr .asm_d9bb @@ -214,7 +214,7 @@ GeneratePartyMonStats:  	ld a, $1  	ld c, a  	ld b, $0 -	call CalcPkmnStatC +	call CalcMonStatC  	ld a, [hStringCmpString2]  	ld [de], a  	inc de @@ -281,7 +281,7 @@ GeneratePartyMonStats:  	ld bc, $a  	add hl, bc  	ld b, $0 -	call CalcPkmnStats +	call CalcMonStats  .asm_da4b  	ld a, [wMonType]  	and $f @@ -295,7 +295,7 @@ GeneratePartyMonStats:  	ld bc, PARTYMON_STRUCT_LENGTH  	call AddNTimes  	predef GetUnownLetter -	callab UpdateUnownDex +	callfar UpdateUnownDex  .asm_da71  	scf  	ret @@ -396,7 +396,7 @@ AddTempmonToParty: ; da9c (3:5a9c)  	ld bc, PARTYMON_STRUCT_LENGTH  	call AddNTimes  	predef GetUnownLetter -	callab UpdateUnownDex +	callfar UpdateUnownDex  	ld a, [wFirstUnownSeen]  	and a  	jr nz, .asm_db43 @@ -406,7 +406,7 @@ AddTempmonToParty: ; da9c (3:5a9c)  	and a  	ret -SentGetPkmnIntoFromBox: ; db45 (3:5b45) +SendGetMonIntoFromBox: ; db45 (3:5b45)  	ld a, $1  	call OpenSRAM  	ld a, [wPokemonWithdrawDepositParameter] @@ -544,8 +544,8 @@ SentGetPkmnIntoFromBox: ; db45 (3:5b45)  	srl a  	add $2  	ld [wMonType], a -	predef CopyPkmnToTempMon -	callab CalcLevel +	predef CopyMonToTempMon +	callfar CalcLevel  	ld a, d  	ld [wCurPartyLevel], a  	pop hl @@ -562,7 +562,7 @@ SentGetPkmnIntoFromBox: ; db45 (3:5b45)  	add hl, bc  	push bc  	ld b, $1 -	call CalcPkmnStats +	call CalcMonStats  	pop bc  	ld a, [wPokemonWithdrawDepositParameter]  	and a @@ -649,7 +649,7 @@ Functiondcbc: ; dcbc (3:5cbc)  	push bc  	push hl  	push de -	callba GetMaxPPOfMove ; same bank +	farcall GetMaxPPOfMove ; same bank  	pop de  	pop hl  	ld a, [wd151] @@ -766,7 +766,7 @@ Functiondd6a: ; dd6a (3:5d6a)  	add hl, bc  	push bc  	ld b, $1 -	call CalcPkmnStats +	call CalcMonStats  	ld hl, wPartyMon1Moves  	ld a, [wPokemonData]  	dec a @@ -780,10 +780,10 @@ Functiondd6a: ; dd6a (3:5d6a)  	ld a, [wPartyCount]  	dec a  	ld [wCurPartyMon], a -	callba Functionc6bc ; same bank +	farcall Functionc6bc ; same bank  	ld a, [wCurPartyLevel]  	ld d, a -	callab CalcExpAtLevel +	callfar CalcExpAtLevel  	pop bc  	ld hl, $8  	add hl, bc @@ -836,7 +836,7 @@ Functionde4a: ; de4a (3:5e4a)  	ld bc, BOXMON_STRUCT_LENGTH  	jp CopyBytes -SentPkmnIntoBox: ; de74 (3:5e74) +SendMonIntoBox: ; de74 (3:5e74)  	ld a, $1  	call OpenSRAM  	ld de, sBoxCount @@ -884,7 +884,7 @@ SentPkmnIntoBox: ; de74 (3:5e74)  	push de  	ld a, [wCurPartyLevel]  	ld d, a -	callab CalcExpAtLevel +	callfar CalcExpAtLevel  	pop de  	ld a, [hQuotient]  	ld [de], a @@ -930,7 +930,7 @@ SentPkmnIntoBox: ; de74 (3:5e74)  	jr nz, .asm_df26  	ld hl, sBoxMon1DVs  	predef GetUnownLetter -	callab UpdateUnownDex +	callfar UpdateUnownDex  .asm_df26  	ld hl, sBoxMon1Moves  	ld de, wTempMonMoves @@ -995,8 +995,8 @@ Functiondf65: ; df65 (3:5f65)  GiveEgg: ; df92 (3:5f92)  	ld a, [wCurPartySpecies]  	push af -	callab GetPreEvolution -	callab GetPreEvolution +	callfar GetPreEvolution +	callfar GetPreEvolution  	ld a, [wCurPartySpecies]  	dec a  	push af @@ -1016,7 +1016,7 @@ GiveEgg: ; df92 (3:5f92)  	ld d, $0  	ld hl, wPokedexCaught  	ld b, RESET_FLAG -	predef FlagPredef +	predef SmallFarFlagAction  .asm_dfc9  	pop bc  	ld a, c @@ -1028,7 +1028,7 @@ GiveEgg: ; df92 (3:5f92)  	ld d, $0  	ld hl, wPokedexSeen  	ld b, RESET_FLAG -	predef FlagPredef +	predef SmallFarFlagAction  .asm_dfdf  	pop af  	ld [wCurPartySpecies], a @@ -1234,7 +1234,7 @@ ComputeNPCTrademonStats:  	ld a, MON_STAT_EXP - 1  	call GetPartyParamLocation  	ld b, $1 -	call CalcPkmnStats +	call CalcMonStats  	pop de  	ld a, MON_HP  	call GetPartyParamLocation @@ -1245,7 +1245,7 @@ ComputeNPCTrademonStats:  	ld [hl], a  	ret -CalcPkmnStats: ; e16d +CalcMonStats: ; e16d  ; Calculates all 6 Stats of a Pkmn  ; b: Take into account stat EXP if TRUE  ; 'c' counts from 1-6 and points with 'BaseStats' to the base value @@ -1255,7 +1255,7 @@ CalcPkmnStats: ; e16d  	ld c, $0  .loop  	inc c -	call CalcPkmnStatC +	call CalcMonStatC  	ld a, [hMultiplicand + 1]  	ld [de], a  	inc de @@ -1268,7 +1268,7 @@ CalcPkmnStats: ; e16d  	ret  ; e17b -CalcPkmnStatC: ; e181 +CalcMonStatC: ; e181  ; 'c' is 1-6 and points to the BaseStat  ; 1: HP  ; 2: Attack @@ -1510,8 +1510,8 @@ GivePoke: ; Give a Pokemon from script  .asm_e2c9  	ld a, [wCurPartySpecies]  	ld [wTempEnemyMonSpecies], a -	callab LoadEnemyMon -	call SentPkmnIntoBox +	callfar LoadEnemyMon +	call SendMonIntoBox  	jp nc, Functione3af  	ld a, BOXMON  	ld [wMonType], a @@ -1596,7 +1596,7 @@ GivePoke: ; Give a Pokemon from script  	jr .asm_e38d  .asm_e381 -	callab Functionc7cd0 +	callfar Functionc7cd0  	pop de  	jr c, .asm_e38d  	call InitNickname @@ -1625,7 +1625,7 @@ Functione3af: ; e3af (3:63af)  	ret  TextJump_WasSentToBillsPC: -	text_jump Text_WasSentToBillsPC +	text_far Text_WasSentToBillsPC  	db "@"  InitNickname: ; e3b9 (3:63b9) @@ -1635,7 +1635,7 @@ InitNickname: ; e3b9 (3:63b9)  	pop de  	push de  	ld b, $0 -	callba NamingScreen +	farcall NamingScreen  	pop hl  	ld de, wStringBuffer1  	call InitName diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 54147ee9..52cc06c7 100644 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -95,7 +95,7 @@ Function11b2a:  	inc de  	hlcoord 5, 4  	call PlaceString -	callba GetGender +	farcall GetGender  	jr c, .asm_11b68  	ld a, "♂"  	jr nz, .place_gender @@ -290,14 +290,14 @@ Function11cd4: ; 11cd4 (4:5cd4)  	bit 7, a  	jr nz, .asm_11cef  	call Function11d27 -	callba AnimatedObjects_PlayFrameAndDelay +	farcall AnimatedObjects_PlayFrameAndDelay  	call Function11cff  	call DelayFrame  	and a  	ret  .asm_11cef -	callab ClearAnimatedObjectBuffer +	callfar ClearAnimatedObjectBuffer  	call ClearSprites  	xor a  	ld [hSCX], a @@ -817,7 +817,7 @@ Function11fde: ; 11fde (4:5fde)  Function1201e: ; 1201e (4:601e)  	call ClearSprites -	callab ClearAnimatedObjectBuffer +	callfar ClearAnimatedObjectBuffer  	call Functiond9e  	call LoadFontsExtra  	ld de, NamingScreenGFX_MiddleLine ; $6232 @@ -1005,14 +1005,14 @@ Function1238d: ; 1238d (4:638d)  	bit 7, a  	jr nz, .asm_123a8  	call Function123d5 -	callba AnimatedObjects_PlayFrameAndDelay +	farcall AnimatedObjects_PlayFrameAndDelay  	call Function123b8  	call DelayFrame  	and a  	ret  .asm_123a8 -	callab ClearAnimatedObjectBuffer +	callfar ClearAnimatedObjectBuffer  	call ClearSprites  	xor a  	ld [hSCX], a diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 2bf5fda2..593a1d75 100755 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -605,7 +605,7 @@ Function554b: ; 554b (1:554b)  	ret nc  	ld d, h  	ld e, l -	callba CopyTempObjectToObjectStruct +	farcall CopyTempObjectToObjectStruct  	ret  Function5558: ; 5558 (1:5558) @@ -717,14 +717,14 @@ Function55ef: ; 55ef (1:55ef)  	call Function5636  	jr c, Function5613  	call Function561b -	callba Function4441 ; same bank +	farcall Function4441 ; same bank  	xor a  	ret  Function5606: ; 5606 (1:5606)  	call Function5636  	jr c, Function5613 -	callba Function4441 ; same bank +	farcall Function4441 ; same bank  	xor a  	ret @@ -748,7 +748,7 @@ Function561b: ; 561b (1:561b)  	ld hl, $e  	add hl, bc  	ld [hl], a -	callba UpdateGrassPriority ; same bank +	farcall UpdateGrassPriority ; same bank  	ret  Function5636: ; 5636 (1:5636) @@ -931,7 +931,7 @@ Function5730:: ; 5730 (1:5730)  	ld [wcf39], a  	ld [wPlayerObjectStepFrame], a  	call Function574f -	callba Function14a44 +	farcall Function14a44  	call c, Function5770  	call Function5761  	ret @@ -974,7 +974,7 @@ StartFollow::  	ret c  	ld a, c  	call Function57a2 -	callba QueueFollowerFirstStep +	farcall QueueFollowerFirstStep  	ret  Function578b: ; 578b (1:578b) @@ -1015,7 +1015,7 @@ Function57bd: ; 57bd (1:57bd)  	cp $ff  	ret z  	call GetObjectStruct -	callba Function5859 ; same bank +	farcall Function5859 ; same bank  	ld a, $ff  	ld [wObjectFollow_Follower], a  	ret diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index 1fdec4e2..8af7c726 100755 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -576,7 +576,7 @@ Function10341: ; 10341 (4:4341)  	add e  	ld e, a  	ld bc, wPlayerSprite -	callba Function7120 +	farcall Function7120  	jr nc, .asm_10369  	call Function1036f  	jr c, .asm_1036c diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index 7ad065fc..ce847b18 100755 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -148,7 +148,7 @@ CheckPokerusTick:  	and a  	jr z, .asm_118e6  	ld b, a -	callba ApplyPokerusTick ; same bank +	farcall ApplyPokerusTick ; same bank  .asm_118e6  	xor a  	ret @@ -217,7 +217,7 @@ Function11934: ; 11934 (4:5934)  	ld hl, wCurHPAnimMaxHP  	call Function1182e  	call CloseSRAM -	callba Function2a4f6 +	farcall Function2a4f6  .asm_1195e  	ld a, BANK(sMysteryGiftTimer)  	call OpenSRAM diff --git a/engine/pack.asm b/engine/pack.asm index b8e4725e..27db7cd2 100755 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -115,12 +115,12 @@ Pack_InitTMHMPocket:  	ret  Pack_TMHMPocketMenu: -	callba Pack_TMHMPocketMenu_ +	farcall Pack_TMHMPocketMenu_  	ld b, $5  	ld c, $1  	call Function10cef  	ret c -	callba CheckTossableItem_ +	farcall CheckTossableItem_  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_1053a @@ -180,15 +180,15 @@ TMHMPocketSubmenuJumptable_Give:  	dw QuitItemSubmenu  UseTMorHM: -	callba AskTeachTMHM +	farcall AskTeachTMHM  	ret c -	callba ChooseMonToLearnTMHM +	farcall ChooseMonToLearnTMHM  	jr c, .asm_105a9  	ld hl, wOptions  	ld a, [hl]  	push af  	res 4, [hl] -	callba TeachTMHM +	farcall TeachTMHM  	pop af  	ld [wOptions], a  .asm_105a9 @@ -228,29 +228,29 @@ Pack_BallsPocketMenu:  	ret  Function105f5: ; 105f5 (4:45f5) -	callba CheckTossableItem_ +	farcall CheckTossableItem_  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_10629 -	callba CheckSelectableItem +	farcall CheckSelectableItem  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_1061b -	callba CheckItemMenu +	farcall CheckItemMenu  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_10637  	jr .asm_10657  .asm_1061b -	callba CheckItemMenu +	farcall CheckItemMenu  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_1063f  	jr .asm_1065f  .asm_10629 -	callba CheckSelectableItem +	farcall CheckSelectableItem  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_10647 @@ -417,7 +417,7 @@ ItemSubmenuJumptable_GiveTossQuit:  	dw QuitItemSubmenu  UseItem: -	callba CheckItemMenu +	farcall CheckItemMenu  	ld a, [wItemAttributeParamBuffer]  	ld hl, .Jumptable  	rst JumpTable @@ -470,7 +470,7 @@ UseItem:  TossMenu:  	ld hl, Text_ThrowAwayHowMany  	call Function10cb9 -	callba SelectQuantityToToss ; 9:4f20 +	farcall SelectQuantityToToss ; 9:4f20  	push af  	call ExitMenu  	pop af @@ -521,7 +521,7 @@ Function107cd:  	ret  RegisterItem: -	callba CheckSelectableItem +	farcall CheckSelectableItem  	ld a, [wItemAttributeParamBuffer]  	and a  	jr nz, .asm_10826 @@ -560,16 +560,16 @@ GiveItem:  	ld a, $8  	ld [wPartyMenuActionText], a  	call ClearBGPalettes -	callba LoadPartyMenuGFX -	callba InitPartyMenuWithCancel -	callba InitPartyMenuGFX +	farcall LoadPartyMenuGFX +	farcall InitPartyMenuWithCancel +	farcall InitPartyMenuGFX  .asm_10857 -	callba WritePartyMenuTilemap -	callba PrintPartyMenuText +	farcall WritePartyMenuTilemap +	farcall PrintPartyMenuText  	call WaitBGMap  	call SetPalettes  	call DelayFrame -	callba PartyMenuSelect +	farcall PartyMenuSelect  	jr c, .asm_108a5  	ld a, [wCurPartySpecies]  	cp EGG @@ -609,7 +609,7 @@ Function108b6: ; 108b6 (4:48b6)  	ret  Text_AnEggCantHoldAnItem: -	text_jump Text_AnEGGCantHoldAnItem +	text_far Text_AnEGGCantHoldAnItem  	db "@"  QuitItemSubmenu: @@ -733,7 +733,7 @@ BattlePack_InitTMHMPocket:  	ret  BattlePack_TMHMPocketMenu: -	callba Pack_TMHMPocketMenu_ ; b:457a +	farcall Pack_TMHMPocketMenu_ ; b:457a  	ld b, $5  	ld c, $1  	call Function10cef @@ -771,7 +771,7 @@ BattlePack_BallsPocketMenu:  	ret  Function10a03: ; 10a03 (4:4a03) -	callba CheckItemContext +	farcall CheckItemContext  	ld a, [wItemAttributeParamBuffer]  Function10a0c: ; 10a0c (4:4a0c)  	and a @@ -828,7 +828,7 @@ BattlePackQuitJumptable:  	dw BattlePack_QuitSubmenu  BattlePack_UseItem: -	callba CheckItemContext +	farcall CheckItemContext  	ld a, [wItemAttributeParamBuffer]  	ld hl, $4a67  	rst JumpTable @@ -972,7 +972,7 @@ DepositOrSell_TMHMPocket:  	ld a, $3  	call Function10b92  	call Function10cca -	callba Pack_TMHMPocketMenu_ ; b:457a +	farcall Pack_TMHMPocketMenu_ ; b:457a  	ld a, [wd002]  	ld [wd002], a  	ret @@ -1058,7 +1058,7 @@ TutorialPack:  	ld a, [wInputType]  	or a  	jr z, .asm_10bfa -	callba DudeAutoInput_RightA ; 70:4dee +	farcall DudeAutoInput_RightA ; 70:4dee  .asm_10bfa  	call Function10c07  	call Function10b9f @@ -1125,7 +1125,7 @@ TutorialTMHM:  	ld a, $3  	call Function10b92  	call Function10cca -	callba Pack_TMHMPocketMenu_ +	farcall Pack_TMHMPocketMenu_  	ld a, [wd002]  	ld [wd002], a  	ret @@ -1278,7 +1278,7 @@ Function10cef: ; 10cef (4:4cef)  	ret  .asm_10d3e -	callba SwitchItemsInBag ; 9:4834 +	farcall SwitchItemsInBag ; 9:4834  	ld hl, Text_MoveItemWhere  	call Function10cb9  	scf @@ -1295,7 +1295,7 @@ Function10cef: ; 10cef (4:4cef)  	ret  .asm_10d58 -	callba SwitchItemsInBag ; 9:4834 +	farcall SwitchItemsInBag ; 9:4834  	ld de, SFX_SWITCH_POKEMON  	call WaitPlaySFX  	ld de, SFX_SWITCH_POKEMON @@ -1335,7 +1335,7 @@ Function10d70: ; 10d70 (4:4d70)  	call Function10dc0  	hlcoord 0, 12  	ld bc, IncGradGBPalTable_13 -	call TextBox +	call Textbox  	call EnableLCD  	call Function10ccd  	ret @@ -1525,47 +1525,47 @@ PC_Mart_BallsPocketMenuDataHeader:  	dba UpdateItemDescription ; 9:43eb  Text_PackNoItems: -	text_jump Text_PackNoItems_ +	text_far Text_PackNoItems_  	db "@"  Text_ThrowAwayHowMany: -	text_jump Text_ThrowAwayHowMany_ +	text_far Text_ThrowAwayHowMany_  	db "@"  Text_ConfirmThrowAway: -	text_jump Text_ConfirmThrowAway_ +	text_far Text_ConfirmThrowAway_  	db "@"  Text_ThrewAway: -	text_jump Text_ThrewAway_ +	text_far Text_ThrewAway_  	db "@"  Text_ThisIsntTheTime: -	text_jump Text_ThisIsntTheTime_ +	text_far Text_ThisIsntTheTime_  	db "@"  Text_YouDontHaveAPokemon: -	text_jump Text_YouDontHaveAMon +	text_far Text_YouDontHaveAMon  	db "@"  Text_RegisteredTheItem: -	text_jump Text_RegisteredTheItem_ +	text_far Text_RegisteredTheItem_  	db "@"  Text_CantRegisterThatItem: -	text_jump Text_CantRegisterThatItem_ +	text_far Text_CantRegisterThatItem_  	db "@"  Text_MoveItemWhere: -	text_jump Text_MoveItemWhere_ +	text_far Text_MoveItemWhere_  	db "@"  Text_PackEmptyString: -	text_jump Text_PackEmptyString_ +	text_far Text_PackEmptyString_  	db "@"  Text_CantUseItInABattle: -	text_jump Text_YouCantUseItInABattle +	text_far Text_YouCantUseItInABattle  	db "@"  PackMenuGFX: INCBIN "gfx/misc/pack_menu.2bpp" diff --git a/engine/predef.asm b/engine/predef.asm index 4e386f98..b0d0eb56 100755 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -1,102 +1,28 @@ -GetPredefPointer:: ; 8b3b (2:4b3b) +GetPredefPointer:: +; Return the bank and address of wPredefID in a and wPredefAddress. + +; Save hl for later (back in Predef)  	ld a, h -	ld [wPredefHLBuffer], a +	ld [wPredefTemp], a  	ld a, l -	ld [wPredefHLBuffer + 1], a +	ld [wPredefTemp + 1], a +  	push de  	ld a, [wPredefID]  	ld e, a -	ld d, $0 +	ld d, 0  	ld hl, PredefPointers  	add hl, de  	add hl, de  	add hl, de  	pop de +  	ld a, [hli] -	ld [wPredefPointerBuffer + 1], a +	ld [wPredefAddress + 1], a  	ld a, [hli] -	ld [wPredefPointerBuffer], a +	ld [wPredefAddress], a  	ld a, [hl] -	ret -PredefPointers:: -; temp macro -predef_pointer: macro -IF DEF(GOLD) -	dwb \1, \3 -ENDC -IF DEF(SILVER) -	dwb \2, \3 -ENDC -endm +	ret -	add_predef LearnMove ; $0 -	add_predef Predef1 ; $1 -	add_predef HealParty -	add_predef FlagPredef -	add_predef ComputeHPBarPixels -	add_predef FillPP -	add_predef TryAddMonToParty -	add_predef AddTempmonToParty -	add_predef SentGetPkmnIntoFromBox -	add_predef SentPkmnIntoBox -	add_predef GiveEgg -	add_predef AnimateHPBar -	add_predef CalcPkmnStats -	add_predef CalcPkmnStatC -	add_predef CanLearnTMHMMove -	add_predef GetTMHMMove -	add_predef Predef_LinkTextbox ; $ 10 -	add_predef PrintMoveDesc -	add_predef UpdatePlayerHUD -	add_predef PlaceGraphic -	add_predef CheckPlayerPartyForFitPkmn -	add_predef UpdateEnemyHUD -	add_predef StartBattle -	add_predef FillInExpBar -	add_predef GetMonBackpic ; $18 -	add_predef GetMonFrontpic -	add_predef LearnLevelMoves -	add_predef FillMoves -	add_predef EvolveAfterBattle -	add_predef TradeAnimationPlayer2 -	add_predef TradeAnimation -	add_predef CopyPkmnToTempMon -	add_predef ListMoves ; $20 -	add_predef PlaceNonFaintStatus -	add_predef Predef22 -	add_predef ListMovePP -	add_predef GetGender -	add_predef StatsScreenInit -	add_predef DrawPlayerHP -	add_predef DrawEnemyHP -	add_predef PrintTempMonStats ; $28 -	add_predef GetTypeName -	add_predef PrintMoveType -	add_predef PrintType -	add_predef PrintMonTypes -	add_predef GetUnownLetter -	add_predef LoadPoisonBGPals -	add_predef Predef2F -	add_predef InitSGBBorder ; $30 -	add_predef Predef_LoadSGBLayout -	add_predef Area_ -	add_predef CheckContestMon -	add_predef Predef_StartBattle -	add_predef Predef35 -	add_predef Predef36 -	add_predef PlayBattleAnim -	add_predef Predef38 ; $38 -	add_predef Predef39 -	add_predef Predef3A -	add_predef PartyMonItemName -	add_predef GetFrontpic -	add_predef GetBackpic -	add_predef GetTrainerPic -	add_predef DecompressPredef -	add_predef CheckTypeMatchup ; $40 -	add_predef ConvertMon_1to2 -	add_predef NewPokedexEntry -	add_predef FrontpicPredef -	add_predef UpdateTimePredef -    dbw $ff, InexplicablyEmptyFunction +INCLUDE "data/predef_pointers.asm"
\ No newline at end of file diff --git a/engine/sine.asm b/engine/sine.asm index 4341e848..9a730219 100644 --- a/engine/sine.asm +++ b/engine/sine.asm @@ -37,4 +37,4 @@ Sine_e:: ; 8ac9 (2:4ac9)  	ret  .SineWave: -	sine_wave $100 +	sine_table $100 diff --git a/engine/specials.asm b/engine/specials.asm index b26b6bf1..aa8aefdd 100755 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -157,7 +157,7 @@ GameCornerPrizeMonCheckDex: ; c38a  	call FadeToMenu  	ld a, [wScriptVar]  	ld [wd151], a -	callba NewPokedexEntry +	farcall NewPokedexEntry  	call ExitAllMenus  	ret @@ -170,28 +170,28 @@ UnusedSetSeenMon: ; c3ac  FindPartyMonAboveLevel: ; c3b4  	ld a, [wScriptVar]  	ld b, a -	callba PartySearch_MaximumLevel ; same bank +	farcall PartySearch_MaximumLevel ; same bank  	jr z, asm_c3f2  	jr asm_c3ec  FindPartyMonAtLeastThatHappy: ; c3c2  	ld a, [wScriptVar]  	ld b, a -	callba PartySearch_MinimumHappiness ; same bank +	farcall PartySearch_MinimumHappiness ; same bank  	jr z, asm_c3f2  	jr asm_c3ec  FindPartyMonThatSpecies: ; c3d0  	ld a, [wScriptVar]  	ld b, a -	callba PartySearch_SameSpecies ; same bank +	farcall PartySearch_SameSpecies ; same bank  	jr z, asm_c3f2  	jr asm_c3ec  FindPartyMonThatSpeciesYourTrainerID: ; c3de  	ld a, [wScriptVar]  	ld b, a -	callba PartySearch_SameSpeciesAndYourID ; same bank +	farcall PartySearch_SameSpeciesAndYourID ; same bank  	jr z, asm_c3f2  	jr asm_c3ec @@ -208,7 +208,7 @@ asm_c3f2  NameRival: ; c3f7  	ld b, $2  	ld de, wRivalName -	callba NamingScreen_ +	farcall NamingScreen_  	ld hl, wRivalName  	ld de, .DefaultName  	call InitName @@ -224,31 +224,31 @@ IF DEF(SILVER)  ENDC  NameRater: -	callba _NameRater +	farcall _NameRater  	ret  OverworldTownMap: ; c41a (3:441a)  	call FadeToMenu -	callba Function9188a +	farcall Function9188a  	call ExitAllMenus  	ret  UnownPrinter: ; c427 (3:4427)  	call FadeToMenu -	callba Function16e3a +	farcall Function16e3a  	call ExitAllMenus  	ret  DisplayLinkRecord: ; c434 (3:4434)  	call FadeToMenu -	callba Function3f55d +	farcall Function3f55d  	call ExitAllMenus  	ret  PlayersHousePC: ; c441 (3:4441)  	xor a  	ld [wScriptVar], a -	callba Function159b0 +	farcall Function159b0  	ld a, c  	ld [wScriptVar], a  	ret @@ -294,11 +294,11 @@ GetMysteryGiftItem: ; c463 (3:4463)  	ret  ReceivedMysteryGiftText: -	text_jump ReceivedMysteryGiftText_ +	text_far ReceivedMysteryGiftText_  	db "@"  BugContestJudging: ; c4a4 (3:44a4) -	callba Function13a5f +	farcall Function13a5f  	ld a, b  	ld [wScriptVar], a  	ret @@ -306,12 +306,12 @@ BugContestJudging: ; c4a4 (3:44a4)  MapRadio: ; c4af (3:44af)  	ld a, [wScriptVar]  	ld e, a -	callba Function919c1 +	farcall Function919c1  	ret  UnownPuzzle: ; c4ba (3:44ba)  	call FadeToMenu -	callba Functione199d +	farcall Functione199d  	ld a, [wFieldMoveSucceeded]  	ld [wScriptVar], a  	call ExitAllMenus @@ -380,11 +380,11 @@ Functionc508: ; c508 (3:4508)  	ret  .NoCoinsText: -	text_jump NoCoinsText_ +	text_far NoCoinsText_  	db "@"  .NoCoinCaseText: -	text_jump NoCoinCaseText_ +	text_far NoCoinCaseText_  	db "@"  ClearBGPalettesBufferScreen: ; c535 (3:4535) @@ -404,7 +404,7 @@ Functionc53c: ; c53c (3:453c)  	ret  UnusedCheckUnusedTwoDayTimer: ; c549 (3:4549) -	callba Function118f8 +	farcall Function118f8  	ld a, [wUnusedTwoDayTimer]  	ld [wScriptVar], a  	ret @@ -440,17 +440,17 @@ Functionc56c:  	ret  CheckPokerus: ; c588 (3:4588) -	callba Functionc7a40 +	farcall Functionc7a40  	jp Functionc53c  ResetLuckyNumberShowFlag: ; c591 (3:4591) -	callba Function11917 +	farcall Function11917  	ClearFlag ENGINE_LUCKY_NUMBER_SHOW -	callba LoadOrRegenerateLuckyIDNumber +	farcall LoadOrRegenerateLuckyIDNumber  	ret  CheckLuckyNumberShowFlag: ; c5a3 (3:45a3) -	callba Function1192e +	farcall Function1192e  	jp Functionc53c  CountUnown: ; c5ac (3:45ac) @@ -467,7 +467,7 @@ CountUnown: ; c5ac (3:45ac)  	ret  SelectApricornForKurt: ; c5bb (3:45bb) -	callba Function24b8d +	farcall Function24b8d  	ld a, c  	ld [wScriptVar], a  	and a @@ -547,20 +547,20 @@ FadeOutMusic: ; c628 (3:4628)  	ld a, $0  	ld [wMusicFadeID], a  	ld a, $0 -	ld [wMusicFadeIDHi], a +	ld [wMusicFadeID + 1], a  	ld a, $2  	ld [wMusicFade], a  	ret  Diploma: ; c638 (3:4638)  	call FadeToMenu -	callba Functione0002 +	farcall Functione0002  	call ExitAllMenus  	ret  PrintDiploma: ; c645 (3:4645)  	call FadeToMenu -	callba Function84684 +	farcall Function84684  	call ExitAllMenus  	ret diff --git a/engine/sprites_dump.asm b/engine/sprites_dump.asm deleted file mode 100755 index e69de29b..00000000 --- a/engine/sprites_dump.asm +++ /dev/null diff --git a/engine/step_types.asm b/engine/step_types.asm index 98ae1964..91858f98 100755 --- a/engine/step_types.asm +++ b/engine/step_types.asm @@ -560,7 +560,7 @@ Function4ea4: ; 4ea4 (1:4ea4)  	add hl, bc  	ld a, [hl]  	ld b, a -	callba CopyDECoordsToMapObject +	farcall CopyDECoordsToMapObject  	pop bc  	ld hl, $5  	add hl, bc diff --git a/engine/title.asm b/engine/title.asm index 4e9a2d3a..8427dfc9 100755 --- a/engine/title.asm +++ b/engine/title.asm @@ -1,7 +1,7 @@  IntroSequence: ; 6241 (1:6241) -	callab Copyright_GFPresents +	callfar Copyright_GFPresents  	jr c, StartTitleScreen -	callab GoldSilverIntro +	callfar GoldSilverIntro  StartTitleScreen:  	call InitTitleScreen  	call DelayFrame @@ -58,7 +58,7 @@ InitTitleScreen: ; 6291 (1:6291)  	ld bc, $2000  	xor a  	call ByteFill -	callba ClearAnimatedObjectBuffer +	farcall ClearAnimatedObjectBuffer  	ld hl, TitleScreenGFX1  	ld de, $9000 @@ -237,7 +237,7 @@ TitleScreenFrame: ; 63da (1:63da)  	call Function640f  	ld a, $1  	ld [hOAMUpdate], a -	callba AnimatedObjects_PlayFrame +	farcall AnimatedObjects_PlayFrame  	xor a  	ld [hOAMUpdate], a  	call Function64b1 @@ -341,8 +341,8 @@ Function6434:  	ld hl, wce63  	inc [hl]  	xor a -	ld [wMusicFadeIDLo], a -	ld [wMusicFadeIDHi], a +	ld [wMusicFadeID], a +	ld [wMusicFadeID + 1], a  	ld hl, wMusicFade  	ld [hl], $8  	ld hl, wce65 @@ -369,11 +369,11 @@ Function648b:  	ret  DeleteSaveData: -	callba DeleteSaveData_ +	farcall DeleteSaveData_  	jp Init  ResetClock: -	callba ResetClock_ +	farcall ResetClock_  	jp Init  Function64b1: ; 64b1 (1:64b1) | 
