Example #1
0
/**
 * Init palette and object managers, scheduler, keyboard and mouse.
 */
void TinselEngine::RestartDrivers() {
	// init the palette manager
	ResetPalAllocator();

	// init the object manager
	KillAllObjects();

	// init the process scheduler
	CoroScheduler.reset();

	// init the event handlers
	g_pMouseProcess = CoroScheduler.createProcess(PID_MOUSE, MouseProcess, NULL, 0);
	g_pKeyboardProcess = CoroScheduler.createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);

	// open MIDI files
	OpenMidiFiles();

	// open sample files (only if mixer is ready)
	if (_mixer->isReady()) {
		_sound->openSampleFiles();
	}

	// Set midi volume
	bool mute = false;
	if (ConfMan.hasKey("mute"))
		mute = ConfMan.getBool("mute");

	SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
}
Example #2
0
/**
 * Init palette and object managers, scheduler, keyboard and mouse.
 */
void TinselEngine::RestartDrivers(void) {
	// init the palette manager
	ResetPalAllocator();

	// init the object manager
	KillAllObjects();

	// init the process scheduler
	_scheduler->reset();

	// init the event handlers
	pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0);
	pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);

	// open MIDI files
	OpenMidiFiles();

	// open sample files (only if mixer is ready)
	if (_mixer->isReady()) {
		_sound->openSampleFiles();
	}

	// Set midi volume
	SetMidiVolume(volMusic);
}
Example #3
0
/**
 * Wrap up the last scene.
 */
void EndScene() {
	if (SceneHandle != 0) {
		UnlockScene(SceneHandle);
		SceneHandle = 0;
	}

	KillInventory();	// Close down any open inventory

	DropPolygons();		// No polygons
	DropScroll();	// No no-scrolls
	DropBackground();	// No background
	DropMovers();		// No moving actors
	DropCursor();		// No cursor
	DropActors();		// No actor reels running
	FreeAllTokens();	// No-one has tokens
	FreeMostInterpretContexts();	// Only master script still interpreting

	if (TinselV2) {
		SetSysVar(ISV_DIVERT_ACTOR, 0);
		SetSysVar(ISV_GHOST_ACTOR, 0);
		SetSysVar(SV_MinimumXoffset, 0);
		SetSysVar(SV_MaximumXoffset, 0);
		SetSysVar(SV_MinimumYoffset, 0);
		SetSysVar(SV_MaximumYoffset, 0);
		ResetFontHandles();
		NoSoundReels();
	}

	_vm->_sound->stopAllSamples();		// Kill off any still-running sample
	//_vm->_mixer->stopAll();

	// init the palette manager
	ResetPalAllocator();

	// init the object manager
	KillAllObjects();

	// kill all destructable process
	g_scheduler->killMatchingProcess(PID_DESTROY, PID_DESTROY);
}
Example #4
0
// remove all objects (command "objectclear") ---------------------------------
//
PRIVATE
void Cmd_OBJECTCLEAR()
{
	// free objects and particles
	KillAllObjects();
}
Example #5
0
// clear remnants of demo replay and stop demo optionally ---------------------
//
void DEMO_ClearDemo( int stopreplay )
{
	//NOTE:
	// this function has to be used after a demo containing network packets
	// has been replayed (and ended) to restore/ensure a proper game state.

	//NOTE:
	// if the network mode is not active or the net simulation has already
	// been stopped (e.g., the demo has finished) the network state will
	// be left untouched (i.e., not reset!).

	// make sure it's off
	ObjCamOff();

	// clean up network state
	if ( NetConnected ) {

		// update player status
		Player_Status[ LocalPlayerId ] = PLAYER_INACTIVE;

		// ensure no remote players
		NET_RemoveRemotePlayers();

		// remove dangling virtual packets
		NETs_FlushListenBuffers();
	}

	if ( stopreplay ) {

		// stop audio stream if started from demo
		if ( con_audio_stream_started ) {
			con_audio_stream_started = FALSE;
			AUDs_StopAudioStream();
		}

		// ensure replay stopped
		stop_from_clear_demo = TRUE;
		DEMO_StopReplay();
		stop_from_clear_demo = FALSE;

		// turn off fading
		SetScreenFade = 0;
	}

	// set proper entry-mode state
	if ( NetConnected ) {
		EntryMode		= NetJoined ? FALSE : TRUE;
		InFloatingMenu	= NetJoined ? FALSE : FloatingMenu;
	} else {
		EntryMode		= FALSE;
		InFloatingMenu	= FloatingMenu;
	}

	// reset the floating menu state
	if ( InFloatingMenu ) {
		ActivateFloatingMenu( FALSE );
	}

	// scroll demo text out
	if ( !AUX_DISABLE_CLEAR_TEXT_ON_CLEARDEMO ) {
//		HUD_ClearDemoText();
	}

	// stop local ship
	MyShip->CurSpeed = 0;

	// ensure automatic actions disabled
	REPLAY_StopAutomaticActions();

	// ensure local particle weapons are destroyed
	WFX_EnsureParticleWeaponsInactive( MyShip );

	// stop residual motion due to view camera filter
	if ( !AUX_DISABLE_CAMFILT_RESET_ON_CLEARDEMO ) {
		CAMERA_ResetFilter();
	}

	// reset mapping table for class ids
	ResetClassMapTable();

	// free objects and particles
	if ( !AUX_DISABLE_OBJECT_FREE_ON_CLEARDEMO ) {
		KillAllObjects();
	}
}