diff options
-rw-r--r-- | init.c | 4 | ||||
-rw-r--r-- | level.c | 122 | ||||
-rw-r--r-- | player.c | 14 | ||||
-rw-r--r-- | render.c | 6 |
4 files changed, 73 insertions, 73 deletions
@@ -18,8 +18,8 @@ extern PLAYER player; int InitGame() { - LIGHT light = {LIGHT_POINT, {15.0, 15.0, 15.0}, {0.0, 0.0, 0.0}}; - COLOR ambient = {0.1, 0.1, 0.1}; + LIGHT light = {LIGHT_POINT, {{15.0, 15.0, 15.0}}, {{0.0, 0.0, 0.0}}}; + COLOR ambient = {{0.1, 0.1, 0.1}}; glViewport(0, 0, 640, 480); @@ -37,18 +37,18 @@ static void LoadTriangles(xmlNodePtr node, LEVEL *level, WALL* walls, int nWalls for(; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "triangle")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"triangle")) continue; walls[i].visible = 1; - data = xmlGetProp(node, "visible"); + data = xmlGetProp(node, (xmlChar*)"visible"); if(data) { - if(!xmlStrcmp(data, "false")) walls[i].visible = 0; + if(!xmlStrcmp(data, (xmlChar*)"false")) walls[i].visible = 0; xmlFree(data); } - data = xmlGetProp(node, "texture"); + data = xmlGetProp(node, (xmlChar*)"texture"); if(data) { - tex.name = data; + tex.name = (char*)data; texp = bsearch(&tex, level->textures, level->nTextures, sizeof(TEXTURE), SortTextures); if(texp) walls[i].texture = texp->id; @@ -60,60 +60,60 @@ static void LoadTriangles(xmlNodePtr node, LEVEL *level, WALL* walls, int nWalls for(node2 = node->children; node2 != NULL; node2 = node2->next) { if(node2->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node2->name, "vertex")) { + if(!xmlStrcmp(node2->name, (xmlChar*)"vertex")) { if(++j > 2) break; - data = xmlGetProp(node2, "x"); + data = xmlGetProp(node2, (xmlChar*)"x"); if(data) { - walls[i].vertices[j].x = atof(data); + walls[i].vertices[j].x = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "y"); + data = xmlGetProp(node2, (xmlChar*)"y"); if(data) { - walls[i].vertices[j].y = atof(data); + walls[i].vertices[j].y = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "z"); + data = xmlGetProp(node2, (xmlChar*)"z"); if(data) { - walls[i].vertices[j].z = atof(data); + walls[i].vertices[j].z = atof((char*)data); xmlFree(data); } } - else if(!xmlStrcmp(node2->name, "normal")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"normal")) { if(j < 0) continue; - data = xmlGetProp(node2, "x"); + data = xmlGetProp(node2, (xmlChar*)"x"); if(data) { - walls[i].normals[j].x = atof(data); + walls[i].normals[j].x = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "y"); + data = xmlGetProp(node2, (xmlChar*)"y"); if(data) { - walls[i].normals[j].y = atof(data); + walls[i].normals[j].y = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "z"); + data = xmlGetProp(node2, (xmlChar*)"z"); if(data) { - walls[i].normals[j].z = atof(data); + walls[i].normals[j].z = atof((char*)data); xmlFree(data); } } - else if(!xmlStrcmp(node2->name, "texcoords")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"texcoords")) { if(j < 0) continue; - data = xmlGetProp(node2, "s"); + data = xmlGetProp(node2, (xmlChar*)"s"); if(data) { - walls[i].texcoords[j].s = atof(data); + walls[i].texcoords[j].s = atof((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "t"); + data = xmlGetProp(node2, (xmlChar*)"t"); if(data) { - walls[i].texcoords[j].t = atof(data); + walls[i].texcoords[j].t = atof((char*)data); xmlFree(data); } } @@ -142,10 +142,10 @@ LEVEL *LoadLevel(char *filename) { xmlDocPtr doc; xmlDtdPtr dtd; xmlValidCtxtPtr validCtxt; - xmlNodePtr root, node, node2, node3, rooms = NULL, gates = NULL; + xmlNodePtr root, node, node2, rooms = NULL, gates = NULL; xmlChar *data; char *name; - int i, j; + int i; ROOM room, *roomp; @@ -160,7 +160,7 @@ LEVEL *LoadLevel(char *filename) { if(!doc) return NULL; - dtd = xmlParseDTD("-//libzoom//DTD level 0.1//EN", "levels/level.dtd"); + dtd = xmlParseDTD((xmlChar*)"-//libzoom//DTD level 0.1//EN", (xmlChar*)"levels/level.dtd"); if(!dtd) { xmlFreeDoc(doc); @@ -189,7 +189,7 @@ LEVEL *LoadLevel(char *filename) { xmlFreeDtd(dtd); root = xmlDocGetRootElement(doc); - if(!root || xmlStrcmp(root->name, "level")) { + if(!root || xmlStrcmp(root->name, (xmlChar*)"level")) { xmlFreeDoc(doc); xmlCleanupParser(); return NULL; @@ -202,51 +202,51 @@ LEVEL *LoadLevel(char *filename) { for(node = root->children; node != NULL; node = node->next) { if(node->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node->name, "info")) { + if(!xmlStrcmp(node->name, (xmlChar*)"info")) { level->info = calloc(1, sizeof(LEVELINFO)); for(node2 = node->children; node2 != NULL; node2 = node2->next) { if(node2->type != XML_ELEMENT_NODE) continue; - if(!xmlStrcmp(node2->name, "name")) { + if(!xmlStrcmp(node2->name, (xmlChar*)"name")) { if(level->info->name != NULL) continue; data = xmlNodeGetContent(node2); - level->info->name = strdup(data); + level->info->name = strdup((char*)data); xmlFree(data); } - else if(!xmlStrcmp(node2->name, "desc")) { + else if(!xmlStrcmp(node2->name, (xmlChar*)"desc")) { if(level->info->desc != NULL) continue; data = xmlNodeGetContent(node2); - level->info->desc = strdup(data); + level->info->desc = strdup((char*)data); xmlFree(data); } - else if(!xmlStrcmp(node2->name, "start")) { - data = xmlGetProp(node2, "x"); - if(data) level->info->start.x = atof(data); + else if(!xmlStrcmp(node2->name, (xmlChar*)"start")) { + data = xmlGetProp(node2, (xmlChar*)"x"); + if(data) level->info->start.x = atof((char*)data); xmlFree(data); - data = xmlGetProp(node2, "y"); - if(data) level->info->start.y = atof(data); + data = xmlGetProp(node2, (xmlChar*)"y"); + if(data) level->info->start.y = atof((char*)data); xmlFree(data); - data = xmlGetProp(node2, "z"); - if(data) level->info->start.z = atof(data); + data = xmlGetProp(node2, (xmlChar*)"z"); + if(data) level->info->start.z = atof((char*)data); xmlFree(data); } } } - else if(!xmlStrcmp(node->name, "rooms")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"rooms")) { if(rooms != NULL) continue; rooms = node; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "room")) level->nRooms++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"room")) level->nRooms++; } } - else if(!xmlStrcmp(node->name, "gates")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"gates")) { if(gates != NULL) continue; gates = node; @@ -254,32 +254,32 @@ LEVEL *LoadLevel(char *filename) { node2 = node->children; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "gate")) level->nGates++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"gate")) level->nGates++; } } - else if(!xmlStrcmp(node->name, "textures")) { + else if(!xmlStrcmp(node->name, (xmlChar*)"textures")) { if(level->textures != NULL) continue; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "texture")) level->nTextures++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"texture")) level->nTextures++; } level->textures = calloc(level->nTextures, sizeof(TEXTURE)); i = 0; for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type != XML_ELEMENT_NODE || xmlStrcmp(node2->name, "texture")) continue; + if(node2->type != XML_ELEMENT_NODE || xmlStrcmp(node2->name, (xmlChar*)"texture")) continue; - data = xmlGetProp(node2, "name"); + data = xmlGetProp(node2, (xmlChar*)"name"); if(data) { - level->textures[i].id = LoadTexture(data); + level->textures[i].id = LoadTexture((char*)data); xmlFree(data); } - data = xmlGetProp(node2, "id"); + data = xmlGetProp(node2, (xmlChar*)"id"); if(data) { - level->textures[i].name = strdup(data); + level->textures[i].name = strdup((char*)data); xmlFree(data); } @@ -295,17 +295,17 @@ LEVEL *LoadLevel(char *filename) { i = 0; for(node = rooms->children; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "room")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"room")) continue; - data = xmlGetProp(node, "id"); + data = xmlGetProp(node, (xmlChar*)"id"); if(data) { - level->rooms[i].id = strdup(data); + level->rooms[i].id = strdup((char*)data); xmlFree(data); } for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "triangle")) level->rooms[i].nWalls++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"triangle")) level->rooms[i].nWalls++; } level->rooms[i].walls = calloc(level->rooms[i].nWalls, sizeof(WALL)); @@ -321,11 +321,11 @@ LEVEL *LoadLevel(char *filename) { i = 0; for(node = gates->children; node != NULL; node = node->next) { - if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, "gate")) continue; + if(node->type != XML_ELEMENT_NODE || xmlStrcmp(node->name, (xmlChar*)"gate")) continue; - data = xmlGetProp(node2, "room1"); + data = xmlGetProp(node, (xmlChar*)"room1"); if(data) { - room.id = data; + room.id = (char*)data; roomp = bsearch(&room, level->rooms, level->nRooms, sizeof(ROOM), SortRooms); if(roomp) level->gates[i].room1 = roomp; @@ -333,9 +333,9 @@ LEVEL *LoadLevel(char *filename) { xmlFree(data); } - data = xmlGetProp(node2, "room2"); + data = xmlGetProp(node, (xmlChar*)"room2"); if(data) { - room.id = data; + room.id = (char*)data; roomp = bsearch(&room, level->rooms, level->nRooms, sizeof(ROOM), SortRooms); if(roomp) level->gates[i].room2 = roomp; @@ -344,7 +344,7 @@ LEVEL *LoadLevel(char *filename) { } for(node2 = node->children; node2 != NULL; node2 = node2->next) { - if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, "triangle")) level->gates[i].nWalls++; + if(node2->type == XML_ELEMENT_NODE && !xmlStrcmp(node2->name, (xmlChar*)"triangle")) level->gates[i].nWalls++; } level->gates[i].walls = calloc(level->gates[i].nWalls, sizeof(WALL)); @@ -10,7 +10,7 @@ int input = 0; int falling = 0; PLAYER player = { - {0.0, 0.0, 0.0}, + {{0.0, 0.0, 0.0}}, 0.0, 0.0, 1.0, 100, 100, 0 }; @@ -34,16 +34,16 @@ void MouseInput(int x, int y) { void DoInput(int delta) { int i, wasfalling = falling; - int g; + //int g; VERTEX pos; int room = player.room; - VECTOR move = {0.0, 0.0, 0.0}; - VECTOR v = {0.0, -1.0, 0.0}; + VECTOR move = {{0.0, 0.0, 0.0}}; + VECTOR v = {{0.0, -1.0, 0.0}}; float s, c; float f = 0.0; - VERTEX p1, p2; - VECTOR v1, v2; - MATRIX transform; + //VERTEX p1, p2; + //VECTOR v1, v2; + //MATRIX transform; objrot += 0.01*delta; if(objrot > 360.0) objrot -= 360.0; @@ -23,13 +23,13 @@ static int SortByTex(const void *p1, const void *p2) { } void Render() { - GLfloat std_emission[] = {0.0, 0.0, 0.0, 1.0}; - MATRIX rotate = { + //GLfloat std_emission[] ={{0.0, 0.0, 0.0, 1.0}; + MATRIX rotate = {.f = { player.rotycos, 0.0, -player.rotysin, 0.0, 0.0, 1.0, 0.0, 0.0, player.rotysin, 0.0, player.rotycos, 0.0, 0.0, 0.0, 0.0, 1.0 - }; + }}; POLYGON_LIST *room; int i, j, k; float d; |