mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
Freed up old script hint flag, so I can use it for automap marking instead.
This commit is contained in:
parent
b5e2bbb485
commit
1de7a61344
|
@ -617,8 +617,6 @@ class A2PackPartitions
|
|||
def x = hOff + colNum
|
||||
def tile = (row && x < width) ? row[x] : null
|
||||
def flags = 0
|
||||
if ([colNum, rowNum] in locationsWithTriggers)
|
||||
flags |= 0x40
|
||||
if (tile?.@obstruction == 'true')
|
||||
flags |= 0x80
|
||||
buf.put((byte)((tile ? tileMap[tile.@id] : 0) | flags))
|
||||
|
@ -698,9 +696,7 @@ class A2PackPartitions
|
|||
rows.eachWithIndex { row,y ->
|
||||
buf.put((byte)0xFF) // sentinel at start of row
|
||||
row.eachWithIndex { tile,x ->
|
||||
// Mark scripted locations with a flag
|
||||
def flags = ([x,y] in locationsWithTriggers) ? 0x20 : 0
|
||||
buf.put((byte)(texMap[tile?.@id] | flags))
|
||||
buf.put((byte) texMap[tile?.@id])
|
||||
}
|
||||
buf.put((byte)0xFF) // sentinel at end of row
|
||||
}
|
||||
|
@ -996,6 +992,7 @@ class A2PackPartitions
|
|||
//println "Packing 2D map #$num named '$name': num=$num."
|
||||
withContext("map '$name'") {
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
//println "2d map ${name}: ${rows[0].size()} x ${rows.size()} = ${rows[0].size() * rows.size()}"
|
||||
write2DMap(name, mapEl, rows)
|
||||
}
|
||||
}
|
||||
|
@ -1009,6 +1006,7 @@ class A2PackPartitions
|
|||
addResourceDep("map", name, "map3D", name)
|
||||
addResourceDep("map", name, "tileSet", "tileSet_special") // global tiles for clock, compass, etc.
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
//println "3d map ${name}: ${rows[0].size()} x ${rows.size()} = ${rows[0].size() * rows.size()}"
|
||||
def (scriptModule, locationsWithTriggers) = packScripts(mapEl, name, rows[0].size(), rows.size())
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
write3DMap(buf, name, rows, scriptModule, locationsWithTriggers)
|
||||
|
|
|
@ -62,10 +62,9 @@
|
|||
; (bank 1) D000.DEFF memory manager part 2
|
||||
; (bank 1) DF00.DFFF decompressor
|
||||
; (bank 2) D000.D9FF PLASMA runtime
|
||||
; (bank 2) DA00.DFFF (unused)
|
||||
; (bank 2) DA00.EBFF small-object heap
|
||||
; Note: Memory manager can't load any resources directly into LC space,
|
||||
; because ProRWTS is in aux LC and thus can't write to the main LC.
|
||||
; E000.EBFF small-object heap
|
||||
; EC00.FAFF font engine
|
||||
; FB00.FFF9 font data
|
||||
; FFFA.FFFF 6502 vectors
|
||||
|
|
|
@ -127,88 +127,6 @@ asm callProRWTS(cmdPlusOpenFlg, filename, addr, size)#1
|
|||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The following only used for speed testing
|
||||
//asm readNoSlotClock // param: dstBuf (will receive 8 BCD bytes)
|
||||
//!zone {
|
||||
// +asmPlasmRet 1
|
||||
// ; record dst ptr
|
||||
// sta tmp
|
||||
// sty tmp+1
|
||||
// ; obtain a pointer to our little table of magic values
|
||||
// lda #$60
|
||||
// sta pTmp
|
||||
//.base = *+2
|
||||
// jsr pTmp
|
||||
// tsx
|
||||
// dex
|
||||
// dex
|
||||
// txs
|
||||
// pla
|
||||
// sta pTmp
|
||||
// pla
|
||||
// sta pTmp+1
|
||||
// ldy #<(.tbl - .base)
|
||||
// ; record state of slot ROM, then turn on C3 ROM
|
||||
// sei
|
||||
// lda $CFFF
|
||||
// pha
|
||||
// sta $C300
|
||||
// lda $C304
|
||||
// ldx #8
|
||||
//.wr1:
|
||||
// lda (pTmp),y
|
||||
// sec
|
||||
// ror
|
||||
//.wr2:
|
||||
// bcs +
|
||||
// bit $C300
|
||||
// bcc ++
|
||||
//+ bit $C301
|
||||
//++ lsr
|
||||
// bne .wr2
|
||||
// iny
|
||||
// dex
|
||||
// bne .wr1
|
||||
// ldy #7
|
||||
//.rd1:
|
||||
// ldx #8
|
||||
//.rd2:
|
||||
// lda $C304
|
||||
// lsr
|
||||
// ror pTmp
|
||||
// dex
|
||||
// bne .rd2
|
||||
// lda pTmp
|
||||
// sta (tmp),y
|
||||
// dey
|
||||
// bpl .rd1
|
||||
// ; restore slot ROM state
|
||||
// pla
|
||||
// bmi +
|
||||
// sta $CFFF
|
||||
//+ cli
|
||||
// rts
|
||||
//.tbl !byte $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
|
||||
//} ; end zone
|
||||
//end
|
||||
//
|
||||
//def getTick()
|
||||
// byte timeBuf[8]
|
||||
// word tick
|
||||
// readNoSlotClock(@timeBuf)
|
||||
// tick = (timeBuf[7] & $F) + ((timeBuf[7] >> 4) * 10)
|
||||
// tick = tick + ((timeBuf[6] & $F) * 100) + ((timeBuf[6] >> 4) * 1000)
|
||||
// return tick + (((timeBuf[5] & $F) % 5) * 6000)
|
||||
//end
|
||||
//
|
||||
//def tickDiff(tStart, tEnd)
|
||||
// word diff
|
||||
// diff = tEnd - tStart
|
||||
// if diff >= 0; return diff; fin
|
||||
// return diff + 30000
|
||||
//end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _rwGame(cmd)#0
|
||||
while TRUE
|
||||
|
|
|
@ -171,6 +171,10 @@ export byte[] S_HIS = "his"
|
|||
export byte[] S_HER = "her"
|
||||
export byte[] S_THEIR = "their"
|
||||
|
||||
byte[] macro = "lddddwwwwwwwwwwwwwwaaaaawwwwwdwwwwwwwwddwwwwwwwwaw",0
|
||||
word pMacro = NULL //@macro
|
||||
word startTick = NULL
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Definitions used by assembly code
|
||||
asm _defs
|
||||
|
@ -1150,6 +1154,171 @@ asm mulRatio(num, ratio)#1
|
|||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Check for script(s) attached to the given location, and establish the array of map scripts.
|
||||
// Does not call any of them -- that's the job of scriptEvent().
|
||||
// Structure of trigger table:
|
||||
// Y (1 byte)
|
||||
// entry length (1 byte, includes Y and this length)
|
||||
// X (1 byte)
|
||||
// script ptr (2 bytes)
|
||||
// X
|
||||
// script ptr...
|
||||
// Y (or $FF for end of table)
|
||||
// ...
|
||||
asm scanScripts(x, y, triggerTbl, mapScripts)#1
|
||||
!zone {
|
||||
.pMapScripts = tmp
|
||||
.pTriggerTbl = pTmp
|
||||
.outOffset = ysav
|
||||
.limit = ysav1
|
||||
.xCoord = evalStkL+3
|
||||
.yCoord = evalStkL+2
|
||||
+asmPlasmRet 4
|
||||
sta .pMapScripts ; pointer to output mapScripts
|
||||
sty .pMapScripts+1
|
||||
lda evalStkL+1,x ; pointer to trigger tbl
|
||||
sta .pTriggerTbl
|
||||
lda evalStkH+1,x
|
||||
sta .pTriggerTbl+1
|
||||
lda #0 ; zero initial output offset
|
||||
sta .outOffset
|
||||
.ylup
|
||||
ldy #0
|
||||
lda (.pTriggerTbl),y
|
||||
cmp #$FF ; Y=$FF marks end of trigger table
|
||||
bne +
|
||||
.done
|
||||
lda .outOffset
|
||||
lsr ; divide offset by 2 to get # of output scripts
|
||||
ldy #0
|
||||
rts ; all done
|
||||
+ iny
|
||||
cmp .yCoord,x ; check for Y coordinate we want
|
||||
beq .goty
|
||||
lda (.pTriggerTbl),y ; not found, add offset to find next Y section
|
||||
clc
|
||||
adc .pTriggerTbl
|
||||
sta .pTriggerTbl
|
||||
bcc .ylup
|
||||
inc .pTriggerTbl+1
|
||||
bne .ylup ; always taken
|
||||
.goty
|
||||
lda (.pTriggerTbl),y ; get # of bytes in X table
|
||||
sta .limit
|
||||
iny
|
||||
.xlup
|
||||
lda (.pTriggerTbl),y
|
||||
iny
|
||||
cmp .xCoord,x
|
||||
bne .nextx
|
||||
tya
|
||||
pha ; save trigger table pointer
|
||||
iny
|
||||
lda (.pTriggerTbl),y ; hi byte of script
|
||||
pha
|
||||
dey
|
||||
lda (.pTriggerTbl),y ; lo byte of script
|
||||
ldy .outOffset
|
||||
sta (.pMapScripts),y
|
||||
iny
|
||||
pla
|
||||
sta (.pMapScripts),y
|
||||
iny
|
||||
sty .outOffset
|
||||
pla ; back to scanning trigger tbl
|
||||
tay
|
||||
.nextx
|
||||
iny
|
||||
iny
|
||||
cpy .limit ; stop at end of X/ptr list
|
||||
bcs .done
|
||||
bcc .xlup ; always taken
|
||||
}
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The following only used for speed testing
|
||||
asm readNoSlotClock(dstBuf)#0 // param: dstBuf (will receive 8 BCD bytes)
|
||||
!zone {
|
||||
+asmPlasmNoRet 1
|
||||
; record dst ptr
|
||||
sta tmp
|
||||
sty tmp+1
|
||||
; obtain a pointer to our little table of magic values
|
||||
lda #$60
|
||||
sta pTmp
|
||||
.base = *+2
|
||||
jsr pTmp
|
||||
tsx
|
||||
dex
|
||||
dex
|
||||
txs
|
||||
pla
|
||||
sta pTmp
|
||||
pla
|
||||
sta pTmp+1
|
||||
ldy #<(.tbl - .base)
|
||||
; record state of slot ROM, then turn on C3 ROM
|
||||
sei
|
||||
lda $CFFF
|
||||
pha
|
||||
sta $C300
|
||||
lda $C304
|
||||
ldx #8
|
||||
.wr1:
|
||||
lda (pTmp),y
|
||||
sec
|
||||
ror
|
||||
.wr2:
|
||||
bcs +
|
||||
bit $C300
|
||||
bcc ++
|
||||
+ bit $C301
|
||||
++ lsr
|
||||
bne .wr2
|
||||
iny
|
||||
dex
|
||||
bne .wr1
|
||||
ldy #7
|
||||
.rd1:
|
||||
ldx #8
|
||||
.rd2:
|
||||
lda $C304
|
||||
lsr
|
||||
ror pTmp
|
||||
dex
|
||||
bne .rd2
|
||||
lda pTmp
|
||||
sta (tmp),y
|
||||
dey
|
||||
bpl .rd1
|
||||
; restore slot ROM state
|
||||
pla
|
||||
bmi +
|
||||
sta $CFFF
|
||||
+ cli
|
||||
rts
|
||||
.tbl !byte $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
|
||||
} ; end zone
|
||||
end
|
||||
|
||||
def getTick()
|
||||
byte timeBuf[8]
|
||||
word tick
|
||||
readNoSlotClock(@timeBuf)
|
||||
tick = (timeBuf[7] & $F) + ((timeBuf[7] >> 4) * 10)
|
||||
tick = tick + ((timeBuf[6] & $F) * 100) + ((timeBuf[6] >> 4) * 1000)
|
||||
return tick + (((timeBuf[5] & $F) % 5) * 6000)
|
||||
end
|
||||
|
||||
def tickDiff(tStart, tEnd)
|
||||
word diff
|
||||
diff = tEnd - tStart
|
||||
if diff >= 0; return diff; fin
|
||||
return diff + 30000
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// General methods
|
||||
|
||||
|
@ -1335,6 +1504,22 @@ export def getUpperKey()#1
|
|||
copyWindow(0)
|
||||
fin
|
||||
|
||||
if pMacro
|
||||
pMacro++
|
||||
if ^pMacro
|
||||
if ^pMacro <> 'l'
|
||||
if !startTick; startTick = getTick(); fin
|
||||
fin
|
||||
return charToUpper(^pMacro)
|
||||
else
|
||||
pMacro = NULL
|
||||
printf3("start=%d end=%d elapsed=%d\n", startTick, getTick(), tickDiff(startTick, getTick()))
|
||||
^$C054
|
||||
^$C051
|
||||
rdkey()
|
||||
fin
|
||||
fin
|
||||
|
||||
// Now wait for a key, and animate while doing so.
|
||||
while ^kbd < 128
|
||||
*seed = *seed + 1
|
||||
|
@ -1824,38 +2009,6 @@ export def scriptEvent(event, param)#0
|
|||
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Check for script(s) attached to the given location, and establish the array of map scripts.
|
||||
// Does not call any of them -- that's the job of scriptEvent().
|
||||
def scanScripts(x, y)#0
|
||||
word p
|
||||
word script
|
||||
word pNext
|
||||
|
||||
nMapScripts = 0
|
||||
x = x - triggerOriginX
|
||||
y = y - triggerOriginY
|
||||
p = triggerTbl
|
||||
while p
|
||||
if ^p == $FF
|
||||
break
|
||||
fin
|
||||
pNext = p + p->1
|
||||
if ^p == y
|
||||
p = p + 2
|
||||
while p < pNext
|
||||
if x == ^p
|
||||
if nMapScripts == MAX_MAP_SCRIPTS; fatal("maxScpts"); fin
|
||||
mapScripts[nMapScripts] = p=>1
|
||||
nMapScripts++
|
||||
fin
|
||||
p = p + 3
|
||||
loop
|
||||
fin
|
||||
p = pNext
|
||||
loop
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export def loadMainFrameImg()#0
|
||||
if curFullscreenImg
|
||||
|
@ -2091,7 +2244,7 @@ def initMap(x, y, dir)#0
|
|||
animPauseCt = ANIM_PAUSE_MAX
|
||||
|
||||
// Populate script handlers for the current square, so that leave handlers will trigger right.
|
||||
scanScripts(x, y)
|
||||
nMapScripts = scanScripts(x-triggerOriginX, y-triggerOriginY, triggerTbl, @mapScripts)
|
||||
|
||||
// Display the party characters
|
||||
showParty()
|
||||
|
@ -2263,20 +2416,15 @@ def moveInternal(facingDir, moveDir, beepOK, shouldAdvTime)#1
|
|||
if val >= 2
|
||||
scriptEvent(@S_LEAVE, NULL)
|
||||
nMapScripts = 0
|
||||
fin
|
||||
|
||||
// If there are script(s) on the new tile, run them.
|
||||
if val == 3
|
||||
// If there are script(s) on the new tile, run them.
|
||||
getPos(@x, @y)
|
||||
scanScripts(x, y)
|
||||
nMapScripts = scanScripts(x-triggerOriginX, y-triggerOriginY, triggerTbl, @mapScripts)
|
||||
if nMapScripts
|
||||
scriptEvent(@S_ENTER, NULL)
|
||||
elsif global=>p_encounterZones
|
||||
checkEncounter(x, y, FALSE)
|
||||
fin
|
||||
elsif val >= 2 and global=>p_encounterZones
|
||||
getPos(@x, @y)
|
||||
checkEncounter(x, y, FALSE)
|
||||
fin
|
||||
return val
|
||||
end
|
||||
|
@ -2455,7 +2603,6 @@ def kbdLoop()#0
|
|||
fatal("xRegChg")
|
||||
fin
|
||||
key = getUpperKey()
|
||||
printf1("key=%d\n", key) // foo
|
||||
if key >= 0 and key < $60
|
||||
func = cmdTbl[key]
|
||||
if func
|
||||
|
@ -3189,11 +3336,12 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export def giveItemToParty(itemFuncNum, displayFunc)#0
|
||||
word p_item, p_existing, p_player
|
||||
word p_item, p_existing, p_player, iname
|
||||
p_item = createThing(MOD_GEN_ITEMS, itemFuncNum)
|
||||
iname = p_item=>s_name
|
||||
|
||||
// Check for an existing item (or stack we can add to)
|
||||
p_existing = partyHasItem(p_item=>s_name)
|
||||
p_existing = partyHasItem(iname)
|
||||
if p_existing
|
||||
if p_existing->t_type == TYPE_FANCY_ITEM and p_existing=>w_count > 0
|
||||
p_existing=>w_count = p_existing=>w_count + p_item=>w_count
|
||||
|
@ -3211,11 +3359,11 @@ export def giveItemToParty(itemFuncNum, displayFunc)#0
|
|||
if p_player
|
||||
addToList(@p_player=>p_items, p_item)
|
||||
if p_player <> global=>p_players
|
||||
displayFunc(sprintf3("%s has no room, so %s has the %s now.\n", global=>p_players=>s_name, p_player=>s_name, p_item=>s_name))#0
|
||||
displayFunc(sprintf3("%s has no room, so %s has the %s now.\n", global=>p_players=>s_name, p_player=>s_name, iname))#0
|
||||
fin
|
||||
heapCollect
|
||||
else
|
||||
displayFunc(sprintf1("\nYou have no room; %s dropped.\n", p_item=>s_name))#0
|
||||
displayFunc(sprintf1("\nYou have no room; %s dropped.\n", iname))#0
|
||||
fin
|
||||
end
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ start:
|
|||
; code is at the very end.
|
||||
|
||||
; Documentation of flags used on the map tiles:
|
||||
; $20 = script hint
|
||||
; $40 = sprite already done flag
|
||||
; $20 = sprite already done flag
|
||||
; $40 = automap mark
|
||||
; $80 = sprite flag
|
||||
|
||||
; Here are the entry points for PLASMA code. Identical API for 2D and 3D.
|
||||
|
@ -310,7 +310,7 @@ castRay: !zone
|
|||
bmi .negX
|
||||
inc mapX
|
||||
iny ; also the Y reg which indexes the map
|
||||
jmp .checkX
|
||||
bne .checkX ; always taken
|
||||
.negX: dec mapX
|
||||
dey
|
||||
.checkX:
|
||||
|
@ -322,7 +322,7 @@ castRay: !zone
|
|||
lda deltaDistX ; re-init X distance
|
||||
sta sideDistX
|
||||
lda (pMap),y ; check map at current X/Y position
|
||||
and #$DF ; mask off script flag
|
||||
and #$BF ; mask off automap mark
|
||||
beq .DDA_step ; nothing there? do another step.
|
||||
bpl .hitX
|
||||
jmp .hitSprite
|
||||
|
@ -379,7 +379,7 @@ castRay: !zone
|
|||
lda deltaDistY ; re-init Y distance
|
||||
sta sideDistY
|
||||
lda (pMap),y ; check map at current X/Y position
|
||||
and #$DF ; mask off script flag
|
||||
and #$BF ; mask off automap mark
|
||||
bmi .hitSprite
|
||||
bne .hitY ; nothing there? do another step.
|
||||
jmp .DDA_step
|
||||
|
@ -412,12 +412,12 @@ castRay: !zone
|
|||
!if DEBUG >= 2 { jsr .debugFinal }
|
||||
rts
|
||||
.hitSprite:
|
||||
cmp #$DF ; check for special mark at edges of map (was $FF but the $20 bit was masked off)
|
||||
cmp #$BF ; check for special mark at edges of map (was $FF but the $40 bit was masked off)
|
||||
beq .hitEdge
|
||||
; We found a sprite cell on the map. We only want to process this sprite once,
|
||||
; so check if we've already done it.
|
||||
tax
|
||||
and #$40
|
||||
and #$20
|
||||
beq .notDone ; already done, don't do again
|
||||
txa
|
||||
and #$1F
|
||||
|
@ -430,7 +430,7 @@ castRay: !zone
|
|||
; Haven't seen this one yet. Mark it, and also record the address of the flag
|
||||
; so we can clear it later after tracing all rays.
|
||||
lda (pMap),y ; get back the original byte
|
||||
ora #$40 ; add special flag
|
||||
ora #$20 ; add special flag
|
||||
sta (pMap),y ; and store it back
|
||||
and #$1F ; get just the texture number
|
||||
sta txNum ; and save it
|
||||
|
@ -438,7 +438,7 @@ castRay: !zone
|
|||
cpx #MAX_SPRITES ; check for table overflow
|
||||
bne +
|
||||
lda #'S'
|
||||
sta $7F7 ; quickly note it on the text screen
|
||||
sta $7F7 ; quickly note sprite overflow on the text screen
|
||||
bne .spriteDone ; and skip this sprite (always taken)
|
||||
+ tya ; Y reg indexes the map
|
||||
clc
|
||||
|
@ -1744,8 +1744,7 @@ calcMapOriginX:
|
|||
; Params: none
|
||||
; Return: 0 if blocked;
|
||||
; 1 if advanced but still within same map tile;
|
||||
; 2 if pos is on a new map tile;
|
||||
; 3 if that new tile is also scripted
|
||||
; 2 if pos is on a new map tile
|
||||
pl_advance: !zone
|
||||
lda playerDir
|
||||
asl
|
||||
|
@ -1800,13 +1799,7 @@ pl_advance: !zone
|
|||
bne +
|
||||
iny ; not a new map tile, return 1
|
||||
bne .done ; always taken
|
||||
+ ; It is a new map tile. Is script hint set?
|
||||
ldy playerX+1
|
||||
lda (pMap),y
|
||||
ldy #2 ; ret val 2 = new blk but no script
|
||||
and #$20 ; map flag $20 is the script hint
|
||||
beq .done ; if not scripted, return one
|
||||
iny ; else return 3 = new blk and a script
|
||||
+ ldy #2 ; ret val 2 = new blk
|
||||
.done tya ; retrieve ret value
|
||||
ldy #0 ; hi byte of ret is always 0
|
||||
rts ; all done
|
||||
|
@ -1864,13 +1857,13 @@ pl_swapTile: !zone
|
|||
sta tmp
|
||||
|
||||
eor tmp+1 ; grab all bits from fromTile
|
||||
and #$20 ; except script hint
|
||||
and #$40 ; except automap mark
|
||||
eor tmp+1
|
||||
sta (pTmp),y ; save toTile
|
||||
|
||||
lda tmp+1
|
||||
eor tmp ; grab all bits from toTile
|
||||
and #$20 ; except script hint
|
||||
and #$40 ; except automap mark
|
||||
eor tmp
|
||||
sta (pMap,x) ; save fromTile
|
||||
|
||||
|
@ -1952,7 +1945,7 @@ castAllRays: !zone
|
|||
lda mapSpriteH,x ; grab hi byte of ptr
|
||||
sta pMap+1
|
||||
lda (pMap),y ; get the sprite byte
|
||||
and #$BF ; mask off the already-done bit
|
||||
and #$DF ; mask off the already-done bit
|
||||
sta (pMap),y ; and save it back
|
||||
inx ; next table entry
|
||||
bne .rstLup ; always taken
|
||||
|
|
|
@ -113,7 +113,7 @@ next_zp = $AD
|
|||
JMP pl_setPos ; params: x (0-255), y (0-255); return: nothing
|
||||
JMP pl_getDir ; params: none; return: dir (0-15)
|
||||
JMP pl_setDir ; params: dir (0-15); return: nothing
|
||||
JMP pl_advance ; params: none; return: 0 if same, 1 if new map tile, 2 if new and scripted
|
||||
JMP pl_advance ; params: none; return: 0 if blocked, 1 if same, 2 if new map tile
|
||||
JMP pl_setColor ; params: slot (0=sky/1=ground), color (0-15); return: nothing
|
||||
JMP pl_render ; params: none
|
||||
JMP pl_texControl ; params: 1=load, 0=unload
|
||||
|
@ -1352,24 +1352,16 @@ pl_advance: !zone {
|
|||
PLA
|
||||
STA AVATAR_DIR
|
||||
|
||||
+ LDY #0 ; default return: didn't move
|
||||
PLA
|
||||
+ PLA
|
||||
EOR REL_Y
|
||||
STA .or+1
|
||||
PLA
|
||||
EOR REL_X
|
||||
.or ORA #11 ; self-modified above
|
||||
BEQ .ret
|
||||
LDY #2 ; moved, so return at least 2.
|
||||
LDA AVATAR_TILE
|
||||
AND #$40 ; check script flag
|
||||
BEQ .ret
|
||||
INY ; moved and also new place is scripted, return 3.
|
||||
.ret TYA
|
||||
PHA
|
||||
JSR LOAD_SCRIPTS_NO_CALC ; we might have moved to a new place; load new scripts.
|
||||
PLA
|
||||
LDY #0 ; hi byte of return always zero
|
||||
BEQ .ret ; didn't move, return 0
|
||||
JSR LOAD_SCRIPTS_NO_CALC ; we have moved to a new place; load new scripts.
|
||||
LDA #2 ; moved, so return 2.
|
||||
.ret LDY #0 ; hi byte of return always zero
|
||||
RTS
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user