#include "game.h" #include #include #include #include #include #include #include #if HAVE_PIC_LIB #include "pic.h" #endif #include "texturemap.h" #include "playerlocation.h" //create the classes that do the stuff #include "world.h" World world; //when adding more cameras remember the windowreshape function too #include "camera.h" Camera camera; #include "input.h" Input input; //! instance pointer for callbacks Game* Game::s_pGame = NULL; //! helper function to read strings from a stream inline bool READ_STRING(istream &is, char* pString) { is >> pString; return is.good(); } const char* Game::SNAPSHOT_FILENAME = "snapshot.jpg"; //--------------------------------------------------------------------- // Intro // // Method: Constructor // //--------------------------------------------------------------------- Game::Game() { // initialize instance pointer for callbacks s_pGame = this; mainWindow = -1; iWindowWidth = 0; iWindowHeight = 0; gamemode=0; for (int x=0; x 0) glutDestroyWindow(mainWindow); } /* bool Game::ReadLevel(const char *introfilename) { cerr << "Reading intro description file "<>numintroframes; for (int x=0; x>introTimes[x]; if (!READ_STRING(is, introFilenames[x])) { cerr << "ERROR" << endl; return false; } } is>>introendtime; return true; }*/ bool Game::ReadGameFile() { cerr << "Reading game description file "<>numlevels; for (int x=0; x=numlevels) {//if we beat the game //doending(); cerr<<"Do the ending here!*****************"<>inputFile; is>>skyboxPath; is>>courseFile; is>>npcFile; is>>eventFile; is>>minimapfile; is>>minimapmaskfile; is>>chatback; is>>chatborder; is>>worldtype; cout<<"t1:"<>inputtype; cout<<"t2:"<>cameratype; cout<<"t2:"<>wgoaltype>>wgoalx>>wgoaly>>wgoaldistance; is>>numslideframes; for (int r=0; r>slideTimes[r]; is>>slideFilenames[r]; } is>>slideendtime; cout<<"initing the world"<=slideendtime) x++; } else if (time(0)-slidestarttime>=slideTimes[x+1]) { x++; loaded=0; } //cerr<<"whiled with x="<1) numplayers--; if ((world.players[numplayers].loc.x>0)&&(world.players[numplayers].loc.x0)&&(world.players[numplayers].loc.y= 0; i--) { glReadPixels(0, iWindowHeight-1-i, iWindowWidth, 1, GL_RGB, GL_UNSIGNED_BYTE, &in->pix[i*in->nx*in->bpp]); } // write the result bool bResult = jpeg_write((char *)filename, in); pic_free(in); if (!bResult) cerr << "Intro::_CaptureImage : Error writing image " << filename << endl; return bResult; #else cerr << "Intro::_CaptureImage() needs 'libpicio'" << endl; return false; #endif // HAVE_PIC_LIB }