Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TustinsPC: ; Tustin's PC. Where the TPP minigame located.
- db $8
- ld a, [wd78e]
- bit 0, a
- ld hl, TustinsPCNotAvailable
- jr z, .nopc
- jr .pcready
- .nopc
- call PrintText
- jp TextScriptEnd
- .pcready
- ld hl, TustinsPCOn
- call PrintText
- call YesNoChoice
- ld hl, TustinsPCNo
- ld a, [wCurrentMenuItem]
- and a
- jp nz, .nopc
- ; Start the TPP minigame
- ld a, 2
- ld [wcd50], a
- predef EmotionBubble
- call LoadFontTilePatterns
- ld hl, TustinsPCYes
- call PrintText
- ; Clear counters
- ; Counter structure: 0 | A | B | S | R | L | U | D
- ; The first byte is always set to 0 to prevent cinnabar shore abuse
- xor a
- ld hl, W_GRASSRATE
- ld bc, 8
- call FillMemory
- .inputloop
- ld a, [hJoyInput]
- ld c, a
- cp b
- jr z, .inputloop ; No new button detected
- jr c, .updatelastbtn ; a < b. Means that some buttons are released
- ; There's a new button!
- sub b ; Get a newly pressed button
- ld hl, W_GRASSMONS
- bit 0, a
- jr z, .noA
- call IncIfLessThan250
- .noA
- inc hl
- bit 1, a
- jr z, .noB
- call IncIfLessThan250
- .noB
- inc hl
- bit 3, a
- jr z, .nostart
- call IncIfLessThan250
- .nostart
- inc hl
- bit 4, a
- jr z, .noR
- call IncIfLessThan250
- .noR
- inc hl
- bit 5, a
- jr z, .noL
- call IncIfLessThan250
- .noL
- inc hl
- bit 6, a
- jr z, .noU
- call IncIfLessThan250
- .noU
- inc hl
- bit 7, a
- jr z, .noD
- call IncIfLessThan250
- .noD
- bit 2, a
- jr nz, .stop
- .updatelastbtn
- ld b, c
- jr .inputloop
- .stop
- ld hl, TustinsPCStop
- call PrintText
- ld bc, W_GRASSRATE
- ld hl, TustinsPC251A
- call Compare251bci
- jr z, .lotA
- ld hl, TustinsPCPressedA
- .lotA
- call PrintText
- ld hl, TustinsPC251B
- call Compare251bci
- jr z, .lotB
- ld hl, TustinsPCPressedB
- .lotB
- call PrintText
- ld hl, TustinsPC251S
- call Compare251bci
- jr z, .lotS
- ld hl, TustinsPCPressedS
- .lotS
- call PrintText
- ld hl, TustinsPC251R
- call Compare251bci
- jr z, .lotR
- ld hl, TustinsPCPressedR
- .lotR
- call PrintText
- ld hl, TustinsPC251L
- call Compare251bci
- jr z, .lotL
- ld hl, TustinsPCPressedL
- .lotL
- call PrintText
- ld hl, TustinsPC251U
- call Compare251bci
- jr z, .lotU
- ld hl, TustinsPCPressedU
- .lotU
- call PrintText
- ld hl, TustinsPC251D
- call Compare251bci
- jr z, .end
- ld hl, TustinsPCPressedD
- .end
- call PrintText
- jp TextScriptEnd
- IncIfLessThan250: ; Don't increment if the stored value is greater than 250, else do it.
- push af
- ld a, [hl]
- cp 251
- jr z, .skip
- inc [hl]
- .skip
- pop af
- ret
- Compare251bci:
- inc bc
- ld a, [bc]
- cp 251
- ret
- TustinsPCPressedA:
- TX_FAR _TustinsPCPressedA
- db "@"
- TustinsPCPressedB:
- TX_FAR _TustinsPCPressedB
- db "@"
- TustinsPCPressedS:
- TX_FAR _TustinsPCPressedS
- db "@"
- TustinsPCPressedR:
- TX_FAR _TustinsPCPressedR
- db "@"
- TustinsPCPressedL:
- TX_FAR _TustinsPCPressedL
- db "@"
- TustinsPCPressedU:
- TX_FAR _TustinsPCPressedU
- db "@"
- TustinsPCPressedD:
- TX_FAR _TustinsPCPressedD
- db "@"
- TustinsPC251A:
- TX_FAR _TustinsPC251A
- db "@"
- TustinsPC251B:
- TX_FAR _TustinsPC251B
- db "@"
- TustinsPC251S:
- TX_FAR _TustinsPC251S
- db "@"
- TustinsPC251R:
- TX_FAR _TustinsPC251R
- db "@"
- TustinsPC251L:
- TX_FAR _TustinsPC251L
- db "@"
- TustinsPC251U:
- TX_FAR _TustinsPC251U
- db "@"
- TustinsPC251D:
- TX_FAR _TustinsPC251D
- db "@"
- TustinsPCNotAvailable:
- TX_FAR _TustinsPCNotAvailable
- db "@"
- TustinsPCOn:
- TX_FAR _TustinsPCOn
- db "@"
- TustinsPCYes:
- TX_FAR _TustinsPCYes
- db "@"
- TustinsPCNo:
- TX_FAR _TustinsPCNo
- db "@"
- TustinsPCStop:
- TX_FAR _TustinsPCStop
- db "@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement