Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1.  
  2. ;//Allocations to userMem are made right before the final definition, to
  3. ;//maximize space for executable code. See main.z80
  4.  
  5. ;//Macros used to construct hotspot data
  6. ;//Example constructs:
  7. ;// hs_point(0,0) , hs_warp(3,4,Base_B1)
  8. ;// hs_square(20,12,4) , hs_dialog(entryAreaDialog1)
  9.  
  10. ;//First half: detection positioning. Limit 64x64 detection.
  11. ;//Format: .db %vvxxxxxx,%nnyyyyyy : where x,y is obvious.
  12. ;//vv = var1: 0=point 1=horiz 2=vert 3=square
  13. ;//nn = dim if not point: 0=EntireArea 1=two 2=three 3=four
  14. ;//x,y point
  15.  
  16. ;//Second half format: Depends on first byte to ID:
  17. ;// %0mmmmmmm,x,y : Warp point, m=NewMapID x,y=NewXYPos
  18. ;// %10------,e,t : Treasure box, t=TreasureID e=MonsterEncounterID
  19. ;// %110-----,adr : Scripted tile. adr=scriptAddress.
  20. ;//
  21. ;//
  22. ;//Implementation notes: If warp points need vehicle exclusivity, can use
  23. ;// unused bits of x or y destination.
  24. ;//
  25.  
  26. ;//helper macros
  27. .define hs_2_6_split(a,b) (((b&%11000000)>>6)|(a&%00111111))
  28. .deflong hs_tst127(a)
  29. .if (a>127)||(a<0)
  30. .fail "Data defined out of bounds (0-63)"
  31. .endif
  32. .enddeflong
  33. .deflong hs_tst63(a)
  34. .if (a>63)||(a<0)
  35. .fail "Data defined out of bounds (0-63)"
  36. .endif
  37. .enddeflong
  38. .deflong hs_tst3(a)
  39. .if (a>3)||(a<0)
  40. .fail "Data defined out of bounds (0-3)"
  41. .endif
  42. .enddeflong
  43. .deflong hs_tstdim(a)
  44. .if (a<2)||(a>4)
  45. .fail "Data defined out of bounds (2-4)"
  46. .endif
  47. .enddeflong
  48. ;//Variables for init
  49. TREASURE_TRACKER = 0
  50.  
  51. ;//--------------------------------------------------------------------------
  52. ;//--------------------------------------------------------------------------
  53. ;// 1ST HALF MACROS: TRIGGER LOCATIONS
  54.  
  55. ;//point defined by x,y
  56. .deflong hs_point(x,y)
  57. hs_tst63((x|y))
  58. .db hs_2_6_split(x,0),hs_2_6_split(y,0)
  59. .enddeflong
  60.  
  61. ;//full horizontal line defined by ypos
  62. .deflong hs_horiz(y)
  63. hs_tst63(y)
  64. .db hs_2_6_split(0,1),hs_2_6_split(y,0)
  65. .enddeflong
  66.  
  67. ;//horizontal line starting at x,y and is 2-4 long (moving rightward)
  68. .deflong hs_hline(x,y,len)
  69. hs_tst63((x|y))
  70. hs_tstdim(len)
  71. .db hs_2_6_split(x,1),hs_2_6_split(y,(len-1))
  72. .enddeflong
  73.  
  74. ;//full vertical line defined by xpos
  75. .deflong hs_vert(x)
  76. hs_tst63(x)
  77. .db hs_2_6_split(x,2),hs_2_6_split(0,0)
  78. .enddeflong
  79.  
  80. ;//vertical line starting at x,y and is 2-4 long (moving downward)
  81. .deflong hs_vline(x,y,len)
  82. hs_tst63((x|y))
  83. hs_tstdim(len)
  84. .db hs_2_6_split(x,2),hs_2_6_split(y,(len-1))
  85. .enddeflong
  86.  
  87. ;//square area with upper left corner at x,y and is 2-4 squares long and wide
  88. .deflong hs_square(x,y,len)
  89. hs_tst63((x|y))
  90. hs_tstdim(len)
  91. .db hs_2_6_split(x,3),hs_2_6_split(y,(len-1))
  92. .enddeflong
  93.  
  94. ;//--------------------------------------------------------------------------
  95. ;//--------------------------------------------------------------------------
  96. ;// 2ST HALF MACROS: ACTION OR FURTHER COMPARISONS
  97.  
  98. ;//Warp points. Defines destination map and location
  99. .deflong hs_warp(x,y,mID)
  100. hs_tst127(mID)
  101. hs_tst63((x|y))
  102. .db (%01111111&mID),hs_2_6_split(x,0),hs_2_6_split(y,0)
  103. .enddeflong
  104.  
  105. ;//Treasure chest definition for monster-in-a-box
  106. .deflong hs_treasure(encounterID,treasureID)
  107. t_ext = 0
  108. .db %10000000|(t_ext&%00111111),encounterID,treasureID
  109. .enddeflong
  110. ;//Treasure chest definition for just treasure. EncounterID internally is zero
  111. .deflong hs_treasure(treasureID)
  112. hs_treasure(0,treasureID)
  113. .enddeflong
  114.  
  115. .deflong hs_scripted(scriptadr)
  116. t_ext = 0
  117. .db %11000000|(t_ext&%00011111) \.dw scriptadr
  118. .enddeflong
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement