#include <CSGame.h>
Inheritance diagram for CSGame:
|
Definition at line 66 of file CSGame.cpp. References loadGameData(), LOG_ENTER, and LOG_EXIT.
00067 { 00068 static char *functionName="CSGame"; 00069 LOG_ENTER 00070 initialize(); 00071 loadGameData(gameFileName); 00072 LOG_EXIT 00073 } |
Here is the call graph for this function:
|
Definition at line 75 of file CSGame.cpp. References freeLevel(), LOG_ENTER, LOG_EXIT, mDesktop, and mLevelData.
00076 { 00077 static char *functionName="~CSGame"; 00078 LOG_ENTER 00079 freeLevel(); 00080 00081 TileCollisionCheckDatas::iterator iter = mTileCollisionCheckDatas.begin(); 00082 while (iter != mTileCollisionCheckDatas.end()) 00083 { 00084 TileCollisionCheckData *data = *iter; 00085 mTileCollisionCheckDatas.erase(iter); 00086 delete data; 00087 iter = mTileCollisionCheckDatas.begin(); 00088 } 00089 00090 SpriteCollisionCheckDatas::iterator titer = mSpriteCollisionCheckDatas.begin(); 00091 while (titer != mSpriteCollisionCheckDatas.end()) 00092 { 00093 SpriteCollisionCheckData *data = *titer; 00094 mSpriteCollisionCheckDatas.erase(titer); 00095 delete data; 00096 titer = mSpriteCollisionCheckDatas.begin(); 00097 } 00098 for (StringVector::iterator siter = mLevels.begin(); siter != mLevels.end(); siter++) 00099 { 00100 delete *siter; 00101 } 00102 mLevels.clear(); 00103 if (mId) 00104 { 00105 free(mId); 00106 mId = 0; 00107 } 00108 if (mEventMap != 0) 00109 { 00110 CSEventMap::iterator iter; 00111 for (iter = mEventMap->begin(); iter!=mEventMap->end(); iter++) 00112 { 00113 delete (iter->second); 00114 } 00115 00116 mEventMap->clear(); 00117 delete mEventMap; 00118 mEventMap = 0; 00119 } 00120 if (mLevelData != 0) 00121 { 00122 delete mLevelData; 00123 mLevelData = 0; 00124 } 00125 if (mMenuBar) 00126 { 00127 delete (mMenuBar); 00128 mMenuBar = 0; 00129 } 00130 if (mDesktop) 00131 { 00132 delete (mDesktop); 00133 mDesktop = 0; 00134 } 00135 LOG_EXIT 00136 } |
Here is the call graph for this function:
|
Definition at line 1470 of file CSGame.cpp. References CSDesktop::dispatchKeyEvent(), mDesktop, MESSAGE_END, MESSAGE_KEY_DOWN, MESSAGE_KEY_LEFT, MESSAGE_KEY_RIGHT, MESSAGE_KEY_UP, MESSAGE_PAUSE, MESSAGE_TOGGLE_FULLSCREEN, MESSAGE_TOGGLE_GUI, p, and CSMessageDispatchable::sendMessage(). Referenced by run().
01471 { 01472 static char *functionName="handleEvents"; 01473 SDL_Event event; 01474 01475 if (SDL_PeepEvents(&event, 1, SDL_PEEKEVENT,SDL_MOUSEMOTIONMASK)==1) 01476 { 01477 do 01478 { 01479 SDL_PeepEvents(&event,1, SDL_GETEVENT,SDL_MOUSEMOTIONMASK); 01480 } while (SDL_PeepEvents(&event,1 , SDL_PEEKEVENT,SDL_MOUSEMOTIONMASK)==1); 01481 01482 onMouseMotion(event.motion); 01483 } 01484 01485 if (SDL_PollEvent(&event)) 01486 { 01487 switch(event.type) 01488 { 01489 case SDL_MOUSEMOTION: 01490 { 01491 onMouseMotion(event.motion); 01492 break; 01493 } 01494 case SDL_MOUSEBUTTONDOWN: 01495 { 01496 onMouseButtonDown(event.button); 01497 break; 01498 } 01499 case SDL_MOUSEBUTTONUP: 01500 { 01501 onMouseButtonUp(event.button); 01502 break; 01503 } 01504 case SDL_KEYUP: 01505 { 01506 if (mIsGui) 01507 { 01508 mDesktop->dispatchKeyEvent(event, SDL_KEYUP); 01509 } 01510 break; 01511 } 01512 case SDL_KEYDOWN: 01513 { 01514 bool used = false; 01515 if (mIsGui) 01516 { 01517 used = mDesktop->dispatchKeyEvent(event, SDL_KEYDOWN); 01518 } 01519 if (!used) 01520 { 01521 switch(event.key.keysym.sym) 01522 { 01523 case SDLK_ESCAPE: 01524 sendMessage(MESSAGE_END); 01525 break; 01526 01527 case SDLK_RIGHT: 01528 case SDLK_r: 01529 sendMessage(MESSAGE_KEY_RIGHT); 01530 break; 01531 01532 case SDLK_LEFT: 01533 case SDLK_l: 01534 sendMessage(MESSAGE_KEY_LEFT); 01535 break; 01536 01537 case SDLK_UP: 01538 case SDLK_u: 01539 sendMessage(MESSAGE_KEY_UP); 01540 break; 01541 01542 case SDLK_DOWN: 01543 case SDLK_d: 01544 sendMessage(MESSAGE_KEY_DOWN); 01545 break; 01546 case SDLK_p: 01547 sendMessage(MESSAGE_PAUSE); 01548 break; 01549 case SDLK_g: 01550 sendMessage(MESSAGE_TOGGLE_GUI); 01551 break; 01552 01553 case SDLK_SPACE: 01554 // sendMessage(MESSAGE_KEY_FIRE); 01555 p = 1; 01556 break; 01557 01558 case SDLK_F4: 01559 sendMessage(MESSAGE_TOGGLE_FULLSCREEN); 01560 break; 01561 default: 01562 break; 01563 } 01564 } 01565 } 01566 break; 01567 } 01568 } 01569 } |
Here is the call graph for this function:
|
Definition at line 1575 of file CSGame.cpp. References CSSprite::getFilename(), mLevelData, SpriteData::name, and CSLevelData::sprites.
01576 { 01577 SpriteDatas::iterator iter = mLevelData->sprites.begin(); 01578 01579 for (int i = 0; i < mLevelData->sprites.size(); i++) 01580 { 01581 SpriteData* data = (SpriteData *) mLevelData->sprites.at(i); 01582 if (strcmp(data->name, sprite->getFilename().c_str()) == 0) 01583 { 01584 return i; 01585 } 01586 } 01587 return -1; 01588 } |
Here is the call graph for this function:
|
Definition at line 550 of file CSGame.cpp. References INIT_COUNT, LOG_ENTER, LOG_EXIT, mInitCount, and mSecPerFrame. Referenced by nextLevel(), and run().
00551 { 00552 static char *functionName="initSpeed"; 00553 LOG_ENTER 00554 mInitCount = INIT_COUNT; 00555 mSecPerFrame = 0.0f; 00556 LOG_EXIT 00557 } |
|
Definition at line 263 of file CSGame.h. References mLevelFinished.
00263 {mLevelFinished = true;} |
|
Definition at line 264 of file CSGame.h. References addSprite(), and mMainSprite. Referenced by initLevel().
00265 { 00266 mMainSprite = sprite; 00267 addSprite(sprite); 00268 } |
Here is the call graph for this function:
|
Definition at line 491 of file CSGame.cpp. References CSWorld::addSprite(), LOG_ENTER, LOG_EXIT, mSprites, mWorld, mWorldCount, and removeSprite(). Referenced by addMainSprite(), and initLevel().
00492 { 00493 static char *functionName="addSprite"; 00494 LOG_ENTER 00495 // savety meassure, not to add twice! 00496 removeSprite(sprite); 00497 for (int i=0; i < mWorldCount; i++) 00498 { 00499 mWorld[i]->addSprite(sprite); 00500 } 00501 mSprites.push_back(sprite); 00502 LOG_EXIT 00503 } |
Here is the call graph for this function:
|
Definition at line 505 of file CSGame.cpp. References LOG_ENTER, LOG_EXIT, mSprites, mWorld, mWorldCount, and CSWorld::removeSprite(). Referenced by addSprite(), and freeLevel().
00506 { 00507 static char *functionName="removeSprite"; 00508 LOG_ENTER 00509 for (int i=0; i < mWorldCount; i++) 00510 { 00511 mWorld[i]->removeSprite(sprite); 00512 } 00513 CSSprites::iterator iter = mSprites.begin(); 00514 while (iter != mSprites.end()) 00515 { 00516 if ((*iter) == sprite) 00517 { 00518 mSprites.erase(iter); 00519 iter = mSprites.begin(); // restart! 00520 } 00521 else 00522 { 00523 iter++; 00524 } 00525 } 00526 00527 // TODO: ensure, that the listener is not currently enqueued with 00528 // a waiting message! 00529 LOG_EXIT 00530 } |
Here is the call graph for this function:
|
Definition at line 271 of file CSGame.h. Referenced by run().
00271 {}; |
|
Definition at line 272 of file CSGame.h. Referenced by run().
00272 {}; |
|
Definition at line 273 of file CSGame.h. Referenced by run().
00273 {}; |
|
Definition at line 395 of file CSGame.cpp. References CHECK_HIT, CHECK_PIXEL, CSSprite::checkCollision(), CSSprite::checkCollisionPixels(), CSTiles, CSSprite::getCollidingTiles(), CSWorld::getLayer(), TileCollisionCheckData::layer, GameMessage::layer, mCurrentWorld, MESSAGE_SPRITE_SPRITE_COLLISION, MESSAGE_SPRITE_TILE_COLLISION, GameMessage::other, SpriteCollisionCheckData::other, GameMessage::pixels, CSMessageDispatchable::sendMessage(), TileCollisionCheckData::sprite, GameMessage::sprite, SpriteCollisionCheckData::sprite, SpriteCollisionCheckData::threshold, GameMessage::tile, GameMessage::tiles, TileCollisionCheckData::type, and SpriteCollisionCheckData::type. Referenced by run().
00396 { 00397 static char *functionName="checkCollisions"; 00398 // sprite 00399 SpriteCollisionCheckDatas::iterator iter = mSpriteCollisionCheckDatas.begin(); 00400 while (iter != mSpriteCollisionCheckDatas.end()) 00401 { 00402 SpriteCollisionCheckData *data = *iter; 00403 int count = 0; 00404 if (data->type == CHECK_HIT) 00405 { 00406 if (data->sprite->checkCollision(data->other)) 00407 { 00408 count = 10000000; // something like max int 00409 } 00410 } 00411 else //CHECK_PIXEL 00412 { 00413 count = data->sprite->checkCollisionPixels(data->other); 00414 } 00415 if (count>data->threshold) 00416 { 00417 MESSAGE_SPRITE_SPRITE_COLLISION.tiles.clear(); 00418 MESSAGE_SPRITE_SPRITE_COLLISION.tile = 0; 00419 MESSAGE_SPRITE_SPRITE_COLLISION.layer = -1; 00420 00421 MESSAGE_SPRITE_SPRITE_COLLISION.sprite = data->sprite; 00422 MESSAGE_SPRITE_SPRITE_COLLISION.other = data->other; 00423 MESSAGE_SPRITE_SPRITE_COLLISION.pixels = count; 00424 sendMessage(MESSAGE_SPRITE_SPRITE_COLLISION); 00425 } 00426 iter++; 00427 } 00428 00429 // tile 00430 TileCollisionCheckDatas::iterator titer = mTileCollisionCheckDatas.begin(); 00431 while (titer != mTileCollisionCheckDatas.end()) 00432 { 00433 TileCollisionCheckData *data = *titer; 00434 int count = 0; 00435 if (data->type == CHECK_HIT) 00436 { 00437 CSTiles tiles = data->sprite->getCollidingTiles(mCurrentWorld->getLayer(data->layer)); 00438 if (tiles.size() >0) 00439 { 00440 CSTiles::iterator ttiter = tiles.begin(); 00441 while (ttiter != tiles.end()) 00442 { 00443 MESSAGE_SPRITE_TILE_COLLISION.tiles.clear(); 00444 MESSAGE_SPRITE_TILE_COLLISION.tile = *ttiter; 00445 MESSAGE_SPRITE_TILE_COLLISION.other = 0; 00446 MESSAGE_SPRITE_TILE_COLLISION.sprite = data->sprite; 00447 MESSAGE_SPRITE_TILE_COLLISION.layer = data->layer; 00448 MESSAGE_SPRITE_TILE_COLLISION.pixels = 1; 00449 sendMessage(MESSAGE_SPRITE_TILE_COLLISION); 00450 ttiter++; 00451 } 00452 } 00453 } 00454 else if (data->type == CHECK_PIXEL) 00455 { 00456 CSTiles tiles = data->sprite->getCollidingTiles(mCurrentWorld->getLayer(data->layer)); 00457 if (tiles.size() >0) 00458 { 00459 CSTiles::iterator ttiter = tiles.begin(); 00460 while (ttiter != tiles.end()) 00461 { 00462 MESSAGE_SPRITE_TILE_COLLISION.tiles.clear(); 00463 MESSAGE_SPRITE_TILE_COLLISION.tile = *ttiter; 00464 MESSAGE_SPRITE_TILE_COLLISION.other = 0; 00465 MESSAGE_SPRITE_TILE_COLLISION.sprite = data->sprite; 00466 MESSAGE_SPRITE_TILE_COLLISION.layer = data->layer; 00467 MESSAGE_SPRITE_TILE_COLLISION.pixels = data->sprite->checkCollisionPixels(*ttiter); 00468 sendMessage(MESSAGE_SPRITE_TILE_COLLISION); 00469 ttiter++; 00470 } 00471 } 00472 } 00473 else // CHECK_JUST_HIT 00474 { 00475 CSTiles tiles = data->sprite->getCollidingTiles(mCurrentWorld->getLayer(data->layer)); 00476 if (tiles.size() >0) 00477 { 00478 MESSAGE_SPRITE_TILE_COLLISION.tiles = tiles; 00479 MESSAGE_SPRITE_TILE_COLLISION.tile = 0; 00480 MESSAGE_SPRITE_TILE_COLLISION.other = 0; 00481 MESSAGE_SPRITE_TILE_COLLISION.sprite = data->sprite; 00482 MESSAGE_SPRITE_TILE_COLLISION.layer = data->layer; 00483 MESSAGE_SPRITE_TILE_COLLISION.pixels = 1; 00484 sendMessage(MESSAGE_SPRITE_TILE_COLLISION); 00485 } 00486 } 00487 titer++; 00488 } 00489 } |
Here is the call graph for this function:
|
Definition at line 1148 of file CSGame.cpp. References CSWorld::getHeight(), CSSprite::getMaxHeight(), CSSprite::getMaxWidth(), CSWorld::getWidth(), getWorld(), CSSprite::getXPos(), CSSprite::getYPos(), MESSAGE_SPRITE_OUT_OF_BOUNDS, CSMessageDispatchable::sendMessage(), CSMessage::setSubsubtype(), GameMessage::sprite, OutOfBoundsData::sprite, OutOfBoundsData::threshold, X_HIGHER, X_LOWER, Y_HIGHER, and Y_LOWER. Referenced by run().
01149 { 01150 static char *functionName="checkOutOfBounds"; 01151 // sprite 01152 OutOfBoundsDatas::iterator iter = mOutOfBoundsDatas.begin(); 01153 while (iter != mOutOfBoundsDatas.end()) 01154 { 01155 OutOfBoundsData *data = *iter; 01156 int count = 0; 01157 int yl = data->sprite->getYPos() - data->threshold; 01158 int xl = data->sprite->getXPos() - data->threshold; 01159 int yh = yl+data->sprite->getMaxHeight() + data->threshold; 01160 int xh = xl+data->sprite->getMaxWidth() + data->threshold; 01161 01162 if (yh > getWorld()->getHeight()) 01163 { 01164 MESSAGE_SPRITE_OUT_OF_BOUNDS.setSubsubtype(Y_HIGHER); 01165 MESSAGE_SPRITE_OUT_OF_BOUNDS.sprite = data->sprite; 01166 sendMessage(MESSAGE_SPRITE_OUT_OF_BOUNDS); 01167 } 01168 else if (yl < 0) 01169 { 01170 MESSAGE_SPRITE_OUT_OF_BOUNDS.setSubsubtype(Y_LOWER); 01171 MESSAGE_SPRITE_OUT_OF_BOUNDS.sprite = data->sprite; 01172 sendMessage(MESSAGE_SPRITE_OUT_OF_BOUNDS); 01173 } 01174 if (xh > getWorld()->getWidth()) 01175 { 01176 MESSAGE_SPRITE_OUT_OF_BOUNDS.setSubsubtype(X_HIGHER); 01177 MESSAGE_SPRITE_OUT_OF_BOUNDS.sprite = data->sprite; 01178 sendMessage(MESSAGE_SPRITE_OUT_OF_BOUNDS); 01179 } 01180 else if (xl < 0) 01181 { 01182 MESSAGE_SPRITE_OUT_OF_BOUNDS.setSubsubtype(X_LOWER); 01183 MESSAGE_SPRITE_OUT_OF_BOUNDS.sprite = data->sprite; 01184 sendMessage(MESSAGE_SPRITE_OUT_OF_BOUNDS); 01185 } 01186 iter++; 01187 } 01188 } |
Here is the call graph for this function:
|
Definition at line 276 of file CSGame.h.
00276 {mDisplayScaled = b;} |
|
Definition at line 277 of file CSGame.h.
00277 {return mDisplayScaled;}
|
|
Definition at line 1409 of file CSGame.cpp. References LOG_ENTER, LOG_EXIT, mCurrentWorld, and CSWorld::setScaleDisplayLayer().
01410 { 01411 static char *functionName="setScaleDisplayLayer"; 01412 LOG_ENTER 01413 mCurrentWorld->setScaleDisplayLayer(b,layer); 01414 LOG_EXIT 01415 } |
Here is the call graph for this function:
|
Definition at line 872 of file CSGame.cpp. References SpriteData::behaviour, CSLevelData::descriptions, CSXMLHelper::getError(), CSXMLHelper::getErrorMessage(), CSXMLHelper::getInt(), CSXMLHelper::getString(), CSLevelData::id, loadLevelDataSpecific(), LOG_ENTER, LOG_EXIT, CSLevelData::mainSprite, SampleData::name, SpriteData::name, CSLevelData::samples, SDLMain::shutdown(), SampleData::sid, SpriteData::speed, CSLevelData::sprites, CSLevelData::worlds, SpriteData::x, SpriteData::y, and SpriteData::z. Referenced by initLevel().
00873 { 00874 static char *functionName="loadLevelData"; 00875 LOG_ENTER 00876 char tmp[10]; 00877 int i; 00878 CSXMLHelper xmlSupport(filename, "LEVEL"); 00879 try 00880 { 00881 if (xmlSupport.getError()) 00882 { 00883 throw "error"; 00884 } 00885 00886 data->id = strdup(xmlSupport.getString("ID").c_str()); 00887 int dCount = xmlSupport.getInt("count(DESCRIPTION)"); 00888 if (dCount > 0) 00889 { 00890 for (i=0; i<dCount; i++) 00891 { 00892 char *line; 00893 // i+1, predicates in xpath start with 1 00894 std::string a = xmlSupport.getString((std::string)"DESCRIPTION["+itoa(i+1,tmp,10)+"]"); 00895 line = strdup(a.c_str()); 00896 00897 data->descriptions.push_back(line); 00898 } 00899 } 00900 int wCount = xmlSupport.getInt("count(WORLD)"); 00901 for (i=0; i<wCount; i++) 00902 { 00903 char *line; 00904 // i+1, predicates in xpath start with 1 00905 std::string a = xmlSupport.getString((std::string)"WORLD["+itoa(i+1,tmp,10)+"]"); 00906 line = strdup(a.c_str()); 00907 00908 data->worlds.push_back(line); 00909 } 00910 data->mainSprite.name = strdup(xmlSupport.getString((std::string)"MAIN_SPRITE/NAME").c_str()); 00911 data->mainSprite.speed = xmlSupport.getInt("MAIN_SPRITE/SPEED"); 00912 data->mainSprite.x = xmlSupport.getInt("MAIN_SPRITE/START_POSITION/X"); 00913 data->mainSprite.y = xmlSupport.getInt("MAIN_SPRITE/START_POSITION/Y"); 00914 data->mainSprite.z = xmlSupport.getInt("MAIN_SPRITE/START_POSITION/Z"); 00915 00916 int sCount = xmlSupport.getInt("count(SPRITE)"); 00917 for (i=0; i<sCount; i++) 00918 { 00919 SpriteData *sData = new SpriteData(); 00920 sData->name = strdup(xmlSupport.getString((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/NAME").c_str()); 00921 sData->speed = xmlSupport.getInt((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/SPEED"); 00922 sData->x = xmlSupport.getInt((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/START_POSITION/X"); 00923 sData->y = xmlSupport.getInt((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/START_POSITION/Y"); 00924 sData->z = xmlSupport.getInt((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/START_POSITION/Z"); 00925 sData->behaviour = xmlSupport.getInt((std::string)"SPRITE["+itoa(i+1,tmp,10)+"]/BEHAVIOUR"); 00926 00927 data->sprites.push_back(sData); 00928 } 00929 00930 sCount = xmlSupport.getInt("count(SAMPLE)"); 00931 for (i=0; i<sCount; i++) 00932 { 00933 SampleData *sData = new SampleData(); 00934 sData->name = strdup(xmlSupport.getString((std::string)"SAMPLE["+itoa(i+1,tmp,10)+"]/NAME").c_str()); 00935 sData->sid = strdup(xmlSupport.getString((std::string)"SAMPLE["+itoa(i+1,tmp,10)+"]/SID").c_str()); 00936 data->samples.push_back(sData); 00937 } 00938 loadLevelDataSpecific(xmlSupport); 00939 } 00940 catch(...) 00941 { 00942 LOG_EXIT 00943 SDLMain::shutdown((std::string)"XML error \"" + filename + "\": " + xmlSupport.getErrorMessage().c_str(), 1); 00944 } 00945 LOG_EXIT 00946 } |
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Definition at line 948 of file CSGame.cpp. References clearSamples(), clearTimedEvents(), freeLevelSpecific(), LOG_ENTER, LOG_EXIT, mLevelData, mMainSprite, mScaleCenterSprite, mSprites, mWorld, mWorldCount, and removeSprite(). Referenced by nextLevel(), run(), and ~CSGame().
00949 { 00950 static char *functionName="freeLevel"; 00951 LOG_ENTER 00952 freeLevelSpecific(); 00953 clearTimedEvents(); 00954 clearSamples(); 00955 if (mMainSprite != 0) 00956 { 00957 removeSprite(mMainSprite); 00958 delete mMainSprite; 00959 mMainSprite = 0; 00960 } 00961 mScaleCenterSprite = 0; 00962 00963 CSSprites::iterator iter = mSprites.begin(); 00964 while (iter != mSprites.end()) 00965 { 00966 CSSprite *sprite = *iter; 00967 removeSprite(sprite); 00968 delete sprite; 00969 iter = mSprites.begin(); 00970 } 00971 mSprites.clear(); 00972 00973 if (mWorld != 0) 00974 { 00975 for (int i=0; i < mWorldCount; i++) 00976 { 00977 delete mWorld[i]; 00978 } 00979 00980 delete[] mWorld; 00981 mWorld = 0; 00982 } 00983 if (mLevelData != 0) 00984 { 00985 delete mLevelData; 00986 mLevelData = 0; 00987 } 00988 LOG_EXIT 00989 } |
Here is the call graph for this function:
|
Definition at line 1066 of file CSGame.cpp. References CSXMLHelper::getError(), CSXMLHelper::getErrorMessage(), CSXMLHelper::getInt(), CSXMLHelper::getString(), LOG_ENTER, LOG_EXIT, and SDLMain::shutdown(). Referenced by CSGame().
01067 { 01068 static char *functionName="loadGameData"; 01069 LOG_ENTER 01070 char tmp[10]; 01071 int i; 01072 if (filename.size() == 0) 01073 { 01074 // a dummy game? 01075 // just the gui? 01076 dummyGame = true; 01077 return; 01078 } 01079 01080 CSXMLHelper xmlSupport(filename, "GAME"); 01081 try 01082 { 01083 if (xmlSupport.getError()) 01084 { 01085 throw "error"; 01086 } 01087 01088 mId = strdup(xmlSupport.getString("ID").c_str()); 01089 int lCount = xmlSupport.getInt("count(LEVEL)"); 01090 if (lCount > 0) 01091 { 01092 for (i=0; i<lCount; i++) 01093 { 01094 char *line; 01095 // i+1, predicates in xpath start with 1 01096 std::string a = xmlSupport.getString((std::string)"LEVEL["+itoa(i+1,tmp,10)+"]"); 01097 line = strdup(a.c_str()); 01098 mLevels.push_back(line); 01099 } 01100 } 01101 } 01102 catch(...) 01103 { 01104 LOG_EXIT 01105 SDLMain::shutdown((std::string)"XML error \"" + filename + "\": " + xmlSupport.getErrorMessage().c_str(), 1); 01106 } 01107 LOG_EXIT 01108 } |
Here is the call graph for this function:
|
Definition at line 1052 of file CSGame.cpp. References checkWorld(), getDisplayArea(), LOG_ENTER, LOG_EXIT, mCurrentWorld, mWorld, mWorldCount, and CSWorld::setDisplayArea(). Referenced by initLevel(), and resetSprites().
01053 { 01054 static char *functionName="setCurrentWorld"; 01055 LOG_ENTER 01056 mCurrentWorld = mWorld[w]; 01057 mCurrentWorld->setDisplayArea(getDisplayArea()); 01058 for (int i=0; i < mWorldCount; i++) 01059 { 01060 mWorld[i]->setActive(i==w); 01061 } 01062 checkWorld(); 01063 LOG_EXIT 01064 } |
Here is the call graph for this function:
|
Definition at line 225 of file CSGame.cpp. References SDLMain::getInstance(), SDLMain::getScreenHeight(), SDLMain::getScreenWidth(), LOG_ENTER, and LOG_EXIT. Referenced by initLevel(), and setCurrentWorld().
00226 { 00227 static char *functionName="getDisplayArea"; 00228 LOG_ENTER 00229 SDL_Rect area; 00230 area.x = 0; 00231 area.y = 0; 00232 area.w = SDLMain::getInstance()->getScreenWidth(); 00233 area.h = SDLMain::getInstance()->getScreenHeight(); 00234 LOG_EXIT 00235 return area; 00236 } |
Here is the call graph for this function:
|
Definition at line 238 of file CSGame.cpp. References LOG_ENTER, and LOG_EXIT. Referenced by initLevel().
|
|
Definition at line 288 of file CSGame.h. Referenced by initLevel().
00288 {return 0.5;}
|
|
Definition at line 1110 of file CSGame.cpp. Referenced by initLevel().
01111 { 01112 static char *functionName="addSample"; 01113 mSampleMap.insert(std::map<std::string, CSSample *>::value_type(sid, sample)); 01114 } |
|
Definition at line 1116 of file CSGame.cpp.
01117 { 01118 static char *functionName="removeSample"; 01119 // delete single object 01120 std::map<std::string, CSSample *>::iterator iter; 01121 for (iter = mSampleMap.begin(); iter!=mSampleMap.end(); iter++) 01122 { 01123 if (strcmp(sid, iter->first.c_str()) == 0) 01124 { 01125 mSampleMap.erase(iter); 01126 } 01127 } 01128 } |
|
Definition at line 1130 of file CSGame.cpp. References LOG_ENTER, and LOG_EXIT. Referenced by freeLevel().
|
|
Definition at line 626 of file CSGame.cpp. References checkWorld(), freeLevel(), initLevel(), initSpeed(), LOG_ENTER, LOG_EXIT, and mCurrentLevel. Referenced by run().
00627 { 00628 static char *functionName="nextLevel"; 00629 LOG_ENTER 00630 mCurrentLevel = (mCurrentLevel+1) % mLevels.size(); 00631 freeLevel(); 00632 initLevel(mLevels.at(mCurrentLevel)); 00633 initSpeed(); 00634 checkWorld(); 00635 LOG_EXIT 00636 } |
Here is the call graph for this function:
|
Definition at line 294 of file CSGame.h.
00294 {} |
|
Definition at line 1372 of file CSGame.cpp. References CSSprite::adjustSpeed(), LOG_ENTER, LOG_EXIT, and mSprites.
|
Here is the call graph for this function:
|
Definition at line 1348 of file CSGame.cpp. References LOG_ENTER, LOG_EXIT, CSLevelData::mainSprite, mLevelData, mMainSprite, mSprites, resetSpritesSpecific(), setCurrentWorld(), CSSprite::setPosition(), CSLevelData::sprites, SpriteData::x, SpriteData::y, and SpriteData::z.
01349 { 01350 static char *functionName="resetSprites"; 01351 LOG_ENTER 01352 int i; 01353 CSSprites::iterator iter = mSprites.begin(); 01354 for (i = 0; i < mLevelData->sprites.size(); i++) 01355 { 01356 CSSprite* sprite = *iter; 01357 sprite->setPosition(mLevelData->sprites.at(i)->x, 01358 mLevelData->sprites.at(i)->y, 01359 mLevelData->sprites.at(i)->z); 01360 iter++; 01361 } 01362 01363 if (mMainSprite != 0) 01364 { 01365 mMainSprite->setPosition(mLevelData->mainSprite.x, mLevelData->mainSprite.y, mLevelData->mainSprite.z); 01366 setCurrentWorld(mLevelData->mainSprite.z); 01367 } 01368 resetSpritesSpecific(); 01369 LOG_EXIT 01370 } |
Here is the call graph for this function:
|
Definition at line 1288 of file CSGame.cpp. References LOG_ENTER, and LOG_EXIT. Referenced by freeLevel().
01289 { 01290 static char *functionName="clearTimedEvents"; 01291 LOG_ENTER 01292 CSEventMap::iterator iter = mEventMap->begin(); 01293 while (iter!=mEventMap->end()) 01294 { 01295 TimedEvent *event = iter->second; 01296 mEventMap->erase(iter); 01297 delete (event); 01298 iter = mEventMap->begin(); 01299 } 01300 LOG_EXIT 01301 } |
|
Definition at line 298 of file CSGame.h.
00298 {mEnableCheck = b;} |
|
Definition at line 300 of file CSGame.h. Referenced by loadLevelData().
00300 {} |
|
Definition at line 301 of file CSGame.h. Referenced by initLevel().
00301 {} |
|
Definition at line 302 of file CSGame.h. Referenced by freeLevel().
00302 {} |
|
Definition at line 303 of file CSGame.h. Referenced by resetSprites().
00303 {} |
|
Definition at line 1386 of file CSGame.cpp. References CSSample::isPlaying().
01387 { 01388 static char *functionName="isSamplePlaying"; 01389 return CSSample::isPlaying(); 01390 } |
Here is the call graph for this function:
|
Reimplemented from CSMessageDispatchable. Definition at line 311 of file CSGame.h. References CLASS.
00311 {return (std::string) CLASS;} |
|
Definition at line 1571 of file CSGame.cpp.
01572 { 01573 } |
|
Definition at line 639 of file CSGame.cpp. References SDLMain::addUpdateRect(), checkCollisions(), checkOutOfBounds(), checkWorld(), COLOR, CSMessageListener::dispatchQueuedMessages(), CSWorld::display(), displayGameData(), CSWorld::displayScaled(), endRun(), freeLevel(), SDLMain::getScreenHeight(), SDLMain::getScreenWidth(), handleEvents(), INIT_COUNT, initLevel(), initSpeed(), LOG_ENTER, LOG_EXIT, mAverageFrameRate, mCurrentLevel, mCurrentTime, mCurrentWorld, mDesktop, mDiffTime, mGameTime, mInitCount, mLevelFinished, mPause, mQuit, mScaleCenterSprite, mSecPerFrame, mStartLevel, mWorld, mWorldCount, nextLevel(), p, CSDesktop::paint(), CSFont::putString(), CSWorld::setSecPerFrame(), startRun(), CSWorld::update(), and SDLMain::updateScreen().
00640 { 00641 static char *functionName="run"; 00642 LOG_ENTER 00643 mCurrentTime = SDL_GetTicks(); 00644 mDiffTime = 0; 00645 mSecPerFrame = 0; 00646 mGameTime = 0; 00647 mCurrentLevel = mStartLevel; 00648 00649 initSpeed(); 00650 if (!dummyGame) 00651 { 00652 freeLevel(); 00653 initLevel(mLevels.at(mCurrentLevel)); 00654 00655 checkWorld(); 00656 00657 for (int i=0; i < mWorldCount; i++) 00658 { 00659 mWorld[i]->update(); 00660 } 00661 if (mIsWorldOutOfBounds) 00662 { 00663 adjustDisplay(); 00664 } 00665 } 00666 00667 while (!mQuit) 00668 { 00669 static int count = 0; 00670 static int frameRateTotal = 0; 00671 long allDrawStart = SDL_GetTicks(); 00672 00673 mCurrentTime = SDL_GetTicks(); 00674 do 00675 { 00676 handleEvents(); 00677 if (mPause) 00678 { 00679 SDL_Delay(50); 00680 } 00681 } 00682 while ((mPause) && (!mQuit)); 00683 { 00684 char str[100]; 00685 sprintf(str, "GUI Update time in millseconds: %i ", mDiffTimeGUI); 00686 mFont->putString(SDLMain::getScreen(), 0, 40+50, str); 00687 00688 sprintf(str, "Game Update time in millseconds: %i ", mDiffTimeGame); 00689 mFont->putString(SDLMain::getScreen(), 0, 55+50, str); 00690 00691 sprintf(str, "All Update time in millseconds: %i ", mDiffTimeAll); 00692 mFont->putString(SDLMain::getScreen(), 0, 70+50, str); 00693 00694 sprintf(str, "Framerate (average, current): %i, %i ", mAverageFrameRate, mCurrentFrameRate); 00695 mFont->putString(SDLMain::getScreen(), 0, 85+50, str); 00696 } 00697 00698 if (mIsGui) 00699 { 00700 long desktopDrawStart = SDL_GetTicks(); 00701 00702 SDL_Rect area; 00703 area.x = 0; 00704 area.y = 0; 00705 area.w = SDLMain::getScreenWidth(); 00706 area.h = SDLMain::getScreenHeight(); 00707 mDesktop->paint(SDLMain::getScreen(), 0); 00708 SDLMain::updateScreen(); 00709 SDL_FillRect(SDLMain::getScreen(), &area, COLOR(SDLMain::getScreen(), 0)); 00710 SDLMain::addUpdateRect(area); 00711 mDiffTimeGUI = SDL_GetTicks() - desktopDrawStart; 00712 } 00713 else 00714 { 00715 if (mLastIsGui) // make sure double buffers are deleted 00716 { 00717 SDL_Rect area; 00718 area.x = 0; 00719 area.y = 0; 00720 area.w = SDLMain::getScreenWidth(); 00721 area.h = SDLMain::getScreenHeight(); 00722 SDLMain::updateScreen(); 00723 SDL_FillRect(SDLMain::getScreen(), &area, COLOR(SDLMain::getScreen(), 0)); 00724 SDLMain::addUpdateRect(area); 00725 } 00726 else 00727 { 00728 SDLMain::updateScreen(); 00729 } 00730 } 00731 long gameStart = SDL_GetTicks(); 00732 mLastIsGui = mIsGui; 00733 startRun(); 00734 for (int i=0; i < mWorldCount; i++) 00735 { 00736 mWorld[i]->update(); 00737 } 00738 if (mIsWorldOutOfBounds) 00739 { 00740 adjustDisplay(); 00741 } 00742 checkOutOfBounds(); 00743 // checkCollisions(); // before // - not done yet 00744 if (!dummyGame) 00745 { 00746 mCurrentWorld->display(); 00747 if ((mDisplayScaled) && (mScaleCenterSprite != 0)) 00748 { 00749 mCurrentWorld->displayScaled(mScaleCenterSprite); 00750 } 00751 } 00752 00753 dispatchQueuedMessages(); 00754 if (mEnableCheck) 00755 { 00756 checkCollisions(); // after 00757 } 00758 checkTimedEvent(); 00759 endRun(); 00760 displayGameData(); 00761 mDiffTime = SDL_GetTicks() - mCurrentTime; 00762 mGameTime += mDiffTime; 00763 mCurrentFrameRate = (int)(1/(float (mDiffTime/1000.0f))); 00764 frameRateTotal += mCurrentFrameRate; 00765 count++; 00766 mAverageFrameRate = frameRateTotal/count; 00767 mDiffTimeGame = SDL_GetTicks() - gameStart; 00768 if (mInitCount) 00769 { 00770 count = 0; 00771 frameRateTotal = 0; 00772 mInitCount--; 00773 mSecPerFrame += (float (mDiffTime/1000.0f)); 00774 00775 if (mInitCount == 0) 00776 { 00777 mSecPerFrame = (float) (mSecPerFrame / ((float)INIT_COUNT)); 00778 for (int i=0; i < mWorldCount; i++) 00779 { 00780 mWorld[i]->setSecPerFrame(mSecPerFrame); 00781 } 00782 } 00783 } 00784 00785 if ((p==1) || (mLevelFinished)) 00786 { 00787 nextLevel(); 00788 p=0; 00789 } 00790 mDiffTimeAll = SDL_GetTicks() - allDrawStart; 00791 } 00792 LOG_EXIT 00793 } |
Here is the call graph for this function:
|
Definition at line 564 of file CSGame.cpp. References GuiMessage::actionId, doPause(), END_MESSAGE, GAME_MESSAGE, CSMessage::getSubtype(), CSMessage::getType(), GUI_MESSAGE, mQuit, PAUSE_MESSAGE, QUIT_ACTION_ID, SCREEN_CHANGED_MESSAGE, SDL_MESSAGE, TOGGLE_FULLSCREEN_MESSAGE, and TOGGLE_GUI_MESSAGE. Referenced by reactOnMessage().
00565 { 00566 static char *functionName="reactOnMessage"; 00567 switch (message->getType()) 00568 { 00569 case GAME_MESSAGE: 00570 { 00571 switch (message->getSubtype()) 00572 { 00573 case END_MESSAGE: 00574 { 00575 mQuit = true; 00576 return; 00577 } 00578 00579 case PAUSE_MESSAGE: 00580 { 00581 doPause(); 00582 return; 00583 } 00584 00585 case TOGGLE_FULLSCREEN_MESSAGE: 00586 { 00587 toggleFullscreen(); 00588 return; 00589 } 00590 case TOGGLE_GUI_MESSAGE: 00591 { 00592 toggleGui(); 00593 return; 00594 } 00595 } 00596 break; 00597 } 00598 case SDL_MESSAGE: 00599 { 00600 switch (message->getSubtype()) 00601 { 00602 case SCREEN_CHANGED_MESSAGE: 00603 { 00604 screenChanged(); 00605 return; 00606 } 00607 } 00608 break; 00609 } 00610 case GUI_MESSAGE: 00611 { 00612 GuiMessage *gm = (GuiMessage *) message; 00613 switch (gm->actionId) 00614 { 00615 case QUIT_ACTION_ID: 00616 { 00617 mQuit = true; 00618 return; 00619 } 00620 } 00621 break; 00622 } 00623 } 00624 } |
Here is the call graph for this function:
|
Implements CSMessageListener. Definition at line 559 of file CSGame.cpp. References reactOnMessageGame().
00560 { 00561 reactOnMessageGame(message); 00562 } |
Here is the call graph for this function:
|
Definition at line 317 of file CSGame.h. References CSSprites, and mSprites.
00317 {return &mSprites;} |
|
Definition at line 318 of file CSGame.h. References mMainSprite.
00318 {return mMainSprite;} |
|
Definition at line 319 of file CSGame.h. References mCurrentWorld. Referenced by checkOutOfBounds().
00319 {return mCurrentWorld;} |
|
Definition at line 797 of file CSGame.cpp. References CSWorld::getDisplayXLowerBound(), CSWorld::getDisplayXUpperBound(), CSWorld::getDisplayYLowerBound(), CSWorld::getDisplayYUpperBound(), CSWorld::getHeight(), CSWorld::getWidth(), LOG_ENTER, LOG_EXIT, and mCurrentWorld. Referenced by nextLevel(), run(), and setCurrentWorld().
00798 { 00799 static char *functionName="checkWorld"; 00800 LOG_ENTER 00801 mIsWorldOutOfBounds = false; 00802 00803 unsigned int ww = mCurrentWorld->getWidth(); 00804 unsigned int wh = mCurrentWorld->getHeight(); 00805 00806 unsigned int dx = mCurrentWorld->getDisplayXLowerBound(); 00807 unsigned int dX = mCurrentWorld->getDisplayXUpperBound(); 00808 unsigned int dy = mCurrentWorld->getDisplayYLowerBound(); 00809 unsigned int dY = mCurrentWorld->getDisplayYUpperBound(); 00810 00811 unsigned int dw = dX - dx; 00812 unsigned int dh = dY - dy; 00813 00814 if ((ww > dw) || (wh > dh)) mIsWorldOutOfBounds = true; 00815 LOG_EXIT 00816 } |
Here is the call graph for this function:
|
Definition at line 251 of file CSGame.cpp. References LOG_ENTER, and LOG_EXIT.
00252 { 00253 static char *functionName="enableOutOfBoundsCheck"; 00254 LOG_ENTER 00255 OutOfBoundsData *data = new OutOfBoundsData(); 00256 data->sprite = sprite; 00257 data->listener = listener; 00258 data->threshold = threshold; 00259 mOutOfBoundsDatas.push_back(data); 00260 LOG_EXIT 00261 } |
|
Definition at line 297 of file CSGame.cpp. References CHECK_JUST_HIT, LOG_ENTER, and LOG_EXIT.
00298 { 00299 static char *functionName="enableTileCollisionCheckJustHit"; 00300 LOG_ENTER 00301 TileCollisionCheckData *data = new TileCollisionCheckData(); 00302 data->type = CHECK_JUST_HIT; 00303 data->sprite = sprite; 00304 data->layer = layer; 00305 data->listener = listener; 00306 mTileCollisionCheckDatas.push_back(data); 00307 LOG_EXIT 00308 } |
|
Definition at line 284 of file CSGame.cpp. References CHECK_HIT, LOG_ENTER, and LOG_EXIT.
00285 { 00286 static char *functionName="enableTileCollisionCheck"; 00287 LOG_ENTER 00288 TileCollisionCheckData *data = new TileCollisionCheckData(); 00289 data->type = CHECK_HIT; 00290 data->sprite = sprite; 00291 data->layer = layer; 00292 data->listener = listener; 00293 mTileCollisionCheckDatas.push_back(data); 00294 LOG_EXIT 00295 } |
|
Definition at line 310 of file CSGame.cpp. References CHECK_PIXEL, LOG_ENTER, and LOG_EXIT.
00311 { 00312 static char *functionName="enableTileCollisionCheckPixel"; 00313 LOG_ENTER 00314 TileCollisionCheckData *data = new TileCollisionCheckData(); 00315 data->type = CHECK_PIXEL; 00316 data->sprite = sprite; 00317 data->layer = layer; 00318 data->listener = listener; 00319 data->threshold = pixelThreshold; 00320 mTileCollisionCheckDatas.push_back(data); 00321 LOG_EXIT 00322 } |
|
Definition at line 324 of file CSGame.cpp. References CHECK_HIT, LOG_ENTER, and LOG_EXIT.
00325 { 00326 static char *functionName="enableSpriteCollisionCheck"; 00327 LOG_ENTER 00328 SpriteCollisionCheckData *data = new SpriteCollisionCheckData(); 00329 data->type = CHECK_HIT; 00330 data->sprite = sprite; 00331 data->other = other; 00332 data->listener = listener; 00333 mSpriteCollisionCheckDatas.push_back(data); 00334 LOG_EXIT 00335 } |
|
Definition at line 337 of file CSGame.cpp. References CHECK_PIXEL, LOG_ENTER, and LOG_EXIT.
00338 { 00339 static char *functionName="enableSpriteCollisionCheckPixel"; 00340 LOG_ENTER 00341 SpriteCollisionCheckData *data = new SpriteCollisionCheckData(); 00342 data->type = CHECK_PIXEL; 00343 data->sprite = sprite; 00344 data->other = other; 00345 data->listener = listener; 00346 data->threshold = pixelThreshold; 00347 mSpriteCollisionCheckDatas.push_back(data); 00348 LOG_EXIT 00349 } |
|
Definition at line 263 of file CSGame.cpp. References OutOfBoundsData::listener, LOG_ENTER, LOG_EXIT, and OutOfBoundsData::sprite.
00264 { 00265 static char *functionName="disableOutOfBoundsCheck"; 00266 LOG_ENTER 00267 OutOfBoundsDatas::iterator iter = mOutOfBoundsDatas.begin(); 00268 while (iter != mOutOfBoundsDatas.end()) 00269 { 00270 OutOfBoundsData *data = *iter; 00271 if ((data->sprite == sprite) && 00272 (data->listener == listener) 00273 ) 00274 { 00275 mOutOfBoundsDatas.erase(iter); 00276 delete data; 00277 break; 00278 } 00279 iter++; 00280 } 00281 LOG_EXIT 00282 } |
|
Definition at line 351 of file CSGame.cpp. References TileCollisionCheckData::layer, TileCollisionCheckData::listener, LOG_ENTER, LOG_EXIT, and TileCollisionCheckData::sprite.
00352 { 00353 static char *functionName="disableTileCollisionCheck"; 00354 LOG_ENTER 00355 TileCollisionCheckDatas::iterator iter = mTileCollisionCheckDatas.begin(); 00356 while (iter != mTileCollisionCheckDatas.end()) 00357 { 00358 TileCollisionCheckData *data = *iter; 00359 if ((data->sprite == sprite) && 00360 (data->layer == layer) && 00361 (data->listener == listener) 00362 ) 00363 { 00364 mTileCollisionCheckDatas.erase(iter); 00365 delete data; 00366 break; 00367 } 00368 iter++; 00369 } 00370 LOG_EXIT 00371 } |
|
Definition at line 373 of file CSGame.cpp. References SpriteCollisionCheckData::listener, LOG_ENTER, LOG_EXIT, SpriteCollisionCheckData::other, and SpriteCollisionCheckData::sprite.
00374 { 00375 static char *functionName="disableSpriteCollisionCheck"; 00376 LOG_ENTER 00377 SpriteCollisionCheckDatas::iterator iter = mSpriteCollisionCheckDatas.begin(); 00378 while (iter != mSpriteCollisionCheckDatas.end()) 00379 { 00380 SpriteCollisionCheckData *data = *iter; 00381 if ((data->sprite == sprite) && 00382 (data->other == other) && 00383 (data->listener == listener) 00384 ) 00385 { 00386 mSpriteCollisionCheckDatas.erase(iter); 00387 delete data; 00388 break; 00389 } 00390 iter++; 00391 } 00392 LOG_EXIT 00393 } |
|
Definition at line 332 of file CSGame.h.
00332 {mThreshold = threshold;} |
|
Definition at line 333 of file CSGame.h. References mStartLevel.
00333 {mStartLevel = l;} |
|
Definition at line 1138 of file CSGame.cpp.
01139 { 01140 static char *functionName="playSample"; 01141 std::map<std::string, CSSample *>::iterator iter = mSampleMap.find(sid); 01142 if (iter != mSampleMap.end()) 01143 { 01144 iter->second->play(); 01145 } 01146 } |
|
Definition at line 1190 of file CSGame.cpp. References LOG_ENTER, LOG_EXIT, mCurrentTime, mPause, CSSample::pauseAll(), and CSSample::resumeAll(). Referenced by reactOnMessageGame().
01191 { 01192 static char *functionName="doPause"; 01193 LOG_ENTER 01194 mPause = !mPause; 01195 if (mPause) 01196 { 01197 CSSample::pauseAll(); 01198 } 01199 else 01200 { 01201 CSSample::resumeAll(); 01202 mCurrentTime = SDL_GetTicks(); 01203 } 01204 LOG_EXIT 01205 } |
Here is the call graph for this function:
|
Definition at line 1230 of file CSGame.cpp. References TimedEvent::data, TimedEvent::finishTime, TimedEvent::id, TimedEvent::intervall, mGameTime, TimedEvent::repeat, and TimedEvent::useRepeat.
01231 { 01232 static char *functionName="addTimedEvent"; 01233 // don't add two events at exactly the same time! 01234 CSEventMap::iterator iter = mEventMap->find(mGameTime + timeSpace); 01235 while (iter != mEventMap->end()) 01236 { 01237 timeSpace++; 01238 iter = mEventMap->find(mGameTime + timeSpace); 01239 } 01240 01241 TimedEvent *event = new TimedEvent(); 01242 event->id = id; 01243 event->data = data; 01244 event->repeat = repeat; 01245 event->finishTime = mGameTime + timeSpace; 01246 event->intervall = timeSpace; 01247 event->useRepeat = repeatUse; 01248 01249 mEventMap->insert(CSEventMap::value_type(event->finishTime, event)); 01250 } |
|
Definition at line 1207 of file CSGame.cpp. References TimedEvent::answer, TimedEvent::data, TimedEvent::finishTime, TimedEvent::id, TimedEvent::intervall, mGameTime, TimedEvent::repeat, and TimedEvent::useRepeat.
01208 { 01209 static char *functionName="addTimedEvent"; 01210 // don't add two events at exactly the same time! 01211 CSEventMap::iterator iter = mEventMap->find(mGameTime + timeSpace); 01212 while (iter != mEventMap->end()) 01213 { 01214 timeSpace++; 01215 iter = mEventMap->find(mGameTime + timeSpace); 01216 } 01217 01218 TimedEvent *event = new TimedEvent(); 01219 event->id = id; 01220 event->data = data; 01221 event->repeat = repeat; 01222 event->finishTime = mGameTime + timeSpace; 01223 event->intervall = timeSpace; 01224 event->useRepeat = repeatUse; 01225 event->answer = answer; 01226 01227 mEventMap->insert(CSEventMap::value_type(event->finishTime, event)); 01228 } |
|
Definition at line 1270 of file CSGame.cpp. References TimedEvent::id.
01271 { 01272 static char *functionName="removeTimedEvent"; 01273 CSEventMap::iterator iter = mEventMap->begin(); 01274 while (iter!=mEventMap->end()) 01275 { 01276 TimedEvent *event = iter->second; 01277 if (event->id == id) 01278 { 01279 mEventMap->erase(iter); 01280 delete (event); 01281 iter = mEventMap->begin(); 01282 continue; 01283 } 01284 iter++; 01285 } 01286 } |
|
Definition at line 1252 of file CSGame.cpp. References TimedEvent::data, and TimedEvent::id.
01253 { 01254 static char *functionName="removeTimedEvent"; 01255 CSEventMap::iterator iter = mEventMap->begin(); 01256 while (iter!=mEventMap->end()) 01257 { 01258 TimedEvent *event = iter->second; 01259 if ((event->id == id) && (data == event->data)) 01260 { 01261 mEventMap->erase(iter); 01262 delete (event); 01263 iter = mEventMap->begin(); 01264 continue; 01265 } 01266 iter++; 01267 } 01268 } |
|
Definition at line 1417 of file CSGame.cpp. References LOG_ENTER, and LOG_EXIT.
|
|
Definition at line 342 of file CSGame.h. References CSFont::putString(). Referenced by print().
|
Here is the call graph for this function:
|
Definition at line 353 of file CSGame.h. References print().
00354 { 00355 char t[40]; 00356 sprintf(t, "%i", number); 00357 print(x, y, t); 00358 } |
Here is the call graph for this function:
|
Definition at line 233 of file CSGame.h. Referenced by freeLevel(), getLevelDataNum(), initLevel(), resetSprites(), and ~CSGame(). |
|
Definition at line 234 of file CSGame.h. Referenced by reactOnMessageGame(), and run(). |
|
|
|
Definition at line 236 of file CSGame.h. Referenced by initLevel(), run(), and setLevelFinished(). |
|
Definition at line 238 of file CSGame.h. Referenced by initSpeed(), and run(). |
|
|
|
Definition at line 240 of file CSGame.h. Referenced by run(). |
|
Definition at line 241 of file CSGame.h. Referenced by addTimedEvent(), and run(). |
|
Definition at line 242 of file CSGame.h. Referenced by run(). |
|
Definition at line 243 of file CSGame.h. Referenced by initSpeed(), and run(). |
|
Definition at line 247 of file CSGame.h. Referenced by handleEvents(), run(), and ~CSGame(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 253 of file CSGame.h. Referenced by addSprite(), disableSpriteMovement(), freeLevel(), getSprites(), removeSprite(), and resetSprites(). |
|
Definition at line 254 of file CSGame.h. Referenced by addMainSprite(), freeLevel(), getMainSprite(), initLevel(), and resetSprites(). |
|
Definition at line 255 of file CSGame.h. Referenced by freeLevel(), initLevel(), and run(). |
|
Definition at line 256 of file CSGame.h. Referenced by addSprite(), freeLevel(), initLevel(), removeSprite(), run(), and setCurrentWorld(). |
|
Definition at line 257 of file CSGame.h. Referenced by checkCollisions(), checkWorld(), getWorld(), initLevel(), run(), setCurrentWorld(), and setScaleDisplayLayer(). |
|
Definition at line 258 of file CSGame.h. Referenced by nextLevel(), and run(). |
|
Definition at line 259 of file CSGame.h. Referenced by run(), and setStartLevel(). |
|
Definition at line 260 of file CSGame.h. Referenced by addSprite(), freeLevel(), initLevel(), removeSprite(), run(), and setCurrentWorld(). |
|
|
|
Reimplemented from CSMessageDispatchable. Definition at line 32 of file CSGame.cpp. Referenced by getType(). |
|
Definition at line 360 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 361 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 362 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 363 of file CSGame.h. Referenced by checkCollisions(). |
|
Definition at line 364 of file CSGame.h. Referenced by checkCollisions(). |
|
Definition at line 365 of file CSGame.h. Referenced by checkOutOfBounds(). |
|
Definition at line 366 of file CSGame.h. Referenced by handleEvents(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 376 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 377 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 378 of file CSGame.h. Referenced by handleEvents(). |
|
Definition at line 379 of file CSGame.h. Referenced by handleEvents(). |
|
|
|
|