Advertisement
Guest User

Untitled

a guest
Dec 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DebugMenu_MonPicker:
  2.     ld a, [hInMenu]
  3.     push af
  4.  
  5.     call ClearWindowData
  6.  
  7.     hlcoord 1, 3
  8.     lb bc, 10, 16
  9.     call TextBox
  10.  
  11.     ld hl, .MenuDataHeader
  12.     call LoadMenuDataHeader
  13.  
  14.     call ScrollingMenu
  15.  
  16.     pop af
  17.     ld [hInMenu], a
  18.     ld a, [wScrollingMenuCursorPosition]
  19.     inc a
  20.     ret
  21.  
  22. .MenuDataHeader:
  23.     db $40 ; flags
  24.     db 04, 02 ; start coords
  25.     db 13, 17 ; end coords
  26.     dw .MenuData2
  27.     db 1 ; default option
  28.  
  29. .MenuData2:
  30.     db %00000001 ; flags
  31.     db 5, 0 ; rows, columns
  32.     db 2 ; horizontal spacing
  33.     dba .NumItems
  34.     dba .PlaceMenuItemName
  35.  
  36. .NumItems:
  37.     db NUM_POKEMON - 1
  38.     db 0, 0, -1, 0, 0, 0, -1
  39.  
  40. .PlaceMenuItemName:
  41.     ld a, [MenuSelection]
  42.     cp -1
  43.     jr z, .PlaceMenuItemName_cancel
  44.  
  45. .PlaceMenuItemName_normal:
  46.     push de
  47.     ld a, [wScrollingMenuCursorPosition]
  48.     inc a
  49.     ld [wNamedObjectIndexBuffer], a
  50.     call GetPokemonName
  51.     pop hl
  52.     push de
  53.     ld de, wNamedObjectIndexBuffer
  54.     lb bc, PRINTNUM_LEADINGZEROS | 1, 3
  55.     call PrintNum
  56.     pop de
  57.     inc hl
  58.     call PlaceString
  59.  
  60.     ret
  61.  
  62. ; Shitty hack to circumvent the cancel option in menus
  63. .PlaceMenuItemName_cancel:
  64.     push bc
  65.     push de
  66.     call .PlaceMenuItemName_normal
  67.  
  68.     di
  69.     ld c, 4
  70. .PlaceMenuItemName_cancel_stackloop:
  71.     pop hl
  72.     push hl
  73.     push hl
  74.     add sp, 4
  75.     dec c
  76.     jr nz, .PlaceMenuItemName_cancel_stackloop
  77.     ld hl, ScrollingMenu_UpdateDisplay.loop
  78.     push hl
  79.     add sp, -2
  80.     ld hl, ReturnFarCall ; Prevent the mangling of hl on return.
  81.     push hl
  82.     add sp, -4
  83.     ei
  84.  
  85.     pop hl
  86.     ld bc, 2 * SCREEN_WIDTH
  87.     add hl, bc
  88.     pop bc
  89.     inc c
  90.  
  91.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement