home *** CD-ROM | disk | FTP | other *** search
- //=======================================================================//
- //ReadEntity - Reads all entities that are not made from a brush //
- // ie a platform has point coordinates and is handled //
- // seperately //
- //Martian 11/13/96 //
- //Martian 11/15/96 - Reads all entities, brushes, and special brushes //
- // - ie like platforms. Not tested every possible //
- // - speacial brush, that's up to you //
- //=======================================================================//
-
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "io.h"
- #include "entity.h"
- #include "brush.h"
-
- void ReadEntity(char *token, int *scriptline, char *dat, int *location)
- {
- while (1)
- {
- getentity:
- if (!GetToken(TRUE, token, scriptline, dat, location))
- break;
- if ((strcmp (token, "}") )==0)
- break;
- printf (">>read entity\n");
-
- GetToken(FALSE, token, scriptline, dat, location); //Entity which must be listed after classname
- printf("\tEntity is: %s\n",token);
-
- GetToken(TRUE, token, scriptline, dat, location); //origin should be first after classname identifier
- if ((strcmp (token, "{"))==0) //if not then it is a special brush like a platform
- {
- ReadSpecialEntity(token,scriptline,dat,location);
- goto getentity;
- }
- GetToken(FALSE, token, scriptline, dat, location); //get origin information, needs to be converted to int to use
- printf("\tOrigin is: %s\n",token);
-
- GetToken(TRUE, token, scriptline, dat, location); //check for additional attributes
-
- if ((strcmp(token,"}"))!=0)
- {
- printf("\tOther Attributes: \n");
-
- while ((strcmp(token,"}"))!=0) //loop and collect all attributes
- {
- printf("\t\tattrib : %s",token);
- GetToken(FALSE, token, scriptline, dat, location);
- printf("\t%s\n",token);
-
- GetToken(TRUE, token, scriptline, dat, location);
- }
- GetToken(TRUE, token, scriptline, dat, location);
- }
- else
- {
- GetToken(TRUE, token, scriptline, dat, location);
- }
- }
-
- }
-
- void ReadSpecialEntity(char *token, int *scriptline, char *dat, int *location)
- {
- int i;
-
- printf (">>read special entity\n");
- printf ("\t");
-
- ReadBrush (token, scriptline, dat, location);
- //Print out some key info//
- printf("\tTexture %s\n",f->texture.texture);
- printf("\tNumber of faces %i\n",numfaces);
- printf("\tWinding for each Face\n");
- for (i=0 ; i<MAX_FACES ; i++)
- {
- if (faces[i].w)
- {
- printf("\t\tV (%Li)\n",faces[i].w);
- }
- }
- printf("\tBMINS (%Li %Li %Li)\n",bmins[0],bmins[1],bmins[2]);
- printf("\tBMAXS (%Li %Li %Li)\n",bmaxs[0],bmaxs[1],bmaxs[2]);
- }