//--------------------------------------------------------------------------------- // Name: resetGame() //--------------------------------------------------------------------------------- void GameplayState::resetGame() { resetGameState(); memset(m_tdata, 0, sizeof(unsigned) * 4 ); m_map_complete_time = 0; BATTLE_CITY->resetMap(); BATTLE_CITY->resetPlayers(); // set layers position GraphicsLayer * tp = LAYER_MGR->findLayer(BOTTOM_LAYER); GraphicsLayer * bt = LAYER_MGR->findLayer(TOP_LAYER); assert( tp && bt ); unsigned w, h; w = MAP_MGR->getMapWidthPx(); h = MAP_MGR->getMapHeightPx(); unsigned x, y; x = (BASE_SCREEN_WIDTH - w ) >> 1; y = (BASE_SCREEN_HEIGHT - h ) >> 1; tp->setPosition( x, y ); bt->setPosition( x, y ); }
// called by Gamesman when new game is started void gPenHandleTclMessage(int options[], char *filename, Tcl_Interp *tclInterp, int debug) { if (hasPenLoaderFinished()) { // already read through entire file, no need to do it again return; } if (isPenLoaderStarted()) { // loader already started - reset state, change output to new file resetGameState(); startNewPenOutputFile(); } else if (startPenLoader(filename, debug) == 0) { // started loader for the first time - set initial state, start timer resetGameState(); tclInterpreter = tclInterp; Tcl_CreateTimerHandler(TCL_TIMER_MS, &TclTimerProc, NULL); } }