Merge branch 'master' into audio-macros

This commit is contained in:
dannye
2020-01-06 22:07:33 -06:00
451 changed files with 10496 additions and 10448 deletions

View File

@@ -1,6 +1,6 @@
; Audio interfaces.
MapSetup_Sound_Off::
InitSound::
push hl
push de
push bc
@@ -8,11 +8,11 @@ MapSetup_Sound_Off::
ldh a, [hROMBank]
push af
ld a, BANK(_MapSetup_Sound_Off)
ld a, BANK(_InitSound)
ldh [hROMBank], a
ld [MBC3RomBank], a
call _MapSetup_Sound_Off
call _InitSound
pop af
ldh [hROMBank], a
@@ -71,7 +71,7 @@ PlayMusic::
ldh a, [hROMBank]
push af
ld a, BANK(_PlayMusic) ; aka BANK(_MapSetup_Sound_Off)
ld a, BANK(_PlayMusic) ; aka BANK(_InitSound)
ldh [hROMBank], a
ld [MBC3RomBank], a
@@ -83,7 +83,7 @@ PlayMusic::
jr .end
.nomusic
call _MapSetup_Sound_Off
call _InitSound
.end
pop af
@@ -359,7 +359,8 @@ PlayMapMusic::
pop hl
ret
EnterMapMusic::
PlayMapMusicBike::
; If the player's on a bike, play the bike music instead of the map music
push hl
push de
push bc

View File

@@ -272,9 +272,9 @@ Request1bpp::
ldh a, [hTilesPerCycle]
push af
ld a, $8
ldh [hTilesPerCycle], a
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, .NotMobile

View File

@@ -23,7 +23,7 @@ FarCall_hl::
push af
ldh a, [hBuffer]
rst Bankswitch
call FarJump_hl
call FarCall_JumpToHL
ReturnFarCall::
; We want to retain the contents of f.
@@ -45,5 +45,5 @@ ReturnFarCall::
ld c, a
ret
FarJump_hl::
FarCall_JumpToHL::
jp hl

View File

@@ -1,6 +1,6 @@
Reset::
di
call MapSetup_Sound_Off
call InitSound
xor a
ldh [hMapAnims], a
call ClearPalettes
@@ -162,7 +162,7 @@ Init::
predef InitSGBBorder ; SGB init
call MapSetup_Sound_Off
call InitSound
xor a
ld [wMapMusic], a
jp GameInit

View File

@@ -338,6 +338,12 @@ JoyTextDelay::
ret
WaitPressAorB_BlinkCursor::
; Show a blinking cursor in the lower right-hand
; corner of a textbox and wait until A or B is
; pressed.
;
; NOTE: The cursor has to be shown before calling
; this function or no cursor will be shown at all.
ldh a, [hMapObjectIndexBuffer]
push af
ldh a, [hObjectStructIndexBuffer]
@@ -372,7 +378,10 @@ SimpleWaitPressAorB::
jr z, .loop
ret
ButtonSound::
PromptButton::
; Show a blinking cursor in the lower right-hand
; corner of a textbox and wait until A or B is
; pressed, afterwards, play a sound.
ld a, [wLinkMode]
and a
jr nz, .link

View File

@@ -330,7 +330,7 @@ CopyWarpData::
ld bc, 2 ; warp number
add hl, bc
ld a, [hli]
cp $ff
cp -1
jr nz, .skip
ld hl, wBackupWarpNumber
ld a, [hli]
@@ -369,6 +369,7 @@ CheckIndoorMap::
ret
; unused
UnreferencedCheckEnvironment::
cp INDOOR
ret z
cp GATE
@@ -380,11 +381,11 @@ LoadMapAttributes::
call CopyMapPartialAndAttributes
call SwitchToMapScriptsBank
call ReadMapScripts
xor a ; do not skip object_events
xor a ; do not skip object events
call ReadMapEvents
ret
LoadMapAttributes_SkipPeople::
LoadMapAttributes_SkipObjects::
call CopyMapPartialAndAttributes
call SwitchToMapScriptsBank
call ReadMapScripts
@@ -597,7 +598,7 @@ ReadObjectEvents::
; Fill the remaining sprite IDs and y coords with 0 and -1, respectively.
; Bleeds into wObjectMasks due to a bug. Uncomment the above subtraction
; to fix.
ld bc, OBJECT_LENGTH
ld bc, MAPOBJECT_LENGTH
.loop
ld [hl], 0
inc hl
@@ -631,7 +632,7 @@ CopyMapObjectEvents::
jr nz, .loop2
pop hl
ld bc, OBJECT_LENGTH
ld bc, MAPOBJECT_LENGTH
add hl, bc
pop bc
dec c
@@ -640,13 +641,13 @@ CopyMapObjectEvents::
ClearObjectStructs::
ld hl, wObject1Struct
ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
ld bc, OBJECT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
xor a
call ByteFill
; Just to make sure (this is rather pointless)
ld hl, wObject1Struct
ld de, OBJECT_STRUCT_LENGTH
ld de, OBJECT_LENGTH
ld c, NUM_OBJECT_STRUCTS - 1
xor a
.loop
@@ -656,7 +657,7 @@ ClearObjectStructs::
jr nz, .loop
ret
RestoreFacingAfterWarp::
GetWarpDestCoords::
call GetMapScriptsBank
rst Bankswitch
@@ -679,12 +680,12 @@ endr
ld [wXCoord], a
; destination warp number
ld a, [hli]
cp $ff
cp -1
jr nz, .skip
call .backup
.skip
farcall GetCoordOfUpperLeftCorner
farcall GetMapScreenCoords
ret
.backup
@@ -1114,14 +1115,14 @@ BGEvent::
jumptext BGEventText
BGEventText::
text_far UnknownText_0x1c46fc
text_far _BGEventText
text_end
CoordinatesEvent::
jumptext CoordinatesEventText
CoordinatesEventText::
text_far UnknownText_0x1c4706
text_far _CoordinatesEventText
text_end
CheckObjectMask::
@@ -1437,7 +1438,7 @@ SaveScreen::
.vertical
ld b, SCREEN_META_WIDTH
ld c, SCREEN_META_HEIGHT - 1
jr SaveScreen_LoadNeighbor
jr SaveScreen_LoadConnection
.left
ld de, wScreenSave + 1
@@ -1449,9 +1450,9 @@ SaveScreen::
.horizontal
ld b, SCREEN_META_WIDTH - 1
ld c, SCREEN_META_HEIGHT
jr SaveScreen_LoadNeighbor
jr SaveScreen_LoadConnection
LoadNeighboringBlockData::
LoadConnectionBlockData::
ld hl, wOverworldMapAnchor
ld a, [hli]
ld h, [hl]
@@ -1463,7 +1464,7 @@ LoadNeighboringBlockData::
ld b, SCREEN_META_WIDTH
ld c, SCREEN_META_HEIGHT
SaveScreen_LoadNeighbor::
SaveScreen_LoadConnection::
.row
push bc
push hl
@@ -1480,7 +1481,6 @@ SaveScreen_LoadNeighbor::
ld e, a
jr nc, .okay
inc d
.okay
pop hl
ldh a, [hConnectionStripLength]
@@ -2259,7 +2259,7 @@ GetFishingGroup::
pop de
ret
LoadTileset::
LoadMapTileset::
push hl
push bc

View File

@@ -202,7 +202,7 @@ CheckStandingOnEntrance::
GetMapObject::
; Return the location of map object a in bc.
ld hl, wMapObjects
ld bc, OBJECT_LENGTH
ld bc, MAPOBJECT_LENGTH
call AddNTimes
ld b, h
ld c, l
@@ -358,7 +358,7 @@ CopyPlayerObjectTemplate::
ld [de], a
inc de
pop hl
ld bc, OBJECT_LENGTH - 1
ld bc, MAPOBJECT_LENGTH - 1
call CopyBytes
ret
@@ -370,7 +370,7 @@ Unreferenced_Function19b8:
push af
ld [hl], -1
inc hl
ld bc, OBJECT_LENGTH - 1
ld bc, MAPOBJECT_LENGTH - 1
xor a
call ByteFill
pop af
@@ -424,7 +424,7 @@ FindFirstEmptyObjectStruct::
push bc
push de
ld hl, wObjectStructs
ld de, OBJECT_STRUCT_LENGTH
ld de, OBJECT_LENGTH
ld c, NUM_OBJECT_STRUCTS
.loop
ld a, [hl]
@@ -594,7 +594,7 @@ UpdateSprites::
ret
GetObjectStruct::
ld bc, OBJECT_STRUCT_LENGTH
ld bc, OBJECT_LENGTH
ld hl, wObjectStructs
call AddNTimes
ld b, h

File diff suppressed because it is too large Load Diff

539
home/menu2.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -127,66 +127,3 @@ ComputePathToWalkToPlayer::
big_step UP
big_step LEFT
big_step RIGHT
SetMenuAttributes::
push hl
push bc
ld hl, w2DMenuCursorInitY
ld b, $8
.loop
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .loop
ld a, $1
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
pop bc
pop hl
ret
StaticMenuJoypad::
callfar _StaticMenuJoypad
call GetMenuJoypad
ret
ScrollingMenuJoypad::
callfar _ScrollingMenuJoypad
call GetMenuJoypad
ret
GetMenuJoypad::
push bc
push af
ldh a, [hJoyLast]
and D_PAD
ld b, a
ldh a, [hJoyPressed]
and BUTTONS
or b
ld b, a
pop af
ld a, b
pop bc
ret
PlaceHollowCursor::
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], "â–·"
ret
HideCursor::
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], " "
ret

View File

@@ -13,12 +13,12 @@ PrintBCDNumber::
; Note that bits 5 and 7 are modified during execution. The above reflects
; their meaning at the beginning of the functions's execution.
ld b, c ; save flags in b
res 7, c
res 6, c
res 5, c ; c now holds the length
bit 5, b
res PRINTNUM_LEADINGZEROS_F, c
res PRINTNUM_LEFTALIGN_F, c
res PRINTNUM_MONEY_F, c ; c now holds the length
bit PRINTNUM_MONEY_F, b
jr z, .loop
bit 7, b
bit PRINTNUM_LEADINGZEROS_F, b
jr nz, .loop ; skip currency symbol
ld [hl], "ÂĄ"
inc hl
@@ -31,14 +31,14 @@ PrintBCDNumber::
inc de
dec c
jr nz, .loop
bit 7, b ; were any non-zero digits printed?
bit PRINTNUM_LEADINGZEROS_F, b
jr z, .done ; if so, we are done
.numberEqualsZero ; if every digit of the BCD number is zero
bit 6, b ; left or right alignment?
jr nz, .skipRightAlignmentAdjustment
dec hl ; if the string is right-aligned, it needs to be moved back one space
.skipRightAlignmentAdjustment
bit 5, b
bit PRINTNUM_LEFTALIGN_F, b
jr nz, .skipLeftAlignmentAdjustment
dec hl ; if the string is left-aligned, it needs to be moved back one space
.skipLeftAlignmentAdjustment
bit PRINTNUM_MONEY_F, b
jr z, .skipCurrencySymbol
ld [hl], "ÂĄ" ; currency symbol
inc hl
@@ -54,25 +54,25 @@ PrintBCDDigit::
and a
jr z, .zeroDigit
.nonzeroDigit
bit 7, b ; have any non-space characters been printed?
bit PRINTNUM_LEADINGZEROS_F, b ; have any non-space characters been printed?
jr z, .outputDigit
; if bit 7 is set, then no numbers have been printed yet
bit 5, b ; print the currency symbol?
bit PRINTNUM_MONEY_F, b
jr z, .skipCurrencySymbol
ld [hl], "ÂĄ"
inc hl
res 5, b
res PRINTNUM_MONEY_F, b
.skipCurrencySymbol
res 7, b ; unset 7 to indicate that a nonzero digit has been reached
res PRINTNUM_LEADINGZEROS_F, b ; unset 7 to indicate that a nonzero digit has been reached
.outputDigit
add "0"
ld [hli], a
jp PrintLetterDelay
.zeroDigit
bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
bit PRINTNUM_LEADINGZEROS_F, b ; either printing leading zeroes or already reached a nonzero digit?
jr z, .outputDigit ; if so, print a zero digit
bit 6, b ; left or right alignment?
bit PRINTNUM_LEFTALIGN_F, b
ret nz
ld a, " "
ld [hli], a ; if right-aligned, "print" a space by advancing the pointer

View File

@@ -8,12 +8,12 @@ PrintLevel::
; How many digits?
ld c, 2
cp 100 ; This is distinct from MAX_LEVEL.
jr c, Print8BitNumRightAlign
jr c, Print8BitNumLeftAlign
; 3-digit numbers overwrite the :L.
dec hl
inc c
jr Print8BitNumRightAlign
jr Print8BitNumLeftAlign
PrintLevel_Force3Digits::
; Print :L and all 3 digits
@@ -21,8 +21,8 @@ PrintLevel_Force3Digits::
inc hl
ld c, 3
Print8BitNumRightAlign::
Print8BitNumLeftAlign::
ld [wDeciramBuffer], a
ld de, wDeciramBuffer
ld b, PRINTNUM_RIGHTALIGN | 1
ld b, PRINTNUM_LEFTALIGN | 1
jp PrintNum

View File

@@ -26,12 +26,10 @@ SECTION "rst28", ROM0 ; rst JumpTable
add hl, de
ld a, [hli]
ld h, [hl]
; SECTION "rst30", ROM0
ld l, a
pop de
jp hl
; SECTION "rst30", ROM0
; rst30 is midst rst28
SECTION "rst38", ROM0
rst $38

View File

@@ -478,7 +478,7 @@ Paragraph::
.linkbattle
call Text_WaitBGMap
call ButtonSound
call PromptButton
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox
@@ -499,7 +499,7 @@ _ContText::
call Text_WaitBGMap
push de
call ButtonSound
call PromptButton
pop de
ld a, [wLinkMode]
@@ -545,7 +545,7 @@ PromptText::
.ok
call Text_WaitBGMap
call ButtonSound
call PromptButton
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, DoneText
@@ -686,29 +686,29 @@ DoTextUntilTerminator::
TextCommands::
; entries correspond to TX_* constants (see macros/scripts/text.asm)
dw TextCommand_START ; TX_START
dw TextCommand_RAM ; TX_RAM
dw TextCommand_BCD ; TX_BCD
dw TextCommand_MOVE ; TX_MOVE
dw TextCommand_BOX ; TX_BOX
dw TextCommand_LOW ; TX_LOW
dw TextCommand_WAIT_BUTTON ; TX_WAIT_BUTTON
dw TextCommand_SCROLL ; TX_SCROLL
dw TextCommand_START_ASM ; TX_START_ASM
dw TextCommand_NUM ; TX_NUM
dw TextCommand_PAUSE ; TX_PAUSE
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79
dw TextCommand_DOTS ; TX_DOTS
dw TextCommand_LINK_WAIT_BUTTON ; TX_LINK_WAIT_BUTTON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_20_49
dw TextCommand_SOUND ; TX_SOUND_ITEM
dw TextCommand_SOUND ; TX_SOUND_CAUGHT_MON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_80_109
dw TextCommand_SOUND ; TX_SOUND_FANFARE
dw TextCommand_SOUND ; TX_SOUND_SLOT_MACHINE_START
dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER
dw TextCommand_DAY ; TX_DAY
dw TextCommand_FAR ; TX_FAR
dw TextCommand_START ; TX_START
dw TextCommand_RAM ; TX_RAM
dw TextCommand_BCD ; TX_BCD
dw TextCommand_MOVE ; TX_MOVE
dw TextCommand_BOX ; TX_BOX
dw TextCommand_LOW ; TX_LOW
dw TextCommand_PROMPT_BUTTON ; TX_PROMPT_BUTTON
dw TextCommand_SCROLL ; TX_SCROLL
dw TextCommand_START_ASM ; TX_START_ASM
dw TextCommand_NUM ; TX_NUM
dw TextCommand_PAUSE ; TX_PAUSE
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79
dw TextCommand_DOTS ; TX_DOTS
dw TextCommand_LINK_PROMPT_BUTTON ; TX_LINK_PROMPT_BUTTON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_20_49
dw TextCommand_SOUND ; TX_SOUND_ITEM
dw TextCommand_SOUND ; TX_SOUND_CAUGHT_MON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_80_109
dw TextCommand_SOUND ; TX_SOUND_FANFARE
dw TextCommand_SOUND ; TX_SOUND_SLOT_MACHINE_START
dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER
dw TextCommand_DAY ; TX_DAY
dw TextCommand_FAR ; TX_FAR
TextCommand_START::
; text_start
@@ -834,22 +834,22 @@ TextCommand_LOW::
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
TextCommand_WAIT_BUTTON::
; text_waitbutton
TextCommand_PROMPT_BUTTON::
; text_promptbutton
; wait for button press
; show arrow
; [06]
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jp z, TextCommand_LINK_WAIT_BUTTON
jp z, TextCommand_LINK_PROMPT_BUTTON
cp LINK_MOBILE
jp z, TextCommand_LINK_WAIT_BUTTON
jp z, TextCommand_LINK_PROMPT_BUTTON
push hl
call LoadBlinkingCursor
push bc
call ButtonSound
call PromptButton
pop bc
call UnloadBlinkingCursor
pop hl
@@ -896,7 +896,7 @@ TextCommand_NUM::
ld a, b
and $f0
swap a
set PRINTNUM_RIGHTALIGN_F, a
set PRINTNUM_LEFTALIGN_F, a
ld b, a
call PrintNum
ld b, h
@@ -1005,13 +1005,13 @@ TextCommand_DOTS::
pop hl
ret
TextCommand_LINK_WAIT_BUTTON::
; text_linkwaitbutton
TextCommand_LINK_PROMPT_BUTTON::
; text_linkpromptbutton
; wait for key down
; display arrow
push hl
push bc
call ButtonSound
call PromptButton
pop bc
pop hl
ret

View File

@@ -15,7 +15,7 @@ _CheckTrainerBattle::
; Skip the player object.
ld a, 1
ld de, wMapObjects + OBJECT_LENGTH
ld de, wMapObjects + MAPOBJECT_LENGTH
.loop
@@ -78,7 +78,7 @@ _CheckTrainerBattle::
.next
pop de
ld hl, OBJECT_LENGTH
ld hl, MAPOBJECT_LENGTH
add hl, de
ld d, h
ld e, l

View File

@@ -39,7 +39,7 @@ CloseText::
ld a, $90
ldh [hWY], a
call ReplaceKrisSprite
farcall ReturnFromMapSetupScript
farcall InitMapNameSign
farcall LoadOverworldFont
ret