Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;//Allocations to userMem are made right before the final definition, to
- ;//maximize space for executable code. See main.z80
- ;//Macros used to construct hotspot data
- ;//Example constructs:
- ;// hs_point(0,0) , hs_warp(3,4,Base_B1)
- ;// hs_square(20,12,4) , hs_dialog(entryAreaDialog1)
- ;//First half: detection positioning. Limit 64x64 detection.
- ;//Format: .db %vvxxxxxx,%nnyyyyyy : where x,y is obvious.
- ;//vv = var1: 0=point 1=horiz 2=vert 3=square
- ;//nn = dim if not point: 0=EntireArea 1=two 2=three 3=four
- ;//x,y point
- ;//Second half format: Depends on first byte to ID:
- ;// %0mmmmmmm,x,y : Warp point, m=NewMapID x,y=NewXYPos
- ;// %10------,e,t : Treasure box, t=TreasureID e=MonsterEncounterID
- ;// %110-----,adr : Scripted tile. adr=scriptAddress.
- ;//
- ;//
- ;//Implementation notes: If warp points need vehicle exclusivity, can use
- ;// unused bits of x or y destination.
- ;//
- ;//helper macros
- .define hs_2_6_split(a,b) (((b&%11000000)>>6)|(a&%00111111))
- .deflong hs_tst127(a)
- .if (a>127)||(a<0)
- .fail "Data defined out of bounds (0-63)"
- .endif
- .enddeflong
- .deflong hs_tst63(a)
- .if (a>63)||(a<0)
- .fail "Data defined out of bounds (0-63)"
- .endif
- .enddeflong
- .deflong hs_tst3(a)
- .if (a>3)||(a<0)
- .fail "Data defined out of bounds (0-3)"
- .endif
- .enddeflong
- .deflong hs_tstdim(a)
- .if (a<2)||(a>4)
- .fail "Data defined out of bounds (2-4)"
- .endif
- .enddeflong
- ;//Variables for init
- TREASURE_TRACKER = 0
- ;//--------------------------------------------------------------------------
- ;//--------------------------------------------------------------------------
- ;// 1ST HALF MACROS: TRIGGER LOCATIONS
- ;//point defined by x,y
- .deflong hs_point(x,y)
- hs_tst63((x|y))
- .db hs_2_6_split(x,0),hs_2_6_split(y,0)
- .enddeflong
- ;//full horizontal line defined by ypos
- .deflong hs_horiz(y)
- hs_tst63(y)
- .db hs_2_6_split(0,1),hs_2_6_split(y,0)
- .enddeflong
- ;//horizontal line starting at x,y and is 2-4 long (moving rightward)
- .deflong hs_hline(x,y,len)
- hs_tst63((x|y))
- hs_tstdim(len)
- .db hs_2_6_split(x,1),hs_2_6_split(y,(len-1))
- .enddeflong
- ;//full vertical line defined by xpos
- .deflong hs_vert(x)
- hs_tst63(x)
- .db hs_2_6_split(x,2),hs_2_6_split(0,0)
- .enddeflong
- ;//vertical line starting at x,y and is 2-4 long (moving downward)
- .deflong hs_vline(x,y,len)
- hs_tst63((x|y))
- hs_tstdim(len)
- .db hs_2_6_split(x,2),hs_2_6_split(y,(len-1))
- .enddeflong
- ;//square area with upper left corner at x,y and is 2-4 squares long and wide
- .deflong hs_square(x,y,len)
- hs_tst63((x|y))
- hs_tstdim(len)
- .db hs_2_6_split(x,3),hs_2_6_split(y,(len-1))
- .enddeflong
- ;//--------------------------------------------------------------------------
- ;//--------------------------------------------------------------------------
- ;// 2ST HALF MACROS: ACTION OR FURTHER COMPARISONS
- ;//Warp points. Defines destination map and location
- .deflong hs_warp(x,y,mID)
- hs_tst127(mID)
- hs_tst63((x|y))
- .db (%01111111&mID),hs_2_6_split(x,0),hs_2_6_split(y,0)
- .enddeflong
- ;//Treasure chest definition for monster-in-a-box
- .deflong hs_treasure(encounterID,treasureID)
- t_ext = 0
- .db %10000000|(t_ext&%00111111),encounterID,treasureID
- .enddeflong
- ;//Treasure chest definition for just treasure. EncounterID internally is zero
- .deflong hs_treasure(treasureID)
- hs_treasure(0,treasureID)
- .enddeflong
- .deflong hs_scripted(scriptadr)
- t_ext = 0
- .db %11000000|(t_ext&%00011111) \.dw scriptadr
- .enddeflong
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement