SSI Eye of Beholder III / Dungeon Hack - engine

PSEUDO-3D VIEW SYSTEM

View grid 7x4
 
0
1
2
3
4
5
6
0
             
1
             
2
             
3
             

  Visible walls
  Player position

WALLS

In the resource file, the wall are organized as several bitmap, one after other.
The wall resource, contains 19 bitmap of several size.
So, there are 6 basic kind of lateral walls (1,8,13,4,5,6) and 3 kind of frontal (9,17,14.
The 19 is the backdrop.
The other bitmap (15,16,18) are transparent (maybe some kind of walls can use them???).

19

1 7 8 2 13 3 4 10 5 11 6 12

9 17 14

To create a pseudo-3D view, we scan the map, starting from the current player position, with a grid of 7x4 around him;
the player is situated in 3,3 (bottom center).
We draw in a window of 176x120 pixel, and to make simple we start from screen coord 0,0.
Starting the drawing from the top of view grid (in the 3D view the wall are drawed from the farther to close, so the last can cover the first):
(a f mean that the wall is horizontal mirrored)

View grid coord.
Wall number
X pos in 3D
Y pos in 3D
Only if this coord is a wall
0,0 4 0 28 0,0
1,0 14 16 - width[wall14] (-32) 28 1,0
1,0 5 16 28 1,0 and (2,0 is free)
2,0 14 16 28 2,0
2,0 4 16 + width[wall14] (64) 28 2,0 and (3,0 is free)
3,0 14 16 + width[wall14] (64) 28 3,0
4,0 4f 16 + (width[wall14] * 2) - width[wall4] (104) 28 4,0 and (3,0 is free)
4,0 14 16 + (width[wall14] * 2) (112) 28 4,0
5,0 5f 16 + (width[wall14] * 3) - width[wall5] (136) 28 5,0 and (4,0 is free)
5,0 14 16 + (width[wall14] * 3) (160) 28 5,0
6,0 4f 176 - width[wall4] (168) 28 6,0
1,1 6 0 28 1,1 and (2,1 is free)
2,1 17 48 - width[wall17] (-32) 20 2,1
2,1 3 48 20 2,1 and (3,1 is free)
3,1 17 48 20 3,1
4,1 3f 48 + width[wall17] - width[wall3] (112) 20 4,1 and (3,1 is free)
4,1 17 48 + width[wall17] (128) 20 4,1
5,1 6f 176 - width[wall6] (160) 28 5,1 and (4,1 is free)
2,2 9 24 - width[wall9] (-104) 8 2,2
2,2 2 24 8 2,2 and (3,2 is free)
3,2 9 24 8 3,2
4,2 2f 152 - 24 (128) 8 4,2 and (3,2 is free)
4,2 9 24 + width[wall9] (152) 8 4,2
2,3 1 0 0 2,3
4,3 1f 176 - width[wall1] (152) 0 4,3

During moving, we alternate the walls bitmap to make illusion of moving. The 19 with his horizontal mirror, the walls 1,8,13,4,5,6 swap with 7, 2, 3, 10, 11, 12.