Ejemplo n.º 1
0
static int InitializePoll (CMenu& menu, int& key, int nCurItem, int nState)
{
if (nState)
	return nCurItem;

paletteManager.LoadEffect ();
switch (loadOp) {
	case 0:
		/*---*/PrintLog ("Creating default tracker list\n");
		tracker.CreateList ();
		break;
	case 1:
		/*---*/PrintLog ("Loading ban list\n");
		banList.Load ();
		break;
	case 2:
		/*---*/PrintLog ("Initializing control types\n");
		SetControlType ();
		break;
	case 3:
		/*---*/PrintLog ("Initializing keyboard\n");
		KeyInit ();
		break;
	case 4:
		/*---*/PrintLog ("Initializing joystick\n");
		DoJoystickInit ();
		break;
	case 5:
		int i;
		if ((i = FindArg ("-xcontrol")) > 0)
			externalControls.Init (strtol (pszArgList [i+1], NULL, 0), strtol (pszArgList [i+2], NULL, 0));
		break;
	case 6:
		/*---*/PrintLog ("Initializing movies\n");
		if (FindArg ("-nohires") || FindArg ("-nohighres") || !GrVideoModeOK (MENU_HIRES_MODE))
			gameOpts->movies.bHires = 
			gameStates.menus.bHires = 
			gameStates.menus.bHiresAvailable = 0;
		else
			gameStates.menus.bHires = gameStates.menus.bHiresAvailable = 1;
		movieManager.InitLibs ();		//init movie libraries
		break;
	case 7:
		BMInit ();
		break;
	case 8:
		/*---*/PrintLog ("Initializing sound\n");
		audio.Setup (1);
		break;
	case 9:
		/*---*/PrintLog ("Loading hoard data\n");
		LoadHoardData ();
		break;
	case 10:
		error_init (ShowInGameWarning, NULL);
		break;
	case 11:
		break;
		g3_init ();
	case 12:
		/*---*/PrintLog ("Initializing texture merge buffer\n");
		TexMergeInit (100); // 100 cache bitmaps
		break;
	case 13:
		InitPowerupTables ();
		break;
	case 14:
		LoadGameBackground ();
		atexit (CloseGame);
		break;
	case 15:
		InitThreads ();
		break;
	case 16:
		PiggyInitMemory ();
		break;
	case 17:
		if (!FindArg ("-nomouse"))
			MouseInit ();
		break;
	case 18:
		/*---*/PrintLog ("Enabling TrackIR support\n");
		TIRLoad ();
		break;
	}
loadOp++;
if (gameStates.app.bProgressBars && gameOpts->menus.nStyle) {
	if (loadOp == InitGaugeSize ())
		key = -2;
	else {
		menu [0].m_value++;
		menu [0].m_bRebuild = 1;
		key = 0;
		}
	}
paletteManager.LoadEffect ();
return nCurItem;
}
Ejemplo n.º 2
0
int OglCacheLevelTextures (void)
{
	int				i, j, bD1;
	tEffectClip*	ecP;
	int				max_efx = 0, ef;
	int				nSegment, nSide;
	short				nBaseTex, nOvlTex;
	CBitmap*			bmBot,* bmTop, * bmm;
	CSegment*		segP;
	CSide*			sideP;
	CObject*			objP;
	CStaticArray< bool, MAX_POLYGON_MODELS >	bModelLoaded;

if (gameStates.render.bBriefing)
	return 0;
PrintLog ("caching level textures\n");
TexMergeClose ();
TexMergeInit (-1);
PrintLog ("   caching effect textures\n");
for (bD1 = 0; bD1 <= gameStates.app.bD1Data; bD1++) {
	for (i = 0, ecP = gameData.eff.effects [bD1].Buffer (); i < gameData.eff.nEffects [bD1]; i++, ecP++) {
		if ((ecP->changingWallTexture == -1) && (ecP->changingObjectTexture == -1))
			continue;
		if (ecP->vClipInfo.nFrameCount > max_efx)
			max_efx = ecP->vClipInfo.nFrameCount;
		}
	for (ef = 0; ef < max_efx; ef++)
		for (i = 0, ecP = gameData.eff.effects [bD1].Buffer (); i < gameData.eff.nEffects [bD1]; i++, ecP++) {
			if ((ecP->changingWallTexture == -1) && (ecP->changingObjectTexture == -1))
				continue;
			ecP->xTimeLeft = -1;
			}
	}

PrintLog ("   caching geometry textures\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 0);
for (segP = SEGMENTS.Buffer (), nSegment = 0; nSegment < gameData.segs.nSegments; nSegment++, segP++) {
	for (nSide = 0, sideP = segP->m_sides; nSide < MAX_SIDES_PER_SEGMENT; nSide++, sideP++) {
		nBaseTex = sideP->m_nBaseTex;
		if ((nBaseTex < 0) || (nBaseTex >= gameData.pig.tex.nTextures [gameStates.app.bD1Data]))
			continue;
#if DBG
		if ((nSegment == nDbgSeg) && ((nDbgSide < 0) || (nSide == nDbgSide)))
			nDbgSeg = nDbgSeg;
#endif
		bmBot = LoadFaceBitmap (nBaseTex, sideP->m_nFrame, bLoadTextures);
		if ((nOvlTex = sideP->m_nOvlTex)) {
			bmTop = LoadFaceBitmap (nOvlTex, sideP->m_nFrame, bLoadTextures);
			bmTop->SetTranspType (3);
			if (gameOpts->ogl.bGlTexMerge) // || !(bmTop->Flags () & BM_FLAG_SUPER_TRANSPARENT))
				bmTop->SetupTexture (1, bLoadTextures);
			else if ((bmm = TexMergeGetCachedBitmap (nBaseTex, nOvlTex, sideP->m_nOvlOrient)))
				bmBot = bmm;
			else
				bmTop->SetupTexture (1, bLoadTextures);
			}
		bmBot->SetTranspType (3);
		bmBot->SetupTexture (1, bLoadTextures);
		}
	}

PrintLog ("   caching addon textures\n");
CacheAddonTextures ();

PrintLog ("   caching model textures\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 1);
bModelLoaded.Clear ();
bVClipLoaded.Clear ();
FORALL_OBJS (objP, i) {
	if (objP->info.renderType != RT_POLYOBJ)
		continue;
	if (bModelLoaded [objP->rType.polyObjInfo.nModel])
		continue;
	bModelLoaded [objP->rType.polyObjInfo.nModel] = true;
	OglCachePolyModelTextures (objP->rType.polyObjInfo.nModel);
	}

PrintLog ("   caching hostage sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 3);
OglCacheVClipTextures (33, 3);    

PrintLog ("   caching weapon sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 5);
for (i = 0; i < EXTRA_OBJ_IDS; i++)
	OglCacheWeaponTextures (gameData.weapons.info + i);

PrintLog ("   caching powerup sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 4);
for (i = 0; i < MAX_POWERUP_TYPES; i++)
	if (i != 9)
		OglCacheVClipTextures (gameData.objs.pwrUp.info [i].nClipIndex, 3);

PrintLog ("   caching effect textures\n");
CacheObjectEffects ();
bLoadTextures = (ogl.m_states.nPreloadTextures > 2);
for (i = 0; i < gameData.eff.nClips [0]; i++)
	OglCacheVClipTextures (i, 1);

PrintLog ("   caching cockpit textures\n");
for (i = 0; i < 2; i++)
	for (j = 0; j < MAX_GAUGE_BMS; j++)
		if (gameData.cockpit.gauges [i][j].index != 0xffff)
			LoadBitmap (gameData.cockpit.gauges [i][j].index, 0);

ResetSpecialEffects ();
InitSpecialEffects ();
DoSpecialEffects (true);
return 0;
}