#include #include #include #include #include #include #include #include LEVEL *level; GLuint sphere; GLuint meditex_blue; GLuint lightmap; extern TEXLIST *texlist; 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}}; glViewport(0, 0, 640, 480); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(50.0, 640.0/480.0, 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glShadeModel(GL_SMOOTH); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glDisable(GL_LIGHTING); SetAmbient(ambient); AddLight(light); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); meditex_blue = LoadTexture("medib.png"); lightmap = LoadTexture("lightmap.png"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); GLUquadricObj *quadric = gluNewQuadric(); gluQuadricDrawStyle(quadric, GLU_FILL); gluQuadricTexture(quadric, GL_TRUE); level = LoadLevel("level.lvl"); player.pos = level->info->start; sphere = glGenLists(1); glNewList(sphere, GL_COMPILE); glRotatef(90, 1.0, 0.0, 0.0); gluSphere(quadric, 1.0, 24, 24); glEndList(); gluDeleteQuadric(quadric); return 1; } void UninitGame() { FreeLevel(level); free(texlist); }