Пример #1
0
void draw_stats()
{
	if (mdview.baseModel)
	{
		iTextX = 2*TEXT_WIDTH;	// arb start pos 2 in from both edges
		iTextY = 4*TEXT_DEPTH;	// ... or 4... :-)

//		// Displays text at a 2d screen coord. 0,0 is top left corner, add TEXT_DEPTH per Y to go down a line
//
//		Text_DisplayFlat("testing testing HELLO!!", 100,100, 0, 255,0, true);
//		
//		Vec3 v={0,0,0};
//		Text_Display("testing testing HELLO!!", v, 255,0,0);
//
//
		gl_model *model = mdview.baseModel;

		stat_skeleton( model, NULL );

		// anim locks on the whole model?, if so display 'em...
		//
		char sString[1024];
		for (int i=0; i<2; i++)
		{
			// display anim locks at bottom of screen...
			//
			Sequence_t* pSeq=NULL;

			bool bIsUpper = false;

			if (i==0 && iAnimLockNumber_Upper )
			{
				pSeq = Animation_GetUpperSequence( iAnimLockNumber_Upper-1 );			
				bIsUpper = true;
			}

			if (i==1 && iAnimLockNumber_Lower )
			{
				pSeq = Animation_GetLowerSequence( iAnimLockNumber_Lower-1 );
				bIsUpper = false;
			}

			if (pSeq)
			{				
				int iYpos = g_iScreenHeight-((!i?4:3)*TEXT_DEPTH);

				// cheat, do this next bit here just to get the X coord, then overwrite later
				sprintf(sString,"%s anim lock: %s  Frames: %4d...%4d%s",!i?"Upper":"Lower",String_EnsureMinLength(pSeq->sName.c_str(),iAnimLockLongestString),pSeq->iTargetFrame,(pSeq->iTargetFrame+pSeq->iFrameCount)-1,String_EnsureMinLength((pSeq->iLoopFrame==-1)?"":va("  loop: %3d(%3d)",pSeq->iLoopFrame,pSeq->iTargetFrame+pSeq->iLoopFrame),25));				
				int iXpos = (g_iScreenWidth/2)-( (strlen(sString)/2)*TEXT_WIDTH);

				if (pSeq->bMultiSeq)
				{
					Sequence_t *pCurrentMultiSeq = GetMultiLockedSequenceFromFrame(bIsUpper?pModel_Upper->currentFrame:pModel_Lower->currentFrame, bIsUpper );
					int iStrlenAtCurrentSeqPoint = 0;

					sprintf(sString,"%s anim lock: ",bIsUpper?"Upper":"Lower");

					MultiSequenceLock_t* pMultiLock = (bIsUpper)?&MultiSequenceLock_Upper:&MultiSequenceLock_Lower;
					MultiSequenceLock_t::iterator it;
					for (it = pMultiLock->begin(); it != pMultiLock->end(); ++it)
					{
						int iSeqIndex = *it;

						pSeq = (bIsUpper)?Animation_GetUpperSequence(iSeqIndex):Animation_GetLowerSequence(iSeqIndex);
						
						assert(pSeq);
						if (pSeq)
						{
							if (pSeq == pCurrentMultiSeq)
								iStrlenAtCurrentSeqPoint = strlen(sString);

							strcat(sString,va("%s  ",pSeq->sName.c_str()));
						}
					}

//					int iXpos = (g_iScreenWidth/2)-( (strlen(sString)/2)*TEXT_WIDTH);					
				
					Text_DisplayFlat(sString, iXpos, iYpos, 255,0,0, true);

					// now overlay the highlighted one for current...
					//
					if (pCurrentMultiSeq)
					{
						iXpos += iStrlenAtCurrentSeqPoint*TEXT_WIDTH;
		
						Text_DisplayFlat(pCurrentMultiSeq->sName.c_str(), iXpos, iYpos, 255,0,255, true);					
					}
				}
				else
				{
					sprintf(sString,"%s anim lock: %s  Frames: %4d...%4d%s",!i?"Upper":"Lower",String_EnsureMinLength(pSeq->sName.c_str(),iAnimLockLongestString),pSeq->iTargetFrame,(pSeq->iTargetFrame+pSeq->iFrameCount)-1,String_EnsureMinLength((pSeq->iLoopFrame==-1)?"":va("  loop: %3d(%3d)",pSeq->iLoopFrame,pSeq->iTargetFrame+pSeq->iLoopFrame),25));
					
//					int iXpos = (g_iScreenWidth/2)-( (strlen(sString)/2)*TEXT_WIDTH);					
				
					Text_DisplayFlat(sString, iXpos, iYpos, 255,0,0, true);
				}
			}

			if (RunningNT() == 4)	// only needed on NT4, NT 2000 and W95/98 are ok
			{
				pSeq = NULL;

				if (i==0 && iAnimDisplayNumber_Upper)
					pSeq = Animation_GetUpperSequence( iAnimDisplayNumber_Upper-1);
				if (i==1 && iAnimDisplayNumber_Lower)
					pSeq = Animation_GetLowerSequence( iAnimDisplayNumber_Lower-1);

				if (pSeq)
				{	
					if (pSeq->bMultiSeq)
					{
						assert(0);	// should never be able to get here in the animlock display-cycler				
					}
					else
					{
						sprintf(sString,"( %s anim     : %s  Frames: %4d...%4d%s )",!i?"Upper":"Lower",String_EnsureMinLength(pSeq->sName.c_str(),iAnimLockLongestString),pSeq->iTargetFrame,(pSeq->iTargetFrame+pSeq->iFrameCount)-1,String_EnsureMinLength((pSeq->iLoopFrame==-1)?"":va("  loop: %3d(%3d)",pSeq->iLoopFrame,pSeq->iTargetFrame+pSeq->iLoopFrame),25));					
						
						int iXpos = (g_iScreenWidth/2)-( ((strlen(sString)/2)/*+2*/)*TEXT_WIDTH);	// 2 chars back from LOCk string, because of bracket+space at start
						int iYpos = g_iScreenHeight-((!i?7:6)*TEXT_DEPTH);

						Text_DisplayFlat(sString, iXpos, iYpos, 0,200,200, true);	// dim yellow
					}
				}
			}
		}

		// display current FPS and interp state...
		//
		sprintf(sString,"FPS: %2.2f %s",1/(mdview.animSpeed),mdview.animate?"(Playing)":"(Stopped)");

		iTextX = 
		Text_DisplayFlat(sString,	(g_iScreenWidth/2)-( (strlen(sString)/2)*TEXT_WIDTH),
									1*TEXT_DEPTH,
									255,255,255,
									false
						);

		if (mdview.interpolate)
		{
			iTextX = Text_DisplayFlat("(Interpolated)", iTextX+(2*TEXT_WIDTH),1*TEXT_DEPTH, 255/2,255/2,255/2,false);
		}

		iTextX = Text_DisplayFlat(va("(LOD: %d)",mdview.iLODLevel+1), iTextX+(2*TEXT_WIDTH), 1*TEXT_DEPTH, 255/2,255,255/2,false);
/*		Text_DisplayFlat(sString,	g_iScreenWidth-((strlen(sString)+2)*TEXT_WIDTH),
																	 2 *TEXT_DEPTH,
									255,255,255,
									false
						);*/

		iTextX = Text_DisplayFlat(va("( FOV: %g )",mdview.dFOV), iTextX+(2*TEXT_WIDTH),1*TEXT_DEPTH, 255, 255, 255, false);


		if (mdview.bUseAlpha)
		{
			Text_DisplayFlat("( Alpha )", iTextX+(2*TEXT_WIDTH),1*TEXT_DEPTH, 128, 128, 128, false);
		}

		// display head skin numbers in top left...
		//
		gl_model* pModel = R_FindModel( mdview.baseModel, "head");
		if (pModel)
		{
			sprintf(sString,"Head skin: %s", va("\"%s%s\"",model->sHeadSkinName,!mdview.iSkinNumber?"":va("-%1d",mdview.iSkinNumber)));

			Text_DisplayFlat(sString,	2*TEXT_WIDTH,//(g_iScreenWidth/2)-( (strlen(sString)/2)*TEXT_WIDTH),
										1*TEXT_DEPTH,
										200,200,200,
										false
							);
		}

		// display which format anim table this is using (if any)...
		//
		if (mdview.bAnimCFGLoaded)
		{
			if (mdview.bAnimIsMultiPlayerFormat)
				sprintf(sString,"( MultiPlayer ) ");
			else
				sprintf(sString,"( SinglePlayer ) ");

			int iYpos = g_iScreenHeight-(2*TEXT_DEPTH);
			int iXpos = g_iScreenWidth -(strlen(sString)*TEXT_WIDTH);

			Text_DisplayFlat(sString, iXpos, iYpos, 128,128,128, true);	// grey
		}


		// display current picmip state...
		//
		{
			extern int TextureList_GetMip(void);

			int iYpos = g_iScreenHeight-(2*TEXT_DEPTH);
			int iXpos = 1*TEXT_WIDTH;

			sprintf(sString,"( PICMIP: %d )",TextureList_GetMip());
			Text_DisplayFlat(sString,	
								iXpos, iYpos,
								100,100,100,
								false
							);
		}
	}
}
Пример #2
0
BOOL CDOSProcess::executeTool(CProcessStatus& status)
{
	CString sCl = getCommandLine(status);

	/* FIND OUT WHERE THE EXECUTABLE IS */

	 CString sActualPath;
	 HINSTANCE hInstance = FindExecutable(getToolPath(), NULL, sActualPath.GetBuffer(MAX_PATH));
	 sActualPath.ReleaseBuffer();

	if((DWORD)hInstance == ERROR_FILE_NOT_FOUND)
	{
		CString s;
		s.Format("The executable %s could not be found.  Make sure it is part of the PATH statement in your AUTOEXEC.BAT file\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == ERROR_PATH_NOT_FOUND)
	{
		CString s;
		s.Format("Windows gave a PATH NOT FOUND error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == SE_ERR_ACCESSDENIED)
	{
		CString s;
		s.Format("Windows gave an ACCESS DENIED error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance <=32)
	{
		CString s;
		s.Format("Unknown problem trying to execute(find?) %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}


	CString sBatchPath = status.makeTempPath(getBatchName(status), ".bat");

	ofstream fout(sBatchPath);
	if(!fout.is_open())
	{
		MessageBox( NULL, "executeTool()", "Couldn't open batch file for writing", MB_ICONEXCLAMATION | MB_OK);
		return FALSE;
	}
	//TRACE("%s Command Line Length=%d\n", getToolPath(), strlen(sCl));
	fout << "REM created by CARLAStudio during a parse operation\n";
	fout << "\"" << sActualPath << "\" " << sCl << "\n";
	fout.close();

	CString s;
#ifdef Before1_04
	if(status.getVerbosity())
		s = sBatchPath;
	else
		s.Format("C:\\WINDOWS\\COMMAND.COM  /c \"%s\"", sBatchPath);
#else  // hab and drz 1.04 to make work with NT
	TCHAR lpszCommand[MAX_PATH];
	if (RunningNT())
	{
		GetSystemDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\cmd.exe");
	}
	else
	{
		GetWindowsDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\command.com");
	}
	s.Format("%s %s \"%s\"", lpszCommand,
						 (status.getVerbosity()& 0x01)  ? "/k" : "/c", //jdh 11/10/99
						 sBatchPath);
#endif // Before1_04

	return WinExecWait(s, TRUE); //status.getVerbosity());// false makes winoldapps

/*	 hInstance = ShellExecute(
		AfxGetMainWnd( )->m_hWnd,	// handle to parent window
		"open",	// pointer to string that specifies operation to perform
		sBatchPath,	// pointer to filename or folder name string
		NULL,	// pointer to string that specifies executable-file parameters
		// To Do: this is just a guess at the best place to put them
		//status.sRAWPath.getDirectory(),	// pointer to string that specifies default directory
		status.getTempDirectory(),
		status.getVerbosity()?SW_SHOW:SW_HIDE	// whether file is shown when opened
	   );

	return TRUE;
*/
}