mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-10-06 01:55:47 +00:00
Final rogue
This commit is contained in:
parent
bfa25bf2b6
commit
ac3c5164d7
1
src/samplesrc/LEVEL0#040000
Normal file
1
src/samplesrc/LEVEL0#040000
Normal file
@ -0,0 +1 @@
|
|||||||
|
## .#[-]#.......#&......&..*
# ..*...*...###T#.....####..
# ...###.....##.#...&...##..
# ....###.&....#.#.......##..
.............#.+.......##..
.............#.#.T.....##..
......&#.....&.#.:.......##..
......###....###.:.......##..
##.....#.....###.#......&##..
#&.....*...#####.##:#:#:###..
######......####.#&.........*
###.T......#####.##*....#####
#..........#####.##.....##[=]
##....&#....&###.##.....#..O.
#.....###...####.###....#$...
##&....#.....###.#&#....###%#
,##....*....####.##.>>.##*..*
.######+########.##<<<..##...
...............&.##>>>>>....&
|
@ -1 +1 @@
|
|||||||
##....&$&#####.......##..#[-]#..#...........................T.
#.....#######. .&##..*...*..#.##########......*...*......&
.....###..... .###.........#.#.......###...##.....##....#
#........ .####.........#...#####.##&...##.T...##....#
##. ..###.........#.#.#.....####....*...*......&
#### ....######+#####.#.#.##########.........<<<<<
######### ........###.#&#.#.#.#..........#####....>>>>>>
###....&##......T........##.#..#..#.#.########....##...<<<<<<<
&#.## ##############*....#.#####.#.#.#...#.&####..:...>>>>>>>
...... ############.....T#.......#.#...#T...#.##*.:....<<<<<<
###.........#####........##########.########:#.##..#...>>>>>>$
##.....................*##.....................##..#..<<<<<<..
..&###*..##..............#+##################.###*.#.>>>>>....
..#####..##......#&........#..................##...#.<<<<....#
..&##O...#.....####....*####.###################*..#.>>>>...##
...............T##*....##.....................#....#.<<<....##
#...........&..........#########.*.*.########.#O...#.>>>...O.#
####..................##.........#.#.....###..#.##.#........&#
..$.########........###..#########.####+####.##.##.#.......###
#####......##########.&.##....O$&#.#..&.##*..#.....##....##...
......*###............###..#######.#.T..##..##.....##########+
.####....##############...*#...&O#.#...*&#O.#...##.....O##&...
.&..####.....................#####.#..T..##.#...##............
###T#&.#######################.....##.....#.#...*...##....*##.
..####.........................###..##....#.#.......##*....##.
&....###########+###############.....###.&#.#..&##......##....
.#.O.#...#...&.......#&###.......###...##.#.#.T....*##....*...
...#...#...#...#...#.....####.####Z###..#.#.#.......##........
.#...#.&O#.*.#...#...#*.#Z#.#+#.......*.#.#.#&.........T....&.
..,#...#...#...#...#......#.............#O#+####...&......####
.#.&.#...#...#...#....&..##...#.........#+#.########.....####&
...#..Z#...#&..#..*...####.O..:.&.......#.:.#......O..........
.#...#...#...#.......##..#....:.........*.:.*Z................
&.......*.......######...##&..#::::::#....:.................##
####........#####.........###.............:.&.#::::::::::::::#
...##########...............#......O......:............&......
............................#.............#......Z............
............................##.............................##.
.............................########%########################
...open space............###########..:.......................
........................##............:..Z....................
....fill it in!!.......##..############.......................
.......................#..##..................................
......................##...:..................................
...##########...............#......O......:............&......
...##########...............#......O......:............&......
...##########...............#......O......:............&......
...##########...............#......O......:............&......
............................#.............#......Z............
...##########...............#......O......:............&......
............................##.............................##.
...##########...............#......O......:............&......
.............................########%########################
...##########...............#......O......:............&......
...open space............###########..:.......................
...##########...............#......O......:............&......
........................##............:..Z....................
...##########...............#......O......:............&......
....fill it in!!.......##..############.......................
...##########...............#......O......:............&......
.......................#..##..................................
...##########...............#......O......:............&......
......................##...:..................................
............................#.............#......Z............
............................#.............#......Z............
...##########...............#......O......:............&......
.......... .......Z..&#....................................
.R.......... ..&.......#....................................
........R.... ........*##....................................
............................#.............#......Z............
...open space............###########..:.......................
............................#.............#......Z............
........................##............:..Z....................
|
##....&@&#####.......##..#[-]#..#...........................T.
#.....#######. .&##..*...*..#.##########......*...*......&
.....###..... .###.........#.#.......###...##.....##....#
#........ .####.........#...#####.##&...##.T...##....#
##. ..###.........#.#.#.....####....*...*......&
#### ....######+#####.#.#.##########.........<<<<<
######### ........###.#&#.#.#.#..........#####....>>>>>>
###....&##......T........##.#..#..#.#.########....##...<<<<<<<
&#.## ##############*....#.#####.#.#.#...#.&####..:...>>>>>>>
...... ############.....T#.......#.#...#T...#.##*.:....<<<<<<
###.........#####........##########.########:#.##..#...>>>>>>$
##.....................*##.....................##..#..<<<<<<..
..&###*..##..............#+##################.###*.#.>>>>>....
..#####..##......#&........#..................##...#.<<<<....#
..&##O...#.....####....*####.###################*..#.>>>>...##
...............T##*....##.....................#....#.<<<....##
#...........&..........#########.*.*.########.#O...#.>>>...O.#
####..................##.........#.#.....###..#.##.#........&#
..$.########........###..#########.####+####.##.##.#.......###
#####......##########.&.##....O$&#.#..&.##*..#.....##....##...
......*###............###..#######.#.T..##..##.....##########+
.####....##############...*#...&O#.#...*&#O.#...##.....O##&...
.&..####.....................#####.#..T..##.#...##............
###T#&.#######################.....##.....#.#...*...##....*##.
..####.........................###..##....#.#.......##*....##.
&....###########+###############.....###.&#.#..&##......##....
.#.O.#...#...&.......#&###.......###...##.#.#.T....*##....*...
...#...#...#...#...#.....####.####Z###..#.#.#.......##........
.#...#.&O#.*.#...#...#*.#Z#.#+#.......*.#.#.#&.........T....&.
..,#...#...#...#...#......#.............#O#+####...&......####
.#.&.#...#...#...#....&..##...#.........#+#.########.....####&
...#..Z#...#&..#..*...####.O..:.&.......#.:.#......O..........
.#...#...#...#.......##..#....:.........*.:.*Z................
&.......*.......######...##&..#::::::#....:.................##
####........#####.........###.............:.&.#::::::::::::::#
#####################.......#......O......:............&......
#...................##......#.............#......Z............
........*...$$...*...#......##.............................##.
.........#......#....#.......########%########################
............................##.............................##.
...##########...............#......O......:............&......
............................##.............................##.
............................#.............#......Z............
............................##.............................##.
............................##.............................##.
............................##.............................##.
.............................########%########################
............................##.............................##.
...open space............###########..:.......................
............................##.............................##.
........................##............:..Z....................
............................##.............................##.
....fill it in!!.......##..############.......................
............................##.............................##.
.......................#..##..................................
............................##.............................##.
......................##...:..................................
.............................########%########################
.............................########%########################
...##########...............#......O......:............&......
.............................########%########################
............................#.............#......Z............
.............................########%########################
............................##.............................##.
.............................########%########################
.............................########%########################
.............................########%########################
...open space............###########..:.......................
.............................########%########################
........................##............:..Z....................
.............................########%########################
....fill it in!!.......##..############.......................
.............................########%########################
.......................#..##..................................
.............................########%########################
......................##...:..................................
...open space............###########..:.......................
...open space............###########..:.......................
...##########...............#......O......:............&......
...open space............###########..:.......................
............................#.............#......Z............
|
@ -30,9 +30,26 @@ struc t_player
|
|||||||
word oil
|
word oil
|
||||||
byte gold
|
byte gold
|
||||||
byte key
|
byte key
|
||||||
|
byte raft
|
||||||
byte[32] name[32]
|
byte[32] name[32]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
//
|
||||||
|
// ASCII Warrior
|
||||||
|
//
|
||||||
|
|
||||||
|
byte[] ascii_warrior
|
||||||
|
byte = " | "
|
||||||
|
byte = " T "
|
||||||
|
byte = " \\ () "
|
||||||
|
byte = " \\^ "
|
||||||
|
byte = " #\\_] "
|
||||||
|
byte = " # ] "
|
||||||
|
byte = " /\\ "
|
||||||
|
byte = " / \\ "
|
||||||
|
byte = " / / "
|
||||||
|
byte = " = = "
|
||||||
|
|
||||||
//
|
//
|
||||||
// Other monsters
|
// Other monsters
|
||||||
//
|
//
|
||||||
@ -87,16 +104,16 @@ byte = "|%%//%%%/|"
|
|||||||
byte = "<===|@___/"
|
byte = "<===|@___/"
|
||||||
|
|
||||||
byte[] ascii_rogue
|
byte[] ascii_rogue
|
||||||
byte = " | "
|
byte = " "
|
||||||
byte = " T "
|
byte = " \\ / "
|
||||||
byte = " \\ () "
|
byte = " < - - > "
|
||||||
byte = " \\^ "
|
byte = " ( \" ) "
|
||||||
byte = " #\\_] "
|
byte = " \\VVV/ "
|
||||||
byte = " # ] "
|
byte = " \\M/ "
|
||||||
byte = " /\\ "
|
byte = " ^^^^^^ "
|
||||||
byte = " / \\ "
|
byte = " / \\ "
|
||||||
byte = " / / "
|
byte = "( ) ^^>--="
|
||||||
byte = " = = "
|
byte = "( ) WW>--//"
|
||||||
|
|
||||||
word ascii_entity = @ascii_thief, @ascii_ogre, @ascii_zombie, @ascii_rogue
|
word ascii_entity = @ascii_thief, @ascii_ogre, @ascii_zombie, @ascii_rogue
|
||||||
//
|
//
|
||||||
@ -104,9 +121,9 @@ word ascii_entity = @ascii_thief, @ascii_ogre, @ascii_zombie, @ascii_rogue
|
|||||||
//
|
//
|
||||||
|
|
||||||
byte thief = "Thief", 5
|
byte thief = "Thief", 5
|
||||||
byte ogre = "Ogre", 15
|
byte ogre = "Ogre", 20
|
||||||
byte zombie = "Zombie", 25
|
byte zombie = "Zombie", 40
|
||||||
byte rogue = "Rogue", 50
|
byte rogue = "Rogue", 80
|
||||||
export word entity = @thief, @ogre, @zombie, @rogue
|
export word entity = @thief, @ogre, @zombie, @rogue
|
||||||
export word entities = 0
|
export word entities = 0
|
||||||
|
|
||||||
@ -153,7 +170,7 @@ export def fight(player, enemy)
|
|||||||
puts(@lifestr); puti(enemy->life)
|
puts(@lifestr); puti(enemy->life)
|
||||||
for e_atck = 0 to 9
|
for e_atck = 0 to 9
|
||||||
gotoxy(0, 10 + e_atck)
|
gotoxy(0, 10 + e_atck)
|
||||||
puts(@ascii_rogue + e_atck * 11)
|
puts(@ascii_warrior + e_atck * 11)
|
||||||
gotoxy(20, 10 + e_atck)
|
gotoxy(20, 10 + e_atck)
|
||||||
puts(ascii_entity[enemy->kind] + e_atck * 11)
|
puts(ascii_entity[enemy->kind] + e_atck * 11)
|
||||||
next
|
next
|
||||||
|
@ -19,7 +19,7 @@ import ROGUEIO
|
|||||||
end
|
end
|
||||||
|
|
||||||
const FALSE = 0
|
const FALSE = 0
|
||||||
const TRUE = not FALSE
|
const TRUE = 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Octant beam parameters
|
// Octant beam parameters
|
||||||
@ -124,6 +124,7 @@ const LOCKED_TILE = '%'
|
|||||||
const WATER1_TILE = '>'
|
const WATER1_TILE = '>'
|
||||||
const WATER2_TILE = '<'
|
const WATER2_TILE = '<'
|
||||||
const KEY_TILE = ','
|
const KEY_TILE = ','
|
||||||
|
const RAFT_TILE = '@'
|
||||||
const GOLD_TILE = '$'
|
const GOLD_TILE = '$'
|
||||||
const FOOD_TILE = '&'
|
const FOOD_TILE = '&'
|
||||||
const ENTER_TILE = '-'
|
const ENTER_TILE = '-'
|
||||||
@ -134,30 +135,7 @@ const LIT_TILE = $80
|
|||||||
const INV_TILE = $3F
|
const INV_TILE = $3F
|
||||||
const MAP_TILE = $7F
|
const MAP_TILE = $7F
|
||||||
|
|
||||||
//byte[] map
|
byte catacomb = "LEVEL0"
|
||||||
//byte = "###############################"
|
|
||||||
//byte = "### .#[-]#.......#&.....O&..*#"
|
|
||||||
//byte = "## ..*...*...###T#.....####..#"
|
|
||||||
//byte = "## ...###.T...##.#...&...##..#"
|
|
||||||
//byte = "## ....###.&....#.#.......##..#"
|
|
||||||
//byte = "# .............#.+.......##..#"
|
|
||||||
//byte = "# T.....T.......#.#.T.....##..#"
|
|
||||||
//byte = "#......&#.....&.#.:.......##..#"
|
|
||||||
//byte = "#......###....###.:.......##..#"
|
|
||||||
//byte = "###.....#.....###.#......&##..#"
|
|
||||||
//byte = "##&.....*...#####.##:#:#:###..#"
|
|
||||||
//byte = "#######......####.#&........Z*#"
|
|
||||||
//byte = "####.O......#####.##*....######"
|
|
||||||
//byte = "##..........#####.##.....##[=]#"
|
|
||||||
//byte = "###....&#....&###.##.....#..R.#"
|
|
||||||
//byte = "##.....###...####.###....#$...#"
|
|
||||||
//byte = "###&...T#.....###.#&#....###%##"
|
|
||||||
//byte = "#,##....*....####.##.>>.##*..*#"
|
|
||||||
//byte = "#.######+########.##<<<..##...#"
|
|
||||||
//byte = "#...............&.##>>>>>..Z.&#"
|
|
||||||
//byte = "###############################"
|
|
||||||
|
|
||||||
byte catacomb = "CATACOMB"
|
|
||||||
word map, viewmap
|
word map, viewmap
|
||||||
|
|
||||||
const xcentr = 20
|
const xcentr = 20
|
||||||
@ -183,10 +161,10 @@ word = @linebuffer, @linebuffer, @linebuffer, @linebuffer, @linebuffer
|
|||||||
word = @linebuffer, @linebuffer, @linebuffer, @linebuffer, @linebuffer
|
word = @linebuffer, @linebuffer, @linebuffer, @linebuffer, @linebuffer
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load map
|
// Load map - levels 0 to 9
|
||||||
//
|
//
|
||||||
|
|
||||||
export def loadmap
|
export def loadmap(level)
|
||||||
byte mapref, row, l
|
byte mapref, row, l
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -203,6 +181,10 @@ export def loadmap
|
|||||||
map = heapalloc(mapsize)
|
map = heapalloc(mapsize)
|
||||||
fin
|
fin
|
||||||
memset(map, mapsize, $2323) // Solid walls
|
memset(map, mapsize, $2323) // Solid walls
|
||||||
|
//
|
||||||
|
// Set level map and read it
|
||||||
|
//
|
||||||
|
catacomb[catacomb] = '0' + level
|
||||||
mapref = open(@catacomb, O_READ)
|
mapref = open(@catacomb, O_READ)
|
||||||
if mapref
|
if mapref
|
||||||
newline(mapref, $7F, $0D)
|
newline(mapref, $7F, $0D)
|
||||||
@ -211,7 +193,9 @@ export def loadmap
|
|||||||
^(map + (row << 6) + l) = WALL_TILE
|
^(map + (row << 6) + l) = WALL_TILE
|
||||||
next
|
next
|
||||||
close(mapref)
|
close(mapref)
|
||||||
|
return TRUE
|
||||||
fin
|
fin
|
||||||
|
return FALSE
|
||||||
end
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -262,6 +246,9 @@ export def lighttorches
|
|||||||
next
|
next
|
||||||
fin
|
fin
|
||||||
next
|
next
|
||||||
|
if not (ymap & 7)
|
||||||
|
putc('.')
|
||||||
|
fin
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -358,7 +345,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
// Update view
|
// Update view
|
||||||
//
|
//
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr-ybeam[l], xcentr+xbeam[l]] = tile & INV_TILE
|
screen.[ycentr-ybeam[l], xcentr+xbeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -430,7 +419,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr-xbeam[l], xcentr+ybeam[l]] = tile & INV_TILE
|
screen.[ycentr-xbeam[l], xcentr+ybeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -478,7 +469,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr+xbeam[l], xcentr+ybeam[l]] = tile & INV_TILE
|
screen.[ycentr+xbeam[l], xcentr+ybeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -526,7 +519,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr+ybeam[l], xcentr+xbeam[l]] = tile & INV_TILE
|
screen.[ycentr+ybeam[l], xcentr+xbeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -574,7 +569,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr+ybeam[l], xcentr-xbeam[l]] = tile & INV_TILE
|
screen.[ycentr+ybeam[l], xcentr-xbeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -622,7 +619,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr+xbeam[l], xcentr-ybeam[l]] = tile & INV_TILE
|
screen.[ycentr+xbeam[l], xcentr-ybeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -670,7 +669,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr-xbeam[l], xcentr-ybeam[l]] = tile & INV_TILE
|
screen.[ycentr-xbeam[l], xcentr-ybeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
@ -718,7 +719,9 @@ export def drawmap(xorg, yorg, viewfield, viewdir, lightdist, viewdist)
|
|||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
^(viewmap + imap) = tile | VIEWED_TILE
|
^(viewmap + imap) = tile | VIEWED_TILE
|
||||||
|
if tile <> PIT_TILE
|
||||||
screen.[ycentr-ybeam[l], xcentr-xbeam[l]] = tile & INV_TILE
|
screen.[ycentr-ybeam[l], xcentr-xbeam[l]] = tile & INV_TILE
|
||||||
|
fin
|
||||||
else
|
else
|
||||||
vispix[l] = 0
|
vispix[l] = 0
|
||||||
fin
|
fin
|
||||||
|
@ -15,6 +15,7 @@ import ROGUEMAP
|
|||||||
const mapsize = maprows*mapcols
|
const mapsize = maprows*mapcols
|
||||||
|
|
||||||
const FLOOR_TILE = '.'
|
const FLOOR_TILE = '.'
|
||||||
|
const WALL_TILE = '#'
|
||||||
const TORCH_TILE = '*'
|
const TORCH_TILE = '*'
|
||||||
const PIT_TILE = ' '
|
const PIT_TILE = ' '
|
||||||
const DOOR_TILE = '+'
|
const DOOR_TILE = '+'
|
||||||
@ -22,6 +23,7 @@ import ROGUEMAP
|
|||||||
const WATER1_TILE = '>'
|
const WATER1_TILE = '>'
|
||||||
const WATER2_TILE = '<'
|
const WATER2_TILE = '<'
|
||||||
const KEY_TILE = ','
|
const KEY_TILE = ','
|
||||||
|
const RAFT_TILE = '@'
|
||||||
const GOLD_TILE = '$'
|
const GOLD_TILE = '$'
|
||||||
const FOOD_TILE = '&'
|
const FOOD_TILE = '&'
|
||||||
const ENTER_TILE = '-'
|
const ENTER_TILE = '-'
|
||||||
@ -55,7 +57,8 @@ word xdir = 0, 1, 1, 1, 0, -1, -1, -1
|
|||||||
word ydir = -1, -1, 0, 1, 1, 1, 0, -1
|
word ydir = -1, -1, 0, 1, 1, 1, 0, -1
|
||||||
byte vplayer = '^', '\\', '>', '/', 'v', '\\', '<', '/'
|
byte vplayer = '^', '\\', '>', '/', 'v', '\\', '<', '/'
|
||||||
byte totaldarkness = 0
|
byte totaldarkness = 0
|
||||||
|
byte level = 0
|
||||||
|
word free_entities
|
||||||
//
|
//
|
||||||
// Power-ups
|
// Power-ups
|
||||||
//
|
//
|
||||||
@ -84,6 +87,7 @@ struc t_player
|
|||||||
word oil
|
word oil
|
||||||
byte gold
|
byte gold
|
||||||
byte key
|
byte key
|
||||||
|
byte raft
|
||||||
byte[16] name
|
byte[16] name
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -98,6 +102,7 @@ byte = 100 // energy
|
|||||||
word = 500 // oil
|
word = 500 // oil
|
||||||
byte = 0 // gold
|
byte = 0 // gold
|
||||||
byte = 0 // key
|
byte = 0 // key
|
||||||
|
byte = 0 // raft
|
||||||
byte[16] = "Player"
|
byte[16] = "Player"
|
||||||
|
|
||||||
predef moveplayer
|
predef moveplayer
|
||||||
@ -122,11 +127,12 @@ end
|
|||||||
|
|
||||||
const statusline = 23
|
const statusline = 23
|
||||||
|
|
||||||
byte helthstr = "Helth:"
|
byte helthstr = "Hlth:"
|
||||||
byte enrgystr = "Enrgy:"
|
byte enrgystr = "NRG:"
|
||||||
byte oilstr = "Oil:"
|
byte oilstr = "Oil:"
|
||||||
byte goldstr = "Gold:"
|
byte goldstr = "Gld:"
|
||||||
byte keystr = "Key"
|
byte keystr = "Key"
|
||||||
|
byte raftstr = "Flt"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Messages
|
// Messages
|
||||||
@ -134,11 +140,12 @@ byte keystr = "Key"
|
|||||||
|
|
||||||
word instr
|
word instr
|
||||||
byte namestr = "\nGreetings Warrior,\n what is your name"
|
byte namestr = "\nGreetings Warrior,\n what is your name"
|
||||||
byte prepstr = "\nPrepare"
|
byte prepstr = "\nPrepare."
|
||||||
byte quitstr = "Are you sure you want to quit?"
|
byte quitstr = "Are you sure you want to quit?"
|
||||||
byte youmadeitstr = "You made it out alive with $"
|
byte youmadeitstr = "You made it out alive with $"
|
||||||
byte youdiedstr = "You perished inside the catacombs :-("
|
byte youdiedstr = "You perished inside the catacombs :-("
|
||||||
byte againstr = "\n\nPlay again by typing: +rogue\n"
|
byte againstr = "\n\nPlay again by typing: +rogue\n"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Utility functions
|
// Utility functions
|
||||||
//
|
//
|
||||||
@ -171,6 +178,21 @@ def fall
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def drown
|
||||||
|
word i
|
||||||
|
|
||||||
|
tone(10,20)
|
||||||
|
tone(10,1)
|
||||||
|
for i = 0 to 1000
|
||||||
|
next
|
||||||
|
tone(10,25)
|
||||||
|
tone(10,2)
|
||||||
|
for i = 0 to 1000
|
||||||
|
next
|
||||||
|
tone(10,30)
|
||||||
|
tone(10,3)
|
||||||
|
end
|
||||||
|
|
||||||
def groan
|
def groan
|
||||||
byte i
|
byte i
|
||||||
|
|
||||||
@ -187,15 +209,19 @@ def status
|
|||||||
gotoxy(0, statusline)
|
gotoxy(0, statusline)
|
||||||
puts(@helthstr)
|
puts(@helthstr)
|
||||||
puti(player.health)
|
puti(player.health)
|
||||||
gotoxy(10, statusline)
|
gotoxy(9, statusline)
|
||||||
puts(@enrgystr)
|
puts(@enrgystr)
|
||||||
puti(player.energy)
|
puti(player.energy)
|
||||||
gotoxy(20, statusline)
|
gotoxy(17, statusline)
|
||||||
puts(@oilstr)
|
puts(@oilstr)
|
||||||
puti(player:oil/10)
|
puti(player:oil/10)
|
||||||
gotoxy(28, statusline)
|
gotoxy(25, statusline)
|
||||||
puts(@goldstr)
|
puts(@goldstr)
|
||||||
puti(player.gold)
|
puti(player.gold)
|
||||||
|
if player.raft
|
||||||
|
gotoxy(32, statusline)
|
||||||
|
puts(@raftstr)
|
||||||
|
fin
|
||||||
if player.key
|
if player.key
|
||||||
gotoxy(36, statusline)
|
gotoxy(36, statusline)
|
||||||
puts(@keystr)
|
puts(@keystr)
|
||||||
@ -211,16 +237,28 @@ end
|
|||||||
//
|
//
|
||||||
|
|
||||||
def moveplayer(dir)
|
def moveplayer(dir)
|
||||||
player.xpos = player.xpos + dir * xdir[player.angle]
|
byte xmove, ymove
|
||||||
player.ypos = player.ypos + dir * ydir[player.angle]
|
|
||||||
when getmaptile(player.xpos, player.ypos) & MAP_TILE
|
xmove = player.xpos + dir * xdir[player.angle]
|
||||||
|
ymove = player.ypos + dir * ydir[player.angle]
|
||||||
|
when getmaptile(xmove, ymove) & MAP_TILE
|
||||||
is PIT_TILE
|
is PIT_TILE
|
||||||
fall
|
fall
|
||||||
player.energy = 0
|
player.energy = 0
|
||||||
player.health = 0
|
player.health = 0
|
||||||
|
break
|
||||||
|
is WATER1_TILE
|
||||||
|
is WATER2_TILE
|
||||||
|
if not player.raft
|
||||||
|
drown
|
||||||
|
player.energy = 0
|
||||||
|
player.health = 0
|
||||||
|
break
|
||||||
|
fin
|
||||||
is FLOOR_TILE
|
is FLOOR_TILE
|
||||||
is TORCH_TILE
|
is TORCH_TILE
|
||||||
is KEY_TILE
|
is KEY_TILE
|
||||||
|
is RAFT_TILE
|
||||||
is GOLD_TILE
|
is GOLD_TILE
|
||||||
is FOOD_TILE
|
is FOOD_TILE
|
||||||
if player.energy < 10
|
if player.energy < 10
|
||||||
@ -229,10 +267,10 @@ def moveplayer(dir)
|
|||||||
if player.energy
|
if player.energy
|
||||||
player.energy = player.energy - 1
|
player.energy = player.energy - 1
|
||||||
fin
|
fin
|
||||||
|
player.xpos = xmove
|
||||||
|
player.ypos = ymove
|
||||||
break
|
break
|
||||||
otherwise
|
otherwise
|
||||||
player.xpos = player.xpos - dir * xdir[player.angle]
|
|
||||||
player.ypos = player.ypos - dir * ydir[player.angle]
|
|
||||||
ouch
|
ouch
|
||||||
wend
|
wend
|
||||||
end
|
end
|
||||||
@ -507,12 +545,18 @@ def play
|
|||||||
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
||||||
gotit
|
gotit
|
||||||
break
|
break
|
||||||
|
is RAFT_TILE
|
||||||
|
player.raft = 1
|
||||||
|
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
||||||
|
gotit
|
||||||
|
break
|
||||||
is GOLD_TILE
|
is GOLD_TILE
|
||||||
player.gold = player.gold + 1
|
player.gold = player.gold + 1
|
||||||
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
||||||
gotit
|
gotit
|
||||||
break
|
break
|
||||||
is TORCH_TILE
|
is TORCH_TILE
|
||||||
|
if player.oil < 1000
|
||||||
player:oil = player:oil + TORCH_OIL
|
player:oil = player:oil + TORCH_OIL
|
||||||
if player:oil > 1000
|
if player:oil > 1000
|
||||||
player:oil = 1000
|
player:oil = 1000
|
||||||
@ -524,8 +568,10 @@ def play
|
|||||||
next
|
next
|
||||||
next
|
next
|
||||||
gotit
|
gotit
|
||||||
|
fin
|
||||||
break
|
break
|
||||||
is FOOD_TILE
|
is FOOD_TILE
|
||||||
|
if player.health < 100 or player.energy < 100
|
||||||
player.health = player.health + MANA/2
|
player.health = player.health + MANA/2
|
||||||
if player.health > 100
|
if player.health > 100
|
||||||
player.health = 100
|
player.health = 100
|
||||||
@ -537,6 +583,7 @@ def play
|
|||||||
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
updtmaptile(player.xpos, player.ypos, FLOOR_TILE)
|
||||||
player.fov = 1
|
player.fov = 1
|
||||||
gotit
|
gotit
|
||||||
|
fin
|
||||||
break
|
break
|
||||||
wend
|
wend
|
||||||
break
|
break
|
||||||
@ -573,24 +620,25 @@ def play
|
|||||||
player:oil = 0
|
player:oil = 0
|
||||||
player.lamp = 0
|
player.lamp = 0
|
||||||
fin
|
fin
|
||||||
return TRUE
|
return player.health
|
||||||
end
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
// Main loop
|
// Main loop
|
||||||
//
|
//
|
||||||
|
|
||||||
loadmap
|
|
||||||
puts(@namestr)
|
puts(@namestr)
|
||||||
instr = gets($BA)
|
instr = gets($BA)
|
||||||
if ^instr > 15
|
if ^instr > 15
|
||||||
^instr = 15
|
^instr = 15
|
||||||
fin
|
fin
|
||||||
memcpy(@player.name, instr, ^instr + 1)
|
memcpy(@player.name, instr, ^instr + 1)
|
||||||
puts(@prepstr)
|
while loadmap(level)
|
||||||
findentities
|
puts(@prepstr)
|
||||||
lighttorches
|
free_entities = heapmark()
|
||||||
repeat
|
findentities
|
||||||
|
lighttorches
|
||||||
|
repeat
|
||||||
moveentities(player.lamp or getmaptile(player.xpos, player.ypos) & LIT_TILE))
|
moveentities(player.lamp or getmaptile(player.xpos, player.ypos) & LIT_TILE))
|
||||||
totaldarkness = drawmap(player.xpos, player.ypos, player.fov, player.angle, player.lamp, maxview)
|
totaldarkness = drawmap(player.xpos, player.ypos, player.fov, player.angle, player.lamp, maxview)
|
||||||
if not totaldarkness
|
if not totaldarkness
|
||||||
@ -599,9 +647,17 @@ repeat
|
|||||||
putc(vplayer[player.angle])
|
putc(vplayer[player.angle])
|
||||||
fin
|
fin
|
||||||
status
|
status
|
||||||
until not play or player.health == 0
|
until not play
|
||||||
clearstatus
|
heaprelease(free_entities)
|
||||||
gotoxy(0, statusline)
|
entities = 0
|
||||||
|
player.key = 0
|
||||||
|
level = level + 1
|
||||||
|
clearstatus
|
||||||
|
gotoxy(0, statusline)
|
||||||
|
if player.health == 0
|
||||||
|
break
|
||||||
|
fin
|
||||||
|
loop
|
||||||
if player.health > 0
|
if player.health > 0
|
||||||
puts(@youmadeitstr)
|
puts(@youmadeitstr)
|
||||||
puti(player.gold)
|
puti(player.gold)
|
||||||
|
@ -1758,8 +1758,10 @@ def editmode
|
|||||||
if flags & insmode
|
if flags & insmode
|
||||||
splitline
|
splitline
|
||||||
else
|
else
|
||||||
openline(cursrow + 1)
|
|
||||||
cursdown
|
cursdown
|
||||||
|
curscol = 0
|
||||||
|
cursx = 0
|
||||||
|
scrnleft = 0
|
||||||
redraw
|
redraw
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
|
@ -774,11 +774,11 @@ def allocalignheap(size, pow2, freeaddr)
|
|||||||
return addr
|
return addr
|
||||||
end
|
end
|
||||||
def markheap
|
def markheap
|
||||||
return heap//
|
return heap
|
||||||
end
|
end
|
||||||
def releaseheap(newheap)
|
def releaseheap(newheap)
|
||||||
heap = newheap//
|
heap = newheap
|
||||||
return @newheap - heap//
|
return @newheap - heap
|
||||||
end
|
end
|
||||||
def allocxheap(size)
|
def allocxheap(size)
|
||||||
word xaddr
|
word xaddr
|
||||||
|
Loading…
Reference in New Issue
Block a user