mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-10-06 01:55:47 +00:00
Loadable map
This commit is contained in:
parent
963046d4f6
commit
ac6faf4e96
@ -30,7 +30,7 @@ word titlestr = @initstr
|
|||||||
//
|
//
|
||||||
|
|
||||||
export word rnd, getkb, home, gotoxy, tone
|
export word rnd, getkb, home, gotoxy, tone
|
||||||
export word open, read, close
|
export word open, read, close, newline
|
||||||
|
|
||||||
byte noapple1 = "APPLE 1 NOT SUPPORTED."
|
byte noapple1 = "APPLE 1 NOT SUPPORTED."
|
||||||
|
|
||||||
@ -117,6 +117,15 @@ def a2read(refnum, buff, len)
|
|||||||
syscall($CA, @params)
|
syscall($CA, @params)
|
||||||
return params:6
|
return params:6
|
||||||
end
|
end
|
||||||
|
def a2newline(refnum, emask, nlchar)
|
||||||
|
byte params[4]
|
||||||
|
|
||||||
|
params.0 = 3
|
||||||
|
params.1 = refnum
|
||||||
|
params.2 = emask
|
||||||
|
params.3 = nlchar
|
||||||
|
return syscall($C9, @params)
|
||||||
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
// SOS file routines
|
// SOS file routines
|
||||||
@ -151,6 +160,15 @@ def a3read(refnum, buff, len)
|
|||||||
syscall($CA, @params)
|
syscall($CA, @params)
|
||||||
return params:6
|
return params:6
|
||||||
end
|
end
|
||||||
|
def a3newline(refnum, emask, nlchar)
|
||||||
|
byte params[4]
|
||||||
|
|
||||||
|
params.0 = 3
|
||||||
|
params.1 = refnum
|
||||||
|
params.2 = emask
|
||||||
|
params.3 = nlchar
|
||||||
|
return syscall($C9, @params)
|
||||||
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
// Apple /// console routines
|
// Apple /// console routines
|
||||||
@ -237,6 +255,7 @@ when MACHID & $C8
|
|||||||
open = @a3open
|
open = @a3open
|
||||||
read = @a3read
|
read = @a3read
|
||||||
close = @a3close
|
close = @a3close
|
||||||
|
newline = @a3newline
|
||||||
break
|
break
|
||||||
otherwise // Apple ][
|
otherwise // Apple ][
|
||||||
rnd = @a2rnd
|
rnd = @a2rnd
|
||||||
@ -247,6 +266,7 @@ when MACHID & $C8
|
|||||||
open = @a2open
|
open = @a2open
|
||||||
read = @a2read
|
read = @a2read
|
||||||
close = @a2close
|
close = @a2close
|
||||||
|
newline = @a2newline
|
||||||
wend
|
wend
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -15,7 +15,7 @@ import ROGUEIO
|
|||||||
const O_READ_WRITE = 3
|
const O_READ_WRITE = 3
|
||||||
|
|
||||||
predef puti, toupper
|
predef puti, toupper
|
||||||
word rnd, getkb, home, gotoxy, tone, open, read, close
|
word rnd, getkb, home, gotoxy, tone, open, read, close, newline
|
||||||
end
|
end
|
||||||
|
|
||||||
const FALSE = 0
|
const FALSE = 0
|
||||||
@ -201,11 +201,12 @@ export def loadmap
|
|||||||
if not map
|
if not map
|
||||||
map = heapalloc(mapsize)
|
map = heapalloc(mapsize)
|
||||||
fin
|
fin
|
||||||
memset(viewmap, mapsize, $A3A3) // Solid walls
|
memset(map, mapsize, $2323) // Solid walls
|
||||||
mapref = open(@catacomb, O_READ)
|
mapref = open(@catacomb, O_READ)
|
||||||
if mapref
|
if mapref
|
||||||
|
newline(mapref, $7F, $0D)
|
||||||
for row = 1 to maprows - 2
|
for row = 1 to maprows - 2
|
||||||
read(mapref, map + (row << 6) + 1, mapcols - 2)
|
read(mapref, map + (row << 6) + 1, mapcols)
|
||||||
next
|
next
|
||||||
close(mapref)
|
close(mapref)
|
||||||
fin
|
fin
|
||||||
@ -216,7 +217,7 @@ end
|
|||||||
//
|
//
|
||||||
|
|
||||||
export def getmaptile(xmap, ymap)
|
export def getmaptile(xmap, ymap)
|
||||||
return map + (ymap << rowshift) + xmap
|
return ^(map + (ymap << rowshift) + xmap)
|
||||||
end
|
end
|
||||||
|
|
||||||
export def setmaptile(xmap, ymap, tile)
|
export def setmaptile(xmap, ymap, tile)
|
||||||
@ -345,7 +346,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
//
|
//
|
||||||
// Check adjacent tile for opaqueness - improves wall display
|
// Check adjacent tile for opaqueness - improves wall display
|
||||||
//
|
//
|
||||||
adjtile = map[imap + 1] & INV_TILE
|
adjtile = ^(map + imap + 1) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap + 1) = adjtile | VIEWED_TILE
|
^(viewmap + imap + 1) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr-ybeam[l], xcentr+xbeam[l]+1] = adjtile
|
screen.[ycentr-ybeam[l], xcentr+xbeam[l]+1] = adjtile
|
||||||
@ -420,7 +421,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap - mapcols] & INV_TILE
|
adjtile = ^(map + imap - mapcols) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE
|
^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr-xbeam[l]-1, xcentr+ybeam[l]] = adjtile
|
screen.[ycentr-xbeam[l]-1, xcentr+ybeam[l]] = adjtile
|
||||||
@ -468,7 +469,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap + mapcols] & INV_TILE
|
adjtile = ^(map + imap + mapcols) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE
|
^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr+xbeam[l]+1, xcentr+ybeam[l]] = adjtile
|
screen.[ycentr+xbeam[l]+1, xcentr+ybeam[l]] = adjtile
|
||||||
@ -516,7 +517,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap + 1] & INV_TILE
|
adjtile = ^(map + imap + 1) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap + 1) = adjtile | VIEWED_TILE
|
^(viewmap + imap + 1) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr+ybeam[l], xcentr+xbeam[l]+1] = adjtile
|
screen.[ycentr+ybeam[l], xcentr+xbeam[l]+1] = adjtile
|
||||||
@ -564,7 +565,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap - 1] & INV_TILE
|
adjtile = ^(map + imap - 1) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap - 1) = adjtile | VIEWED_TILE
|
^(viewmap + imap - 1) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr+ybeam[l], xcentr-xbeam[l]-1] = adjtile
|
screen.[ycentr+ybeam[l], xcentr-xbeam[l]-1] = adjtile
|
||||||
@ -612,7 +613,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap + mapcols] & INV_TILE
|
adjtile = ^(map + imap + mapcols) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE
|
^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr+xbeam[l]+1, xcentr-ybeam[l]] = adjtile
|
screen.[ycentr+xbeam[l]+1, xcentr-ybeam[l]] = adjtile
|
||||||
@ -660,7 +661,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap - mapcols] & INV_TILE
|
adjtile = ^(map + imap - mapcols) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE
|
^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr-xbeam[l]-1, xcentr-ybeam[l]] = adjtile
|
screen.[ycentr-xbeam[l]-1, xcentr-ybeam[l]] = adjtile
|
||||||
@ -708,7 +709,7 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
else
|
else
|
||||||
vispix[l] = 1
|
vispix[l] = 1
|
||||||
adjtile = map[imap - 1] & INV_TILE
|
adjtile = ^(map + imap - 1) & INV_TILE
|
||||||
if adjtile & OPAQUE_TILE
|
if adjtile & OPAQUE_TILE
|
||||||
^(viewmap + imap - 1) = adjtile | VIEWED_TILE
|
^(viewmap + imap - 1) = adjtile | VIEWED_TILE
|
||||||
screen.[ycentr-ybeam[l], xcentr-xbeam[l]-1] = adjtile
|
screen.[ycentr-ybeam[l], xcentr-xbeam[l]-1] = adjtile
|
||||||
|
Loading…
Reference in New Issue
Block a user