示例#1
0
// Back to race hook ***************************************************
static void
rmBackToRaceHookActivate(void * /* dummy */)
{
	// Temporary hack for the Paused race case, in order
	// the race does not get ended (as is is currently stopped)
	// TODO: Activate the Stop Race menu directly, as for the Help menu (F1),
	//      and no more through changing the race engine state to STOP
	//      But beware of the other hooks ...
	LmRaceEngine().inData()->_reState = RE_STATE_RACE;

	// Back to the race screen in next display loop.
	LegacyMenu::self().activateGameScreen();

	// Launch the "slow resume race" manager if non-blind mode.
	if (LmRaceEngine().outData()->_displayMode == RM_DISP_MODE_NORMAL)
		rmProgressiveTimeModifier.start();
}
static void
rmRacePause(void * /* vboard */)
{
#ifdef STARTPAUSED
   // Pause is disabled during Pre Race Pause
   // as the simulation is already Paused
   if (!rmPreRacePause)
   {
      if (rmRacePaused)
      {
         if (LegacyMenu::self().soundEngine())
            LegacyMenu::self().soundEngine()->mute(false);
#else
    if (rmRacePaused)
	{
		if (LegacyMenu::self().soundEngine())
			LegacyMenu::self().soundEngine()->mute(false);
#endif

		LmRaceEngine().start();

		// Hide the "Pause" label.
		GfuiVisibilitySet(rmScreenHandle, rmPauseId, GFUI_INVISIBLE);
		
		// Show again the hidden message label.
		GfuiVisibilitySet(rmScreenHandle, rmMsgId, GFUI_VISIBLE);

		// Launch the "slow resume race" manager if non-blind mode.
		if (LmRaceEngine().outData()->_displayMode == RM_DISP_MODE_NORMAL)
			rmProgressiveTimeModifier.start();
    }
	else
	{
		if (LegacyMenu::self().soundEngine())
			LegacyMenu::self().soundEngine()->mute(true);

		LmRaceEngine().stop();

		// Show the "Pause" label.
		GfuiVisibilitySet(rmScreenHandle, rmPauseId, GFUI_VISIBLE);

		// Hide the message label (no need to bother the user with the time mult. factor
		// when it is changing, whihc occurs when the user hits P when a slow start
		// is in-process).
		GfuiVisibilitySet(rmScreenHandle, rmMsgId, GFUI_INVISIBLE);
    }
	
	// Toggle the race-paused flag.
	rmRacePaused = !rmRacePaused;
	
	// The menu changed.
	rmbMenuChanged = true;
#ifdef STARTPAUSED
}
#endif
}

static void
rmSkipPreStart(void * /* dummy */)
{
	// TODO: move this to a new LmRaceEngine().skipRacePreStart() ...
	tRmInfo* reInfo = LmRaceEngine().inData();
    if (reInfo->s->currentTime < -1.0) {
		reInfo->s->currentTime = -1.0;
		reInfo->_reLastRobTime = -1.0;
    }
}