1. [code]
2. Dim cannot be used to declare a new array in a function
3. I'm positive that you're not creating vertices in the correct places: your "For vir" loop creates all its vertices in the same spot!
4. Entity handles are integers - no need to use a string (room_name$)
4a. Using the same variable name for two different purposes in the same function is bad for you
5. room\name is an integer?
6. The name of your variable is "area" not "room"
6a. R.room? Is it area.room, room.room, or R.room?
7. There's more, but my fingers are tired.
P.S. I'm certain that Tomb Raider didn't dynamically generate rooms. I think what you want to do is load in prebuilt meshes and paste them in where your level's 3d tile map says they should go. A room would be a room because the meshes (3d tiles) for walls and corners would be positioned around some empty tiles. I fail to see the need for vertical stretching, but that could be accomplished with an extra variable per tile and ScaleEntity(). e.g.
Const MAX_TILE_MESH_BLUEPRINTS=4
Const MAP_WIDTH=10, MAP_DEPTH=10, MAP_HEIGHT=2
Const TILE_WIDTH=32, TILE_DEPTH=32, TILE_HEIGHT=32
Dim tile_mesh_blueprint(MAX_TILE_MESH_BLUEPRINTS-1)
Dim map_tile(MAP_WIDTH-1, MAP_DEPTH-1, MAP_HEIGHT-1)
Graphics3D 800, 600, 32, 0
camera = CreateCamera()
init_tile_mesh_blueprints()
load_map()
While Not KeyHit(1)
MoveEntity camera, 0, 0, KeyDown(200)-KeyDown(208)
TurnEntity camera, 0, KeyDown(205)-KeyDown(203), 0
RenderWorld
Flip
Wend
End
Function init_tile_mesh_blueprints()
tile_mesh_blueprint(0) = LoadMesh("void.x") : HideEntity(tile_mesh_blueprint(0))
tile_mesh_blueprint(1) = LoadMesh("floor.x") : HideEntity(tile_mesh_blueprint(1))
tile_mesh_blueprint(2) = LoadMesh("wall.x") : HideEntity(tile_mesh_blueprint(2))
tile_mesh_blueprint(3) = LoadMesh("corner.x") : HideEntity(tile_mesh_blueprint(3))
End Function
Function load_map()
For z = 0 To MAP_HEIGHT-1
For y = 0 To MAP_DEPTH-1
For x = 0 To MAP_WIDTH-1
Read tile_index, tile_rotations
tile = CopyEntity(tile_mesh_blueprint(tile_index))
PositionEntity(tile, x*TILE_WIDTH, y*TILE_DEPTH, z*TILE_HEIGHT)
TurnEntity(tile, 0, 90*tile_rotations, 0)
map_tile(x, y, z) = tile
Next
Next
Next
End Function
Function unload_map()
For z = 0 To MAP_HEIGHT-1
For y = 0 To MAP_DEPTH-1
For x = 0 To MAP_WIDTH-1
FreeEntity(map_tile(x, y, z))
Next
Next
Next
End Function
Data 3,3, 2,0, 2,0, 2,0, 2,0, 3,0, 0,0, 0,0, 0,0, 0,0
Data 2,3, 1,0, 1,0, 1,0, 1,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 1,0, 1,0, 1,0, 1,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 1,0, 1,0, 1,0, 1,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 1,0, 1,0, 1,0, 1,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 3,2, 2,2, 2,2, 2,2, 2,2, 3,1, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 3,3, 2,0, 2,0, 2,0, 2,0, 3,0, 0,0, 0,0, 0,0, 0,0
Data 2,3, 0,0, 0,0, 0,0, 0,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 0,0, 0,0, 0,0, 0,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 0,0, 0,0, 0,0, 0,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 2,3, 0,0, 0,0, 0,0, 0,0, 2,1, 0,0, 0,0, 0,0, 0,0
Data 3,2, 2,2, 2,2, 2,2, 2,2, 3,1, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0
Data 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0