MainScene::MainScene()
	: m_pBackground(0)
	, m_LabelTimer(0)
	, m_MatchDuration(0)
{
	LoadGameSettings();

	m_QuickScrollPos = CCPointMake(-1, -1);
	m_MatchStartTime = CSystem::GetTickCount();

	BubbleElement::LoadBubbles();
}
예제 #2
0
파일: gameloop.c 프로젝트: bowlofstew/ja2
BOOLEAN InitializeGame(void)
{ 
	UINT32				uiIndex;

	giStartingMemValue = MemGetFree( );

	
	ClearAllDebugTopics();
	RegisterJA2DebugTopic( TOPIC_JA2OPPLIST, "Reg" );
	//RegisterJA2DebugTopic( TOPIC_MEMORY_MANAGER, "Reg" );


	// Initlaize mouse subsystems
	MSYS_Init( );
	InitButtonSystem();
	InitCursors( );

	// Init Fonts
	if ( !InitializeFonts( ) )
	{
		// Send debug message and quit
		DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "COULD NOT INUT FONT SYSTEM...");
		return( ERROR_SCREEN );
	}

	//Deletes all the Temp files in the Maps\Temp directory
	InitTacticalSave( TRUE );

	// Initialize Game Screens.
  for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++)
  { 
    if ((*(GameScreens[uiIndex].InitializeScreen))() == FALSE)
    { // Failed to initialize one of the screens. 
      return FALSE;
    }
  }

	//Init the help screen system
	InitHelpScreenSystem();

	//Loads the saved (if any) general JA2 game settings
	LoadGameSettings();

	//Initialize the Game options ( Gun nut, scifi and dif. levels
	InitGameOptions();

	// preload mapscreen graphics
	HandlePreloadOfMapGraphics( );

	guiCurrentScreen = INIT_SCREEN;
	
  return TRUE;
}
예제 #3
0
void D_CheckNetGame (void)
{
    net_gamesettings_t settings;

    D_RegisterLoopCallbacks(&doom_loop_interface);

    if (netgame)
    {
        autostart = true;
    }

    SaveGameSettings(&settings);
    D_StartNetGame(&settings, NULL);
    LoadGameSettings(&settings);
}
예제 #4
0
//
// D_CheckNetGame
// Works out player numbers among the net participants
//
void D_CheckNetGame (void)
{
    net_gamesettings_t settings;

    if (netgame)
    {
        autostart = true;
    }

    D_RegisterLoopCallbacks(&doom_loop_interface);

    SaveGameSettings(&settings);
    D_StartNetGame(&settings, NULL);
    LoadGameSettings(&settings);

    DEH_printf("startskill %i  deathmatch: %i  startmap: %i  startepisode: %i\n",
               startskill, deathmatch, startmap, startepisode);

    DEH_printf("player %i of %i (%i nodes)\n",
               consoleplayer+1, settings.num_players, settings.num_players);

    // Show players here; the server might have specified a time limit

    if (timelimit > 0 && deathmatch)
    {
        // Gross hack to work like Vanilla:

        if (timelimit == 20 && M_CheckParm("-avg"))
        {
            DEH_printf("Austin Virtual Gaming: Levels will end "
                           "after 20 minutes\n");
        }
        else
        {
            DEH_printf("Levels will end after %d minute", timelimit);
            if (timelimit > 1)
                printf("s");
            printf(".\n");
        }
    }
}
예제 #5
0
// WANNE - MP: This method initializes variables that should be initialized
// differently for single and multiplayer
void InitDependingGameStyleOptions()
{
	// Yes, also initialize these ones, because of SP and MP game!
	InitStrategicEngine();
	InitStrategicMovementCosts();
	InitializeFaceGearGraphics();
	
	// WANNE: Initialize again, because if differs from SP to MP game!
	LoadGameSettings();

	FreeGameExternalOptions();

	// Load APBPConstants.ini
	LoadGameAPBPConstants();
	// Load ja2_options.ini
	LoadGameExternalOptions();
	// Load new STOMP ini - SANDRO
	LoadSkillTraitsExternalSettings();
	// HEADROCK HAM 4: CTH constants
	LoadCTHConstants();
	// Load externalised taunts settings
	LoadTauntsSettings();
	// Load helicopter repair settings
	LoadHelicopterRepairRefuelSettings();
	// Load externalised morale settings
	LoadMoraleSettings();
	// Load externalised reputation settings
	LoadReputationSettings();
	// Load creatures settings
	LoadCreaturesSettings();

#ifdef JA2UB
	LoadGameUBOptions(); // JA25 UB
#endif

	InitSightRange(); //lal

	ReStartingGame();	
}
예제 #6
0
void GameStateGame::OnCreate()
{
    Kengine::EventManager* evMgr = m_stateMgr->GetContext()->eventManager;

    evMgr->AddCallback(StateType::Game, "Key_Escape",
                       &GameStateGame::MainMenu, this);
    evMgr->AddCallback(StateType::Game, "Key_P",
                       &GameStateGame::Pause, this);
    evMgr->AddCallback(StateType::Game, "Key_O",
                       &GameStateGame::ToggleOverlay, this);

    sf::Vector2u size = m_stateMgr->GetContext()->window->GetWindowSize();
    m_view.setSize(size.x, size.y);
    m_view.setCenter(size.x / 2.0f, size.y / 2.0f);
    m_view.zoom(0.6f);
    m_stateMgr->GetContext()->window->GetRenderWindow()->setView(m_view);

	LoadGameSettings();

	m_gameMap = new Map(m_stateMgr->GetContext(), this);
    m_gameMap->LoadMap(std::string("media/Maps/" + m_mapName + ".tmx"));
}
예제 #7
0
void D_CheckNetGame(void)
{
    net_gamesettings_t settings;

    D_RegisterLoopCallbacks(&hexen_loop_interface);

    if (netgame)
    {
        autostart = true;
    }

    SaveGameSettings(&settings);
    D_StartNetGame(&settings, StartupProgress);
    LoadGameSettings(&settings);

    // Finish netgame progress on startup screen.

    if (netgame)
    {
        StartupProgress(settings.num_players, settings.num_players);
        ST_NetDone();
    }
}
예제 #8
0
DWORD FAR PASCAL CController::RunController(CController* pController)
{
	if ( !pController )
		return 0;

	VARIANT_BOOL fIsSupported;
	pController->m_pGame->get_IsSupported(&fIsSupported);
	if ( fIsSupported==VARIANT_FALSE ) {
		MessageBox(pController->m_hParentWnd, "This game is not supported by Visual PinMAME", "Failed to start", MB_ICONINFORMATION|MB_OK);
		return 1;
	}

	g_fHandleMechanics = pController->m_iHandleMechanics;
	g_fHandleKeyboard  = pController->m_fHandleKeyboard;
	g_fMechSamples = pController->m_fMechSamples;

	// Load the game specific settings
	LoadGameSettings(pController->m_szROM);

	// set some options for the mamew environment
	// set_option("window", "1", 0);
	set_option("resolution", "1x1x16", 0);
	set_option("debug_resolution", "640x480x16", 0);
	set_option("maximize", "0", 0);
	set_option("throttle", "1", 0);
	set_option("sleep", "1", 0);
	set_option("autoframeskip", "0", 0);
	set_option("skip_gameinfo", "1", 0);
	set_option("skip_disclaimer", "1", 0);
	set_option("keepaspect", "0", 0);

	VARIANT fHasSound;
	VariantInit(&fHasSound);
	pController->m_pGameSettings->get_Value(CComBSTR("sound"), &fHasSound);
	if (fHasSound.boolVal==VARIANT_FALSE)
		options.samplerate = 0; // indicates game sound disabled

#ifndef DEBUG
	void* pSplashWnd = NULL;
	if(!cabinetMode)
	// display the splash screen
	CreateSplashWnd(&pSplashWnd, pController->m_szSplashInfoLine);
#endif

	// set the global pointer to Controller
	m_pController = pController;

	g_fPause = 0;

	int iSyncLevel = synclevel;
	if ( iSyncLevel<0 )
		iSyncLevel = 0;
	else if ( iSyncLevel>60 )
		iSyncLevel = 60;

	if ( iSyncLevel ) {
		if ( iSyncLevel<=20 )
			g_iSyncFactor = 1024;
		else
			g_iSyncFactor = (int) (1024.0*(iSyncLevel/60.0));

		g_hEnterThrottle = CreateEvent(NULL, false, true, NULL);
	}
#ifndef DEBUG
	else {
		// just in case
		g_iSyncFactor = 0;
		g_hEnterThrottle = INVALID_HANDLE_VALUE;

		switch ( threadpriority ) {
			case 1:
				SetThreadPriority(pController->m_hThreadRun, THREAD_PRIORITY_ABOVE_NORMAL);
				break;
			case 2:
				SetThreadPriority(pController->m_hThreadRun, THREAD_PRIORITY_HIGHEST);
				break;
		}
	}
#endif

	vpm_game_init(pController->m_nGameNo);
	run_game(pController->m_nGameNo);
	vpm_game_exit(pController->m_nGameNo);

	if ( iSyncLevel ) {
		SetEvent(g_hEnterThrottle);
		CloseHandle(g_hEnterThrottle);
		g_hEnterThrottle = INVALID_HANDLE_VALUE;
		g_iSyncFactor = 0;
	}
	else
		SetThreadPriority(pController->m_hThreadRun, THREAD_PRIORITY_NORMAL);

	// fire the OnMachineStopped event
	OnStateChange(0);

	// reset the global pointer to Controller
	m_pController = NULL;

#ifndef DEBUG
	if(!cabinetMode)
	// destroy the splash screensync
		DestroySplashWnd(&pSplashWnd); 
#endif

	return 0;
}