We reverted back to our old dungeon system as we didt gain almost anything by making the dungeon to a single object or chuncks.
My old culling system whas simply just as fast and alot simplier to add things to.
So i share my mess i used for the experiment.
Its not optimal but someone else could use it for something?
The weird part is that during the dungeon Creation so whas i forced to reverse the Reading of the map Array?
this reads the subimage file if an subimage exist.
And grabbs u and v for that file.
Function SK_SUBIMAGE__Exists_( Parent_Image , Path$ , File$ )
filelen=len(File$)
tp$=GetImageFilename( Parent_Image )
nameLen=len(tp$)-4 // remove .png
tp$=right(tp$,nameLen)
lr = len(Path$)
nameLen=len(tp$)-lr // remove folder
tp$=left(tp$,nameLen)
tp$=tp$+" subimages.txt"
Full_Path$=Path$+tp$
if getfileexists(Full_Path$)=0 then exitfunction itsHere
OpenToRead ( 1 , Full_Path$ )
while DoThis<200
temp$=readline(1)
result$=temp$
ste=len(temp$)
temp$=left(temp$,filelen)
if temp$ = File$
first=0
for st=1 to ste
if mid(result$,st,1)=":"
inc first
if first=1
Sub_U$=mid(result$,st+1,3)
if mid(Sub_U$,2,1)=":" then Sub_U$=mid(Sub_U$,1,1)
if mid(Sub_U$,3,1)=":" then Sub_U$=mid(Sub_U$,1,2)
elseif first=2
Sub_V$=mid(result$,st+1,3)
if mid(Sub_V$,2,1)=":" then Sub_V$=mid(Sub_V$,1,1)
if mid(Sub_V$,3,1)=":" then Sub_V$=mid(Sub_V$,1,2)
endif
endif
if first=2 then exit
next st
itsHere=1
exit
endif
inc DoThis
endwhile
CloseFile ( 1 )
Endfunction itsHere
The whole experimental file i whas testing on and remember its beta work with alot of mess and not optimal.
REM If we use map chunks so do we nead this array to flag when they meet to not have double vertexes
REM // wallSides[20,20,4,3] 4 stands for the four sides while 3 is default,cellar and attic
Function create_Dungeon()
global dim wallSides[20,20,4,3]
Global DungeonFirst,DungeonLast
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,1,1,5,5)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(20*64)-64,0,(20*64)-64)
SetObjectShader(Object,Shader_Fog)
DungeonFirst=Object
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,1,6,5,10)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(15*64)-64,0,(20*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,1,11,5,15)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(10*64)-64,0,(20*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,1,16,5,20)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(5*64)-64,0,(20*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
REM ////////////////////////
Global DungeonE,DungeonF,DungeonG,DungeonH
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,6,1,10,5)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(20*64)-64,0,(15*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,6,6,10,10)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(15*64)-64,0,(15*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,6,11,10,15)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(10*64)-64,0,(15*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,6,16,10,20)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(5*64)-64,0,(15*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
REM ////////////////////////
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,11,1,15,5)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(20*64)-64,0,(10*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,11,6,15,10)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(15*64)-64,0,(10*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,11,11,15,15)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(10*64)-64,0,(10*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,11,16,15,20)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(5*64)-64,0,(10*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
REM ////////////////////////
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,16,1,20,5)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(20*64)-64,0,(5*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,16,6,20,10)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(15*64)-64,0,(5*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,16,11,20,15)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(10*64)-64,0,(5*64)-64)
SetObjectShader(Object,Shader_Fog)
Object=SK_OBJECT__FREE_ID_()
If GetFileExists("temp.obj") then DeleteFile("temp.obj")
Add_WaveFront_Dungeon_(ObjFile,64,16,16,20,20)
LoadObject(Object,"temp.obj")
setobjectimage(Object,MainTexture,0)
setobjectposition(Object,(5*64)-64,0,(5*64)-64)
SetObjectShader(Object,Shader_Fog)
DungeonLast=Object
Object=SK_OBJECT__FREE_ID_()
undim wallSides[]
Endfunction
Function Wave_Dungeon_Cull()
Startx#=GetCameraX(1)
StartY#=GetCameraY(1)
Startz#=GetCameraZ(1)
MoveCameraLocalZ(1,120)
Endx#=GetCameraX(1)
EndY#=GetCameraY(1)
Endz#=GetCameraZ(1)
MoveCameraLocalZ(1,-120)
SetObjectCollisionMode(CameraCollider,0)
//checka=0
//UnDim VisibleDungeon[]
//global Dim VisibleDungeon[5]
//count=0
for obj=DungeonFirst to DungeonLast
setobjectvisible(obj,0)
if ObjectSphereCast( obj, Startx#, StartY#, Startz#, Endx#, EndY#, Endz# ,64)=1
//VisibleDungeon[count]=obj
//inc count
setobjectvisible(obj,1)
//inc checka
endif
next obj
//print("test="+str(checka))
SetObjectCollisionMode(CameraCollider,1)
Endfunction
Function Add_WaveFront_Dungeon_(fileID,scalus#,Wstart,Hstart,Width,Height)
fileID=OpenToWrite("temp.obj",1)
Global Sub_U#
Global Sub_V#
Global Sub_U$
Global Sub_V$
Global VertexCount#
VertexCount#=0.0
dim vx[1000,20]
REM Front facing no backface
REM Uncentered 2 pixels large fronting the camera
//v 0.000000 2.000000 0.000000
//v 0.000000 0.000000 0.000000
//v 2.000000 0.000000 0.000000
//v 2.000000 2.000000 0.000000
f1=1
f2=f1+f1
f3=f1+f1+f1
f4=f1+f1+f1+f1
fillInVertexData=0
Blank$=str(0.000000)
REM // negative is the value lower then the center and positiv is higher Due to the fact that i wanted it centered
zNega#=-((scalus#/2)+0.000000)
zPosi#=(scalus#/2)+0.000000
REM // List of Vertices, with (x,y,z[,w]) coordinates, w is optional and defaults to 1.0.
for x=Wstart to Width
xNega#=-((scalus#/2)+0.000000)
xPosi#=(scalus#/2)+0.000000
for y=Hstart to Height
rX=20-y
rY=20-x
if GridMap[rX,rY].BlockType>0
xNega$=str(xNega#) : xPosi$=str(xPosi#) : zNega$=str(zNega#) : zPosi$=str(zPosi#)
REM // floor
REM /////////////////////////////
yHeight#=(-32)+Cell_Layers[rX,rY].Floor_Level
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight# , zNega#-0.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight# , zNega#+64.1 , zNega#-0.1 )
vx[fillInVertexData,1]=1
REM // ceiling
yHeight#=32+Cell_Layers[rX,rY].Ceiling_Level
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight# , zNega#+64.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight# , zNega#-0.1 , zNega#+64.1 )
vx[fillInVertexData,2]=1
// left wall
REM /////////////////////////////
if GridMap[rX-1,rY].BlockType=0 and wallSides[rX,rY,1,1]=0
yHeight#=-(scalus#/2)+0.000000
Create_Vertex_( fileID , xNega# , xNega# , yHeight# , yHeight#+64.0 , zNega#-0.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega# , xNega# , yHeight#+64.0 , yHeight# , zNega#+64.1 , zNega#+64.1 )
vx[fillInVertexData,3]=1
wallSides[rX,rY,1,1]=1
endif
// left cellar wall
REM /////////////////////////////
skip_cellar_wall_left=0
if Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX-1,rY].Floor_Level
if Cell_Layers[rX,rY].Floor_Level=>0 and GridMap[rX-1,rY].BlockType=0
skip_cellar_wall_left=1
endif
if Cell_Layers[rX,rY].Floor_Level=<Cell_Layers[rX-1,rY].Floor_Level and GridMap[rX-1,rY].BlockType>0 and Cell_Layers[rX-1,rY].Floor_Level<>0
skip_cellar_wall_left=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX-1,rY].Floor_Level=Cell_Layers[rX,rY].Floor_Level
skip_cellar_wall_left=1
endif
else
skip_cellar_wall_left=1
endif
if skip_cellar_wall_left=0 and wallSides[rX,rY,1,2]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Floor_Level>0 or Cell_Layers[rX-1,rY].Floor_Level<>0 and Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX-1,rY].Floor_Level
yHeight#=(yHeight#-64)+Cell_Layers[rX,rY].Floor_Level
elseif Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX-1,rY].Floor_Level and Cell_Layers[rX,rY].Floor_Level<0 // Dont create this if its not neaded
yHeight#=(yHeight#-64)
endif
if Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX-1,rY].Floor_Level
Create_Vertex_( fileID , xNega# , xNega# , yHeight# , yHeight#+64.0 , zNega#-0.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega# , xNega# , yHeight#+64.0 , yHeight# , zNega#+64.1 , zNega#+64.1 )
vx[fillInVertexData,4]=1
wallSides[rX,rY,1,2]=1
elseif wallSides[rX-1,rY,2,2]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega# , xNega# , yHeight# , yHeight#+64.0 , zNega#+64.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega# , xNega# , yHeight#+64.0 , yHeight# , zNega#-0.1 , zNega#-0.1 )
vx[fillInVertexData,4]=1
wallSides[rX,rY,1,2]=1
wallSides[rX-1,rY,2,2]=1
endif
endif
// left attic wall
REM /////////////////////////////
skip_attic_wall_left=0
if Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX-1,rY].Ceiling_Level
if Cell_Layers[rX,rY].Ceiling_Level=<0 and GridMap[rX-1,rY].BlockType=0
skip_attic_wall_left=1
endif
if Cell_Layers[rX,rY].Ceiling_Level=>Cell_Layers[rX-1,rY].Ceiling_Level and GridMap[rX-1,rY].BlockType>0 and Cell_Layers[rX-1,rY].Ceiling_Level<>0
skip_attic_wall_left=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX-1,rY].Ceiling_Level=Cell_Layers[rX,rY].Ceiling_Level
skip_attic_wall_left=1
endif
else
skip_attic_wall_left=1
endif
if skip_attic_wall_left=0 and wallSides[rX,rY,1,3]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Ceiling_Level<0 or Cell_Layers[rX-1,rY].Ceiling_Level<>0 and Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX-1,rY].Ceiling_Level
yHeight#=(yHeight#+64)+Cell_Layers[rX,rY].Ceiling_Level
elseif Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX-1,rY].Ceiling_Level and Cell_Layers[rX,rY].Ceiling_Level>0 // Dont create this if its not neaded
yHeight#=(yHeight#+64)
endif
if Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX-1,rY].Ceiling_Level
Create_Vertex_( fileID , xNega# , xNega# , yHeight# , yHeight#+64.0 , zNega#-0.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega# , xNega# , yHeight#+64.0 , yHeight# , zNega#+64.1 , zNega#+64.1 )
vx[fillInVertexData,5]=1
wallSides[rX,rY,1,3]=1
elseif wallSides[rX-1,rY,2,3]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega# , xNega# , yHeight# , yHeight#+64.0 , zNega#+64.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega# , xNega# , yHeight#+64.0 , yHeight# , zNega#-0.1 , zNega#-0.1 )
vx[fillInVertexData,5]=1
wallSides[rX,rY,1,3]=1
wallSides[rX-1,rY,2,3]=1
endif
endif
// right wall
REM /////////////////////////////
if GridMap[rX+1,rY].BlockType=0 and wallSides[rX,rY,2,1]=0
yHeight#=-(scalus#/2)+0.000000
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight# , yHeight#+64.0 , zNega#+64.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight#+64.0 , yHeight# , zNega#-0.1 , zNega#-0.1 )
vx[fillInVertexData,6]=1
wallSides[rX,rY,2,1]=1
endif
// right cellar wall
REM /////////////////////////////
skip_cellar_wall_right=0
if Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX+1,rY].Floor_Level
if Cell_Layers[rX,rY].Floor_Level=>0 and GridMap[rX+1,rY].BlockType=0
skip_cellar_wall_right=1
endif
if Cell_Layers[rX,rY].Floor_Level=<Cell_Layers[rX+1,rY].Floor_Level and GridMap[rX+1,rY].BlockType>0 and Cell_Layers[rX+1,rY].Floor_Level<>0
skip_cellar_wall_right=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX+1,rY].Floor_Level=Cell_Layers[rX,rY].Floor_Level
skip_cellar_wall_right=1
endif
else
skip_cellar_wall_right=1
endif
if skip_cellar_wall_right=0 and wallSides[rX,rY,2,2]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Floor_Level>0 or Cell_Layers[rX+1,rY].Floor_Level<>0 and Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX+1,rY].Floor_Level
yHeight#=(yHeight#-64)+Cell_Layers[rX,rY].Floor_Level
elseif Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX+1,rY].Floor_Level and Cell_Layers[rX,rY].Floor_Level<0 // Dont create this if its not neaded
yHeight#=(yHeight#-64)
endif
if Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX+1,rY].Floor_Level
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight# , yHeight#+64.0 , zNega#+64.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight#+64.0 , yHeight# , zNega#-0.1 , zNega#-0.1 )
vx[fillInVertexData,7]=1
wallSides[rX,rY,2,2]=1
elseif wallSides[rX+1,rY,1,2]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight# , yHeight#+64.0 , zNega#-0.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight#+64.0 , yHeight# , zNega#+64.1 , zNega#+64.1 )
vx[fillInVertexData,7]=1
wallSides[rX,rY,2,2]=1
wallSides[rX+1,rY,1,2]=1
endif
endif
// right attic wall
REM /////////////////////////////
skip_attic_wall_right=0
if Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX+1,rY].Ceiling_Level
if Cell_Layers[rX,rY].Ceiling_Level=<0 and GridMap[rX+1,rY].BlockType=0
skip_attic_wall_right=1
endif
if Cell_Layers[rX,rY].Ceiling_Level=>Cell_Layers[rX+1,rY].Ceiling_Level and GridMap[rX+1,rY].BlockType>0 and Cell_Layers[rX+1,rY].Ceiling_Level<>0
skip_attic_wall_right=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX+1,rY].Ceiling_Level=Cell_Layers[rX,rY].Ceiling_Level
skip_attic_wall_right=1
endif
else
skip_attic_wall_right=1
endif
if skip_attic_wall_right=0 and wallSides[rX,rY,2,3]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Ceiling_Level<0 or Cell_Layers[rX+1,rY].Ceiling_Level<>0 and Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX+1,rY].Ceiling_Level
yHeight#=(yHeight#+64)+Cell_Layers[rX,rY].Ceiling_Level
elseif Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX+1,rY].Ceiling_Level and Cell_Layers[rX,rY].Ceiling_Level>0 // Dont create this if its not neaded
yHeight#=(yHeight#+64)
endif
if Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX+1,rY].Ceiling_Level
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight# , yHeight#+64.0 , zNega#+64.1 , zNega#+64.1 )
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight#+64.0 , yHeight# , zNega#-0.1 , zNega#-0.1 )
vx[fillInVertexData,8]=1
wallSides[rX,rY,2,3]=1
elseif wallSides[rX+1,rY,1,3]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight# , yHeight#+64.0 , zNega#-0.1 , zNega#-0.1 )
Create_Vertex_( fileID , xNega#+64.0 , xNega#+64.0 , yHeight#+64.0 , yHeight# , zNega#+64.1 , zNega#+64.1 )
vx[fillInVertexData,8]=1
wallSides[rX,rY,2,3]=1
wallSides[rX+1,rY,1,3]=1
endif
endif
// front wall
REM /////////////////////////////
if GridMap[rX,rY+1].BlockType=0 and wallSides[rX,rY,3,1]=0
yHeight#=-(scalus#/2)+0.000000
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight#+64.0 , zNega# , zNega# )
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight#+64.0 , yHeight# , zNega# , zNega# )
vx[fillInVertexData,9]=1
wallSides[rX,rY,3,1]=1
endif
// front cellar wall
skip_cellar_wall_front=0
if Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX,rY+1].Floor_Level
if Cell_Layers[rX,rY].Floor_Level=>0 and GridMap[rX,rY+1].BlockType=0
skip_cellar_wall_front=1
endif
if Cell_Layers[rX,rY].Floor_Level=<Cell_Layers[rX,rY+1].Floor_Level and GridMap[rX,rY+1].BlockType>0 and Cell_Layers[rX,rY+1].Floor_Level<>0
skip_cellar_wall_front=1
endif
else
skip_cellar_wall_front=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX,rY+1].Floor_Level=Cell_Layers[rX,rY].Floor_Level
skip_cellar_wall_front=1
endif
if skip_cellar_wall_front=0 and wallSides[rX,rY,3,2]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Floor_Level>0 or Cell_Layers[rX,rY+1].Floor_Level<>0 and Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX,rY+1].Floor_Level
yHeight#=(yHeight#-64)+Cell_Layers[rX,rY].Floor_Level
elseif Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX,rY+1].Floor_Level and Cell_Layers[rX,rY].Floor_Level<0 // Dont create this if its not neaded
yHeight#=(yHeight#-64)
endif
if Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX,rY+1].Floor_Level
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight#+64.0 , zNega# , zNega# )
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight#+64.0 , yHeight# , zNega# , zNega# )
vx[fillInVertexData,10]=1
wallSides[rX,rY,3,2]=1
elseif wallSides[rX,rY-1,4,2]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight#+64.0 , zNega# , zNega# )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight#+64.0 , yHeight# , zNega# , zNega# )
vx[fillInVertexData,10]=1
wallSides[rX,rY,3,2]=1
wallSides[rX,rY-1,4,2]=1
endif
endif
// front attic wall
skip_attic_wall_front=0
if Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX,rY+1].Ceiling_Level
if Cell_Layers[rX,rY].Ceiling_Level=<0 and GridMap[rX,rY+1].BlockType=0
skip_attic_wall_front=1
endif
if Cell_Layers[rX,rY].Ceiling_Level=>Cell_Layers[rX,rY+1].Ceiling_Level and GridMap[rX,rY+1].BlockType>0 and Cell_Layers[rX,rY+1].Ceiling_Level<>0
skip_attic_wall_front=1
endif
else
skip_attic_wall_front=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX,rY+1].Ceiling_Level=Cell_Layers[rX,rY].Ceiling_Level
skip_attic_wall_front=1
endif
if skip_attic_wall_front=0 and wallSides[rX,rY,3,3]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Ceiling_Level<0 or Cell_Layers[rX,rY+1].Ceiling_Level<>0 and Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX,rY+1].Ceiling_Level
yHeight#=(yHeight#+64)+Cell_Layers[rX,rY].Ceiling_Level
elseif Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX,rY+1].Ceiling_Level and Cell_Layers[rX,rY].Ceiling_Level>0 // Dont create this if its not neaded
yHeight#=(yHeight#+64)
endif
if Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX,rY+1].Ceiling_Level
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight#+64.0 , zNega# , zNega# )
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight#+64.0 , yHeight# , zNega# , zNega# )
vx[fillInVertexData,11]=1
wallSides[rX,rY,3,3]=1
elseif wallSides[rX,rY+1,4,3]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight#+64.0 , zNega# , zNega# )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight#+64.0 , yHeight# , zNega# , zNega# )
vx[fillInVertexData,11]=1
wallSides[rX,rY,3,3]=1
wallSides[rX,rY+1,4,3]=1
endif
endif
// back wall
REM /////////////////////////////
if GridMap[rX,rY-1].BlockType=0 and wallSides[rX,rY,4,1]=0
yHeight#=-(scalus#/2)+0.000000
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight#+64.0 , zNega#+64.0 , zNega#+64.0 )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight#+64.0 , yHeight# , zNega#+64.0 , zNega#+64.0 )
vx[fillInVertexData,12]=1
wallSides[rX,rY,4,1]=1
endif
// back cellar wall
skip_cellar_wall_back=0
if Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX,rY-1].Floor_Level
if Cell_Layers[rX,rY].Floor_Level=>0 and GridMap[rX,rY-1].BlockType=0
skip_cellar_wall_back=1
endif
if Cell_Layers[rX,rY].Floor_Level=<Cell_Layers[rX,rY-1].Floor_Level and GridMap[rX,rY-1].BlockType>0 and Cell_Layers[rX,rY-1].Floor_Level<>0
skip_cellar_wall_back=1
endif
else
skip_cellar_wall_back=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX,rY-1].Floor_Level=Cell_Layers[rX,rY].Floor_Level
skip_cellar_wall_back=1
endif
if skip_cellar_wall_back=0 and wallSides[rX,rY,4,2]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Floor_Level>0 or Cell_Layers[rX,rY-1].Floor_Level<>0 and Cell_Layers[rX,rY].Floor_Level<>Cell_Layers[rX,rY-1].Floor_Level
yHeight#=(yHeight#-64)+Cell_Layers[rX,rY].Floor_Level
elseif Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX,rY-1].Floor_Level and Cell_Layers[rX,rY].Floor_Level<0 // Dont create this if its not neaded
yHeight#=(yHeight#-64)
endif
if Cell_Layers[rX,rY].Floor_Level<Cell_Layers[rX,rY-1].Floor_Level
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight#+64.0 , zNega#+64.0 , zNega#+64.0 )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight#+64.0 , yHeight# , zNega#+64.0 , zNega#+64.0 )
vx[fillInVertexData,13]=1
wallSides[rX,rY,4,2]=1
else //if //wallSides[rX,rY+1,3,2]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight#+64.0 , zNega#+64.0 , zNega#+64.0 )
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight#+64.0 , yHeight# , zNega#+64.0 , zNega#+64.0 )
vx[fillInVertexData,13]=1
wallSides[rX,rY,4,2]=1
wallSides[rX,rY+1,3,2]=1
endif
endif
// back attic wall
skip_attic_wall_back=0
if Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX,rY-1].Ceiling_Level
if Cell_Layers[rX,rY].Ceiling_Level=<0 and GridMap[rX,rY-1].BlockType=0
skip_attic_wall_back=1
endif
if Cell_Layers[rX,rY].Ceiling_Level=>Cell_Layers[rX,rY-1].Ceiling_Level and GridMap[rX,rY-1].BlockType>0 and Cell_Layers[rX,rY-1].Ceiling_Level<>0
skip_attic_wall_back=1
endif
else
skip_attic_wall_back=1
endif
REM // If neighbour have the same floor height dont make the wall
if Cell_Layers[rX,rY-1].Ceiling_Level=Cell_Layers[rX,rY].Ceiling_Level
skip_attic_wall_back=1
endif
if skip_attic_wall_back=0 and wallSides[rX,rY,4,3]=0
yHeight#=-(scalus#/2)+0.000000
if Cell_Layers[rX,rY].Ceiling_Level<0 or Cell_Layers[rX,rY-1].Ceiling_Level<>0 and Cell_Layers[rX,rY].Ceiling_Level<>Cell_Layers[rX,rY-1].Ceiling_Level
yHeight#=(yHeight#+64)+Cell_Layers[rX,rY].Ceiling_Level
elseif Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX,rY-1].Ceiling_Level and Cell_Layers[rX,rY].Ceiling_Level>0 // Dont create this if its not neaded
yHeight#=(yHeight#+64)
endif
if Cell_Layers[rX,rY].Ceiling_Level>Cell_Layers[rX,rY-1].Ceiling_Level
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight# , yHeight#+64.0 , zNega#+64.0 , zNega#+64.0 )
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight#+64.0 , yHeight# , zNega#+64.0 , zNega#+64.0 )
vx[fillInVertexData,14]=1
wallSides[rX,rY,4,3]=1
else //if //wallSides[rX,rY-1,3,3]=0 // raised floor neads mirrored
Create_Vertex_( fileID , xNega#+64.1 , xNega#+64.1 , yHeight# , yHeight#+64.0 , zNega#+64.0 , zNega#+64.0 )
Create_Vertex_( fileID , xNega#-0.1 , xNega#-0.1 , yHeight#+64.0 , yHeight# , zNega#+64.0 , zNega#+64.0 )
vx[fillInVertexData,14]=1
wallSides[rX,rY,4,3]=1
wallSides[rX,rY-1,3,3]=1
endif
endif
endif
xNega# = xNega# - scalus# : xPosi# = xPosi# - scalus#
fillInVertexData=fillInVertexData+1
next y
REM // If we increase so will it be drawn reversed to 2d screen coords
zNega# = zNega# + scalus# : zPosi# = zPosi# + scalus#
next x
REM // group
WriteLine(fileID,"g all")
REM // smoothing group
WriteLine(fileID,"s 1")
REM // merging group
WriteLine(fileID,"mg 1 1.500000")
For t=0 to fillInVertexData
if vx[t,1]>0
WaveFront_TextureCoords(fileID,"floor")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,2]>0
WaveFront_TextureCoords(fileID,"ceiling")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,3]>0
WaveFront_TextureCoords(fileID,"wall")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,4]>0
WaveFront_TextureCoords(fileID,"cellar")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,5]>0
WaveFront_TextureCoords(fileID,"attic")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,6]>0
WaveFront_TextureCoords(fileID,"wall")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,7]>0
WaveFront_TextureCoords(fileID,"cellar")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,8]>0
WaveFront_TextureCoords(fileID,"attic")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,9]>0
WaveFront_TextureCoords(fileID,"wall")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,10]>0
WaveFront_TextureCoords(fileID,"cellar")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,11]>0
WaveFront_TextureCoords(fileID,"attic")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,12]>0
WaveFront_TextureCoords(fileID,"wall")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,13]>0
WaveFront_TextureCoords(fileID,"cellar")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
if vx[t,14]>0
WaveFront_TextureCoords(fileID,"attic")
temp$=str(f1)+"/"+str(f1)+" "+str(f2)+"/"+str(f2)+" "+str(f3)+"/"+str(f3)+" "+str(f4)+"/"+str(f4)
WriteLine(fileID,"f "+temp$)
inc f1,4 : inc f2,4 : inc f3,4 : inc f4,4
endif
next t
undim vx[]
CloseFile(fileID)
endfunction
Function Create_Vertex_(fileID,x1#,x2#,y1#,y2#,z1#,z2#)
x1$=str(x1#) : x2$=str(x2#)
y1$=str(y1#) : y2$=str(y2#)
z1$=str(z1#) : z2$=str(z2#)
WriteLine(fileID,"v "+ x1$ +" "+ y1$ +" "+ z1$)
WriteLine(fileID,"v "+ x2$ +" "+ y2$ +" "+ z2$)
REM // This is done 2 times so increase by half
VertexCount#=VertexCount#+0.5
Endfunction
REM // Texture coordinates, in (u ,v [,w]) coordinates
REM // these will vary between 0 and 1, w is optional and default to 0.
REM 0.0 -------- 1.0
rem I I
rem I I
rem I I
rem 0.1 -------- 1.1
REM // You get the right texture coords by 1/image size (use squared image)
REM // Then use subimage coord * the result for left edge
REM // Then use subimage coord+texture width * the result for right edge
Function WaveFront_TextureCoords(fileID,img$)
ret=0
while DoThis=0
This=Random(1,4)
ret=SK_SUBIMAGE__Exists_( MainTexture , "png/" , img$+str(This)+".png" )
tp#=1.0/256.0
Sub_U#=val(Sub_U$)
Sub_V#=val(Sub_V$)
// Weirdly so do we nead to reverse the texture y coord
Sub_V#=256.0-Sub_V#
Sub_U#=Sub_U#*tp#
Sub_V#=Sub_V#*tp#
Sub_U2#=Sub_U#+(32.0*tp#)
Sub_V2#=Sub_V#-(32.0*tp#)
if ret>0 then exit
Endwhile
WriteLine(fileID,"vt "+str(Sub_U#)+" "+str(Sub_V2#)+" 0" )
WriteLine(fileID,"vt "+str(Sub_U#)+" "+str(Sub_V#)+" 0" )
WriteLine(fileID,"vt "+str(Sub_U2#)+" "+str(Sub_V#)+" 0" )
WriteLine(fileID,"vt "+str(Sub_U2#)+" "+str(Sub_V2#)+" 0" )
Endfunction
ps...
this is only some of the discarded lines of code and i dont even want to Think about how many we are up to now
Van is working on some cool projectile weapons.
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz