From ac6faf4e96b6badcf1f6e94d7563e63e6441c69a Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sat, 27 Dec 2014 20:33:36 -0800 Subject: [PATCH] Loadable map --- src/samplesrc/rogue.io.pla | 22 +++++++++++++++++++++- src/samplesrc/rogue.map.pla | 25 +++++++++++++------------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/samplesrc/rogue.io.pla b/src/samplesrc/rogue.io.pla index 4f566a1..e9daf80 100644 --- a/src/samplesrc/rogue.io.pla +++ b/src/samplesrc/rogue.io.pla @@ -30,7 +30,7 @@ word titlestr = @initstr // export word rnd, getkb, home, gotoxy, tone -export word open, read, close +export word open, read, close, newline byte noapple1 = "APPLE 1 NOT SUPPORTED." @@ -117,6 +117,15 @@ def a2read(refnum, buff, len) syscall($CA, @params) return params:6 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 @@ -151,6 +160,15 @@ def a3read(refnum, buff, len) syscall($CA, @params) return params:6 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 @@ -237,6 +255,7 @@ when MACHID & $C8 open = @a3open read = @a3read close = @a3close + newline = @a3newline break otherwise // Apple ][ rnd = @a2rnd @@ -247,6 +266,7 @@ when MACHID & $C8 open = @a2open read = @a2read close = @a2close + newline = @a2newline wend // diff --git a/src/samplesrc/rogue.map.pla b/src/samplesrc/rogue.map.pla index bdcaf75..9a6fd95 100644 --- a/src/samplesrc/rogue.map.pla +++ b/src/samplesrc/rogue.map.pla @@ -15,7 +15,7 @@ import ROGUEIO const O_READ_WRITE = 3 predef puti, toupper - word rnd, getkb, home, gotoxy, tone, open, read, close + word rnd, getkb, home, gotoxy, tone, open, read, close, newline end const FALSE = 0 @@ -201,11 +201,12 @@ export def loadmap if not map map = heapalloc(mapsize) fin - memset(viewmap, mapsize, $A3A3) // Solid walls + memset(map, mapsize, $2323) // Solid walls mapref = open(@catacomb, O_READ) if mapref + newline(mapref, $7F, $0D) for row = 1 to maprows - 2 - read(mapref, map + (row << 6) + 1, mapcols - 2) + read(mapref, map + (row << 6) + 1, mapcols) next close(mapref) fin @@ -216,7 +217,7 @@ end // export def getmaptile(xmap, ymap) - return map + (ymap << rowshift) + xmap + return ^(map + (ymap << rowshift) + xmap) end 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 // - adjtile = map[imap + 1] & INV_TILE + adjtile = ^(map + imap + 1) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap + 1) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap - mapcols] & INV_TILE + adjtile = ^(map + imap - mapcols) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap + mapcols] & INV_TILE + adjtile = ^(map + imap + mapcols) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap + 1] & INV_TILE + adjtile = ^(map + imap + 1) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap + 1) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap - 1] & INV_TILE + adjtile = ^(map + imap - 1) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap - 1) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap + mapcols] & INV_TILE + adjtile = ^(map + imap + mapcols) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap + mapcols) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap - mapcols] & INV_TILE + adjtile = ^(map + imap - mapcols) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap - mapcols) = adjtile | VIEWED_TILE 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 else vispix[l] = 1 - adjtile = map[imap - 1] & INV_TILE + adjtile = ^(map + imap - 1) & INV_TILE if adjtile & OPAQUE_TILE ^(viewmap + imap - 1) = adjtile | VIEWED_TILE screen.[ycentr-ybeam[l], xcentr-xbeam[l]-1] = adjtile