void doPlayerSelect(void) { if (isControl(CONTROL_PREV_FIGHTER)) { selectNewPlayer(-1); clearControl(CONTROL_PREV_FIGHTER); } if (isControl(CONTROL_NEXT_FIGHTER)) { selectNewPlayer(1); clearControl(CONTROL_NEXT_FIGHTER); } if (player->health > 0 && isAcceptControl()) { battle.playerSelect = 0; initPlayer(); resetAcceptControls(); } }
/* ================ idSplineList::clear ================ */ void idSplineList::clear() { clearControl(); clearSpline(); splineTime.Clear(); selected = NULL; dirty = true; activeSegment = 0; granularity = 0.025f; pathColor = idVec4(1.0f, 0.5f, 0.0f, 1.0f); controlColor = idVec4(0.7f, 0.0f, 1.0f, 1.0f); segmentColor = idVec4(0.0f, 0.0f, 1.0f, 1.0); activeColor = idVec4(1.0f, 0.0f, 0.0f, 1.0f); }
/* * legacy ;-) */ void TTVideoFileInfo::resetVideoInfo() { clearControl(); }
static void handleKeyboard(void) { if (battle.status == MS_IN_PROGRESS) { if (isControl(CONTROL_BOOST) && player->speed > 0) { if (battle.boostTimer == BOOST_RECHARGE_TIME) { playSound(SND_BOOST); activateBoost(); } else { playSound(SND_GUI_DENIED); } clearControl(CONTROL_BOOST); } if (isControl(CONTROL_TARGET)) { selectTarget(); clearControl(CONTROL_TARGET); } if (isControl(CONTROL_ECM)) { if (battle.ecmTimer == ECM_RECHARGE_TIME) { playSound(SND_ECM); activateECM(); } else { playSound(SND_GUI_DENIED); } clearControl(CONTROL_ECM); } if (isControl(CONTROL_BRAKE)) { applyFighterBrakes(); } if (isControl(CONTROL_GUNS)) { switchGuns(); clearControl(CONTROL_GUNS); } if (isControl(CONTROL_RADAR)) { cycleRadarZoom(); clearControl(CONTROL_RADAR); } if (isControl(CONTROL_MISSILE)) { preFireMissile(); clearControl(CONTROL_MISSILE); } } else { applyFighterBrakes(); } }
void resetAcceptControls(void) { app.keyboard[SDL_SCANCODE_SPACE] = app.keyboard[SDL_SCANCODE_RETURN] = 0; clearControl(CONTROL_FIRE); }
int main(int argc, char *argv[]) { float td; long then, lastFrameTime, frames; long expireTextTimer; SDL_Event event; memset(&app, 0, sizeof(App)); memset(&dev, 0, sizeof(Dev)); handleLoggingArgs(argc, argv); atexit(cleanup); srand(time(NULL)); init18N(argc, argv); initLookups(); initSDL(); initGameSystem(); createScreenshotFolder(); if (fileExists(getSaveFilePath(SAVE_FILENAME))) { loadGame(); } handleMissionArgs(argc, argv); dev.fps = frames = td = 0; then = SDL_GetTicks(); lastFrameTime = SDL_GetTicks() + 1000; expireTextTimer = SDL_GetTicks() + (1000 * 10); while (1) { td += (SDL_GetTicks() - then); then = SDL_GetTicks(); while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_MOUSEMOTION: doMouseMotion(&event.motion); break; case SDL_MOUSEWHEEL: doMouseWheel(&event.wheel); break; case SDL_MOUSEBUTTONDOWN: doMouseDown(&event.button); break; case SDL_MOUSEBUTTONUP: doMouseUp(&event.button); break; case SDL_KEYDOWN: doKeyDown(&event.key); break; case SDL_KEYUP: doKeyUp(&event.key); break; case SDL_QUIT: exit(0); break; } } if (app.modalDialog.type != MD_NONE) { doModalDialog(); } while (td >= LOGIC_RATE) { /* let the delegate decide during logic() */ app.doTrophyAlerts = 0; app.delegate.logic(); td -= LOGIC_RATE; if (app.doTrophyAlerts) { doTrophyAlerts(); } if (app.resetTimeDelta) { td = 0; then = SDL_GetTicks(); app.resetTimeDelta = 0; } game.stats[STAT_TIME]++; } prepareScene(); app.delegate.draw(); if (app.doTrophyAlerts) { drawTrophyAlert(); } if (app.modalDialog.type != MD_NONE) { drawModalDialog(); } presentScene(); doDevKeys(); frames++; if (SDL_GetTicks() > lastFrameTime) { dev.fps = frames; frames = 0; lastFrameTime = SDL_GetTicks() + 1000; if (dev.takeScreenshots) { saveScreenshot(); } } if (isControl(CONTROL_SCREENSHOT)) { saveScreenshot(); clearControl(CONTROL_SCREENSHOT); } if (SDL_GetTicks() > expireTextTimer) { expireTexts(0); expireTextTimer = SDL_GetTicks() + (1000 * 10); } /* don't save more than once per request, and not in the middle of battle */ if (app.saveGame && battle.status != MS_IN_PROGRESS) { saveGame(); app.saveGame = 0; } /* always zero the mouse motion */ app.mouse.dx = app.mouse.dy = 0; SDL_Delay(1); } return 0; }