Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;displays the magic menu
- battle_magic:
- call tobackbuff
- rectangle(5,4,75,61,0) \ rectangle(4,5,76,60,0)
- largeSprite(4,4,9,57,MenuImg)
- ld hl,(6*256)+6
- ld (penCol),hl
- wrappedtext(MagicMenuTitle)
- ld hl,(17*256)+16
- ld (penCol),hl
- ld a,16
- ld (_cursor),a
- ld hl,Magic_strings
- ld de,BlackMageStats+black ;thanks Runner112 no idea what some of this does
- _ ld a,(de)
- or a
- jr z,+_
- push de
- call DrawWrappedString
- pop de
- call mNewline ;my addition
- jr ++_
- _ ld c,a
- cpir
- _ inc de
- ld a,e
- cp BlackMageStats+blue+1 & $FF
- jr nz,---_
- xor a ;need cursor to be 0
- ld (_cursor),a
- battle_magic_loop:
- call battle_magic_menupick ;draw pointer
- lcdupdate
- call battle_magic_menupick ;erase pointer
- _ b_call _getCSC
- cp skAlpha
- jr z,_
- cp skUp
- jr z,battle_magic_up
- cp skDown
- jr z,battle_magic_down
- cp skClear
- jr nz,-_
- _ call frombackbuff
- jp battle_return
- mNewline:
- push af
- ld a,(penRow)
- add a,6
- cp 55
- call c,_
- call nc,++_
- pop af
- ret
- _ call Newline
- ld a,(_cursor)
- ld (penCol),a
- ret
- _ ld a,58
- ld (_cursor),a
- ld (penCol),a
- ld a,17
- ld (penRow),a
- ret
- battle_magic_up:
- ld a,(_cursor)
- or a
- jr z, battle_magic_loop
- dec a
- ld (_cursor),a
- jr battle_magic_loop
- battle_magic_down:
- ld a,(_cursor)
- cp 9
- jr z, battle_magic_loop
- inc a
- ld (_cursor),a
- jr battle_magic_loop
- battle_magic_menupick: ;need to draw the picker
- push bc ;don't want to effect
- push af ;all the registers
- push hl ;so lets push them onto the stack
- call _ ;set x and y using call so it's easier to figure out in my head what does what. I should change that later
- ld b,8 ;and height
- ld ix,menupicker ;and give it the right sprite
- call IPutSprite ;draw it now!
- pop hl ;and now we restore
- pop af ;all the registers
- pop bc ;back to normal that we need
- ret ;routine done!
- _ ld a,(_cursor)
- cp 7
- jr nc,_ ;if _cursor is >=8 go to other method
- add a,a
- ld b,a
- add a,a
- add a,b
- add a,16 ;a*6+16
- ld l,a
- ld a,6
- ret
- _ ld b,7
- _ cp 7
- jr nz,_
- ld l,16
- jr ++_
- _ ld l,22
- _ ld a,48
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement