mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Sync home and macro code with pokeyellow
This commit is contained in:
parent
abaf9fee7c
commit
d3e81422d5
16 changed files with 44 additions and 122 deletions
|
@ -2,16 +2,6 @@ TILE_WIDTH EQU 8 ; pixels
|
||||||
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
|
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
|
||||||
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
|
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
|
||||||
|
|
||||||
const_def
|
|
||||||
const SHADE_WHITE ; %00
|
|
||||||
const SHADE_LIGHT ; %01
|
|
||||||
const SHADE_DARK ; %10
|
|
||||||
const SHADE_BLACK ; %11
|
|
||||||
NUM_PAL_COLORS EQU const_value
|
|
||||||
|
|
||||||
PAL_COLOR_SIZE EQU 2
|
|
||||||
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
|
|
||||||
|
|
||||||
SCREEN_WIDTH EQU 20
|
SCREEN_WIDTH EQU 20
|
||||||
SCREEN_HEIGHT EQU 18
|
SCREEN_HEIGHT EQU 18
|
||||||
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
|
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
; monochrome palette color ids
|
; monochrome palette color ids
|
||||||
const_def
|
const_def
|
||||||
const WHITE
|
const SHADE_WHITE ; %00
|
||||||
const LIGHT_GRAY
|
const SHADE_LIGHT ; %01
|
||||||
const DARK_GRAY
|
const SHADE_DARK ; %10
|
||||||
const BLACK
|
const SHADE_BLACK ; %11
|
||||||
|
NUM_PAL_COLORS EQU const_value
|
||||||
|
|
||||||
|
PAL_COLOR_SIZE EQU 2
|
||||||
|
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
|
||||||
|
|
||||||
; pal/blk packets
|
; pal/blk packets
|
||||||
; SetPalFunctions indexes (see engine/gfx/palettes.asm)
|
; SetPalFunctions indexes (see engine/gfx/palettes.asm)
|
||||||
|
|
|
@ -23,7 +23,7 @@ PlayIntro:
|
||||||
PlayIntroScene:
|
PlayIntroScene:
|
||||||
ld b, SET_PAL_NIDORINO_INTRO
|
ld b, SET_PAL_NIDORINO_INTRO
|
||||||
call RunPaletteCommand
|
call RunPaletteCommand
|
||||||
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
|
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
|
||||||
ldh [rBGP], a
|
ldh [rBGP], a
|
||||||
ldh [rOBP0], a
|
ldh [rOBP0], a
|
||||||
ldh [rOBP1], a
|
ldh [rOBP1], a
|
||||||
|
@ -307,7 +307,7 @@ PlayShootingStar:
|
||||||
ld b, SET_PAL_GAME_FREAK_INTRO
|
ld b, SET_PAL_GAME_FREAK_INTRO
|
||||||
call RunPaletteCommand
|
call RunPaletteCommand
|
||||||
farcall LoadCopyrightAndTextBoxTiles
|
farcall LoadCopyrightAndTextBoxTiles
|
||||||
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
|
ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
|
||||||
ldh [rBGP], a
|
ldh [rBGP], a
|
||||||
ld c, 180
|
ld c, 180
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
; These routines manage gradual fading
|
; These routines manage gradual fading
|
||||||
; (e.g., entering a doorway)
|
; (e.g., entering a doorway)
|
||||||
LoadGBPal::
|
LoadGBPal::
|
||||||
ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?)
|
ld a, [wMapPalOffset] ; tells if wCurMap is dark (requires HM5_FLASH?)
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, FadePal4
|
ld hl, FadePal4
|
||||||
ld a, l
|
ld a, l
|
||||||
|
|
|
@ -126,7 +126,7 @@ ClearVram::
|
||||||
|
|
||||||
|
|
||||||
StopAllSounds::
|
StopAllSounds::
|
||||||
ld a, BANK(Audio1_UpdateMusic)
|
ld a, BANK("Audio Engine 1")
|
||||||
ld [wAudioROMBank], a
|
ld [wAudioROMBank], a
|
||||||
ld [wAudioSavedROMBank], a
|
ld [wAudioSavedROMBank], a
|
||||||
xor a
|
xor a
|
||||||
|
|
|
@ -22,15 +22,7 @@ AddAmountSoldToMoney::
|
||||||
; [wWhichPokemon] = index (within the inventory) of the item to remove
|
; [wWhichPokemon] = index (within the inventory) of the item to remove
|
||||||
; [wItemQuantity] = quantity to remove
|
; [wItemQuantity] = quantity to remove
|
||||||
RemoveItemFromInventory::
|
RemoveItemFromInventory::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall RemoveItemFromInventory_
|
||||||
push af
|
|
||||||
ld a, BANK(RemoveItemFromInventory_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call RemoveItemFromInventory_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; function to add an item (in varying quantities) to the player's bag or PC box
|
; function to add an item (in varying quantities) to the player's bag or PC box
|
||||||
|
@ -41,15 +33,6 @@ RemoveItemFromInventory::
|
||||||
; sets carry flag if successful, unsets carry flag if unsuccessful
|
; sets carry flag if successful, unsets carry flag if unsuccessful
|
||||||
AddItemToInventory::
|
AddItemToInventory::
|
||||||
push bc
|
push bc
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf AddItemToInventory_
|
||||||
push af
|
|
||||||
ld a, BANK(AddItemToInventory_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call AddItemToInventory_
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -26,15 +26,7 @@ Divide::
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
ldh a, [hLoadedROMBank]
|
homecall _Divide
|
||||||
push af
|
|
||||||
ld a, BANK(_Divide)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _Divide
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
|
|
|
@ -231,27 +231,9 @@ CalcStat::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
AddEnemyMonToPlayerParty::
|
AddEnemyMonToPlayerParty::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf _AddEnemyMonToPlayerParty
|
||||||
push af
|
|
||||||
ld a, BANK(_AddEnemyMonToPlayerParty)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _AddEnemyMonToPlayerParty
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MoveMon::
|
MoveMon::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf _MoveMon
|
||||||
push af
|
|
||||||
ld a, BANK(_MoveMon)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _MoveMon
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -2321,16 +2321,16 @@ LoadMapData::
|
||||||
; copy current map view to VRAM
|
; copy current map view to VRAM
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
ld de, vBGMap0
|
ld de, vBGMap0
|
||||||
ld b, 18
|
ld b, SCREEN_HEIGHT
|
||||||
.vramCopyLoop
|
.vramCopyLoop
|
||||||
ld c, 20
|
ld c, SCREEN_WIDTH
|
||||||
.vramCopyInnerLoop
|
.vramCopyInnerLoop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc e
|
inc e
|
||||||
dec c
|
dec c
|
||||||
jr nz, .vramCopyInnerLoop
|
jr nz, .vramCopyInnerLoop
|
||||||
ld a, 32 - 20
|
ld a, BG_MAP_WIDTH - SCREEN_WIDTH
|
||||||
add e
|
add e
|
||||||
ld e, a
|
ld e, a
|
||||||
jr nc, .noCarry
|
jr nc, .noCarry
|
||||||
|
@ -2366,15 +2366,15 @@ SwitchToMapRomBank::
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, $00
|
ld b, $00
|
||||||
ld a, BANK(MapHeaderBanks)
|
ld a, BANK(MapHeaderBanks)
|
||||||
call BankswitchHome ; switch to ROM bank 3
|
call BankswitchHome
|
||||||
ld hl, MapHeaderBanks
|
ld hl, MapHeaderBanks
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ldh [hMapROMBank], a ; save map ROM bank
|
ldh [hMapROMBank], a
|
||||||
call BankswitchBack
|
call BankswitchBack
|
||||||
ldh a, [hMapROMBank]
|
ldh a, [hMapROMBank]
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a ; switch to map ROM bank
|
ld [MBC1RomBank], a
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
@ -2395,7 +2395,7 @@ ResetUsingStrengthOutOfBattleBit:
|
||||||
|
|
||||||
ForceBikeOrSurf::
|
ForceBikeOrSurf::
|
||||||
ld b, BANK(RedSprite)
|
ld b, BANK(RedSprite)
|
||||||
ld hl, LoadPlayerSpriteGraphics
|
ld hl, LoadPlayerSpriteGraphics ; in bank 0
|
||||||
call Bankswitch
|
call Bankswitch
|
||||||
jp PlayDefaultMusic ; update map/player state?
|
jp PlayDefaultMusic ; update map/player state?
|
||||||
|
|
||||||
|
|
|
@ -325,16 +325,7 @@ PrintStatusCondition::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
PrintStatusConditionNotFainted::
|
PrintStatusConditionNotFainted::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf PrintStatusAilment
|
||||||
push af
|
|
||||||
ld a, BANK(PrintStatusAilment)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call PrintStatusAilment ; print status condition
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; function to print pokemon level, leaving off the ":L" if the level is at least 100
|
; function to print pokemon level, leaving off the ":L" if the level is at least 100
|
||||||
|
|
|
@ -4,7 +4,7 @@ _Start::
|
||||||
xor a
|
xor a
|
||||||
jr .ok
|
jr .ok
|
||||||
.gbc
|
.gbc
|
||||||
ld a, 0
|
ld a, FALSE
|
||||||
.ok
|
.ok
|
||||||
ld [wGBC], a
|
ld [wGBC], a
|
||||||
jp Init
|
jp Init
|
||||||
|
|
|
@ -146,15 +146,7 @@ DisplayPokemartDialogue::
|
||||||
call LoadItemList
|
call LoadItemList
|
||||||
ld a, PRICEDITEMLISTMENU
|
ld a, PRICEDITEMLISTMENU
|
||||||
ld [wListMenuID], a
|
ld [wListMenuID], a
|
||||||
ldh a, [hLoadedROMBank]
|
homecall DisplayPokemartDialogue_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayPokemartDialogue_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayPokemartDialogue_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
jp AfterDisplayingTextID
|
jp AfterDisplayingTextID
|
||||||
|
|
||||||
PokemartGreetingText::
|
PokemartGreetingText::
|
||||||
|
@ -185,15 +177,7 @@ DisplayPokemonCenterDialogue::
|
||||||
ldh [hItemPrice + 2], a
|
ldh [hItemPrice + 2], a
|
||||||
|
|
||||||
inc hl
|
inc hl
|
||||||
ldh a, [hLoadedROMBank]
|
homecall DisplayPokemonCenterDialogue_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayPokemonCenterDialogue_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayPokemonCenterDialogue_
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
jp AfterDisplayingTextID
|
jp AfterDisplayingTextID
|
||||||
|
|
||||||
DisplaySafariGameOverText::
|
DisplaySafariGameOverText::
|
||||||
|
|
|
@ -3,14 +3,5 @@
|
||||||
; [wTextBoxID] = text box ID
|
; [wTextBoxID] = text box ID
|
||||||
; b, c = y, x cursor position (TWO_OPTION_MENU only)
|
; b, c = y, x cursor position (TWO_OPTION_MENU only)
|
||||||
DisplayTextBoxID::
|
DisplayTextBoxID::
|
||||||
ldh a, [hLoadedROMBank]
|
homecall_sf DisplayTextBoxID_
|
||||||
push af
|
|
||||||
ld a, BANK(DisplayTextBoxID_)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call DisplayTextBoxID_
|
|
||||||
pop bc
|
|
||||||
ld a, b
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -2,13 +2,5 @@ UpdateSprites::
|
||||||
ld a, [wUpdateSpritesEnabled]
|
ld a, [wUpdateSpritesEnabled]
|
||||||
dec a
|
dec a
|
||||||
ret nz
|
ret nz
|
||||||
ldh a, [hLoadedROMBank]
|
homecall _UpdateSprites
|
||||||
push af
|
|
||||||
ld a, BANK(_UpdateSprites)
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
call _UpdateSprites
|
|
||||||
pop af
|
|
||||||
ldh [hLoadedROMBank], a
|
|
||||||
ld [MBC1RomBank], a
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -4,7 +4,7 @@ lb: MACRO ; r, hi, lo
|
||||||
ld \1, ((\2) & $ff) << 8 + ((\3) & $ff)
|
ld \1, ((\2) & $ff) << 8 + ((\3) & $ff)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
ldPal: MACRO
|
ldpal: MACRO
|
||||||
ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5
|
ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,16 @@ homecall: MACRO
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a
|
ld [MBC1RomBank], a
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
homecall_sf: MACRO ; homecall but save flags by popping into bc instead of af
|
||||||
|
ldh a, [hLoadedROMBank]
|
||||||
|
push af
|
||||||
|
ld a, BANK(\1)
|
||||||
|
ldh [hLoadedROMBank], a
|
||||||
|
ld [MBC1RomBank], a
|
||||||
|
call \1
|
||||||
|
pop bc
|
||||||
|
ld a, b
|
||||||
|
ldh [hLoadedROMBank], a
|
||||||
|
ld [MBC1RomBank], a
|
||||||
|
ENDM
|
||||||
|
|
Loading…
Reference in a new issue