void MainWindow::tick() { world->Step(1.0/60.0,6,2); scene->update(); damageBarrier(); killPig(); scoreboard->setText(QString::number(score)); if( killall == true ) { bgm->stop(); QString result; QTextStream(&result) << "LEVEL CLEARED ! " << " \n Your score : " << score << "\n\n Play again ?"; QMessageBox::StandardButton reply; reply = QMessageBox::question(this, " Congratulation ", result, QMessageBox::Yes | QMessageBox::No); if(reply == QMessageBox::No) exitGame(); //end game else restartGame(); } if( num == -1 ) { spdx = bird[0]->getLinearVelocity().x; spdy = bird[0]->getLinearVelocity().y; bound = bird[0]->getPosition().x; //std::cout << g << std::endl; if(( spdx == 0 && spdy == 0 )|| bound > 45 || bound < -5 ) { bgm->stop(); QString result; QTextStream(&result) << "Your score : " << score << "\n\n Try again ?"; QMessageBox::StandardButton reply; reply = QMessageBox::question(this, " Gameover ", result, QMessageBox::Yes | QMessageBox::No); if(reply == QMessageBox::No) exitGame(); //end game else restartGame(); } } }
void IMainGame::update() { if (m_currentScreen) { switch (m_currentScreen->getState()) { case ScreenState::RUNNING: m_currentScreen->update(); break; case ScreenState::CHANGE_NEXT: m_currentScreen->onExit(); m_currentScreen = m_screenList->moveNext(); if (m_currentScreen) { m_currentScreen->setRunning(); m_currentScreen->onEntry(); } break; case ScreenState::CHANGE_PREVIOUS: m_currentScreen->onExit(); m_currentScreen = m_screenList->movePrevious(); if (m_currentScreen) { m_currentScreen->setRunning(); m_currentScreen->onEntry(); } break; case ScreenState::EXIT_APPLICATION: exitGame(); break; default: break; } } else { exitGame(); } }
void BlackJack::newDeal() { player.clearHand(); dealer.clearHand(); hideCard = true; if(!player.getBalance()) { cout << "Sorry you are out of funds. Game Over.\n"; exitGame(); } cout << " *********************************\n" << " * d key = deal | q key = quit *\n" << " *********************************\n" << " Enter: "; char input; cin >> input; while(tolower(input) != 'd' && tolower(input) != 'q') { cout << "Enter a valid option: \n" << "Enter: "; cin >> input; } if(tolower(input) == 'd') { ClearScreen(); control = true; // Run menu() again. newRound(); } else { exitGame(); } }
Form::Form(QWidget *parent) : game(NULL), // подключение формы QWidget(parent), ui(new Ui::Form) { ui -> setupUi(this); layout = new QVBoxLayout(this); settingsLayout = new QHBoxLayout; QPushButton* newgame = new QPushButton(); QPushButton* exitgame = new QPushButton(); QPixmap newG(":/sprite/new.png"); QPixmap exG(":/sprite/exit.png"); QIcon newGIcon(newG); QIcon exGIcon(exG); newgame -> setIcon(newGIcon); exitgame -> setIcon(exGIcon); newgame -> setIconSize(QSize(304,70)); // загрузка картинки "Новая игра" exitgame -> setIconSize(QSize(290,70)); // загрузка картинки "Выход" connect(newgame, SIGNAL(clicked()), this, SLOT(newGame())); // Если нажата кнопка, то новая игра connect(exitgame, SIGNAL(clicked()), this, SLOT(exitGame())); // Если нажата кнопка, то выход settingsLayout -> addWidget(newgame); settingsLayout -> addWidget(exitgame); layout -> setContentsMargins(2, 2, 2, 2); layout -> addLayout(settingsLayout); newGame(); setLayout(layout); }
void IMainGame::onSDLEvent(SDL_Event& evnt) { switch (evnt.type) { case SDL_QUIT: exitGame(); break; case SDL_KEYDOWN: inputManager.keyPressed(evnt.key.keysym.sym); break; case SDL_KEYUP: inputManager.keyReleased(evnt.key.keysym.sym); break; case SDL_MOUSEMOTION: inputManager.setMousePos(glm::vec2(evnt.motion.x, evnt.motion.y)); break; case SDL_MOUSEBUTTONDOWN: inputManager.keyPressed(evnt.button.button); break; case SDL_MOUSEBUTTONUP: inputManager.keyReleased(evnt.button.button); break; } }
void handleCollisions() { // Handle collisions. // -- Check if the helicopter collides with the ground terrain // Calculate the inverse camera matrix GLdouble invCameraMatrix[16]; inverse(getCameraMatrix(), invCameraMatrix); // Get the helicopter position (in camera coordinates) GLdouble heliCameraVec[4] = { helicopterCameraPosX, helicopterCameraPosY, helicopterCameraPosZ, 1 }; // The vector to hold the world position of the helicopter GLdouble heliWorldVec[4]; int index, multindex; // Get the new helicopter position in the world using the inverse camera matrix // and the helicopter position (in camera coordinates) for(index = 0; index < 4; index++) { for(multindex = 0; multindex < 4; multindex++) { heliWorldVec[index] += invCameraMatrix[(4*multindex)+index] * heliCameraVec[multindex]; } } // Get the height of the helicopter GLfloat chopperH = getHeight(heliWorldVec[0], heliWorldVec[2]); // Check for collision with ground if(heliWorldVec[1] <= chopperH || chopperH == -1) { printf("THE HELICOPTER CRASHED! THE APP TOO LOL :O\n"); exitGame(); } }
void showMenu() { int selectMenu = 0; while (1) { printf("** Bulls And Cows **\n"); printf(" [1] Start Game\n"); printf(" [2] Exit Game\n"); printf(" [] select Number : "); scanf("%d", &selectMenu); clearEnter(); switch (selectMenu) { case 1: startGame(); break; case 2: exitGame(); exit(0); break; default: printf("[Error] Invalid value selected!\n"); showMenu(); break; } } }
//custom update function void IMainGame::update(float deltaTime) { if (m_currentScreen) { switch (m_currentScreen->getScreenState()) { case ScreenState::RUNNING: m_currentScreen->update(deltaTime); break; case ScreenState::CHANGE_NEXT: m_currentScreen->onExit(); m_currentScreen = m_screenList->moveNext(); if (m_currentScreen) { m_currentScreen->setRunning(); m_currentScreen->onEntry(); } break; case ScreenState::EXIT_APPLICATION: exitGame(); break; default: break; } } }
virtual void doWith(const std::string ¶meter1, const std::string ¶meter2) const { Location *curLocation = player.getLocation() ; Object *curObject = curLocation->getObject(parameter1) ; if (curObject != NULL) { if (curObject->canTalk()) { if ((getStateFlag(FlagShishka)) == FVShishkaYes) { std::cout << "(" << curObject->getName() << ") Какой-то ты странный сегодня... Эй, ты чего смеёшься?\n" "(Вы) У-ха-ха-ха!! А-ха-ха-хах!! Это так смешно звучит, ой я не могу.. Аааа, мой мозг! А-ха-ха-хах!\n" "(" << curObject->getName() << ") Э-э-э-й! Ты тут вообще?..\n" "(Вы) Да... Да? Да! Тута я! Ля-ля-ля! Блин, как жрать хочу... Ку-ку!!!\n" "(" << curObject->getName() << ") О ужас! Ты выкурил шишку!!\n" "(Вы) Ку-кууу?...\n\n" "Через пару часов Вы успокоились и перестали нести чушь. Вас исключили из лагеря и вскоре Вас " "забрали домой родители. А вот нечего курить всякую гадость в лесу! " "Вы не смогли осуществить своих гениальных замыслов, игра закончена. До свидания!\n"; system("pause"); exitGame(); } curObject->talk(); } else std::cout << "Предметы не разговаривают!\n"; } else { std::cout << "Такого человека здесь нет!\n"; } }
int startGame() { int i=1; int number = -1; hint Hint = { -1, -1, -1, -1 }; engine* Engine = createEngeine(); histroyRecorder* HistoryManager = createHistroyRecorder(); printf("\n [] Start Game!\n"); if (ERR_NULL_POINTER == initEngine(Engine)) { printf("Init Engine failed!\n"); exit(1); } if (ERR_NULL_POINTER == initHistoryRecorder(HistoryManager)) { printf("Init HistoryManager failed! - File open failed!\n"); exit(1); } Engine->generateNumber(); while (Hint.answer != 1) { printf("Guess Number('0' for exit game) : "); scanfForAnswer(&number); Hint = Engine->checkAnswer(number); switch (number) { case 0: exitGame(); showMenu(); break; case ERR_INVALID_PARAMETER: printf("[Error] Invalid value selected!\n"); break; default: break; } if (number > 0 && Hint.answer != 1) { if (ERR_FILE_OPEN_FAIL == HistoryManager->record(Hint)) { printf("Record error! - File open failed!\n"); exit(1); } HistoryManager->print(); i++; } } printf("\nCorrect!!\n", number); printf("Answer : %d\n\n", number); printf("Trying count : %d\n\n", i); showMenu(); return 0; }
bool LuaProxy::Misc::loadEpisode(const std::string& episodeName) { GameAutostart autoStartEpisode; autoStartEpisode.setSelectedEpisode(episodeName); autoStartEpisode.setSaveSlot(GM_CUR_SAVE_SLOT); bool success = autoStartEpisode.applyAutostart(); if (success) exitGame(); return success; }
void menu_update() { if (scene.tempo <= 0) { if (input.escape->press) exitGame(); if (input.up->repeat && selection > 0) { selection--; menu_sound(false); } if (input.down->repeat && selection < 2) { selection++; menu_sound(false); } if (input.enter->press) switch (selection) { case 0: sceneLoad(LEVEL); case 1: sceneLoad(SETTINGS); default: exitGame(); menu_sound(true); } } animTempo += game.delta*.25; }
void StateHandler::startGame() { if (state != uninitialized) return; state = menu; while (!exitGame()) { loopGame(); } window.close(); }
void GuiGameController::setWindow(Proxy* g){ gui = g; qDebug() << "connecting window signals"; connect(gui, SIGNAL( readyToStartOnePersonPlay( int,int )), this, SLOT( startOnePersonPlay( int,int ) ),Qt::QueuedConnection ); connect(gui, SIGNAL( readyToStartTwoPersonPlay() ), this, SLOT( startTwoPersonPlay() ), Qt::QueuedConnection ); connect(gui, SIGNAL( sendPlayerName( QVariant ) ) , this, SLOT( setPlayerName( QVariant ) ),Qt::QueuedConnection ); connect(gui, SIGNAL( enterNetworkLobby() ), this, SLOT( enterNetworkLobby() ), Qt::QueuedConnection ); connect(gui, SIGNAL( readyToExitGame() ), this, SLOT( exitGame() ), Qt::QueuedConnection ); connect(gui, SIGNAL( leaveLobby() ), this, SLOT( leaveLobby() ), Qt::QueuedConnection ); }
void Client::signalRead() { ui::Control::signalRead(); if (game) game->signalRead(); if (backButton.clickSignal) { blurPage(); } if (quitButton.clickSignal) { if (game) { tryingToQuit = true; exitGame(); } else quitting = true; } if (aboutButton.clickSignal) { appLog("<about message>"); } if (closeButton.clickSignal) { exitGame(); } }
void SciEngine::runGame() { setTotalPlayTime(0); initStackBaseWithSelector(SELECTOR(play)); // Call the play selector // Attach the debug console on game startup, if requested if (DebugMan.isDebugChannelEnabled(kDebugLevelOnStartup)) _console->attach(); _gamestate->_syncedAudioOptions = false; do { _gamestate->_executionStackPosChanged = false; run_vm(_gamestate); exitGame(); _gamestate->_syncedAudioOptions = true; if (_gamestate->abortScriptProcessing == kAbortRestartGame) { _gamestate->_segMan->resetSegMan(); initGame(); initStackBaseWithSelector(SELECTOR(play)); patchGameSaveRestore(); setLauncherLanguage(); _gamestate->gameIsRestarting = GAMEISRESTARTING_RESTART; _gamestate->_throttleLastTime = 0; if (_gfxMenu) _gfxMenu->reset(); _gamestate->abortScriptProcessing = kAbortNone; _gamestate->_syncedAudioOptions = false; } else if (_gamestate->abortScriptProcessing == kAbortLoadGame) { _gamestate->abortScriptProcessing = kAbortNone; _gamestate->_executionStack.clear(); initStackBaseWithSelector(SELECTOR(replay)); patchGameSaveRestore(); setLauncherLanguage(); _gamestate->shrinkStackToBase(); _gamestate->abortScriptProcessing = kAbortNone; syncSoundSettings(); syncIngameAudioOptions(); // Games do not set their audio settings when loading } else { break; // exit loop } } while (true); }
Menu::Menu(QWidget *parent) : QWidget(parent), ui(new Ui::Menu) { ui->setupUi(this); connect(ui->newGameButton, &QPushButton::clicked, this, [this]{ emit changeWindow(1); emit startGame(); }); connect(ui->controlsButton, &QPushButton::clicked, this, [this]{ emit changeWindow(2); }); connect(ui->exitButton, &QPushButton::clicked, this, [this]{ emit exitGame(); }); }
void StartMenu::resolveEvent(sf::Event event) { if (startGameButton.checkHover()) { startGameButton.resolveEvent(event); if (startGameButton.checkClick()) { startGame(); } } else if (openCreditsButton.checkHover()) { openCreditsButton.resolveEvent(event); if (openCreditsButton.checkClick()) { openCredits(); } } else if (muteButton.checkHover()) { muteButton.resolveEvent(event); if (muteButton.checkClick()) { shared_ptr<AudioManager> audio = AudioManager::getAudioManager(); if (!audio->isMute()) { audio->mute(); } else { audio->play(); } } } else if (exitGameButton.checkHover()) { exitGameButton.resolveEvent(event); if (exitGameButton.checkClick()) { exitGame(); } } }
bool RoLoginState::updateState(float timeSinceLastFrameInSecs) { auto stage = getCurrentStage(); bool continueState = true; switch (stage) { case RoLoginStage::NONE: if (mLoginServer->isConnected()) { mLoginServer->disconnect(); } changeStage(stage, RoLoginStage::LOGIN_PROMPT); roSCHEDULE_TASK_NAMED(LOGIN_PROMPT_TASK, RoEmptyArgs::INSTANCE); break; case RoLoginStage::LOGIN_CANCELLED: exitGame(); continueState = false; break; } return continueState; }
void IMainGame::onSDLEvent(SDL_Event& evnt) { switch (evnt.type) { case SDL_QUIT: exitGame(); break; case SDL_MOUSEMOTION: inputManager.setMouseCoords((float)evnt.motion.x, (float)evnt.motion.y); break; case SDL_KEYDOWN: inputManager.pressKey(evnt.key.keysym.sym); break; case SDL_KEYUP: inputManager.releaseKey(evnt.key.keysym.sym); break; case SDL_MOUSEBUTTONDOWN: inputManager.pressKey(evnt.button.button); break; case SDL_MOUSEBUTTONUP: inputManager.releaseKey(evnt.button.button); break; } }
int main() { srand ( time(NULL) ); game_graphics = new SDLGraphics(SCREEN_WIDTH + 150, SCREEN_HEIGHT, "Min Wage", 0,0,0); //game_timer = new Timer(); game_input = new Input(); gameMenu = new menuClass(); gameIndoors = new IndoorHandler(); playerStuff.gameStart(); //There's got to be a better way to do this (generating random tiles for the grass)... //This is probably a better idea: generate the entire backdrop as an SDL_Surface that can be drawn // each time it is needed? int randTiles[(SCREEN_HEIGHT / 32) * (SCREEN_WIDTH / 32)]; int i = 0; for (i = 0; i < (SCREEN_HEIGHT / 32) * (SCREEN_WIDTH / 32); i++) { randTiles[i] = rand() % 4; } //makeMap(); //loadMapFile("datfile.dat"); setupTiles(); showTitle(); gameloop(randTiles); exitGame(); return 0; }
/* Choisir le mode de jeu MULTI pour deux humains et SOLO pour humain contre ordinateur */ void menuJeu(void) { game = malloc(sizeof(*game)); game->mode = choseGameType(); game->scoreJoueur1 = 0; game->scoreJoueur2 = 0; printf("tmp = %d\n", game->mode); switch(game->mode) { case 1: game->mode = MULTI; break; case 2: game->mode = SOLO; break; case 3: game->mode = LOAD; loadGame(); break; case 4: exitGame(); break; } }
void Game::run() { //Connect TCP bool success = false; do { try { serverEndpointTCP = *resolverTCP.resolve(queryTCP); socketTCP.open(boost::asio::ip::tcp::v4()); socketTCP.connect(serverEndpointTCP); //Send enter packet to server boost::array<unsigned char, 1> enterPacket = { packet::enter }; socketTCP.send(boost::asio::buffer(enterPacket)); socketTCP.send(boost::asio::buffer(enterPacket)); socketTCP.send(boost::asio::buffer(enterPacket)); //Wait for receiving return data size_t bytes = socketTCP.receive(boost::asio::buffer(receiveBufferTCP)); boost::system::error_code e; receiveHandlerTCP(e, bytes); success = true; } catch (std::exception& e) { std::cout << "\n" << e.what(); } } while (!success); //Connect UDP success = false; do { try { serverEndpointUDP = *resolverUDP.resolve(queryUDP); socketUDP.open(boost::asio::ip::udp::v4()); socketUDP.connect(serverEndpointUDP); boost::array<unsigned char, sizeof(CLIENT_ID_TYPE) + sizeof(packet::PacketType)> enterUDP; enterUDP[0] = packet::enterUdpEndpoint; memcpy(&enterUDP[sizeof(packet::PacketType)], &ID, sizeof(ID)); socketUDP.send(boost::asio::buffer(enterUDP)); socketUDP.receive(boost::asio::buffer(enterUDP));//Wait for server response success = true; } catch (std::exception& e) { std::cout << "\n" << e.what(); } } while (!success); std::thread ioServiceThread(boost::bind(&boost::asio::io_service::run, &ioService)); while (!checkBit(state, GAME_EXIT_BIT)) { mainWindow->clearBuffer(); spehs::beginFPS(); //Update spehs::console::update(); inputManager->update(); update(); //Render render(); spehs::console::render(); spehs::endFPS(); spehs::drawFPS(); mainWindow->swapBuffers(); if (inputManager->isKeyDown(KEYBOARD_Q)) enableBit(state, GAME_EXIT_BIT); } //Notify server exitGame(); ioServiceThread.join(); }
void Client::beginGame(std::unique_ptr<Game> &&game) { if (this->game) exitGame(); else this->game = std::move(game); focusGame(); }
Game::~Game() { for (auto it = objectVisuals.begin(); it != objectVisuals.end(); it++) delete it->second; exitGame(); }
void exitMessage(std::string exitMsg) { std::cout << "Error: " << exitMsg << "\n"; exitGame(); }
void getEntry(int *team, int *stype) { int switching = -1; /* confirm switches 7/27/91 TC */ inputMask = CP_OUTFIT; for (;;) { /* updateShips so he knows how many players on each team */ if (blk_flag) updateShips(); sendMaskPacket(tournamentMask(me->p_team)); if (blk_flag) briefUpdateClient(); flushSockBuf(); /* Have we been busted? */ if (me->p_status == PFREE) { me->p_status = PDEAD; me->p_explode = 600; } socketPause(); readFromClient(); if (isClientDead()) { int i; if (noressurect) exitGame(); printf("Ack! The client went away!\n"); printf("I will attempt to resurrect him!\n"); /* UDP fail-safe */ commMode = COMM_TCP; if (udpSock >= 0) closeUdpConn(); /* For next two minutes, we try to restore connection */ shutdown(sock, 2); sock = -1; for (i = 0;; i++) { switch (me->p_status) { case PFREE: me->p_status = PDEAD; me->p_explode = 600; break; case PALIVE: case POBSERVE: me->p_ghostbuster = 0; break; case PDEAD: me->p_explode = 600; break; default: me->p_explode = 600; me->p_ghostbuster = 0; break; } sleep(5); if (connectToClient(host, nextSocket)) break; if (i == 23) { printf("Oh well, maybe I'm getting rusty!\n"); switch (me->p_status) { case PFREE: break; case PALIVE: case POBSERVE: me->p_ghostbuster = 100000; break; case PDEAD: me->p_explode = 0; break; default: me->p_explode = 0; me->p_ghostbuster = 100000; break; } exitGame(); } } printf("A miracle! He's alive!\n"); teamPick = -1; updateSelf(); updateShips(); flushSockBuf(); } if (teamPick != -1) { if (teamPick < 0 || teamPick > 3) { warning("Get real!"); sendPickokPacket(0); teamPick = -1; continue; } if (!(tournamentMask(me->p_team) & (1 << teamPick))) { warning("I cannot allow that. Pick another team"); sendPickokPacket(0); teamPick = -1; continue; } if (((1 << teamPick) != me->p_team) && (me->p_team != ALLTEAM)) /* switching teams 7/27/91 TC */ if ((switching != teamPick) && (me->p_whydead != KGENOCIDE) && !status2->league ) { switching = teamPick; warning("Please confirm change of teams. Select the new team again."); sendPickokPacket(0); teamPick = -1; continue; } /* His team choice is ok. */ if (shipPick < 0 || shipPick >= NUM_TYPES) { warning("That is an illegal ship type. Try again."); sendPickokPacket(0); teamPick = -1; continue; } if (!allowed_ship(1 << teamPick, mystats->st_rank, mystats->st_royal, shipPick)) { sendPickokPacket(0); teamPick = -1; continue; } if (shipvals[shipPick].s_nflags & SFNMASSPRODUCED) { warning("o)utpost, u)tility, or s)tandard?"); sendPickokPacket(0); tmpPick = shipPick; continue; } break; } if (me->p_status == PTQUEUE) { if (status->tourn) detourneyqueue(); /* You don't time out on the tourney queue */ me->p_ghostbuster = 0; } } *team = teamPick; if ((shipvals[tmpPick].s_nflags & SFNMASSPRODUCED) && ((shipvals[shipPick].s_numports) || (shipPick == SCOUT))) { *stype = tmpPick; tmpPick = CRUISER; } else { *stype = shipPick; tmpPick = CRUISER; } sendPickokPacket(1); flushSockBuf(); }
void Menu::handleEvent(SDL_Event event) { Util util = context->util; switch(event.type) { case SDL_MOUSEMOTION: { int x,y; x = event.motion.x; y = event.motion.y; if(util.coordInsideRect(buttonLocations[QUIT_GAME],x,y)) { if(highlightedButton != QUIT_GAME) { context->screenUpdated = true; highlightedButton = QUIT_GAME; } } else if(util.coordInsideRect(buttonLocations[CLOSE_MENU],x,y)) { if(highlightedButton != CLOSE_MENU) { context->screenUpdated = true; highlightedButton = CLOSE_MENU; } } else if(util.coordInsideRect(buttonLocations[PLACEHOLDER_1],x,y)) { if(highlightedButton != PLACEHOLDER_1) { context->screenUpdated = true; highlightedButton = PLACEHOLDER_1; } } else { context->screenUpdated = true; highlightedButton = NONE_HIGHLIGHTED; } break; } case SDL_MOUSEBUTTONDOWN: { if(event.button.button == SDL_BUTTON_LEFT ) { int x,y; x = event.button.x; y = event.button.y; #if DEBUG >= 3 std::cerr << "Left button pressed @ (" << x << "," << y << ")\n"; #endif if(util.coordInsideRect(buttonLocations[QUIT_GAME],x,y)) { exitGame(); } else if(util.coordInsideRect(buttonLocations[CLOSE_MENU],x,y)) { hide(); } else if(util.coordInsideRect(buttonLocations[PLACEHOLDER_1],x,y)) { context->board->testDrive(); } } break; } } }
//============================================================================= // Update all game items //============================================================================= void Spacewar::update() { if(input->isKeyDown(ESC_KEY)) { exitGame(); } if(ship.getActive()) { ship.update(frameTime, shoot); if(powerupActive) { shootTime += 3*frameTime; powerupTime += frameTime; if(powerupTime >= POWERUP_DURATION) { powerupActive = false; } } else { shootTime += frameTime; } if(shoot && shootTime >= SHIP_SHOOT_DELAY) { spawnBullet(VECTOR2(ship.getX()+(shipNS::SCALE*ship.getWidth()*3)/4, ship.getY()+(shipNS::SCALE*ship.getHeight()/2)), VECTOR2(bulletNS::SPEED,0)); audio->playCue(PEW); shootTime = 0; } } if(timeSincePowerupSpawn >= POWERUP_FREQUENCY) { spawnPowerup(VECTOR2(GAME_WIDTH,(GAME_HEIGHT/4)+rand()%(GAME_HEIGHT/2)),VECTOR2(-1*powerNS::SPEED,0)); timeSincePowerupSpawn = 0; } timeSincePowerupSpawn += frameTime; for(int i=0; i<MAX_GUNS; i++) { if(guns[i].getActive()) { guns[i].update(frameTime, shoot); if(shoot) { spawnEnemyBullet(VECTOR2(guns[i].getX()+(gunNS::SCALE*guns[i].getWidth()*3)/4, guns[i].getY()+(gunNS::SCALE*guns[i].getHeight()*3)/8), VECTOR2(enemyBulletNS::SPEED,0)); audio->playCue(PEW); } } } for(int i=0; i<MAX_BULLETS; i++) { if(bullets[i].getActive()) bullets[i].update(frameTime); } for(int i=0; i<MAX_ENEMY_BULLETS; i++) { if(enemyBullets[i].getActive()) enemyBullets[i].update(frameTime); } if(power.getActive()) { power.update(frameTime); } seconds_since_start = difftime( time(0), start); //Begin Unarmed Asteroid spawning if(seconds_since_start == 10) asterGroupSize = 3; if(seconds_since_start == 20) asterGroupSize = 5; if(seconds_since_start == 30) asterGroupSize = 8; if(seconds_since_start == 40) asterGroupSize = 10; if(seconds_since_start == 60) asterGroupSize = 20; asteroidSpawnTime += frameTime; if(asteroidCounter < asterGroupSize && asteroidCounter < MAX_ASTEROIDS && asteroidSpawnTime > ASTEROID_SPAWN_DELAY) { VECTOR2 newpos = VECTOR2(GAME_WIDTH, rand() % ((GAME_HEIGHT*7)/8+asteroidNS::HEIGHT)-GAME_HEIGHT/8-asteroidNS::HEIGHT); VECTOR2 newdir = VECTOR2(GAME_WIDTH/6, rand() % GAME_HEIGHT) - newpos; D3DXVec2Normalize(&newdir,&newdir); spawnAsteroid(newpos,newdir*asteroidNS::SPEED); asteroidCounter++; asteroidSpawnTime = 0; } for(int i = 0; i < asteroidCounter; i++) { if(!asteroids[i].getActive()) asteroidCounter--; } for(int i=0; i<MAX_ASTEROIDS; i++) { if(asteroids[i].getActive()) asteroids[i].update(frameTime); if(i%2) asteroids[i].setRadians(asteroids[i].getRadians() + ASTEROID_ROTATION_SPEED);//if an even index of the asteroids array, then rotate clockwise else asteroids[i].setRadians(asteroids[i].getRadians() - ASTEROID_ROTATION_SPEED);//if an odd index of the asteroids array, then rotate counter clockwise } //End Unarmed Asteroid spawning }
void intrupt(void) { if (testtime == -1) { struct reserved_spacket sp; /* Give a reasonable period of time to respond to query (and test code if they need to) */ #define RSAREPLYTIMER 30 #ifdef RSA RSA_Client = 0; #endif testtime = RSAREPLYTIMER * 10; makeReservedPacket(&sp); memcpy(testdata, sp.data, RESERVED_SIZE); sendClientPacket(&sp); } else if (testtime != 0) { testtime--; if (testtime==0) { if (report_ident) pmessage2(0, MALL | MJOIN, "GOD->ALL", me->p_no, "%s using %s", me->p_mapchars, me->p_ident); #if defined(RSA) && defined(SHOW_RSA) && defined(SHOW_RSA_FAILURE) if (!hidden && !whitelisted && !bypassed) pmessage2(0, MALL | MJOIN, "GOD->ALL", me->p_no, "%s %.16s is not using a trusted client", ranks[me->p_stats.st_rank].name, me->p_name); #endif if (bypassed) { /* Deal with .bypass entries */ ERROR(3,(".bypass person : %s - logged on\n",me->p_login)); me->p_stats.st_flags |= ST_CYBORG; /* mark for reference */ new_warning(UNDEF,"You are in the .bypass file, be good"); } else { /* User failed to respond to verification query. Bye! */ if (!binconfirm) me->p_stats.st_flags |= ST_CYBORG; /* mark for reference 7/27/91 TC */ else { me->p_explode = 10; me->p_whydead = KQUIT; me->p_status = PEXPLODE; ERROR(3,("User binary failed to verify\n")); #ifdef RSA #ifdef SHOW_RSA pmessage2(0, MALL | MJOIN, "GOD->ALL", me->p_no, "%s %.16s failed to verify", ranks[me->p_stats.st_rank].name, me->p_name); #endif if (RSA_Client==1) new_warning(UNDEF,"No customized binaries. Please use a blessed one."); else if (RSA_Client==2) new_warning(UNDEF,"Wrong Client Version Number!"); else new_warning(UNDEF,"You need a spiffy new RSA client for this server!"); #else new_warning(UNDEF,"No customized binaries. Please use a blessed one."); #endif } } } } if (me->p_status == PFREE) { ERROR(1,("intrupt: exitGame() on PFREE (pid %i)\n",getpid())); exitGame(0); } if (!Observer || me->p_status == PEXPLODE) { if (me->p_status == PEXPLODE || me->p_status == PDEAD) { FD_ZERO(&inputMask); } if (((me->p_status == PDEAD) || (me->p_status == POUTFIT)) && (me->p_ntorp <= 0) && (me->p_nplasmatorp <= 0)) { death(); return; } } if (clue) { if (RECHECK_CLUE && (clueFuse > CLUEINTERVAL)) { clueVerified = 0; clueFuse = 0; clueCount = 0; } if (!clueVerified && (inl_mode || (queues[QU_PICKUP].count != 0))) { clueFuse++; clue_check(); } } auto_features(); updateClient(); }