Advertisement

WorldCraft 1.6 *.map

Started by November 29, 2002 08:40 PM
8 comments, last by PmanC 22 years, 2 months ago
ok... i have been trying to figure this out for a long time. i am using a worldcraft 1.6 exported .map file as level data. i have read in all of the verticies and when i render them, it seems that only 1/2 of the faces are being drawn. there is no face information in the .map file format. here is an example of a file { "classname" "worldspawn" "wad" "c:\documents and settings\pete\desktop\kdmtex.wad" { ( -16 32 16 ) ( 16 32 16 ) ( 16 0 16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 ( -16 0 -16 ) ( 16 0 -16 ) ( 16 32 -16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 ( -16 32 16 ) ( -16 0 16 ) ( -16 0 -16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 ( 16 32 -16 ) ( 16 0 -16 ) ( 16 0 16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 ( 16 32 16 ) ( -16 32 16 ) ( -16 32 -16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 ( 16 0 -16 ) ( -16 0 -16 ) ( -16 0 16 ) CITY2_GRAY 0 0 0 1.000000 1.000000 } } here are the function uses to load in the data and to render it: typedef struct { float x,y,z; }vertex; typedef struct { int numverts; char beginText[256]; vector verts; }mapData; void readstr(FILE *f,char *string){ do{ fgets(string, 255, f); } while ((string[0] == ''/'') || (string[0] == ''\n'')); return; } void loadMap(char *path,mapData *map){ vertex v1,v2,v3; FILE *file; char line[255]; file=fopen(path,"rt"); while(!feof(file)){ readstr(file,line); if (line[0]==''(''){ sscanf(line,"( %f %f %f ) ( %f %f %f ) ( %f %f %f )",&v1.x,&v1.y,&v1.z,&v2.x,&v2.y,&v2.z,&v3.x,&v3.y,&v3.z); map->verts.push_back(v1); map->verts.push_back(v2); map->verts.push_back(v3); map->numverts+=3; } } } void drawMap(mapData *map){ glDisable(GL_CULL_FACE); glColor3f(1,0.3,0); glBegin(GL_TRIANGLES); for (int temp=0; tempnumverts;temp+=1){ glVertex3f(map->verts[temp].x,map->verts[temp].z,map->verts[temp].y); } glEnd(); } i would have put up some screen shots up, but i have no webspace at the moment. -PmanC
Those aren''t vertex lists, they''re plane definitions. You need to intersect planes.

Search the web, this format is pretty well documented.
Advertisement
i understand... that seems like a lot of work. i might switvh to another format. -PmanC
You can try BSP files, i''ve made a utility that converts a compiled quake3 bsp into my own little format. It works out pretty well since a bsp is pretty much a direct dump of C-structs into a file.
i''ll try that. -PmanC
I''ve figured out most of the info myself. There was this slightly outdated info on the net about .MAP files.
The way that the map file works is actually by face (square faces). the ammount of lines between { } is how many faces per shape. 6 being a basic cube.
From the 3 coords they give you, you have to find the 4th to make a face.

I have some source if you need it.
maxxjag@planetquake.com
Advertisement
quote:
Original post by PmanC
i understand... that seems like a lot of work. i might switvh to another format. -PmanC


LOT of work is required in any case!
YES! i got the .map loader working. big thanks to MaxxJag. -PmanC
Could anyone post some code please?

Got me thinking about doing a worldcraft loader now! hehe

Thanks!
Adam
You can find some help here:
http://folk.uio.no/stefanha/
-->tutorials
Life is searching.

This topic is closed to new replies.

Advertisement