Exemple #1
0
BOOL FindRezFiles(char chCdRom, CString& csRezBase)
{
	// Clear the strings...

	g_sGameRez[0] = '\0';
	g_sSoundRez[0] = '\0';


	// Look for game rez file in the current directory and on the cd-rom drive...

	CString sGameRezFile = csRezBase + ".rez";

	if (ExistRezFile(sGameRezFile))
	{
		strcpy(g_sGameRez, sGameRezFile);
	}

	// If necessary, look for a game rez directory in the current directory...

	if (g_sGameRez[0] == '\0')
	{
		if (ExistRezDir(csRezBase))
		{
			strcpy(g_sGameRez, csRezBase);
		}
	}

	// If necessary, look for game rez file on the CD-ROM drive...

	if (g_sGameRez[0] == '\0')
	{
		if (chCdRom > 0)
		{
			char sPath[256];
			wsprintf(sPath, "%c:\\data\\%s.rez", chCdRom, csRezBase);

			if (ExistRezFile(sPath))
			{
				strcpy(g_sGameRez, sPath);
			}
		}
	}


	// Look for sound rez file in the current directory...

	if (ExistRezFile("sound.rez"))
	{
		strcpy(g_sSoundRez, "sound.rez");
	}


	// If necessary, look for a sound directory...

	if (g_sSoundRez[0] == '\0')
	{
		if (ExistRezDir("sound"))
		{
			strcpy(g_sSoundRez, "sound");
		}
	}


	// Determine if we have both rez strings...

	if (g_sGameRez[0] == '\0' || g_sSoundRez[0] == '\0')
	{
		return(FALSE);
	}


	// All done...

	return(TRUE);
}
Exemple #2
0
BOOL FindRezFiles(HINSTANCE hInst)
{
	// Sanity checks...

	if (!hInst) return(FALSE);


	// Clear the strings...

	g_sGameRez[0] = '\0';
	g_sSoundRez[0] = '\0';


	// Load the rez file base name to use...

	CString sGameRezBase;
	CString sGameRezFile;
	CString sGameRezDir;

	if (!sGameRezBase.LoadString(IDS_REZBASE))
	{
		return(FALSE);
	}

	sGameRezFile = sGameRezBase + ".rez";
	sGameRezDir  = sGameRezBase;


	// Look for game rez in the current directory...

	if (ExistRezFile(sGameRezFile))
	{
		strcpy(g_sGameRez, sGameRezFile);
	}


	// If necessary, look for a shogo directory in the current directory...

	if (g_sGameRez[0] == '\0')
	{
		if (ExistRezDir(sGameRezDir))
		{
			strcpy(g_sGameRez, sGameRezDir);
		}
	}


	// Look for sound.rez in the current directory...

	if (ExistRezFile("sound.rez"))
	{
		strcpy(g_sSoundRez, "sound.rez");
	}


	// If necessary, look for a sound directory...

	if (g_sSoundRez[0] == '\0')
	{
		if (ExistRezDir("sound"))
		{
			strcpy(g_sSoundRez, "sound");
		}
	}


	// Determine if we have enough rez info...

	if (g_sGameRez[0] == '\0')
	{
		return(FALSE);
	}


	// All done...

	return(TRUE);
}