4837 lines
216 KiB
C
4837 lines
216 KiB
C
/*=========================================================================
|
|
* RastDisp.c : new rasters display and page managing
|
|
*
|
|
* PC SPECIFIC FILE
|
|
* =========================================================================
|
|
*/
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
|
|
#ifdef USE_PROFILER
|
|
|
|
#include "Limits.h"
|
|
#include "ToolsCPA.h"
|
|
#include "GAM.h"
|
|
#include "PRF.h"
|
|
#include "SCT.h"
|
|
#include "Main.h"
|
|
#include "acp_driver.h"
|
|
#ifdef ACTIVE_EDITOR
|
|
#define __MSC__
|
|
//#include "glide.h"
|
|
#endif
|
|
|
|
extern void GLI_fn_vGetStats( unsigned long *_p_ulPixelsSent, unsigned long *_p_ulPixelsDisplayed );
|
|
extern void GLI_fn_vWaitRetrace( void);
|
|
|
|
void GLI_fn_vPrepareShowFrameRate( int _iTotalEngineDuration, int _iFlipDuration );
|
|
|
|
extern unsigned char g_ucIsEdInGhostMode;
|
|
extern unsigned long PLA_g_ulMaxOccupationOfSupObjHeap;
|
|
extern unsigned long PLA_g_ulMaxOccupationOfChannels;
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
extern unsigned long g_ulNumberOfAgos; /* Number of AGOs currently used */
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
/* Display mode and constants*/
|
|
#define C_lNumberOfPages 11
|
|
/**/
|
|
#define C_lNumberOfModes 5
|
|
|
|
#define C_lAbsoluteValuesMode 0
|
|
#define C_lAbsolutePercentMode 1
|
|
#define C_lAbsoluteGraphicMode 2
|
|
#define C_lWantedPercentMode 3
|
|
#define C_lWantedGraphicMode 4
|
|
/**/
|
|
#define C_lPCMode 0
|
|
#define C_lU64Mode 1
|
|
#define C_lPCFinalMode 2
|
|
#define C_lU64FinalMode 3
|
|
/**/
|
|
#define C_lStep 20 /* Height (in pixel) of a line*/
|
|
|
|
#define C_lBarLength 256
|
|
|
|
/* wanted values for optimal rasters*/
|
|
/* for 2 trames : 2*1000/100 = 20*/
|
|
#define C_lMainLoopWanted 20 /* 2 trames*/
|
|
#define C_lDisplayLoopWanted 10 /* 1 trames*/
|
|
#define C_lIALoopWanted 5 /* 0.5 trames*/
|
|
#define C_lCOLLoopWanted 2 /* 0.2 trames*/
|
|
|
|
#define C_lHistorySize 50
|
|
|
|
#define C_pvNoData ((void *) -1)
|
|
|
|
static unsigned long gs_ulU64CoefForDisplay = 150; /* Coef = 1.5 for a PC at 333 MHz*/
|
|
static unsigned long gs_ulU64CoefForDisplaySpecific = 150; /* Coef = 1.5 for a PC at 333 MHz*/
|
|
static unsigned long gs_ulU64CoefForAI = 270; /* Coef = 2.7*/
|
|
static unsigned long gs_ulU64CoefForCollision = 550; /* Coef = 5.5*/
|
|
static unsigned long gs_ulU64CoefForMechanic = 300; /* Coef = 3.0*/
|
|
static unsigned long gs_ulU64CoefForAnimPlayer = 500; /* Coef = 5.0*/
|
|
static unsigned long gs_ulU64CoefForInput = 180; /* Coef = 1.8*/
|
|
static unsigned long gs_ulU64CoefForSound = 150; /* Coef = 1.5*/
|
|
static unsigned long gs_ulU64CoefForEditor = 0; /* No editor in U64 version*/
|
|
static unsigned long gs_ulU64CoefForRest = 0;
|
|
static unsigned long gs_ulU64CoefForRasterDisplay = 0;
|
|
|
|
static float gs_fEvalCoefForDisplay = 1.3f;
|
|
static float gs_fEvalCoefForDisplaySpecific = 1.2f;
|
|
static float gs_fEvalCoefForAI = 2.0f;
|
|
static float gs_fEvalCoefForCollision = 1.0f;
|
|
static float gs_fEvalCoefForMechanic = 1.5f;
|
|
static float gs_fEvalCoefForAnimPlayer = 1.5f;
|
|
|
|
unsigned long g_ulCoefForDisplay;
|
|
unsigned long g_ulCoefForDisplaySpecific;
|
|
unsigned long g_ulCoefForAI;
|
|
unsigned long g_ulCoefForCollision;
|
|
unsigned long g_ulCoefForMechanic;
|
|
unsigned long g_ulCoefForAnimPlayer;
|
|
unsigned long g_ulCoefForInput;
|
|
unsigned long g_ulCoefForSound;
|
|
unsigned long g_ulCoefForEditor;
|
|
unsigned long g_ulCoefForRest;
|
|
unsigned long g_ulCoefForRasterDisplay;
|
|
|
|
#define M_DisplayIA(ulTime) ((ACP_tdxBool) ((ulTime) > 2 * C_lIALoopWanted)) /* ulTime > 2 % Total IA*/
|
|
#define M_DisplayCollision(ulTime) ((ACP_tdxBool) ((ulTime) > 2 * C_lCOLLoopWanted)) /* ulTime > 2 % Total Collision*/
|
|
#define M_SprintDecimal(text,lValue) sprintf(text, "%2i.%1i%%", lValue, (10 * lValue) % 10 );
|
|
#define M_DisplayValue(text,format,lValue,Coll,y) \
|
|
{ \
|
|
sprintf(text,format,lValue); \
|
|
DisplayPolices(text,Coll,y); \
|
|
}
|
|
#define M_DisplayDecimalValue(text,lValue,Coll,y) \
|
|
{ \
|
|
sprintf(text,"%2i.%1i%%",lValue, (10 * lValue) % 10 ); \
|
|
DisplayPolices(text,Coll,y); \
|
|
}
|
|
|
|
#define M_bMode(p_stDisplayMode,Value) ((p_stDisplayMode) -> lRasterDisplayMode == Value)
|
|
#define M_bAbsoluteValueMode(p_stDisplayMode) M_bMode(p_stDisplayMode,C_lAbsoluteValuesMode)
|
|
#define M_bAbsolutePercentMode(p_stDisplayMode) M_bMode(p_stDisplayMode,C_lAbsolutePercentMode)
|
|
#define M_bAbsoluteGraphicMode(p_stDisplayMode) M_bMode(p_stDisplayMode,C_lAbsoluteGraphicMode)
|
|
#define M_bWantedPercentMode(p_stDisplayMode) M_bMode(p_stDisplayMode,C_lWantedPercentMode)
|
|
#define M_bWantedGraphicMode(p_stDisplayMode) M_bMode(p_stDisplayMode,C_lWantedGraphicMode)
|
|
#define M_bShowCurrent(p_stDisplayMode) (p_stDisplayMode -> bCurrentDisplayed)
|
|
#define M_bShowAverage(p_stDisplayMode) (p_stDisplayMode -> bAverageDisplayed)
|
|
#define M_bShowMaximum(p_stDisplayMode) (p_stDisplayMode -> bMaxDisplayed)
|
|
|
|
#define M_bPCU64Mode(p_stDisplayMode,Value) ((p_stDisplayMode) -> lPCU64Mode == Value)
|
|
#define M_bPCRealMode(p_stDisplayMode) M_bPCU64Mode(p_stDisplayMode,C_lPCMode)
|
|
#define M_bU64RealMode(p_stDisplayMode) M_bPCU64Mode(p_stDisplayMode,C_lU64Mode)
|
|
#define M_bPCFinalMode(p_stDisplayMode) M_bPCU64Mode(p_stDisplayMode,C_lPCFinalMode)
|
|
#define M_bU64FinalMode(p_stDisplayMode) M_bPCU64Mode(p_stDisplayMode,C_lU64FinalMode)
|
|
#define M_bPCDisplayMode(p_stDisplayMode) (M_bPCRealMode(p_stDisplayMode) || M_bPCFinalMode(p_stDisplayMode))
|
|
#define M_bU64DisplayMode(p_stDisplayMode) (M_bU64RealMode(p_stDisplayMode) || M_bU64FinalMode(p_stDisplayMode))
|
|
/*=============================================================================*/
|
|
|
|
/* local private structures*/
|
|
typedef struct tdstHistoryMaxValue_
|
|
{
|
|
void* p_vData;
|
|
char cNbTramesTreated;
|
|
char cNbTramesNotTreated;
|
|
unsigned char ucDisplayLineNumber;
|
|
unsigned long ulValues[ PRF_C_lNbTramesForAverage ];
|
|
} tdstHistoryMaxValue;
|
|
|
|
typedef struct tdstHistoryValues_
|
|
{
|
|
unsigned long ulAverage;
|
|
unsigned long ulMax;
|
|
unsigned long ulValues[ PRF_C_lNbTramesForAverage ];
|
|
char cCurrent;
|
|
} tdstHistoryValues;
|
|
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueAI [C_lHistorySize];
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueCollision [C_lHistorySize];
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueMechanic [C_lHistorySize];
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueAnimPlayer[C_lHistorySize];
|
|
unsigned char ucAIFirstUnusedLineNumber;
|
|
unsigned char ucCollisionFirstUnusedLineNumber;
|
|
unsigned char ucMechanicFirstUnusedLineNumber;
|
|
unsigned char ucAnimPlayerFirstUnusedLineNumber;
|
|
tdstHistoryValues stHistoryValuesTotalPCFinal;
|
|
tdstHistoryValues stHistoryValuesTotalU64Real;
|
|
tdstHistoryValues stHistoryValuesTotalU64Final;
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueOneAI;
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueOneCollision;
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueOneMechanic;
|
|
tdstHistoryMaxValue aDEF_stHistoryMaxValueOneAnimPlayer;
|
|
/*=============================================================================*/
|
|
typedef struct tdstDisplayMode_
|
|
{
|
|
long lRasterDisplayMode;
|
|
long lPCU64Mode;
|
|
ACP_tdxBool bCurrentDisplayed;
|
|
ACP_tdxBool bAverageDisplayed;
|
|
ACP_tdxBool bMaxDisplayed;
|
|
ACP_tdxBool bActorChanged;
|
|
} tdstDisplayMode;
|
|
|
|
/*=============================================================================*/
|
|
|
|
typedef struct stScreenBuffer_
|
|
{
|
|
char sz64_Text [64];
|
|
long lX , lY;
|
|
} tdstScreenBuffer;
|
|
|
|
typedef struct stScreenBuffer2_
|
|
{
|
|
long lX , lY , lLength , lHeight;
|
|
} tdstScreenBuffer2;
|
|
|
|
tdstScreenBuffer a200_stScreenBuffer [200];
|
|
tdstScreenBuffer2 a500_stScreenBuffer2 [500];
|
|
ACP_tdxIndex xNbScreenBuffer;
|
|
ACP_tdxIndex xNbScreenBuffer2;
|
|
|
|
#if defined(WIN32) /* {*/
|
|
static long g_lDeltaXForWnd;
|
|
static long g_lDeltaYForWnd;
|
|
static HWND g_hWndRaster;
|
|
static long g_lXMaxScreenUsed;
|
|
static long g_lYMaxScreenUsed;
|
|
#endif /* WIN32 }*/
|
|
|
|
static void *g_p_vDisplayedActor;
|
|
|
|
/*=============================================================================*/
|
|
|
|
typedef struct stTextToDrawInformation_
|
|
{
|
|
char * szTextToDraw;
|
|
long lX , lY;
|
|
} tdstTextToDrawInformation;
|
|
|
|
#define C_MAX_NUMBER_OF_TEXT_TO_DRAW 10
|
|
|
|
tdstTextToDrawInformation g_a_stTextToDrawInformation [C_MAX_NUMBER_OF_TEXT_TO_DRAW];
|
|
long g_lNumberOfTextToDraw;
|
|
|
|
/*=============================================================================*/
|
|
|
|
/* local private functions*/
|
|
/*void fn_vSlowDownEngine (unsigned long _lTimeSpentToDisplayRaster);*/
|
|
void fn_vDrawEmptyPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawMainPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawDisplayPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawAIPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawCollisionPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawSectorPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawPGMPage (tdstDisplayMode *_p_stDisplayMode , unsigned long _lTimeSpentToDisplayRaster);
|
|
void fn_vDrawMechanicPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawAnimPlayerPage (tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vUpdateTotalTimeValues();
|
|
void fn_vDrawPageIndependantVariable(tdstDisplayMode *_p_stDisplayMode);
|
|
void fn_vDrawPGMScreen (tdstDisplayMode *_p_stDisplayMode);
|
|
void DisplayPolices (char * _szText , long _lX , long _lY);
|
|
void fn_vDrawActorPage (tdstDisplayMode *_p_stDisplayMode);
|
|
long fn_lDrawGliRasterPage (long lPage);
|
|
void fn_vDrawTextToDraw ();
|
|
|
|
#if defined(WIN32) /* {*/
|
|
void GAM_fn_vDisplayOnWindowRaster();
|
|
void GAM_fn_vClearWindowRaster();
|
|
#endif /* WIN32 }*/
|
|
/*=============================================================================*/
|
|
|
|
#ifndef U64
|
|
extern SCR_tdst_Link_Table SECT_stLinkTable;
|
|
extern void GLI_vDrawBar (long _lX0, long _lY0, long _lLength, long _lHeight); /* ??? Warning : this is a specific GLIDE function*/
|
|
extern void GLI_DRV_GetStats(unsigned long *_p_ulPixelSent, unsigned long *_p_ulPixelDisplayed ); /* not a specific glide function*/
|
|
#endif
|
|
|
|
#define M_CoefForFrequency(ulFrequency) (0.7 + 0.3 * ulFrequency / 333)
|
|
|
|
|
|
/****************** FabPerez InfoTrame *****************/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
extern HIE_tdxHandleToSuperObject g_hLoadedSuperObjectRoot;
|
|
extern StructInfoSectorTrame *pt_aStructInfoSectorTrame;
|
|
int iNumSecteurCourant;
|
|
#endif /*WIN32 _DEBUG*/
|
|
/***************** Fin FabPerez InfoTrame *****************/
|
|
|
|
/****************** FabPerez InfoTrame *****************/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
void fn_RecupInfoTrameSecteur(void)
|
|
{
|
|
HIE_tdxHandleToSuperObject hCurrentSectorObjet, hMainCharacterObjet;
|
|
struct tdstEngineObject_ * Engine;
|
|
struct tdstSectInfo_ * SectInfo;
|
|
struct SECT_tdstSector_ * p_stSector;
|
|
unsigned long p_ulTotalTime, ulMonitorFrequency;
|
|
BOOL SecteurTrouve = FALSE;
|
|
|
|
|
|
hMainCharacterObjet = MC_fn_hGetCharacterInMainCharacterNode(MC_fn_hGetFirstMainCharNode());
|
|
Engine = (struct tdstEngineObject_ *) HIE_fn_hGetSuperObjectObject(hMainCharacterObjet);
|
|
SectInfo = Engine->h_SectInfo;
|
|
hCurrentSectorObjet = fn_h_SectInfoGetCurrentSector( SectInfo);
|
|
p_stSector = HIE_M_xGetSuperObjectMember(hCurrentSectorObjet,hLinkedObject.p_stSector);
|
|
|
|
iNumSecteurCourant = 0;
|
|
while( !SecteurTrouve && iNumSecteurCourant < pt_aStructInfoSectorTrame->i_NbSectorMap )
|
|
{
|
|
if(p_stSector->szSectorName == (pt_aStructInfoSectorTrame+iNumSecteurCourant)->p_a256_SectorName) SecteurTrouve = TRUE;
|
|
iNumSecteurCourant++;
|
|
}
|
|
iNumSecteurCourant--;
|
|
|
|
if(SecteurTrouve)
|
|
{
|
|
p_ulTotalTime = PRF_fn_ulGetFunctionDuration(PRF_C_ulFctMainLoop);
|
|
ulMonitorFrequency = PRF_fn_lGetIndependantVariable(PRF_C_ulIdpMonitorFrequency);
|
|
if(ulMonitorFrequency == 0) return;
|
|
|
|
if(p_ulTotalTime <= 1000000/(2*ulMonitorFrequency))
|
|
{
|
|
(pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_UneTrame++;
|
|
}
|
|
else if(p_ulTotalTime > 1000000/(2*ulMonitorFrequency) && p_ulTotalTime <= 2000000/(2*ulMonitorFrequency))
|
|
{
|
|
(pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_DeuxTrames++;
|
|
}
|
|
else (pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_TroisTrames++;
|
|
}
|
|
else return; // erreur impossible de retrouver le secteur
|
|
|
|
}
|
|
#endif /*WIN32 _DEBUG*/
|
|
/***************** Fin FabPerez InfoTrame *****************/
|
|
|
|
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* R A S T E R I N I T *
|
|
* *
|
|
*###########################################################################################*/
|
|
void GAM_fn_vRasterDisplayInit()
|
|
{
|
|
long lDefaultMode;
|
|
unsigned long ulCPUFrequency;
|
|
|
|
memset (aDEF_stHistoryMaxValueAI , 0 , sizeof(tdstHistoryMaxValue) * C_lHistorySize);
|
|
memset (aDEF_stHistoryMaxValueCollision , 0 , sizeof(tdstHistoryMaxValue) * C_lHistorySize);
|
|
memset (aDEF_stHistoryMaxValueMechanic , 0 , sizeof(tdstHistoryMaxValue) * C_lHistorySize);
|
|
memset (aDEF_stHistoryMaxValueAnimPlayer , 0 , sizeof(tdstHistoryMaxValue) * C_lHistorySize);
|
|
memset (&stHistoryValuesTotalPCFinal , 0 , sizeof(tdstHistoryValues) );
|
|
memset (&stHistoryValuesTotalU64Real , 0 , sizeof(tdstHistoryValues) );
|
|
memset (&stHistoryValuesTotalU64Final , 0 , sizeof(tdstHistoryValues) );
|
|
memset (&aDEF_stHistoryMaxValueOneAI , 0 , sizeof(tdstHistoryMaxValue) );
|
|
memset (&aDEF_stHistoryMaxValueOneCollision , 0 , sizeof(tdstHistoryMaxValue) );
|
|
memset (&aDEF_stHistoryMaxValueOneMechanic , 0 , sizeof(tdstHistoryMaxValue) );
|
|
memset (&aDEF_stHistoryMaxValueOneAnimPlayer, 0 , sizeof(tdstHistoryMaxValue) );
|
|
ucAIFirstUnusedLineNumber =
|
|
ucCollisionFirstUnusedLineNumber =
|
|
ucMechanicFirstUnusedLineNumber =
|
|
ucAnimPlayerFirstUnusedLineNumber = 1;
|
|
/**/
|
|
/* Initial default mode*/
|
|
/**/
|
|
lDefaultMode = PRF_C_ulShowCurrent | PRF_C_ulShowAverage | PRF_C_ulSuperImposed; /* PC + Current + Average*/
|
|
PRF_fn_vSetIndependantVariable (PRF_C_ulIdpRasterDisplayMode , lDefaultMode);
|
|
/**/
|
|
/* Take account real CPU Frequency*/
|
|
/**/
|
|
ulCPUFrequency = PRF_fn_ulGetCPUFrequency();
|
|
if( ulCPUFrequency )
|
|
{
|
|
gs_ulU64CoefForDisplay = (unsigned long) (gs_ulU64CoefForDisplay * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForAI = (unsigned long) (gs_ulU64CoefForAI * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForCollision = (unsigned long) (gs_ulU64CoefForCollision * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForMechanic = (unsigned long) (gs_ulU64CoefForMechanic * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForAnimPlayer = (unsigned long) (gs_ulU64CoefForAnimPlayer * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForInput = (unsigned long) (gs_ulU64CoefForInput * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForSound = (unsigned long) (gs_ulU64CoefForSound * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForEditor = (unsigned long) (gs_ulU64CoefForEditor * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForRest = (unsigned long) (gs_ulU64CoefForRest * M_CoefForFrequency(ulCPUFrequency));
|
|
gs_ulU64CoefForRasterDisplay = (unsigned long) (gs_ulU64CoefForRasterDisplay * M_CoefForFrequency(ulCPUFrequency));
|
|
}
|
|
#if defined(WIN32) /* {*/
|
|
{
|
|
RECT ClientRect;
|
|
g_lDeltaXForWnd = GetSystemMetrics (SM_CXBORDER) + GetSystemMetrics(SM_CXFIXEDFRAME);
|
|
g_lDeltaYForWnd = GetSystemMetrics (SM_CYBORDER) + GetSystemMetrics(SM_CYFIXEDFRAME);
|
|
g_hWndRaster = fn_hGetBaseFrameWnd();
|
|
GetClientRect (g_hWndRaster , & ClientRect);
|
|
g_lXMaxScreenUsed = ClientRect . right;
|
|
g_lYMaxScreenUsed = ClientRect . bottom;
|
|
}
|
|
g_p_vDisplayedActor = NULL;
|
|
#endif /* WIN32 }*/
|
|
}
|
|
|
|
void fn_vRegisterTextToDraw (char * _szTextToDraw , long _lX , long _lY)
|
|
{
|
|
tdstTextToDrawInformation * p;
|
|
|
|
if (g_lNumberOfTextToDraw >= C_MAX_NUMBER_OF_TEXT_TO_DRAW) return;
|
|
|
|
p = & g_a_stTextToDrawInformation [g_lNumberOfTextToDraw ++];
|
|
|
|
p -> szTextToDraw = _szTextToDraw;
|
|
p -> lX = _lX;
|
|
p -> lY = _lY;
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* R A S T E R D I S P L A Y *
|
|
* *
|
|
*###########################################################################################*/
|
|
void GAM_fn_vPrepareShowRasters (unsigned long _lTimeSpentToDisplayRaster)
|
|
{
|
|
tdstDisplayMode stDisplayMode;
|
|
ACP_tdxBool b64 , bFinal , bVariableScreen , bPGMScreen;
|
|
unsigned long ulShowWorld , ulDisplayMode;
|
|
|
|
ulDisplayMode = PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode);
|
|
b64 = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulU64Mode ? TRUE : FALSE);
|
|
bFinal = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulFinalMode ? TRUE : FALSE);
|
|
bVariableScreen = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulVariableMode ? TRUE : FALSE);
|
|
bPGMScreen = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulShowPGMMode ? TRUE : FALSE);
|
|
|
|
stDisplayMode . lRasterDisplayMode = (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpAdvancedPage) + 10*C_lNumberOfModes) % C_lNumberOfModes;
|
|
stDisplayMode . lPCU64Mode = b64 ? ( bFinal ? C_lU64FinalMode : C_lU64Mode ) : ( bFinal ? C_lPCFinalMode : C_lPCMode );
|
|
stDisplayMode . bCurrentDisplayed = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulShowCurrent ? TRUE : FALSE);
|
|
stDisplayMode . bAverageDisplayed = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulShowAverage ? TRUE : FALSE);
|
|
stDisplayMode . bMaxDisplayed = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulShowMaximum ? TRUE : FALSE);
|
|
stDisplayMode . bActorChanged = (ACP_tdxBool) (ulDisplayMode & PRF_C_ulChangeActor ? TRUE : FALSE);
|
|
|
|
/* clear flag Change Actor*/
|
|
PRF_fn_vSetIndependantVariable (PRF_C_ulIdpRasterDisplayMode , ulDisplayMode & ~PRF_C_ulChangeActor);
|
|
|
|
/* no raster when editors running*/
|
|
if (fn_bTestIfEditorRunning ()) return;
|
|
|
|
xNbScreenBuffer = 0;
|
|
xNbScreenBuffer2 = 0;
|
|
|
|
/*fn_vSlowDownEngine (_lTimeSpentToDisplayRaster);*/
|
|
|
|
|
|
|
|
|
|
/*g_p_vDisplayedActor = MC_fn_hGetCharacterInMainCharacterNode (MC_fn_hGetFirstMainCharNode ());*/
|
|
|
|
|
|
|
|
|
|
|
|
if (M_bU64DisplayMode (&stDisplayMode))
|
|
{
|
|
g_ulCoefForDisplay = gs_ulU64CoefForDisplay;
|
|
g_ulCoefForDisplaySpecific = gs_ulU64CoefForDisplaySpecific;
|
|
g_ulCoefForAI = gs_ulU64CoefForAI;
|
|
g_ulCoefForCollision = gs_ulU64CoefForCollision;
|
|
g_ulCoefForMechanic = gs_ulU64CoefForMechanic;
|
|
g_ulCoefForAnimPlayer = gs_ulU64CoefForAnimPlayer;
|
|
g_ulCoefForInput = gs_ulU64CoefForInput;
|
|
g_ulCoefForSound = gs_ulU64CoefForSound;
|
|
g_ulCoefForEditor = gs_ulU64CoefForEditor;
|
|
g_ulCoefForRest = gs_ulU64CoefForRest;
|
|
g_ulCoefForRasterDisplay = gs_ulU64CoefForRasterDisplay;
|
|
}
|
|
else if (M_bPCDisplayMode (&stDisplayMode))
|
|
{
|
|
g_ulCoefForDisplay =
|
|
g_ulCoefForDisplaySpecific =
|
|
g_ulCoefForAI =
|
|
g_ulCoefForCollision =
|
|
g_ulCoefForMechanic =
|
|
g_ulCoefForAnimPlayer =
|
|
g_ulCoefForInput =
|
|
g_ulCoefForSound =
|
|
g_ulCoefForEditor =
|
|
g_ulCoefForRest =
|
|
g_ulCoefForRasterDisplay = 100;
|
|
}
|
|
if (M_bPCFinalMode (&stDisplayMode) || M_bU64FinalMode (&stDisplayMode))
|
|
{
|
|
g_ulCoefForDisplay = (unsigned long)(((float)g_ulCoefForDisplay) / gs_fEvalCoefForDisplay);
|
|
g_ulCoefForDisplaySpecific = (unsigned long)(((float)g_ulCoefForDisplaySpecific) / gs_fEvalCoefForDisplaySpecific);
|
|
g_ulCoefForAI = (unsigned long)(((float)g_ulCoefForAI) / gs_fEvalCoefForAI);
|
|
g_ulCoefForCollision = (unsigned long)(((float)g_ulCoefForCollision) / gs_fEvalCoefForCollision);
|
|
g_ulCoefForMechanic = (unsigned long)(((float)g_ulCoefForMechanic) / gs_fEvalCoefForMechanic);
|
|
g_ulCoefForAnimPlayer = (unsigned long)(((float)g_ulCoefForAnimPlayer) / gs_fEvalCoefForAnimPlayer);
|
|
}
|
|
|
|
fn_vUpdateTotalTimeValues();
|
|
|
|
/* display warning if the max number of SPO has been reached in the anim player*/
|
|
if (g_ucIsEdInGhostMode)
|
|
{
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpNbMaxAllocSPO,0);
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpNbMaxAllocCHA,0);
|
|
PLA_g_ulMaxOccupationOfSupObjHeap = 0;
|
|
PLA_g_ulMaxOccupationOfChannels = 0;
|
|
}
|
|
|
|
if (PRF_fn_lGetIndependantVariable(PRF_C_ulIdpNbMaxAllocSPO) > __PLA_NB_MAX_SUPOBJ__)
|
|
{
|
|
char text[256];
|
|
|
|
M_DisplayValue(text,"Warning : overflow PLA SPO : %i",PRF_fn_lGetIndependantVariable(PRF_C_ulIdpNbMaxAllocSPO),280,0);
|
|
}
|
|
|
|
|
|
/* show independant variable screen*/
|
|
if (bVariableScreen)
|
|
{
|
|
fn_vDrawPageIndependantVariable (& stDisplayMode);
|
|
return;
|
|
}
|
|
else if (bPGMScreen)
|
|
{
|
|
fn_vDrawPGMScreen (& stDisplayMode);
|
|
return;
|
|
}
|
|
|
|
/**/
|
|
ulShowWorld = PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulShowAll;
|
|
if( ulShowWorld == PRF_C_ulShowStatic ) DisplayPolices ("Static World Only" , 260 , 0);
|
|
else if( ulShowWorld == PRF_C_ulShowDynamic ) DisplayPolices ("Dynamic World Only" , 260 , 0);
|
|
/**/
|
|
|
|
|
|
/* the independant variable 0 of the profiler is the keydown variable to display pages*/
|
|
switch((PRF_fn_lGetIndependantVariable(PRF_C_ulIdpCurrentPage) + C_lNumberOfPages*20) % C_lNumberOfPages) /* (+ 140 for the case it is negative)*/
|
|
{
|
|
case 0: /* no rasters*/
|
|
fn_vDrawEmptyPage (& stDisplayMode);
|
|
break;
|
|
case 1: /* main page with global times*/
|
|
fn_vDrawMainPage (& stDisplayMode);
|
|
break;
|
|
case 2: /* Display page*/
|
|
fn_vDrawDisplayPage (& stDisplayMode);
|
|
break;
|
|
case 3: /* IA page*/
|
|
fn_vDrawAIPage (& stDisplayMode);
|
|
break;
|
|
case 4: /* COL page*/
|
|
fn_vDrawCollisionPage (& stDisplayMode);
|
|
break;
|
|
case 5: /* Sectors Page*/
|
|
fn_vDrawSectorPage (& stDisplayMode);
|
|
break;
|
|
case 6:
|
|
fn_vDrawMechanicPage (& stDisplayMode);
|
|
break;
|
|
case 7:
|
|
fn_vDrawAnimPlayerPage (& stDisplayMode);
|
|
break;
|
|
case 8:
|
|
fn_vDrawPGMPage (& stDisplayMode , _lTimeSpentToDisplayRaster);
|
|
break;
|
|
case 9:
|
|
fn_vDrawActorPage (& stDisplayMode);
|
|
break;
|
|
case 10:
|
|
GLI_fn_vPrepareShowFrameRate( PRF_fn_ulGetFunctionDuration( PRF_C_ulFctMainLoop ), PRF_fn_ulGetFunctionDuration( PRF_C_ulFctFlip ) );
|
|
break;
|
|
}
|
|
|
|
fn_vDrawTextToDraw ();
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
void GAM_fn_vShowRasters()
|
|
{
|
|
ACP_tdxIndex xI;
|
|
tdstScreenBuffer * p;
|
|
tdstScreenBuffer2 * p2;
|
|
|
|
/* no raster when editors running*/
|
|
if (fn_bTestIfEditorRunning ()) return;
|
|
|
|
if( (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulSuperImposed) )
|
|
{
|
|
for (xI = 0 , p = a200_stScreenBuffer ; xI < xNbScreenBuffer ; xI++ , p ++)
|
|
{
|
|
GLI_vDisplayPolices ((unsigned char *) p -> sz64_Text , p -> lX , p -> lY);
|
|
}
|
|
|
|
for (xI = 0 , p2 = a500_stScreenBuffer2 ; xI < xNbScreenBuffer2 ; xI++ , p2 ++)
|
|
{
|
|
GLI_vDrawBar (p2 -> lX , p2 -> lY , p2 -> lLength , p2 -> lHeight);
|
|
}
|
|
}
|
|
#if defined(WIN32) /* {*/
|
|
else
|
|
{
|
|
/* clear screen*/
|
|
if( PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulClearScreen )
|
|
GAM_fn_vClearWindowRaster();
|
|
|
|
GAM_fn_vDisplayOnWindowRaster();
|
|
|
|
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpRasterDisplayMode , (PRF_fn_lGetIndependantVariable(PRF_C_ulIdpRasterDisplayMode) & ~PRF_C_ulClearScreen));
|
|
}
|
|
#endif /* WIN32 }*/
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
void DisplayPolices (char * _szText , long _lX , long _lY)
|
|
{
|
|
tdstScreenBuffer * p = & a200_stScreenBuffer [xNbScreenBuffer ++];
|
|
|
|
assert (xNbScreenBuffer <= 200);
|
|
|
|
strncpy (p -> sz64_Text , _szText , 64);
|
|
p -> sz64_Text [63] = 0;
|
|
|
|
p -> lX = _lX;
|
|
p -> lY = _lY;
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
void DrawBar (long _lX , long _lY , long _lLength , long _lHeight)
|
|
{
|
|
tdstScreenBuffer2 * p = & a500_stScreenBuffer2 [xNbScreenBuffer2 ++];
|
|
|
|
assert (xNbScreenBuffer2 <= 500);
|
|
|
|
p -> lX = _lX;
|
|
p -> lY = _lY;
|
|
p -> lLength = _lLength;
|
|
p -> lHeight = _lHeight;
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
char *fn_p_cGetSectorName(char *name)
|
|
{
|
|
int i=0;
|
|
|
|
while (name[i] != ':' && name[i] != 0)
|
|
i++;
|
|
|
|
return (name[i] == 0) ? &name[i] : &name[i+1];
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
char *fn_p_cGetSOSectorName(HIE_tdxHandleToSuperObject hSO)
|
|
{
|
|
char *name;
|
|
int i=0;
|
|
|
|
name = fn_szGetSectorName(hSO);
|
|
return fn_p_cGetSectorName( name );
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
char *fn_p_cGetActorFamilyName(HIE_tdxHandleToSuperObject hSO_Character)
|
|
{
|
|
MS_tdxHandleTo3dData h3dData = M_GetMSHandle( hSO_Character, 3dData );
|
|
tdxHandleToFamilyList hFamily = h3dData ? fn_h3dDataGetFamily( h3dData ) : NULL;
|
|
if( hFamily )
|
|
{
|
|
tdObjectType otType = hFamily ? hFamily -> otObjectFamilyType : -1;
|
|
|
|
return fn_szFindFamilyTypeNameOfFamilyType( otType );
|
|
}
|
|
else
|
|
{
|
|
#ifdef _DEBUG
|
|
tdxHandleToState hState = h3dData ? fn_h3dDataGetInitialState( h3dData ) : NULL;
|
|
struct tdstAnim3d_ *p_stAnim = hState ? fn_p_stGetAnimInState( hState ) : NULL;
|
|
|
|
return p_stAnim ? p_stAnim -> szAnimName : NULL;
|
|
#else
|
|
static char szName[20];
|
|
|
|
sprintf( szName, "%p", hSO_Character );
|
|
|
|
return szName;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
/*=============================================================================*/
|
|
|
|
char *fn_p_cGetActorName(HIE_tdxHandleToSuperObject hSO_Character)
|
|
{
|
|
#if defined(_DEBUG) && defined(__DEBUG_AI__)
|
|
AI_tdstMind *p_stMind;
|
|
MS_tdxHandleToBrain h_Brain;
|
|
|
|
if( ((h_Brain = M_GetMSHandle(hSO_Character,Brain)) != NULL ) &&
|
|
((p_stMind = M_pstGetMindOfBrain(h_Brain)) != NULL)
|
|
)
|
|
{
|
|
return p_stMind -> szPersoName;
|
|
}
|
|
#endif
|
|
return fn_p_cGetActorFamilyName(hSO_Character);
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
/* Window Display functions*/
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
#if defined(WIN32) /* {*/
|
|
|
|
/*=============================================================================*/
|
|
void GAM_fn_vDisplayOnWindowRaster()
|
|
{
|
|
ACP_tdxIndex xI;
|
|
tdstScreenBuffer * p;
|
|
tdstScreenBuffer2 * p2;
|
|
HBRUSH hBkBrush , hBrush;
|
|
RECT ClientRect;
|
|
HDC hDC;
|
|
PLOGFONT plfBold;
|
|
HFONT hFont,hPreviousFont;
|
|
int iSpaceSize,iWSize, iCharSize;
|
|
BOOL bAlreadyClear = FALSE;
|
|
|
|
/**/
|
|
hDC = GetDC (g_hWndRaster);
|
|
hBkBrush = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
|
|
hBrush = CreateSolidBrush (GetTextColor (hDC));
|
|
SetBkColor (hDC , GetSysColor (COLOR_WINDOW));
|
|
GetClientRect (g_hWndRaster , & ClientRect);
|
|
/**/
|
|
if( (g_stEngineStructure.stEngineTimer.ulTrameNumber % 20) == 0)
|
|
{
|
|
GAM_fn_vClearWindowRaster();
|
|
bAlreadyClear = TRUE;
|
|
}
|
|
/**/
|
|
plfBold = (PLOGFONT) LocalAlloc (LPTR, sizeof (LOGFONT));
|
|
lstrcpy(plfBold->lfFaceName, "MS Sans Serif");
|
|
plfBold->lfWeight = FW_BOLD ;
|
|
plfBold->lfHeight = 8;
|
|
plfBold->lfEscapement = 0;
|
|
hFont = CreateFontIndirect (plfBold);
|
|
hPreviousFont = SelectObject (hDC , hFont);
|
|
GetCharWidth (hDC , ' ' , ' ' , &iSpaceSize);
|
|
GetCharWidth (hDC , 'W' , 'W' , &iWSize);
|
|
iCharSize = (iSpaceSize + iWSize) >> 1;
|
|
/**/
|
|
for (xI = 0 , p = a200_stScreenBuffer ; xI < xNbScreenBuffer ; xI++ , p ++)
|
|
{
|
|
SIZE size;
|
|
RECT rect;
|
|
char *c;
|
|
int iNbSpaces,iLength;
|
|
int iX;
|
|
|
|
p -> lX += g_lDeltaXForWnd;
|
|
p -> lY += g_lDeltaYForWnd;
|
|
|
|
/**/
|
|
c = p -> sz64_Text;
|
|
while(*c == ' ') c++;
|
|
iNbSpaces = (c - p -> sz64_Text);
|
|
iLength = strlen ((const char *) p -> sz64_Text);
|
|
GetTextExtentPoint32 (hDC , (const char *) p -> sz64_Text , iLength , &size);
|
|
if( !bAlreadyClear )
|
|
{
|
|
rect . left = p -> lX - 5;
|
|
rect . top = p -> lY - 5;
|
|
rect . right = rect . left + size . cx + 10 + iSpaceSize * iNbSpaces;
|
|
rect . bottom = rect . top + size . cy + 10;
|
|
FillRect (hDC , &rect , hBkBrush);
|
|
}
|
|
iX = p -> lX + (iNbSpaces ? iCharSize * iLength - size . cx : 0);
|
|
TextOut (hDC , iX, p -> lY , (const char *) p -> sz64_Text , iLength);
|
|
g_lXMaxScreenUsed = max (g_lXMaxScreenUsed , iX + size . cx);
|
|
g_lYMaxScreenUsed = max (g_lYMaxScreenUsed , p -> lY + size . cy);
|
|
}
|
|
|
|
for (xI = 0 , p2 = a500_stScreenBuffer2 ; xI < xNbScreenBuffer2 ; xI++ , p2 ++)
|
|
{
|
|
RECT rect;
|
|
|
|
p2 -> lX += g_lDeltaXForWnd;
|
|
p2 -> lY += g_lDeltaYForWnd;
|
|
|
|
rect . left = p2 -> lX;
|
|
rect . top = p2 -> lY;
|
|
if( !bAlreadyClear )
|
|
{
|
|
rect . right = ClientRect . right;
|
|
rect . bottom = rect . top + p2 -> lHeight;
|
|
|
|
FillRect (hDC , &rect , hBkBrush);
|
|
}
|
|
rect . right = rect . left + p2 -> lLength;
|
|
rect . bottom = rect . top + p2 -> lHeight;
|
|
|
|
FillRect (hDC , &rect , hBrush);
|
|
|
|
g_lXMaxScreenUsed = max (g_lXMaxScreenUsed , rect . right);
|
|
g_lYMaxScreenUsed = max (g_lYMaxScreenUsed , rect . bottom);
|
|
}
|
|
|
|
SelectObject (hDC , hPreviousFont);
|
|
DeleteObject (hFont);
|
|
DeleteObject (hBkBrush);
|
|
DeleteObject (hBrush);
|
|
LocalFree (plfBold);
|
|
ReleaseDC (g_hWndRaster , hDC);
|
|
}
|
|
|
|
void GAM_fn_vClearWindowRaster()
|
|
{
|
|
HBRUSH hBrush;
|
|
RECT ClearRect;
|
|
HDC hDC;
|
|
|
|
hDC = GetDC (g_hWndRaster);
|
|
hBrush = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
|
|
ClearRect . left = ClearRect . top = 0;
|
|
ClearRect . right = g_lXMaxScreenUsed;
|
|
ClearRect . bottom = g_lYMaxScreenUsed;
|
|
FillRect (hDC , &ClearRect , hBrush);
|
|
DeleteObject (hBrush);
|
|
ReleaseDC (g_hWndRaster, hDC);
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
#endif /* WIN32 }*/
|
|
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
/*=============================================================================*/
|
|
|
|
void fn_vUpdateTotalTimeValues()
|
|
{
|
|
unsigned long ulTotalTime , ulSom , ulCurrent;
|
|
int iCount;
|
|
/**/
|
|
/* PC Final Mode*/
|
|
/**/
|
|
ulTotalTime = (unsigned long)(
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay) / gs_fEvalCoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific) / gs_fEvalCoefForDisplaySpecific+
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctInput) +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctEditor) +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctSound) +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI) / gs_fEvalCoefForAI +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions) / gs_fEvalCoefForCollision +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDNM) / gs_fEvalCoefForMechanic +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAnimPlayer) / gs_fEvalCoefForAnimPlayer +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulWaitFor3dFx) +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctIADNMPLAMisc));
|
|
/**/
|
|
stHistoryValuesTotalPCFinal . cCurrent++;
|
|
if (stHistoryValuesTotalPCFinal . cCurrent == PRF_C_lNbTramesForAverage) stHistoryValuesTotalPCFinal . cCurrent = 0;
|
|
stHistoryValuesTotalPCFinal . ulValues [ stHistoryValuesTotalPCFinal . cCurrent ] = ulTotalTime;
|
|
stHistoryValuesTotalPCFinal . ulMax = 0;
|
|
ulSom = 0;
|
|
for (iCount = 0 ; iCount < PRF_C_lNbTramesForAverage; iCount++)
|
|
{
|
|
ulCurrent = stHistoryValuesTotalPCFinal . ulValues [ iCount ];
|
|
ulSom += ulCurrent;
|
|
if (ulCurrent > stHistoryValuesTotalPCFinal . ulMax) stHistoryValuesTotalPCFinal . ulMax = ulCurrent;
|
|
}
|
|
stHistoryValuesTotalPCFinal . ulAverage = ulSom / PRF_C_lNbTramesForAverage;
|
|
/**/
|
|
/* U64 Real Mode*/
|
|
/**/
|
|
ulTotalTime = (PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay) * gs_ulU64CoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific) * gs_ulU64CoefForDisplaySpecific +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctInput) * gs_ulU64CoefForInput +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctEditor) * gs_ulU64CoefForEditor +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctSound) * gs_ulU64CoefForSound +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI) * gs_ulU64CoefForAI +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions) * gs_ulU64CoefForCollision +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDNM) * gs_ulU64CoefForMechanic +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAnimPlayer) * gs_ulU64CoefForAnimPlayer ) / 100 +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctIADNMPLAMisc);
|
|
/**/
|
|
stHistoryValuesTotalU64Real . cCurrent++;
|
|
if (stHistoryValuesTotalU64Real . cCurrent == PRF_C_lNbTramesForAverage) stHistoryValuesTotalU64Real . cCurrent = 0;
|
|
stHistoryValuesTotalU64Real . ulValues [ stHistoryValuesTotalU64Real . cCurrent ] = ulTotalTime;
|
|
stHistoryValuesTotalU64Real . ulMax = 0;
|
|
ulSom = 0;
|
|
for (iCount = 0 ; iCount < PRF_C_lNbTramesForAverage; iCount++)
|
|
{
|
|
ulCurrent = stHistoryValuesTotalU64Real . ulValues [ iCount ];
|
|
ulSom += ulCurrent;
|
|
if (ulCurrent > stHistoryValuesTotalU64Real . ulMax) stHistoryValuesTotalU64Real . ulMax = ulCurrent;
|
|
}
|
|
stHistoryValuesTotalU64Real . ulAverage = ulSom / PRF_C_lNbTramesForAverage;
|
|
/**/
|
|
/* U64 Final Mode*/
|
|
/**/
|
|
ulTotalTime = (unsigned long)(
|
|
(PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay) * gs_ulU64CoefForDisplay / gs_fEvalCoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific) * gs_ulU64CoefForDisplaySpecific / gs_fEvalCoefForDisplaySpecific +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctInput) * gs_ulU64CoefForInput +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctEditor) * gs_ulU64CoefForEditor +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctSound) * gs_ulU64CoefForSound +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI) * gs_ulU64CoefForAI / gs_fEvalCoefForAI +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions) * gs_ulU64CoefForCollision / gs_fEvalCoefForCollision +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDNM) * gs_ulU64CoefForMechanic / gs_fEvalCoefForMechanic +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAnimPlayer) * gs_ulU64CoefForAnimPlayer / gs_fEvalCoefForAnimPlayer ) / 100 +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctIADNMPLAMisc));
|
|
/**/
|
|
stHistoryValuesTotalU64Final . cCurrent++;
|
|
if (stHistoryValuesTotalU64Final . cCurrent == PRF_C_lNbTramesForAverage) stHistoryValuesTotalU64Final . cCurrent = 0;
|
|
stHistoryValuesTotalU64Final . ulValues [ stHistoryValuesTotalU64Final . cCurrent ] = ulTotalTime;
|
|
stHistoryValuesTotalU64Final . ulMax = 0;
|
|
ulSom = 0;
|
|
for (iCount = 0 ; iCount < PRF_C_lNbTramesForAverage; iCount++)
|
|
{
|
|
ulCurrent = stHistoryValuesTotalU64Final . ulValues [ iCount ];
|
|
ulSom += ulCurrent;
|
|
if (ulCurrent > stHistoryValuesTotalU64Final . ulMax) stHistoryValuesTotalU64Final . ulMax = ulCurrent;
|
|
}
|
|
stHistoryValuesTotalU64Final . ulAverage = ulSom / PRF_C_lNbTramesForAverage;
|
|
}
|
|
|
|
/*=============================================================================*/
|
|
|
|
void fn_vGetTotalTimeValues(tdstDisplayMode *_p_stDisplayMode, unsigned long *_p_ulTotalTime, unsigned long *_p_ulMaxTime, unsigned long *_p_ulAverageTime)
|
|
{
|
|
if (M_bPCRealMode(_p_stDisplayMode))
|
|
{
|
|
*_p_ulTotalTime = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctMainLoop);
|
|
*_p_ulMaxTime = PRF_fn_ulGetFunctionMaxDuration (PRF_C_ulFctMainLoop);
|
|
*_p_ulAverageTime = PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulFctMainLoop);
|
|
|
|
}
|
|
else if (M_bPCFinalMode(_p_stDisplayMode))
|
|
{
|
|
*_p_ulTotalTime = stHistoryValuesTotalPCFinal . ulValues [ stHistoryValuesTotalU64Real . cCurrent ];
|
|
*_p_ulMaxTime = stHistoryValuesTotalPCFinal . ulMax;
|
|
*_p_ulAverageTime = stHistoryValuesTotalPCFinal . ulAverage;
|
|
}
|
|
else if (M_bU64RealMode (_p_stDisplayMode))
|
|
{
|
|
*_p_ulTotalTime = stHistoryValuesTotalU64Real . ulValues [ stHistoryValuesTotalU64Real . cCurrent ];
|
|
*_p_ulMaxTime = stHistoryValuesTotalU64Real . ulMax;
|
|
*_p_ulAverageTime = stHistoryValuesTotalU64Real . ulAverage;
|
|
}
|
|
else if (M_bU64FinalMode(_p_stDisplayMode))
|
|
{
|
|
*_p_ulTotalTime = stHistoryValuesTotalU64Final . ulValues [ stHistoryValuesTotalU64Real . cCurrent ];
|
|
*_p_ulMaxTime = stHistoryValuesTotalU64Final . ulMax;
|
|
*_p_ulAverageTime = stHistoryValuesTotalU64Final . ulAverage;
|
|
}
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* T O O L S *
|
|
* *
|
|
*###########################################################################################*/
|
|
void fn_vDisplayMode(tdstDisplayMode *_p_stDisplayMode, int *_p_y)
|
|
{
|
|
if (M_bPCRealMode(_p_stDisplayMode)) DisplayPolices ("PC" , 0 , *_p_y);
|
|
else if (M_bPCFinalMode(_p_stDisplayMode)) DisplayPolices ("PC Eval" , 0 , *_p_y);
|
|
else if (M_bU64RealMode(_p_stDisplayMode)) DisplayPolices ("U64" , 0 , *_p_y);
|
|
else if (M_bU64FinalMode(_p_stDisplayMode)) DisplayPolices ("U64 Eval" , 0 , *_p_y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode)) DisplayPolices("Absolute",100,*_p_y);
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode)) DisplayPolices("Absolute %",100,*_p_y);
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode)) DisplayPolices("Absolute %",100,*_p_y);
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode)) DisplayPolices("Wanted %",100,*_p_y);
|
|
else /* bWantedPercentMode*/ DisplayPolices("Wanted %",100,*_p_y);
|
|
|
|
(*_p_y) += C_lStep;
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 0 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* empty page*/
|
|
void fn_vDrawEmptyPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
/*
|
|
if (M_bPCRealMode(_p_stDisplayMode)) DisplayPolices ("PC" , 0 , 0);
|
|
else if (M_bPCFinalMode(_p_stDisplayMode)) DisplayPolices ("PC Eval" , 0 , 0);
|
|
else if (M_bU64RealMode(_p_stDisplayMode)) DisplayPolices ("U64" , 0 , 0);
|
|
else if (M_bU64FinalMode(_p_stDisplayMode)) DisplayPolices ("U64 Eval" , 0 , 0);
|
|
*/
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 1 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* main rasters page*/
|
|
void fn_vDrawMainPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 80
|
|
#define Col2 150
|
|
#define Col3 220
|
|
#define Col4 290
|
|
|
|
int y,y0;
|
|
char text[256];
|
|
|
|
unsigned long ulDuration , ulMaxDuration , ulAverageDuration , ulPercentage , ulMaxPercentage;
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
long a_Tab[4] = { Col1 , Col2 , Col3 , Col4 };
|
|
long lCurrentColl , lAverageColl , lMaxColl;
|
|
long lColl = 0;
|
|
|
|
|
|
lCurrentColl = lAverageColl = lMaxColl = 0;
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode) || M_bAbsolutePercentMode(_p_stDisplayMode) || M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if (M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Current",lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Average",lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Maximum",lMaxColl,y);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
y0 = y;
|
|
|
|
DisplayPolices("Total" ,0, y);
|
|
y += C_lStep;
|
|
if( M_bPCDisplayMode( _p_stDisplayMode ) )
|
|
{
|
|
DisplayPolices("Engine" ,0, y);
|
|
y += C_lStep;
|
|
}
|
|
DisplayPolices("Display" ,0, y);
|
|
y += C_lStep;
|
|
DisplayPolices("AI" ,0, y);
|
|
y += C_lStep;
|
|
DisplayPolices("Collision" ,0, y);
|
|
|
|
|
|
y = y0;
|
|
|
|
/* *** Main loop ****/
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode, & ulDuration , & ulMaxDuration , & ulAverageDuration );
|
|
if( (ulDuration == 0) || (ulMaxDuration == 0) || (ulAverageDuration == 0) ) return;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDuration/10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAverageDuration/10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulMaxDuration/10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) DisplayPolices(" 100%",lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) DisplayPolices(" 100%",lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) DisplayPolices(" 100%",lMaxColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulDuration / C_lMainLoopWanted / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAverageDuration / C_lMainLoopWanted / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulMaxDuration / C_lMainLoopWanted / 10,lMaxColl,y);
|
|
/**/
|
|
if ((ulDuration / C_lMainLoopWanted / 10) > 100)
|
|
{
|
|
DisplayPolices(" ***",a_Tab[ lColl ],y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices(" 100%",Col1,y);
|
|
DrawBar (Col2 , y + 3 , C_lBarLength , 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"%4i%%" , ulDuration / C_lMainLoopWanted / 10);
|
|
DisplayPolices(text,Col1,y);
|
|
DrawBar (Col2 , y + 3 , ulDuration * C_lBarLength / C_lMainLoopWanted / 1000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
ulTotalDuration = ulDuration;
|
|
ulMaxTotalDuration = ulMaxDuration;
|
|
ulAverageTotalDuration = ulAverageDuration;
|
|
|
|
/* *** Engine ****/
|
|
|
|
if( M_bPCDisplayMode( _p_stDisplayMode ) )
|
|
{
|
|
ulDuration = PRF_fn_ulGetFunctionDuration (PRF_C_ulWaitFor3dFx);
|
|
ulAverageDuration = PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulWaitFor3dFx);
|
|
ulPercentage = ulTotalDuration ? 100 * (ulTotalDuration-ulDuration) / ulTotalDuration : 0;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(ulTotalDuration-ulDuration)/10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(ulAverageTotalDuration-ulAverageDuration)/10,lAverageColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulPercentage,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageTotalDuration ? 100 * (ulAverageTotalDuration-ulAverageDuration) / ulAverageTotalDuration : 0,lAverageColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode) && ulTotalDuration )
|
|
{
|
|
M_DisplayValue(text,"%4i%%",ulPercentage,Col1,y);
|
|
DrawBar (Col2 , y + 3 , ulPercentage * C_lBarLength / 100, 10);
|
|
}
|
|
y+= C_lStep;
|
|
}
|
|
/* *** Display Common ****/
|
|
|
|
ulDuration = (PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific) / 100;
|
|
ulAverageDuration = (PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific) / 100;
|
|
ulPercentage = ulTotalDuration ? 100 * ulDuration / ulTotalDuration : 0;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDuration / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAverageDuration / 10,lAverageColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulPercentage,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageTotalDuration ? 100 * ulAverageDuration / ulAverageTotalDuration : 0,lAverageColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulDuration / C_lDisplayLoopWanted / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageDuration / C_lDisplayLoopWanted / 10,lAverageColl,y);
|
|
/**/
|
|
if ((ulDuration / C_lDisplayLoopWanted) > 100)
|
|
{
|
|
DisplayPolices(" ***",a_Tab[ lColl ],y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%",ulPercentage,Col1,y);
|
|
DrawBar (Col2 , y + 3 , ulPercentage * C_lBarLength / 100 , 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , ulDuration / C_lDisplayLoopWanted,Col1,y);
|
|
/**/
|
|
DrawBar (Col2 , y + 3 , ulDuration * C_lBarLength / C_lDisplayLoopWanted / 1000 , 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/* *** AI ****/
|
|
|
|
ulDuration = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI) * g_ulCoefForAI / 100;
|
|
ulMaxDuration = PRF_fn_ulGetFunctionMaxDuration (PRF_C_ulFctAI) * g_ulCoefForAI / 100;
|
|
ulAverageDuration = PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulFctAI) * g_ulCoefForAI / 100;
|
|
ulPercentage = ulTotalDuration ? 100 * ulDuration / ulTotalDuration : 0;
|
|
ulMaxPercentage = ulMaxTotalDuration ? 100 * ulMaxDuration / ulMaxTotalDuration : 0;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDuration / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAverageDuration / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulMaxDuration / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulPercentage,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageTotalDuration ? 100 * ulAverageDuration / ulAverageTotalDuration : 0,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulMaxPercentage,lMaxColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulDuration / C_lIALoopWanted / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageDuration / C_lIALoopWanted / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulMaxDuration / C_lIALoopWanted / 10,lMaxColl,y);
|
|
/**/
|
|
if ((ulDuration / C_lIALoopWanted) > 100)
|
|
{
|
|
DisplayPolices(" ***",a_Tab[ lColl ],y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , ulPercentage,Col1,y);
|
|
if (ulMaxPercentage > ulPercentage + 10)
|
|
DrawBar (Col2 , y + 3 , ulMaxPercentage * C_lBarLength / 100 , - 10);
|
|
DrawBar (Col2 , y + 3 , ulPercentage * C_lBarLength / 100 , 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , ulDuration / C_lIALoopWanted / 10,Col1,y);
|
|
/**/
|
|
if ((ulMaxDuration / C_lIALoopWanted / 10) > ((ulDuration / C_lIALoopWanted / 10) + 10))
|
|
DrawBar (Col2 , y + 3 , ulMaxDuration * C_lBarLength / C_lIALoopWanted / 1000 , - 10);
|
|
DrawBar (Col2 , y + 3 , ulDuration * C_lBarLength / C_lIALoopWanted / 1000 , 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/* *** Collision ****/
|
|
|
|
ulDuration = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions) * g_ulCoefForCollision / 100;
|
|
ulMaxDuration = PRF_fn_ulGetFunctionMaxDuration (PRF_C_ulFctCollisions) * g_ulCoefForCollision / 100;
|
|
ulAverageDuration = PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulFctCollisions) * g_ulCoefForCollision / 100;
|
|
ulPercentage = ulTotalDuration ? 100 * ulDuration / ulTotalDuration : 0;
|
|
ulMaxPercentage = ulMaxTotalDuration ? 100 * ulMaxDuration / ulMaxTotalDuration : 0;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDuration / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAverageDuration / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulMaxDuration / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulPercentage,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageTotalDuration ? 100 * ulAverageDuration / ulAverageTotalDuration : 0,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulMaxPercentage,lMaxColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulDuration / C_lCOLLoopWanted / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulAverageDuration / C_lCOLLoopWanted / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i%%",ulMaxDuration / C_lCOLLoopWanted / 10,lMaxColl,y);
|
|
/**/
|
|
if ((ulDuration / C_lCOLLoopWanted) > 100)
|
|
{
|
|
DisplayPolices(" ***",a_Tab[ lColl ],y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , ulPercentage,Col1,y);
|
|
if (ulMaxPercentage > ulPercentage + 10)
|
|
DrawBar (Col2 , y + 3 , ulMaxPercentage * C_lBarLength / 100 , - 10);
|
|
DrawBar (Col2 , y + 3 , ulPercentage * C_lBarLength / 100 , 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , ulDuration / C_lCOLLoopWanted / 10,Col1,y);
|
|
/**/
|
|
if ((ulMaxDuration / C_lCOLLoopWanted) > ((ulDuration / C_lCOLLoopWanted / 10) + 10))
|
|
DrawBar (Col2 , y + 3 , ulMaxDuration * C_lBarLength / C_lCOLLoopWanted / 1000 , - 10);
|
|
DrawBar (Col2 , y + 3 , ulDuration * C_lBarLength / C_lCOLLoopWanted / 1000 , 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
|
|
/*================================================================================================*/
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
|
|
}
|
|
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 2 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* Display rasters page*/
|
|
void fn_vDrawDisplayPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 140
|
|
#define Col2 210
|
|
#define Col3 280
|
|
#define Col4 350
|
|
|
|
|
|
int y;
|
|
char text[100];
|
|
SECT_tdxHandleOfSectorObject hSectorObject = NULL;
|
|
HIE_tdxHandleToSuperObject hSectorSO = NULL;
|
|
/*PRF_GLI unsigned long ulDuration;*/
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
long a_Tab[4] = { Col1 , Col2 , Col3 , Col4 };
|
|
long lMapColl , lActorColl , lShadowColl , lFixColl;
|
|
long lColl = 0;
|
|
unsigned long ulTotalDisplay , ulAverageDisplay;
|
|
unsigned long ulPixelsSent , ulPixelsDisplayed;
|
|
|
|
/*================================================================================================*/
|
|
|
|
/*VL : user gli rasters*/
|
|
static long lPage = 0;
|
|
if ( lPage != 0 )
|
|
{
|
|
lPage = fn_lDrawGliRasterPage( lPage );
|
|
return;
|
|
}
|
|
|
|
if (GetAsyncKeyState( VK_RETURN ) & 0x8000 )
|
|
lPage = 1;
|
|
/*EVL*/
|
|
|
|
|
|
|
|
lMapColl = lActorColl = lShadowColl = lFixColl = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lMapColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
lActorColl = a_Tab[ lColl ++ ];
|
|
lShadowColl = a_Tab[ lColl ++ ];
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lFixColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
|
|
hSectorSO = (HIE_tdxHandleToSuperObject)PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarCurrentSector,PRF_C_pvCameraCurrentSector);
|
|
if (hSectorSO)
|
|
hSectorObject = (SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(hSectorSO);
|
|
|
|
|
|
/*================================================================================================*/
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode, & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
|
|
/*================================================================================================*/
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
/**/
|
|
ulTotalDisplay = PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific;
|
|
ulAverageDisplay = PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific;
|
|
/**/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %4i (ave:%4i) %3i%%", ulTotalDisplay / 1000,
|
|
ulAverageDisplay/ 1000,
|
|
ulTotalDisplay / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%% (ave:%3i.%1i%%)",
|
|
ulTotalDisplay / ulTotalDuration, (10 * ulTotalDisplay / ulTotalDuration) % 10,
|
|
ulAverageDisplay / ulAverageTotalDuration, (10 * ulAverageDisplay / ulAverageTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%% (ave:%3i.%1i%%)",
|
|
ulTotalDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulTotalDisplay / 1000 / C_lDisplayLoopWanted) % 10,
|
|
ulAverageDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulAverageDisplay / 1000 / C_lDisplayLoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"%Display: %3i.%1i%%" , ulTotalDisplay / ulTotalDuration, (10 * ulTotalDisplay / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 , y + 3 , ulTotalDisplay * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%%", ulTotalDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulTotalDisplay / 1000 / C_lDisplayLoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 , y + 3 , ulTotalDisplay * C_lBarLength / C_lIALoopWanted / 100000, 10);
|
|
}
|
|
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
if (hSectorObject)
|
|
{
|
|
unsigned long t1,t2;
|
|
|
|
sprintf (text,"Current:%s",fn_p_cGetSOSectorName(hSectorSO));
|
|
DisplayPolices(text,0,y);
|
|
/*================================================================================================*/
|
|
/* visible sectors*/
|
|
t1 = LST2_M_StaticGetNumberOfElements(&(hSectorObject->stListOfSectorsInGraphicInteraction));
|
|
/* not drawn sectors = visible - number drawn*/
|
|
t2 = t1 + 1 - PRF_fn_ulGetVariableValue(PRF_C_ulVarSectors);
|
|
sprintf (text,"%2i visibles",t1);
|
|
DisplayPolices(text,200,y);
|
|
if (t2 > 0)
|
|
{
|
|
sprintf (text,"(%2i not drawn)",t2);
|
|
DisplayPolices(text,296,y);
|
|
}
|
|
y+= C_lStep;
|
|
/*================================================================================================*/
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Map",lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Actors",lActorColl,y);
|
|
DisplayPolices("Shadows",lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Fix",lFixColl,y);
|
|
y+=C_lStep;
|
|
|
|
/* total objects*/
|
|
DisplayPolices("Total objects:",0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaObjects,PRF_C_pvVisible),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynObjects,PRF_C_pvVisible),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwObjects,PRF_C_pvVisible),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixObjects,PRF_C_pvVisible),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Computed objects:",0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaObjects,PRF_C_pvComputed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynObjects,PRF_C_pvComputed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwObjects,PRF_C_pvComputed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixObjects,PRF_C_pvComputed),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/* drawn objects*/
|
|
DisplayPolices("Drawn objects:" ,0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaObjects,PRF_C_pvDisplayed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynObjects,PRF_C_pvDisplayed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwObjects,PRF_C_pvDisplayed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixObjects,PRF_C_pvDisplayed),lFixColl,y);
|
|
y+= C_lStep+10;
|
|
|
|
/* total Elements*/
|
|
DisplayPolices("Total Elements:",0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaElements,PRF_C_pvVisible),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynElements,PRF_C_pvVisible),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwElements,PRF_C_pvVisible),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixElements,PRF_C_pvVisible),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/* computed Elements*/
|
|
DisplayPolices("Computed Elements:",0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaElements,PRF_C_pvComputed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynElements,PRF_C_pvComputed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwElements,PRF_C_pvComputed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixElements,PRF_C_pvComputed),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/* drawn Elements*/
|
|
DisplayPolices("Drawn Element:" ,0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaElements,PRF_C_pvDisplayed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynElements,PRF_C_pvDisplayed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwElements,PRF_C_pvDisplayed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixElements,PRF_C_pvDisplayed),lFixColl,y);
|
|
y+= C_lStep+10;
|
|
|
|
/* total faces*/
|
|
DisplayPolices("Total faces:", 0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaFaces,PRF_C_pvVisible),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynFaces,PRF_C_pvVisible),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwFaces,PRF_C_pvVisible),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixFaces,PRF_C_pvVisible),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/* computed faces*/
|
|
DisplayPolices("Computed faces:",0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaFaces,PRF_C_pvComputed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynFaces,PRF_C_pvComputed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwFaces,PRF_C_pvComputed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixFaces,PRF_C_pvComputed),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/* drawn faces*/
|
|
DisplayPolices("Drawn faces:" ,0,y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarStaFaces,PRF_C_pvDisplayed),lMapColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarDynFaces,PRF_C_pvDisplayed),lActorColl,y);
|
|
M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarShwFaces,PRF_C_pvDisplayed),lShadowColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%2i",PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarFixFaces,PRF_C_pvDisplayed),lFixColl,y);
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
|
|
GLI_fn_vGetStats( &ulPixelsSent, &ulPixelsDisplayed );
|
|
|
|
/* 3dFx*/
|
|
if( M_bPCDisplayMode(_p_stDisplayMode) )
|
|
{
|
|
y+= 10;
|
|
DisplayPolices("Pixels Sent:" ,0,y);
|
|
M_DisplayDecimalValue(text,ulPixelsSent,Col1,y);
|
|
y+= C_lStep;
|
|
/**/
|
|
DisplayPolices("Pixels Displayed:" ,0,y);
|
|
M_DisplayDecimalValue(text , ulPixelsDisplayed , Col1 , y);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
|
|
DisplayPolices("AGO Sent:" ,0,y);
|
|
M_DisplayValue(text,"%i",g_ulNumberOfAgos,Col1,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Monitor Frequency:" ,0,y);
|
|
M_DisplayValue( text, "%i Hz", PRF_fn_lGetIndependantVariable( PRF_C_ulIdpMonitorFrequency ), Col1, y );
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Map textures" ,0,y);
|
|
M_DisplayValue( text, "%i Ko ", PRF_fn_lGetIndependantVariable( PRF_C_ulIdpTextureSize ) / 1024, Col1, y );
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Texture memory" ,0,y);
|
|
M_DisplayValue( text, "%i Ko ", PRF_fn_lGetIndependantVariable( PRF_C_ulIdpTextureMemorySize ) / 1024, Col1, y );
|
|
y+= C_lStep;
|
|
|
|
|
|
/*================================================================================================*/
|
|
/*PRF_GLI
|
|
|
|
// Misc
|
|
DisplayPolices("Misc:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvMisc));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvMisc);
|
|
|
|
// PRF_C_pvWaitFor3dfx
|
|
DisplayPolices("WaitFor3dfx:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvWaitFor3dfx));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvWaitFor3dfx);
|
|
// PRF_C_pvClipping
|
|
DisplayPolices("PRF_C_pvClipping:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvClipping));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvClipping);
|
|
|
|
// PRF_C_pvProjection
|
|
DisplayPolices("Projection:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvProjection));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvProjection);
|
|
|
|
// PRF_C_pvLights
|
|
DisplayPolices("Lights:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvLights));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvLights);
|
|
|
|
// PRF_C_pvShadow
|
|
DisplayPolices("Shadow:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvShadow));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvShadow);
|
|
|
|
// PRF_C_pvSendToList
|
|
DisplayPolices("SendToList:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvSendToList));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvSendToList);
|
|
|
|
// PRF_C_pvWater
|
|
DisplayPolices("Water:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvWater));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvWater);
|
|
|
|
// PRF_C_pvTexture
|
|
DisplayPolices("InitSend:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvInitSend));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvInitSend);
|
|
|
|
// PRF_C_pvRest
|
|
DisplayPolices("Rest:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvRest));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvRest);
|
|
|
|
// PRF_C_pvLinearOp
|
|
DisplayPolices("LinearOp:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvLinearOp));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvLinearOp);
|
|
|
|
// PRF_C_pvMiscIn
|
|
DisplayPolices("MiscIn:" ,0,y);
|
|
sprintf (text,"%4i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvMiscIn));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
ulDuration += PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplay,PRF_C_pvMiscIn);
|
|
|
|
// Total
|
|
DisplayPolices("Total:" ,0,y);
|
|
sprintf (text,"%4i , (%4i) ",ulDuration, ulDuration - PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplay));
|
|
DisplayPolices(text,Col1,y);
|
|
y+= C_lStep;
|
|
|
|
PRF_GLI*/
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
|
|
/*================================================================================================*/
|
|
}
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 3 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* AI rasters page*/
|
|
void fn_vDrawAIPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 120
|
|
#define Col2 170
|
|
#define Col3 220
|
|
#define Col4 270
|
|
int y , y0 , iTab;
|
|
char text[256];
|
|
int iNbDatas, iCount;
|
|
unsigned char cHistory , cFreeHistory;
|
|
unsigned char i;
|
|
unsigned long ulRestTime, ulNbRestActors;
|
|
ACP_tdxBool bDisplay , bFound;
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
SECT_tdxHandleOfSectorObject hSectorObject = NULL;
|
|
HIE_tdxHandleToSuperObject hSectorSO = NULL;
|
|
tdstHistoryMaxValue *p = NULL;
|
|
long a_Tab[4] = { Col1 , Col2 , Col3 , Col4 };
|
|
long lCurrentColl , lAverageColl , lMaxColl;
|
|
long lColl = 0;
|
|
|
|
/*================================================================================================*/
|
|
|
|
lCurrentColl = lAverageColl = lMaxColl = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "AI: %4i (ave:%4i,max%4i) %3i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "AI: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulAverageTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulAverageTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulMaxTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulMaxTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "AI: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"%AI: %3i.%1i%%" ,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "AI: %3i.%1i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAI) * g_ulCoefForAI * C_lBarLength / C_lIALoopWanted / 100000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
hSectorSO = (HIE_tdxHandleToSuperObject)PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarCurrentSector,PRF_C_pvMainCharCurrentSector);
|
|
if (hSectorSO)
|
|
hSectorObject = (SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(hSectorSO);
|
|
|
|
iNbDatas = PRF_fn_iGetNumberOfUserDataForFunction(PRF_C_ulFctAI);
|
|
|
|
if (hSectorObject)
|
|
{
|
|
sprintf (text,"Active sectors: %2i", LST2_M_StaticGetNumberOfElements(&(hSectorObject->stListOfSectorsInActivityInteraction)));
|
|
DisplayPolices(text,0,y);
|
|
sprintf (text,"Actors: %2i", iNbDatas);
|
|
DisplayPolices(text,150,y);
|
|
y+= C_lStep;
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode) || M_bAbsolutePercentMode(_p_stDisplayMode) || M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if (M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Cur",lCurrentColl,y);
|
|
DisplayPolices("Cur",320 + lCurrentColl,y);
|
|
}
|
|
if (M_bShowAverage(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Ave",lAverageColl,y);
|
|
DisplayPolices("Ave",320 + lAverageColl,y);
|
|
}
|
|
if (M_bShowMaximum(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Max",lMaxColl,y);
|
|
DisplayPolices("Max",320 + lMaxColl,y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices ("Current" , Col1 , y);
|
|
DisplayPolices ("Current" , 320 + Col1 , y);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices ("Current" , Col1 , y);
|
|
DisplayPolices ("Current" , 320 + Col1 , y);
|
|
}
|
|
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAI ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
p -> cNbTramesNotTreated++;
|
|
|
|
y0 = y;
|
|
ulNbRestActors = 0;
|
|
ulRestTime = 0;
|
|
for( iCount = 0 ; iCount < iNbDatas ; iCount++ )
|
|
{
|
|
unsigned long ulTime , ulCount , ulMaxValue , ulTotalValue , ulCurrent;
|
|
void* p_vData;
|
|
char* p_cActorName;
|
|
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithIndex(PRF_C_ulFctAI,&p_vData,iCount) * g_ulCoefForAI / 100;
|
|
|
|
p_cActorName = fn_p_cGetActorFamilyName((HIE_tdxHandleToSuperObject)p_vData);
|
|
|
|
/* update History*/
|
|
ulMaxValue = 0;
|
|
ulTotalValue = 0;
|
|
bDisplay = FALSE;
|
|
cHistory = 0;
|
|
cFreeHistory = C_lHistorySize;
|
|
p = aDEF_stHistoryMaxValueAI;
|
|
/* search th history linked to p_vData and get the first free index*/
|
|
while ((cHistory < C_lHistorySize) && (p -> p_vData != p_vData))
|
|
{
|
|
if ((p -> p_vData == 0) && (cFreeHistory == C_lHistorySize)) cFreeHistory = cHistory;
|
|
cHistory++;
|
|
p++;
|
|
}
|
|
|
|
/* not found and no free index -> continue*/
|
|
if( (cHistory == C_lHistorySize) && (cFreeHistory == C_lHistorySize))
|
|
{
|
|
ulNbRestActors++;
|
|
ulRestTime += ulTime;
|
|
continue;
|
|
}
|
|
|
|
if (cHistory == C_lHistorySize) /* not found and free index*/
|
|
{
|
|
/* new Data*/
|
|
p = & aDEF_stHistoryMaxValueAI [cFreeHistory];
|
|
|
|
p -> p_vData = p_vData;
|
|
p -> cNbTramesTreated = 0;
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ 0 ] = ulTime;
|
|
ulMaxValue = ulTime;
|
|
ulTotalValue = ulTime;
|
|
bDisplay = M_DisplayIA(ulTime);
|
|
if (bDisplay)
|
|
{
|
|
p -> ucDisplayLineNumber = ucAIFirstUnusedLineNumber ++;
|
|
}
|
|
}
|
|
else /* found*/
|
|
{
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ p -> cNbTramesTreated ] = ulTime;
|
|
for ( ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ )
|
|
{
|
|
ulCurrent = p -> ulValues [ ulCount ];
|
|
ulTotalValue += ulCurrent;
|
|
if( ulCurrent > ulMaxValue ) ulMaxValue = ulCurrent;
|
|
if( M_DisplayIA(ulCurrent) ) bDisplay = TRUE;
|
|
}
|
|
|
|
if (bDisplay)
|
|
{
|
|
if (p -> ucDisplayLineNumber == 0 ||
|
|
p -> ucDisplayLineNumber >= ucAIFirstUnusedLineNumber)
|
|
p -> ucDisplayLineNumber = ucAIFirstUnusedLineNumber ++;
|
|
}
|
|
}
|
|
|
|
/*
|
|
if (!bDisplay)
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
*/
|
|
/*y = y0 + (p -> ucDisplayLineNumber - 1) * C_lStep;*/
|
|
if( p -> ucDisplayLineNumber < 19 )
|
|
{
|
|
y = y0 + (p -> ucDisplayLineNumber - 1) * C_lStep;
|
|
iTab = 0;
|
|
}
|
|
else
|
|
{
|
|
y = y0 + (p -> ucDisplayLineNumber - 18 - 1) * C_lStep;
|
|
iTab = 320;
|
|
}
|
|
|
|
/*////////////////////////*/
|
|
if (bDisplay)
|
|
{
|
|
if (GAM_fn_hGetCurrentSector((HIE_tdxHandleToSuperObject)p_vData) == hSectorSO)
|
|
{
|
|
DisplayPolices(".",iTab + 0,y);
|
|
}
|
|
if (p_cActorName) DisplayPolices(p_cActorName,iTab + 12,y);
|
|
else DisplayPolices("Unknown",iTab + 12,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i" , ulTime / 10,iTab + lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i" , ulTotalValue / PRF_C_lNbTramesForAverage / 10,iTab + lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i" , ulMaxValue / 10,iTab + lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,iTab + lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text, 100 * (ulTotalValue / PRF_C_lNbTramesForAverage) / ulAverageTotalDuration,iTab + lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text, 100 * ulMaxValue / ulMaxTotalDuration,iTab + lMaxColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayDecimalValue(text, ulTime / C_lIALoopWanted / 10,iTab + lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text, ulTotalValue / PRF_C_lNbTramesForAverage / C_lIALoopWanted / 10,iTab + lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text, ulMaxValue / C_lIALoopWanted / 10,iTab + lMaxColl,y);
|
|
/**/
|
|
if ((ulTime / C_lIALoopWanted) > 10)
|
|
{
|
|
DisplayPolices(" ***",iTab + a_Tab[ lColl ],y);
|
|
}
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,iTab + Col1,y);
|
|
DrawBar (iTab + Col2 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / C_lIALoopWanted,iTab + Col1,y);
|
|
DrawBar (iTab + Col2 , y + 3 , ulTime * C_lBarLength / C_lIALoopWanted / 1000, 10);
|
|
}
|
|
}
|
|
else
|
|
if (ulMaxValue > 0) /* Maximum time is not big enough -> we don't show the character*/
|
|
{
|
|
ulNbRestActors++;
|
|
ulRestTime += ulTime;
|
|
}
|
|
}
|
|
|
|
if( ulNbRestActors > 0 )
|
|
{
|
|
/*y = y0 + (ucAIFirstUnusedLineNumber - 1) * C_lStep + 10;*/
|
|
if( ucAIFirstUnusedLineNumber < 19 )
|
|
{
|
|
y = y0 + (ucAIFirstUnusedLineNumber - 1) * C_lStep + 10;
|
|
iTab = 0;
|
|
}
|
|
else
|
|
{
|
|
y = y0 + (ucAIFirstUnusedLineNumber - 18 - 1) * C_lStep + 10;
|
|
iTab = 320;
|
|
}
|
|
|
|
sprintf(text,"%2i others",ulNbRestActors);
|
|
DisplayPolices(text,iTab + 0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i" , ulRestTime / 10,iTab + Col1,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,iTab + Col1,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulRestTime / C_lIALoopWanted / 10,iTab + Col1,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%4i%%" , 100 * ulRestTime / ulTotalDuration,iTab + Col1,y);
|
|
DrawBar (iTab + Col2 , y + 3 , ulRestTime * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulRestTime / C_lIALoopWanted / 10,iTab + Col1,y);
|
|
DrawBar (iTab + Col2 , y + 3 , ulRestTime * C_lBarLength / C_lIALoopWanted / 1000, 10);
|
|
}
|
|
}
|
|
|
|
/* Remove the unused characters and delete line form untreated ones*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAI ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p -> cNbTramesNotTreated == PRF_C_lNbTramesForAverage)
|
|
{
|
|
memset (p, 0, sizeof (tdstHistoryMaxValue));
|
|
}
|
|
/*
|
|
else if (p -> cNbTramesNotTreated > 0)
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
*/
|
|
|
|
/* Remove the unused lines*/
|
|
for (i = 1 ; i < ucAIFirstUnusedLineNumber ; i ++)
|
|
{
|
|
p = aDEF_stHistoryMaxValueAI;
|
|
cHistory = 0;
|
|
/* Search the actor that is displayed at the line # i*/
|
|
while (cHistory < C_lHistorySize && p -> ucDisplayLineNumber != i)
|
|
{
|
|
cHistory ++;
|
|
p ++;
|
|
}
|
|
|
|
if (cHistory == C_lHistorySize)
|
|
{
|
|
/* Not found : the line # i does not exist anymore -> we decreaze all the line number greater than i*/
|
|
bFound = FALSE;
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAI ; cHistory < C_lHistorySize ; cHistory ++ , p ++ )
|
|
{
|
|
if (p -> ucDisplayLineNumber > i)
|
|
{
|
|
p -> ucDisplayLineNumber --;
|
|
bFound = TRUE;
|
|
}
|
|
}
|
|
|
|
if (! bFound) /* No line number greater that i*/
|
|
{
|
|
ucAIFirstUnusedLineNumber = i;
|
|
break;
|
|
}
|
|
|
|
ucAIFirstUnusedLineNumber --;
|
|
i --; /* Try the new line # i*/
|
|
}
|
|
}
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 4 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* Collision rasters page*/
|
|
void fn_vDrawCollisionPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 180
|
|
#define Col2 250
|
|
/*#define Col3 266*/
|
|
#define Col3 320
|
|
#define Col4 390
|
|
#define Col5 3
|
|
|
|
int y;
|
|
char text[256];
|
|
int iNbDatas, iCount;
|
|
unsigned char cHistory , cFreeHistory;
|
|
unsigned long ulRestTime, ulNbRestActors;
|
|
SECT_tdxHandleOfSectorObject hSectorObject = NULL;
|
|
HIE_tdxHandleToSuperObject hSectorSO = NULL;
|
|
tdstHistoryMaxValue *p = NULL;
|
|
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
long a_Tab[5] = { Col1 , Col2 , Col3 , Col4 , Col5 };
|
|
long lCurrentColl , lActorColl , lAverageColl , lMaxColl;
|
|
long lColl = 0;
|
|
|
|
/*================================================================================================*/
|
|
|
|
lCurrentColl = lActorColl = lAverageColl = lMaxColl = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
lCurrentColl = a_Tab[ lColl ++ ];
|
|
lActorColl = a_Tab[ lColl ++ ];
|
|
}
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
/*================================================================================================*/
|
|
/* Total collision time*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "COL: %4i (ave:%4i,max%4i) %3i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "COL: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulAverageTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulAverageTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulMaxTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulMaxTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "COL: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"COL: %3i.%1i%%" , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "COL: %3i.%1i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision * C_lBarLength / C_lIALoopWanted / 100000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
/* Character collision time*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Only with actor: %4i (ave:%4i,max%4i) %3i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulTotalDuration);
|
|
DisplayPolices(text,0,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Only with actor: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulAverageTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulAverageTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulMaxTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulMaxTotalDuration) % 10);
|
|
DisplayPolices(text,0,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Only with actor: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,0,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"Only with actor: %4i%%" , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / ulTotalDuration);
|
|
DisplayPolices(text,0,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Only with actor: %3i.%1i%% ",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision / 1000 / C_lIALoopWanted) % 10);
|
|
DisplayPolices(text,0,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctCollisionsChar) * g_ulCoefForCollision * C_lBarLength / C_lIALoopWanted / 100000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
hSectorSO = (HIE_tdxHandleToSuperObject)PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarCurrentSector,PRF_C_pvMainCharCurrentSector);
|
|
if (hSectorSO)
|
|
hSectorObject = (SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(hSectorSO);
|
|
|
|
if (hSectorObject)
|
|
{
|
|
unsigned long ulNbObjects;
|
|
unsigned long ulNbActors;
|
|
|
|
HIE_tdxHandleToSuperObject hMainCharacter = MC_fn_hGetCharacterInMainCharacterNode (MC_fn_hGetFirstMainCharNode ());
|
|
sprintf (text,"Collision sectors:%2i", LST2_M_StaticGetNumberOfElements(&(hSectorObject->stListOfSectorsInCollisionInteraction)));
|
|
DisplayPolices (text , 0 , y);
|
|
|
|
ulNbObjects = PRF_fn_ulGetVariableValueWithData (PRF_C_ulVarStaColl , (void *) hMainCharacter);
|
|
ulNbActors = PRF_fn_ulGetVariableValueWithData (PRF_C_ulVarDynColl , (void *) hMainCharacter);
|
|
sprintf (text,"Rayman col. with %2i object%s, %2i actor%s" , ulNbObjects , ulNbObjects > 1 ? "s" : "" ,
|
|
ulNbActors , ulNbActors > 1 ? "s" : "");
|
|
DisplayPolices (text , 170 , y);
|
|
y+= C_lStep;
|
|
}
|
|
/*================================================================================================*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueCollision ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
p -> cNbTramesNotTreated++;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices("Total" , Col1, y);
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode) || M_bAbsolutePercentMode(_p_stDisplayMode) || M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Total" , lCurrentColl, y);
|
|
DisplayPolices("Actors" , lActorColl, y);
|
|
}
|
|
if(M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Average" , lAverageColl , y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Maximum" , lMaxColl , y);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
iNbDatas = PRF_fn_iGetNumberOfUserDataForFunction(PRF_C_ulFctCollisions);
|
|
ulNbRestActors = 0;
|
|
ulRestTime = 0;
|
|
|
|
/* Treat all characters present in this frame*/
|
|
for( iCount = 0 ; iCount < iNbDatas ; iCount++ )
|
|
{
|
|
unsigned long ulTime;
|
|
void* p_vData;
|
|
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithIndex(PRF_C_ulFctCollisions,&p_vData,iCount) * g_ulCoefForCollision / 100;
|
|
|
|
/* Update History : find if this character is in the history*/
|
|
cHistory = 0;
|
|
cFreeHistory = C_lHistorySize;
|
|
p = aDEF_stHistoryMaxValueCollision;
|
|
/* search th history linked to p_vData and get the first free index*/
|
|
while ((cHistory < C_lHistorySize) && (p -> p_vData != p_vData))
|
|
{
|
|
if ((p -> p_vData == 0) && (cFreeHistory == C_lHistorySize)) cFreeHistory = cHistory;
|
|
cHistory++;
|
|
p++;
|
|
}
|
|
|
|
/* not found and no free index -> continue*/
|
|
if( (cHistory == C_lHistorySize) && (cFreeHistory == C_lHistorySize)) continue;
|
|
|
|
if (cHistory == C_lHistorySize) /* not found and free index*/
|
|
{ /* The character is not in the history : we add it*/
|
|
p = & aDEF_stHistoryMaxValueCollision [cFreeHistory];
|
|
p -> p_vData = p_vData;
|
|
p -> cNbTramesTreated = 0;
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ 0 ] = ulTime;
|
|
}
|
|
else
|
|
{ /* The character is already in the history*/
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ p -> cNbTramesTreated ] = ulTime;
|
|
}
|
|
}
|
|
|
|
/* Treat the characters present in the previous frames but not in this frame*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueCollision ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p -> p_vData != 0 && p -> cNbTramesNotTreated > 0)
|
|
{
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> ulValues [ p -> cNbTramesTreated ] = 0;
|
|
}
|
|
|
|
/* Display the result for all characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueCollision ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
{
|
|
unsigned long * pValue;
|
|
unsigned long ulCount , ulTime;
|
|
HIE_tdxHandleToSuperObject hActorSuperObject;
|
|
MS_tdxHandleToCollSet hCollSet;
|
|
char * p_cActorName;
|
|
unsigned long ulMaxValue = 0;
|
|
unsigned long ulTotalValue = 0;
|
|
|
|
if (p -> p_vData == NULL) continue;
|
|
|
|
pValue = p -> ulValues;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
|
|
ulTime = p -> ulValues [p -> cNbTramesTreated];
|
|
|
|
if (M_DisplayCollision (ulMaxValue) && (HIE_fn_ulGetSuperObjectType ((HIE_tdxHandleToSuperObject)p -> p_vData) == HIE_C_ulActor)) /* Maximum time is big enough -> we show the character*/
|
|
{
|
|
hActorSuperObject = (HIE_tdxHandleToSuperObject) p -> p_vData;
|
|
hCollSet = M_GetMSHandle (hActorSuperObject , CollSet);
|
|
|
|
strcpy ((char *) text, " ");
|
|
if (hCollSet)
|
|
{
|
|
unsigned char ucCollisionFrequency;
|
|
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithMap (hCollSet)) text [0] = 'M';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithMainCharacter (hCollSet)) text [1] = 'R';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithProjectile (hCollSet)) text [2] = 'P';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter (hCollSet)) text [3] = 'A';
|
|
if ( fn_bCollSetGetCharacterForceCollisionWhenNotMoving (hCollSet)) text [4] = 'F';
|
|
|
|
ucCollisionFrequency = fn_ucCollSetGetCollComputeFrequency (hCollSet);
|
|
if (ucCollisionFrequency > 1)
|
|
{
|
|
if (ucCollisionFrequency < 10) text [5] = (unsigned char) (ucCollisionFrequency + '0');
|
|
else text [5] = '*';
|
|
}
|
|
}
|
|
DisplayPolices (text , 0 , y);
|
|
|
|
p_cActorName = fn_p_cGetActorFamilyName (hActorSuperObject);
|
|
if (p_cActorName) DisplayPolices(p_cActorName,56,y);
|
|
else DisplayPolices("Unknown",56,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text,"%3i", ulTime / 10,lCurrentColl,y);
|
|
M_DisplayValue(text,"%3i", PRF_fn_ulGetFunctionDurationWithData (PRF_C_ulFctCollisionsChar,p -> p_vData) * g_ulCoefForCollision / 1000,lActorColl,y);
|
|
}
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
M_DisplayDecimalValue(text,PRF_fn_ulGetFunctionDurationWithData (PRF_C_ulFctCollisionsChar,p -> p_vData) * g_ulCoefForCollision / ulTotalDuration,lActorColl,y);
|
|
}
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulTotalValue / PRF_C_lNbTramesForAverage / ulAverageTotalDuration,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulMaxValue / ulMaxTotalDuration,lMaxColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / C_lCOLLoopWanted,lCurrentColl,y);
|
|
M_DisplayDecimalValue(text,PRF_fn_ulGetFunctionDurationWithData (PRF_C_ulFctCollisionsChar,p -> p_vData) * g_ulCoefForCollision / 1000 / C_lCOLLoopWanted,lActorColl,y);
|
|
}
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text,ulTotalValue / PRF_C_lNbTramesForAverage / C_lCOLLoopWanted / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text,ulMaxValue / C_lCOLLoopWanted / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / C_lCOLLoopWanted / 10,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulTime * C_lBarLength / C_lCOLLoopWanted / 1000, 10 );
|
|
}
|
|
y+= C_lStep;
|
|
}
|
|
else
|
|
if (ulMaxValue > 0) /* Maximum time is not big enough -> we don't show the character*/
|
|
{
|
|
ulNbRestActors++;
|
|
ulRestTime += ulTime;
|
|
}
|
|
/* ??? NON else p -> p_vData = NULL; // Time is 0 for all the previous time -> we remove the character from the history*/
|
|
}
|
|
|
|
if( ulNbRestActors > 0 )
|
|
{
|
|
y += 10;
|
|
|
|
sprintf (text,"%2i others",ulNbRestActors);
|
|
DisplayPolices(text,0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text, "%3i", ulRestTime / 10,Col1,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulRestTime / C_lCOLLoopWanted / 10,Col1,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulRestTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulRestTime / C_lCOLLoopWanted / 10,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulRestTime * C_lBarLength / C_lCOLLoopWanted / 1000, 10 );
|
|
}
|
|
}
|
|
|
|
/* Remove the unused characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueCollision ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p ->cNbTramesNotTreated == PRF_C_lNbTramesForAverage)
|
|
{
|
|
memset (p, 0, sizeof (tdstHistoryMaxValue));
|
|
}
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
#undef Col5
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 5 *
|
|
* *
|
|
*###########################################################################################*/
|
|
|
|
typedef struct _stSector
|
|
{
|
|
SECT_tdxHandleOfSectorObject hSector;
|
|
ACP_tdxBool bVisible;
|
|
ACP_tdxBool bActive;
|
|
ACP_tdxBool bCollidable;
|
|
ACP_tdxBool bDrawn;
|
|
} tdstSector;
|
|
|
|
/* Sector rasters page*/
|
|
void fn_vDrawSectorPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
int y;
|
|
char text[256];
|
|
unsigned long t1 , t2 , ulDrawn;
|
|
SECT_tdxHandleOfElementLstGraphicInteraction hGraphicInteractionChild;
|
|
SECT_tdxHandleOfElementLstActivityInteraction hActivityInteractionChild;
|
|
SECT_tdxHandleOfElementLstCollisionInteraction hCollisionInteractionChild;
|
|
SECT_tdxHandleOfSectorObject hSector;
|
|
tdstSector a50_ListOfSector [50];
|
|
tdstSector * p;
|
|
ACP_tdxIndex xNbSector, xI, xJ, xNbDrawnSectors;
|
|
ACP_tdxBool bFound;
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
HIE_tdxHandleToSuperObject hRaySectorSO = NULL;
|
|
HIE_tdxHandleToSuperObject hCamSectorSO = NULL;
|
|
SECT_tdxHandleOfSectorObject hRaySectorObject = NULL;
|
|
SECT_tdxHandleOfSectorObject hCamSectorObject = NULL;
|
|
unsigned long ulTotalDisplay , ulAverageDisplay;
|
|
|
|
/************ FabPerez SectorInfo ********/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
float fPourcentageTrame;
|
|
unsigned long ulNbTotalTrameSecteur;
|
|
#endif
|
|
/******** Fin FabPerez SectoreInfo *******/
|
|
|
|
|
|
y = 0;
|
|
xNbSector = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
hRaySectorSO = (HIE_tdxHandleToSuperObject) PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarCurrentSector,PRF_C_pvMainCharCurrentSector);
|
|
if (hRaySectorSO)
|
|
hRaySectorObject = (SECT_tdxHandleOfSectorObject) HIE_fn_hGetSuperObjectObject (hRaySectorSO);
|
|
hCamSectorSO = (HIE_tdxHandleToSuperObject) PRF_fn_ulGetVariableValueWithData(PRF_C_ulVarCurrentSector,PRF_C_pvCameraCurrentSector);
|
|
if (hCamSectorSO)
|
|
hCamSectorObject = (SECT_tdxHandleOfSectorObject) HIE_fn_hGetSuperObjectObject (hCamSectorSO);
|
|
|
|
|
|
|
|
/*================================================================================================*/
|
|
/* Display Time*/
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
ulTotalDisplay = PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific;
|
|
ulAverageDisplay = PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific;
|
|
/**/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %4i (ave:%4i) %3i%%", ulTotalDisplay / 1000,
|
|
ulAverageDisplay/ 1000,
|
|
ulTotalDisplay / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%% (ave:%3i.%1i%%)",
|
|
ulTotalDisplay / ulTotalDuration, (10 * ulTotalDisplay / ulTotalDuration) % 10,
|
|
ulAverageDisplay / ulAverageTotalDuration, (10 * ulAverageDisplay / ulAverageTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%% (ave:%3i.%1i%%)",
|
|
ulTotalDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulTotalDisplay / 1000 / C_lDisplayLoopWanted) % 10,
|
|
ulAverageDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulAverageDisplay / 1000 / C_lDisplayLoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"%Display: %3i.%1i%%" , ulTotalDisplay / ulTotalDuration, (10 * ulTotalDisplay / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (200 , y + 3 , ulTotalDisplay * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "Display: %3i.%1i%%", ulTotalDisplay / 1000 / C_lDisplayLoopWanted, (10 * ulTotalDisplay / 1000 / C_lDisplayLoopWanted) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (200 , y + 3 , ulTotalDisplay * C_lBarLength / C_lIALoopWanted / 100000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
/* Name of the current sectors*/
|
|
sprintf (text, "Camera sector:%s" , (hCamSectorSO) ? fn_p_cGetSOSectorName(hCamSectorSO) : "unknown");
|
|
DisplayPolices(text,0,y);
|
|
y+= C_lStep;
|
|
sprintf (text, "Rayman sector:%s" , (hRaySectorSO) ? fn_p_cGetSOSectorName(hRaySectorSO) : "unknown");
|
|
DisplayPolices(text,0,y);
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
if (hCamSectorObject)
|
|
{
|
|
/* visible sectors*/
|
|
t1 = LST2_M_StaticGetNumberOfElements(&(hCamSectorObject->stListOfSectorsInGraphicInteraction));
|
|
/* not drawn sectors = visible - number drawn*/
|
|
t2 = t1 + 1 - PRF_fn_ulGetVariableValue(PRF_C_ulVarSectors);
|
|
|
|
if (hRaySectorObject)
|
|
{
|
|
sprintf (text, "Visible:%2i Active:%2i Collidable:%2i (not drawn:%2i)",
|
|
t1 ,
|
|
LST2_M_StaticGetNumberOfElements(& hRaySectorObject->stListOfSectorsInActivityInteraction) ,
|
|
LST2_M_StaticGetNumberOfElements(& hRaySectorObject->stListOfSectorsInCollisionInteraction) ,
|
|
t2 );
|
|
}
|
|
else
|
|
{
|
|
sprintf (text, "Visible:%2i Active:??? Collidable:??? (not drawn:%2i)", t1 , t2);
|
|
}
|
|
|
|
DisplayPolices (text , 0 , y);
|
|
y += C_lStep + C_lStep / 2;
|
|
|
|
memset (a50_ListOfSector, 0 , sizeof (a50_ListOfSector));
|
|
xNbSector = 0;
|
|
|
|
LST2_M_StaticForEachElementOf (& hCamSectorObject->stListOfSectorsInGraphicInteraction, hGraphicInteractionChild, xI)
|
|
{
|
|
hSector = hGraphicInteractionChild -> hPointerOfSectorSO -> hLinkedObject . p_stSector;
|
|
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hSector;
|
|
p -> bVisible = TRUE;
|
|
}
|
|
/* add camera current sector*/
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hCamSectorObject;
|
|
p -> bVisible = TRUE;
|
|
|
|
}
|
|
|
|
if (hRaySectorObject)
|
|
{
|
|
LST2_M_StaticForEachElementOf (& hRaySectorObject->stListOfSectorsInActivityInteraction, hActivityInteractionChild, xI)
|
|
{
|
|
hSector = hActivityInteractionChild -> hPointerOfSectorSO -> hLinkedObject . p_stSector;
|
|
|
|
bFound = FALSE;
|
|
for (xJ = 0 , p = a50_ListOfSector ; xJ < xNbSector ; xJ++ , p++)
|
|
if (p -> hSector == hSector) { bFound = TRUE; break; }
|
|
|
|
if (! bFound)
|
|
{
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hSector;
|
|
}
|
|
p -> bActive = TRUE;
|
|
}
|
|
|
|
LST2_M_StaticForEachElementOf (& hRaySectorObject->stListOfSectorsInCollisionInteraction, hCollisionInteractionChild, xI)
|
|
{
|
|
hSector = hCollisionInteractionChild -> hPointerOfSectorSO -> hLinkedObject . p_stSector;
|
|
|
|
bFound = FALSE;
|
|
for (xJ = 0 , p = a50_ListOfSector ; xJ < xNbSector ; xJ++ , p++)
|
|
if (p -> hSector == hSector) { bFound = TRUE; break; }
|
|
|
|
if (! bFound)
|
|
{
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hSector;
|
|
}
|
|
p -> bCollidable = TRUE;
|
|
}
|
|
|
|
/* add current Rayman sector*/
|
|
bFound = FALSE;
|
|
for (xJ = 0 , p = a50_ListOfSector ; xJ < xNbSector ; xJ++ , p++)
|
|
if (p -> hSector == hRaySectorObject) { bFound = TRUE; break; }
|
|
|
|
if (! bFound)
|
|
{
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hRaySectorObject;
|
|
}
|
|
p -> bActive = TRUE;
|
|
p -> bCollidable = TRUE;
|
|
|
|
}
|
|
xNbDrawnSectors = (ACP_tdxIndex) PRF_fn_iGetNumberOfUserDataForVariable(PRF_C_ulVarSectors);
|
|
for (xI = 0 ; xI < xNbDrawnSectors ; xI++ )
|
|
{
|
|
ulDrawn = PRF_fn_ulGetVariableValueWithIndex(PRF_C_ulVarSectors,&hSector,xI);
|
|
|
|
bFound = FALSE;
|
|
for (xJ = 0 , p = a50_ListOfSector ; xJ < xNbSector ; xJ++ , p++)
|
|
{
|
|
if (p -> hSector == hSector)
|
|
{
|
|
bFound = TRUE;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (! bFound)
|
|
{
|
|
p = & a50_ListOfSector [xNbSector ++];
|
|
p -> hSector = hSector;
|
|
}
|
|
p -> bDrawn = (ACP_tdxBool) ((ulDrawn>0) ? TRUE : FALSE);
|
|
}
|
|
|
|
for (xI = 0 , p = a50_ListOfSector ; xI < xNbSector ; xI++ , p++)
|
|
{
|
|
strcpy (text , fn_p_cGetSectorName (p -> hSector -> szSectorName) );
|
|
if (p -> hSector == hRaySectorObject)
|
|
strcat(text, " (RAY)");
|
|
else if (p -> hSector == hCamSectorObject)
|
|
strcat(text, " (CAM)");
|
|
DisplayPolices (text , 0 , y);
|
|
sprintf (text , "%c%c%c%c" ,
|
|
p -> bVisible ? 'V' : ' ' ,
|
|
p -> bActive ? 'A' : ' ' ,
|
|
p -> bCollidable ? 'C' : ' ' ,
|
|
p -> bDrawn ? 'D' : ' ');
|
|
DisplayPolices (text , 150 , y);
|
|
y += C_lStep;
|
|
}
|
|
|
|
/************ FabPerez SectorInfo ********/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
DisplayPolices("Frame Info : " ,0, y);
|
|
|
|
ulNbTotalTrameSecteur = (pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_UneTrame + (pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_DeuxTrames + (pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_TroisTrames;
|
|
|
|
y += C_lStep;
|
|
M_DisplayValue(text,"Monitor Frenquency:%2i", PRF_fn_lGetIndependantVariable(PRF_C_ulIdpMonitorFrequency), 0, y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Pourcent 1 Frame : ", 0, y);
|
|
fPourcentageTrame = (ulNbTotalTrameSecteur == 0) ? 0.0 : (float) ((pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_UneTrame * 100 / (float) ulNbTotalTrameSecteur);
|
|
if(fPourcentageTrame >= 99.9) fPourcentageTrame = 100.0;
|
|
else if(fPourcentageTrame <= 0.1) fPourcentageTrame = 0.0;
|
|
M_DisplayValue(text,"%2.1f%", fPourcentageTrame, 150, y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Pourcent 2 Frame : ", 0, y);
|
|
fPourcentageTrame = (ulNbTotalTrameSecteur == 0) ? 0.0 : (float) ((pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_DeuxTrames * 100 / (float) ulNbTotalTrameSecteur);
|
|
if(fPourcentageTrame >= 99.9) fPourcentageTrame = 100.0;
|
|
else if(fPourcentageTrame <= 0.1) fPourcentageTrame = 0.0;
|
|
M_DisplayValue(text,"%2.1f%", fPourcentageTrame, 150, y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Pourcent 3 Frame : ", 0, y);
|
|
fPourcentageTrame = (ulNbTotalTrameSecteur == 0) ? 0.0 : (float) ((pt_aStructInfoSectorTrame+iNumSecteurCourant)->ul_TroisTrames * 100 / (float) ulNbTotalTrameSecteur);
|
|
if(fPourcentageTrame >= 99.9) fPourcentageTrame = 100.0;
|
|
else if(fPourcentageTrame <= 0.1) fPourcentageTrame = 0.0;
|
|
M_DisplayValue(text,"%2.1f%", fPourcentageTrame, 150, y);
|
|
y+= C_lStep;
|
|
#endif
|
|
/******** Fin FabPerez SectoreInfo *******/
|
|
|
|
|
|
}
|
|
|
|
void ShowHistoryBar (int _iX , int _iY , unsigned long _ulFunctionNumber , void * _p_vData)
|
|
{
|
|
BOOL bThisIsAStart;
|
|
BOOL bFinish;
|
|
unsigned long ulStart , ulStop;
|
|
void * p_vData;
|
|
int iXStart , iXStop;
|
|
unsigned long ulNbStartStop = PRF_fn_iGetFunctionNbStartAndStop (_ulFunctionNumber);
|
|
unsigned long i = 0;
|
|
unsigned long ulTimeOfBeginningOfFrame = PRF_fn_ulGetFunctionStartOrStop (PRF_C_ulFctMainLoop , 0 , & p_vData , & bThisIsAStart);
|
|
|
|
if (ulNbStartStop == 0) return;
|
|
|
|
do
|
|
{
|
|
/* Find a start*/
|
|
do
|
|
{
|
|
ulStart = PRF_fn_ulGetFunctionStartOrStop (_ulFunctionNumber , i ++ , & p_vData , & bThisIsAStart);
|
|
|
|
bFinish = (i >= ulNbStartStop) || (bThisIsAStart && (_p_vData == C_pvNoData || _p_vData == p_vData));
|
|
} while (! bFinish);
|
|
|
|
if (i >= ulNbStartStop) return; /* if i = NbStartStop, there cannot be a Stop after, so we stop*/
|
|
|
|
/* Find a stop*/
|
|
do
|
|
{
|
|
ulStop = PRF_fn_ulGetFunctionStartOrStop (_ulFunctionNumber , i ++ , & p_vData , & bThisIsAStart);
|
|
|
|
bFinish = (i >= ulNbStartStop) || ((bThisIsAStart == FALSE) && (_p_vData == C_pvNoData || _p_vData == p_vData));
|
|
} while (! bFinish);
|
|
|
|
if (i > ulNbStartStop) return;
|
|
|
|
if (ulStart < ulTimeOfBeginningOfFrame) ulStart += PRF_fn_ulTimerCount2Duration (ULONG_MAX);
|
|
while (ulStop < ulStart ) ulStop += PRF_fn_ulTimerCount2Duration (ULONG_MAX);
|
|
|
|
iXStart = (int) ((ulStart - ulTimeOfBeginningOfFrame) * C_lBarLength / 10000);
|
|
iXStop = (int) ((ulStop - ulTimeOfBeginningOfFrame) * C_lBarLength / 10000);
|
|
|
|
DrawBar (_iX + iXStart , _iY + 4 , iXStop - iXStart + 1 , 8);
|
|
} while (i < ulNbStartStop);
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 6 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* Programmer rasters page*/
|
|
void fn_vDrawPGMPage (tdstDisplayMode *_p_stDisplayMode , unsigned long _ulTimeSpentToDisplayRaster)
|
|
{
|
|
#define Col1 130
|
|
#define Col2 200
|
|
#define Col3 270
|
|
#define Col4 340
|
|
|
|
int y;
|
|
char text[256];
|
|
char * p_szWarning;
|
|
|
|
/*unsigned long ulTotal = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctMainLoop);*/
|
|
unsigned long ulDisplay = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay) * g_ulCoefForDisplay / 100;
|
|
unsigned long ulDisplaySpecific = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific / 100;
|
|
unsigned long ulInput = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctInput) * g_ulCoefForInput / 100;
|
|
unsigned long ulEditor = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctEditor) * g_ulCoefForEditor / 100;
|
|
unsigned long ulSound = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctSound) * g_ulCoefForSound / 100;
|
|
unsigned long ulFlip = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctFlip);
|
|
unsigned long ulHierarchy = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctHIE);
|
|
unsigned long ulRest = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctMainMisc);
|
|
unsigned long ulWaitFor3dFx = PRF_fn_ulGetFunctionDuration (PRF_C_ulWaitFor3dFx);
|
|
|
|
/* Total = Display + DisplaySpecific + Input + Editor + Sound + WaitFor3dfx + Hierarchy + Rest*/
|
|
/* Total + Flip + Raster = the entire frame (2000, 3000, etc...)*/
|
|
|
|
unsigned long ulDrawSprite = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySprite)* g_ulCoefForDisplay / 100;
|
|
unsigned long ulAI = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI) * g_ulCoefForAI / 100;
|
|
unsigned long ulCollision = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions) * g_ulCoefForCollision / 100;
|
|
unsigned long ulMechanic = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDNM) * g_ulCoefForMechanic / 100;
|
|
unsigned long ulAnimPlayer = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 100;
|
|
unsigned long ulHierarchyRest = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctIADNMPLAMisc)* g_ulCoefForRest / 100;
|
|
|
|
/* Hierarchy = AI + Collision + Mechanic + AnimPlayer + HierarchyRest + a little bit more*/
|
|
|
|
unsigned long ulUnknown;
|
|
long a_Tab[4] = { Col1 , Col2 , Col3 , Col4 };
|
|
long lCurrentColl , lAverageColl , lMaxColl , lWantedColl;
|
|
long lColl = 0;
|
|
unsigned long ulTotalPC , ulTotal , ulMaxTotal , ulAverageTotal;
|
|
|
|
/*================================================================================================*/
|
|
|
|
lCurrentColl = lAverageColl = lMaxColl = lWantedColl = 0;
|
|
ulTotalPC = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
lWantedColl = a_Tab[ lColl ++ ];
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode, & ulTotal , & ulMaxTotal , & ulAverageTotal );
|
|
|
|
ulUnknown = ulTotal - (ulDisplay + ulDisplaySpecific + ulWaitFor3dFx + ulInput + ulEditor + ulSound + ulRest +
|
|
ulAI + ulCollision + ulMechanic + ulAnimPlayer + ulHierarchyRest);
|
|
|
|
/* if (ulUnknown > 1000) ulUnknown = 0;*/
|
|
|
|
if (M_bPCFinalMode(_p_stDisplayMode))
|
|
{
|
|
ulFlip = 9999 - ((ulTotal + _ulTimeSpentToDisplayRaster - 1) % 10000);
|
|
}
|
|
else if(M_bU64RealMode(_p_stDisplayMode))
|
|
{
|
|
ulTotalPC = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctMainLoop) + _ulTimeSpentToDisplayRaster + PRF_fn_ulGetFunctionDuration (PRF_C_ulFctFlip);
|
|
_ulTimeSpentToDisplayRaster = 0;
|
|
ulFlip = 9999 - ((ulTotal - 1) % 10000);
|
|
}
|
|
else if(M_bU64FinalMode(_p_stDisplayMode))
|
|
{
|
|
ulTotalPC = stHistoryValuesTotalPCFinal . ulValues [ stHistoryValuesTotalPCFinal . cCurrent ] + _ulTimeSpentToDisplayRaster;
|
|
ulTotalPC += 9999 - ((ulTotalPC - 1) % 10000); /* Flip*/
|
|
_ulTimeSpentToDisplayRaster = 0;
|
|
ulFlip = 9999 - ((ulTotal - 1) % 10000);
|
|
}
|
|
|
|
y = 0;
|
|
|
|
if (M_bPCRealMode(_p_stDisplayMode)) DisplayPolices ("PC" , 0 , y);
|
|
else if (M_bPCFinalMode(_p_stDisplayMode)) DisplayPolices ("PC Eval" , 0 , y);
|
|
else if (M_bU64RealMode(_p_stDisplayMode)) DisplayPolices ("U64" , 0 , y);
|
|
else if (M_bU64FinalMode(_p_stDisplayMode)) DisplayPolices ("U64 Eval" , 0 , y);
|
|
|
|
y+= C_lStep;
|
|
|
|
if (M_bAbsoluteGraphicMode(_p_stDisplayMode) || M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices ("Display Com" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctDisplay , NULL);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Display Spe" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctDisplaySpecific , NULL);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Wait for 3dFx" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulWaitFor3dFx , NULL);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("AI" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctAI , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Collision" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctCollisions , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Mechanic" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctDNM , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Anim. player" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctAnimPlayer , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Input" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctInput , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Sound" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctSound , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Editors" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctEditor , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Rest" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctMainMisc , C_pvNoData);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctIADNMPLAMisc , C_pvNoData);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Flip" , 0 , y);
|
|
ShowHistoryBar (Col1 , y , PRF_C_ulFctFlip , C_pvNoData);
|
|
y += C_lStep;
|
|
}
|
|
else
|
|
{
|
|
if (M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Current",lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Average",lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Maximum",lMaxColl,y);
|
|
|
|
DisplayPolices("/Wanted",lWantedColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Total",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode))
|
|
M_DisplayValue(text,"%4i",ulTotal / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)/* && !M_bU64DisplayMode(_p_stDisplayMode)*/)
|
|
/*M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctMainLoop) / 10,lAverageColl,y);*/
|
|
M_DisplayValue(text,"%4i",ulAverageTotal / 10,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)/* && !M_bU64DisplayMode(_p_stDisplayMode)*/)
|
|
/*M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctMainLoop) / 10,lMaxColl,y);*/
|
|
M_DisplayValue(text,"%4i",ulMaxTotal / 10,lMaxColl,y);
|
|
|
|
p_szWarning = ulTotal > C_lMainLoopWanted * 1000 ? " ***" : "";
|
|
sprintf (text,"%3i%%%s",ulTotal/C_lMainLoopWanted / 10, p_szWarning);
|
|
DisplayPolices(text,lWantedColl,y);
|
|
y+= C_lStep;
|
|
|
|
if (! M_bU64DisplayMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices("Engine",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(ulTotal - ulWaitFor3dFx) / 10,lCurrentColl,y);
|
|
y+= C_lStep;
|
|
}
|
|
|
|
DisplayPolices("Display",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(ulDisplay+ulDisplaySpecific) / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay +
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific) / 1000,lAverageColl,y);
|
|
|
|
p_szWarning = (ulDisplay+ulDisplaySpecific) > C_lDisplayLoopWanted * 1000 ? " ***" : "";
|
|
sprintf (text,"%3i%%%s",(ulDisplay+ulDisplaySpecific) / C_lDisplayLoopWanted / 10, p_szWarning);
|
|
DisplayPolices(text,lWantedColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Display Com.",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDisplay / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDisplay) * g_ulCoefForDisplay / 1000,lMaxColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Display Spe.",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDisplaySpecific / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDisplaySpecific) * g_ulCoefForDisplaySpecific / 1000,lMaxColl,y);
|
|
y+= C_lStep;
|
|
|
|
if (! M_bU64DisplayMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices ("(Wait for 3dFx)" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text , "%4i" , ulWaitFor3dFx / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text , "%4i" , PRF_fn_ulGetFunctionAverageDuration (PRF_C_ulWaitFor3dFx) / 10,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text , "%4i" , PRF_fn_ulGetFunctionMaxDuration (PRF_C_ulWaitFor3dFx) / 10,lMaxColl,y);
|
|
y += C_lStep;
|
|
}
|
|
|
|
DisplayPolices("Draw Sprite",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulDrawSprite/ 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySprite) * g_ulCoefForDisplay / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDisplaySprite) * g_ulCoefForDisplay / 1000,lMaxColl,y);
|
|
y+= C_lStep;
|
|
|
|
|
|
DisplayPolices("AI",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAI / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAI) * g_ulCoefForAI / 1000,lMaxColl,y);
|
|
|
|
p_szWarning = ulAI > C_lIALoopWanted * 1000 ? " ***" : "";
|
|
sprintf (text,"%3i%%%s",ulAI / C_lIALoopWanted / 10, p_szWarning);
|
|
DisplayPolices(text,lWantedColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices("Collision",0, y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulCollision / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctCollisions) * g_ulCoefForCollision / 1000,lMaxColl,y);
|
|
|
|
p_szWarning = ulCollision > C_lCOLLoopWanted * 1000 ? " ***" : "";
|
|
sprintf (text,"%3i%%%s",ulCollision / C_lCOLLoopWanted / 10, p_szWarning);
|
|
DisplayPolices(text,lWantedColl,y);
|
|
y+= C_lStep;
|
|
|
|
DisplayPolices ("Mechanic" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulMechanic / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Anim. player" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulAnimPlayer / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Input" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulInput / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctInput) * g_ulCoefForInput / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctInput) * g_ulCoefForInput / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Sound" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulSound / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctSound) * g_ulCoefForSound / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctSound) * g_ulCoefForSound / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Editors" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulEditor / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctEditor) * g_ulCoefForEditor / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctEditor) * g_ulCoefForEditor / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Hierarchy Rest" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulHierarchyRest / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctIADNMPLAMisc) * g_ulCoefForRest / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctIADNMPLAMisc) * g_ulCoefForRest / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Misc Rest" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",M_bU64DisplayMode(_p_stDisplayMode) ? 0 : ulRest / 10,lCurrentColl,y);
|
|
if (M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctMainMisc) * g_ulCoefForRest / 1000,lAverageColl,y);
|
|
if (M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text,"%4i",PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctMainMisc) * g_ulCoefForRest / 1000,lMaxColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Unknown" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",M_bU64DisplayMode(_p_stDisplayMode) ? 0 : ulUnknown / 10,lCurrentColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Raster display" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",_ulTimeSpentToDisplayRaster / 10,lCurrentColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Flip" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulFlip / 10,lCurrentColl,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("Total with flip" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",(ulTotal + _ulTimeSpentToDisplayRaster + ulFlip) / 10,lCurrentColl,y);
|
|
|
|
y += C_lStep;
|
|
|
|
if (M_bU64DisplayMode(_p_stDisplayMode))
|
|
{
|
|
DisplayPolices ("Total PC" , 0 , y);
|
|
if (M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%4i",ulTotalPC / 10,lCurrentColl,y);
|
|
}
|
|
y += C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
}
|
|
DisplayPolices("DT",0, y);
|
|
M_DisplayValue(text,"%4i",PRF_fn_lGetIndependantVariable (PRF_C_ulIdpDeltaTime),lCurrentColl,y);
|
|
|
|
/*================================================================================================*/
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* P A G E 7 *
|
|
* *
|
|
*###########################################################################################*/
|
|
/* GLI special raster page*/
|
|
long fn_lDrawGliRasterPage ( long lPage )
|
|
{
|
|
#define Col1 130
|
|
#define Col2 200
|
|
#define Col3 270
|
|
#define Col4 340
|
|
|
|
int y;
|
|
char text[256];
|
|
|
|
unsigned long ulValue, ulAverage, ulMax, ulMin, ulIndex;
|
|
unsigned long ulDisplay = PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplay) / 10;
|
|
unsigned long ulDisplaySpecific = PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDisplaySpecific) / 10;
|
|
|
|
static BOOL bPrint = FALSE;
|
|
static BOOL bAverage;
|
|
static int iFile;
|
|
static int iCount;
|
|
char szTextToPrint[512], *p_szTextToPrint;
|
|
|
|
y = 0;
|
|
|
|
p_szTextToPrint = szTextToPrint;
|
|
|
|
sprintf (text , "GLI (Commun : %4i, specific : %4i ) %s" , ulDisplay, ulDisplaySpecific, bPrint?"Print":"" );
|
|
DisplayPolices (text , 0 , y);
|
|
y += 20;
|
|
|
|
if ( bPrint )
|
|
{
|
|
if (!bAverage)
|
|
p_szTextToPrint = szTextToPrint + sprintf( szTextToPrint, "%4i %4i", PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplay) / 10, PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplaySpecific)/10);
|
|
else if (iCount == 0)
|
|
p_szTextToPrint = szTextToPrint + sprintf( szTextToPrint, "%4i %4i", ulDisplay, ulDisplaySpecific);
|
|
}
|
|
|
|
/* display rasters */
|
|
for (ulIndex = PRF_C_ulGLI1; ulIndex <= PRF_C_ulGLI8; ulIndex ++)
|
|
{
|
|
ulValue = PRF_fn_ulGetFunctionDuration (ulIndex) / 10;
|
|
ulAverage = PRF_fn_ulGetFunctionAverageDuration (ulIndex) / 10;
|
|
if ( ulAverage != 0 )
|
|
{
|
|
ulMax = PRF_fn_ulGetFunctionMaxDuration (ulIndex) / 10;
|
|
ulMin = PRF_fn_ulGetFunctionMinDuration (ulIndex) / 10;
|
|
|
|
sprintf (text , "%s %4i %4i %4i %4i" , PRF_g_a_stFunctionInformation[ulIndex].szFunctionName, ulValue, ulMin, ulAverage, ulMax );
|
|
DisplayPolices (text , 0 , y);
|
|
y += 16;
|
|
}
|
|
if (bPrint )
|
|
{
|
|
if (!bAverage)
|
|
p_szTextToPrint += sprintf( p_szTextToPrint, " %4i", ulValue );
|
|
else if (iCount == 0)
|
|
p_szTextToPrint += sprintf( p_szTextToPrint, " %4i", ulAverage );
|
|
}
|
|
}
|
|
|
|
/* display var */
|
|
y += 4;
|
|
for (ulIndex = PRF_C_ulVarGLI1; ulIndex <= PRF_C_ulVarGLI8; ulIndex++)
|
|
{
|
|
ulValue = PRF_fn_ulGetVariableValue (ulIndex);
|
|
ulAverage = PRF_fn_ulGetVariableAverageValue (ulIndex);
|
|
if (ulAverage != 0)
|
|
{
|
|
ulMax = PRF_fn_ulGetVariableMaxValue (ulIndex);
|
|
ulMin = PRF_fn_ulGetVariableMinValue (ulIndex);
|
|
|
|
sprintf (text , "%s %4i %4i %4i %4i" , PRF_g_a_stVariableInformation[ulIndex].szVariableName, ulValue, ulMin, ulAverage, ulMax );
|
|
DisplayPolices (text , 0 , y);
|
|
y += 16;
|
|
}
|
|
if (bPrint)
|
|
{
|
|
if (!bAverage)
|
|
p_szTextToPrint += sprintf( p_szTextToPrint, " %6i", ulValue );
|
|
else if (iCount == 0)
|
|
p_szTextToPrint += sprintf( p_szTextToPrint, " %6i", ulAverage );
|
|
}
|
|
}
|
|
|
|
if (bPrint)
|
|
{
|
|
if (!bAverage || (iCount == 0) )
|
|
{
|
|
*p_szTextToPrint = '\n';
|
|
_write( iFile, szTextToPrint, p_szTextToPrint - szTextToPrint + 1 );
|
|
}
|
|
if (iCount == 0)
|
|
iCount = 30;
|
|
}
|
|
|
|
if ( GetAsyncKeyState( VK_BACK ) & 0x8000)
|
|
{
|
|
if (bPrint)
|
|
{
|
|
bPrint = FALSE;
|
|
_close( iFile );
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
if (GetAsyncKeyState( VK_SCROLL ) & 0x8000)
|
|
{
|
|
if (GetAsyncKeyState( VK_SHIFT ) & 0x8000)
|
|
{
|
|
if (bPrint)
|
|
{
|
|
bPrint = FALSE;
|
|
_close( iFile );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!bPrint)
|
|
{
|
|
bPrint = TRUE;
|
|
iFile = _open("c:\\gliprf1.txt", _O_WRONLY | _O_CREAT | _O_APPEND, _S_IREAD | _S_IWRITE );
|
|
strcpy( szTextToPrint, "DspC DspS Gli1 Gli2 Gli3 Gli4 Gli5 Gli6 Gli7 Gli8 Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8\n");
|
|
_write( iFile, szTextToPrint, strlen(szTextToPrint) );
|
|
}
|
|
|
|
bAverage = (GetAsyncKeyState( VK_RMENU ) & 0x8000) ? 1 : 0;
|
|
iCount = 0;
|
|
}
|
|
}
|
|
|
|
return 1;
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* S L O W D O W N E N G I N E *
|
|
* *
|
|
*###########################################################################################*/
|
|
void fn_vDrawMechanicPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 180
|
|
#define Col2 250
|
|
#define Col3 320
|
|
|
|
int y , y0 , i;
|
|
char text[256];
|
|
int iNbDatas, iCount;
|
|
unsigned char cHistory , cFreeHistory;
|
|
unsigned long ulRestTime, ulNbRestActors;
|
|
SECT_tdxHandleOfSectorObject hSectorObject = NULL;
|
|
HIE_tdxHandleToSuperObject hSectorSO = NULL;
|
|
tdstHistoryMaxValue *p = NULL;
|
|
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
long a_Tab[3] = { Col1 , Col2 , Col3 };
|
|
long lCurrentColl , lAverageColl , lMaxColl;
|
|
long lColl = 0;
|
|
ACP_tdxBool bFound;
|
|
|
|
/*================================================================================================*/
|
|
lCurrentColl = lAverageColl = lMaxColl = 0;
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
|
|
if (M_bWantedPercentMode(_p_stDisplayMode)) _p_stDisplayMode -> lRasterDisplayMode = C_lAbsolutePercentMode;
|
|
if (M_bWantedGraphicMode(_p_stDisplayMode)) _p_stDisplayMode -> lRasterDisplayMode = C_lAbsoluteGraphicMode;
|
|
|
|
/*================================================================================================*/
|
|
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
/*================================================================================================*/
|
|
/* Total collision time*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "MEC: %4i (ave:%4i,max%4i) %3i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / 1000,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / 1000,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / 1000,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "MEC: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulAverageTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulAverageTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulMaxTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulMaxTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"MEC: %3i.%1i%%" , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDNM) * g_ulCoefForMechanic * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueMechanic ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
p -> cNbTramesNotTreated++;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices("Total" , Col1, y);
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode) || M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Total" , lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Average" , lAverageColl , y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Maximum" , lMaxColl , y);
|
|
}
|
|
y+= C_lStep;
|
|
y0 = y;
|
|
|
|
iNbDatas = PRF_fn_iGetNumberOfUserDataForFunction(PRF_C_ulFctDNM);
|
|
ulNbRestActors = 0;
|
|
ulRestTime = 0;
|
|
|
|
/* Treat all characters present in this frame*/
|
|
for( iCount = 0 ; iCount < iNbDatas ; iCount++ )
|
|
{
|
|
unsigned long ulTime;
|
|
void* p_vData;
|
|
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithIndex(PRF_C_ulFctDNM,&p_vData,iCount) * g_ulCoefForMechanic / 100;
|
|
|
|
/* Update History : find if this character is in the history*/
|
|
cHistory = 0;
|
|
cFreeHistory = C_lHistorySize;
|
|
p = aDEF_stHistoryMaxValueMechanic;
|
|
/* search th history linked to p_vData and get the first free index*/
|
|
while ((cHistory < C_lHistorySize) && (p -> p_vData != p_vData))
|
|
{
|
|
if ((p -> p_vData == 0) && (cFreeHistory == C_lHistorySize)) cFreeHistory = cHistory;
|
|
cHistory++;
|
|
p++;
|
|
}
|
|
|
|
/* not found and no free index -> continue*/
|
|
if( (cHistory == C_lHistorySize) && (cFreeHistory == C_lHistorySize)) continue;
|
|
|
|
if (cHistory == C_lHistorySize) /* not found and free index*/
|
|
{ /* The character is not in the history : we add it*/
|
|
p = & aDEF_stHistoryMaxValueMechanic [cFreeHistory];
|
|
p -> p_vData = p_vData;
|
|
p -> cNbTramesTreated = 0;
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ 0 ] = ulTime;
|
|
p -> ucDisplayLineNumber = ucMechanicFirstUnusedLineNumber ++;
|
|
}
|
|
else
|
|
{ /* The character is already in the history*/
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ p -> cNbTramesTreated ] = ulTime;
|
|
}
|
|
}
|
|
|
|
/* Treat the characters present in the previous frames but not in this frame*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueMechanic ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p -> p_vData != 0 && p -> cNbTramesNotTreated > 0)
|
|
{
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> ulValues [ p -> cNbTramesTreated ] = 0;
|
|
}
|
|
|
|
/* Display the result for all characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueMechanic ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
{
|
|
unsigned long * pValue;
|
|
unsigned long ulCount , ulTime;
|
|
HIE_tdxHandleToSuperObject hActorSuperObject;
|
|
char * p_cActorName;
|
|
unsigned long ulMaxValue = 0;
|
|
unsigned long ulTotalValue = 0;
|
|
|
|
if (p -> p_vData == NULL) continue;
|
|
|
|
pValue = p -> ulValues;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
|
|
if (ulMaxValue > 0)
|
|
{
|
|
if (p -> ucDisplayLineNumber == 0 ||
|
|
p -> ucDisplayLineNumber >= ucMechanicFirstUnusedLineNumber)
|
|
p -> ucDisplayLineNumber = ucMechanicFirstUnusedLineNumber ++;
|
|
}
|
|
else
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
|
|
ulTime = p -> ulValues [p -> cNbTramesTreated];
|
|
|
|
if ((ulMaxValue > 0) && (HIE_fn_ulGetSuperObjectType ((HIE_tdxHandleToSuperObject)p -> p_vData) == HIE_C_ulActor))
|
|
{
|
|
hActorSuperObject = (HIE_tdxHandleToSuperObject) p -> p_vData;
|
|
p_cActorName = fn_p_cGetActorFamilyName (hActorSuperObject);
|
|
|
|
y = y0 + (p -> ucDisplayLineNumber - 1) * C_lStep;
|
|
if (p_cActorName) DisplayPolices(p_cActorName,0,y);
|
|
else DisplayPolices("Unknown",0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%3i", ulTime / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulTotalValue / PRF_C_lNbTramesForAverage / ulAverageTotalDuration,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulMaxValue / ulMaxTotalDuration,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
}
|
|
else
|
|
if (ulMaxValue > 0) /* Maximum time is not big enough -> we don't show the character*/
|
|
{
|
|
ulNbRestActors++;
|
|
ulRestTime += ulTime;
|
|
}
|
|
/* ??? NON else p -> p_vData = NULL; // Time is 0 for all the previous time -> we remove the character from the history*/
|
|
}
|
|
|
|
if( ulNbRestActors > 0 )
|
|
{
|
|
y = y0 + (ucMechanicFirstUnusedLineNumber - 1) * C_lStep + 10;
|
|
|
|
sprintf (text,"%2i others",ulNbRestActors);
|
|
DisplayPolices(text,0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text, "%3i", ulRestTime / 10,Col1,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulRestTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
}
|
|
|
|
/* Remove the unused characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueMechanic ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p ->cNbTramesNotTreated == PRF_C_lNbTramesForAverage)
|
|
{
|
|
memset (p, 0, sizeof (tdstHistoryMaxValue));
|
|
}
|
|
else if (p ->cNbTramesNotTreated > 0)
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
|
|
/* Remove the unused lines*/
|
|
for (i = 1 ; i < ucMechanicFirstUnusedLineNumber ; i ++)
|
|
{
|
|
p = aDEF_stHistoryMaxValueMechanic;
|
|
cHistory = 0;
|
|
/* Search the actor that is displayed at the line # i*/
|
|
while (cHistory < C_lHistorySize && p -> ucDisplayLineNumber != i)
|
|
{
|
|
cHistory ++;
|
|
p ++;
|
|
}
|
|
|
|
if (cHistory == C_lHistorySize)
|
|
{
|
|
/* Not found : the line # i does not exist anymore -> we decreaze all the line number greater than i*/
|
|
bFound = FALSE;
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueMechanic ; cHistory < C_lHistorySize ; cHistory ++ , p ++ )
|
|
{
|
|
if (p -> ucDisplayLineNumber > i)
|
|
{
|
|
p -> ucDisplayLineNumber --;
|
|
bFound = TRUE;
|
|
}
|
|
}
|
|
|
|
if (! bFound) /* No line number greater that i*/
|
|
{
|
|
ucMechanicFirstUnusedLineNumber = (unsigned char)i;
|
|
break;
|
|
}
|
|
|
|
ucMechanicFirstUnusedLineNumber --;
|
|
i --; /* Try the new line # i*/
|
|
}
|
|
}
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
}
|
|
|
|
/*###########################################################################################*
|
|
* *
|
|
* S L O W D O W N E N G I N E *
|
|
* *
|
|
*###########################################################################################*/
|
|
void fn_vDrawAnimPlayerPage (tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 180
|
|
#define Col2 250
|
|
#define Col3 320
|
|
|
|
int y , y0 , i;
|
|
char text[256];
|
|
int iNbDatas, iCount;
|
|
unsigned char cHistory , cFreeHistory;
|
|
unsigned long ulRestTime, ulNbRestActors;
|
|
SECT_tdxHandleOfSectorObject hSectorObject = NULL;
|
|
HIE_tdxHandleToSuperObject hSectorSO = NULL;
|
|
tdstHistoryMaxValue *p = NULL;
|
|
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
long a_Tab[3] = { Col1 , Col2 , Col3 };
|
|
long lCurrentColl , lAverageColl , lMaxColl;
|
|
long lColl = 0;
|
|
ACP_tdxBool bFound;
|
|
|
|
/*================================================================================================*/
|
|
lCurrentColl = lAverageColl = lMaxColl = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
|
|
if (M_bWantedPercentMode(_p_stDisplayMode)) _p_stDisplayMode -> lRasterDisplayMode = C_lAbsolutePercentMode;
|
|
if (M_bWantedGraphicMode(_p_stDisplayMode)) _p_stDisplayMode -> lRasterDisplayMode = C_lAbsoluteGraphicMode;
|
|
|
|
/*================================================================================================*/
|
|
|
|
y = 0;
|
|
|
|
fn_vDisplayMode(_p_stDisplayMode,&y);
|
|
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
/*================================================================================================*/
|
|
/* Total collision time*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "PLA: %4i (ave:%4i,max%4i) %3i%%",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 1000,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 1000,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / 1000,
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulTotalDuration);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text, "PLA: %3i.%1i%% (ave:%3i.%1i%%,max%3i.%1i%%)",
|
|
PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulAverageTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionAverageDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulAverageTotalDuration) % 10,
|
|
PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulMaxTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionMaxDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulMaxTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
sprintf (text,"PLA: %3i.%1i%%" , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulTotalDuration,
|
|
(10 * PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer / ulTotalDuration) % 10);
|
|
DisplayPolices(text,50,y);
|
|
DrawBar (Col2 + 20 , y + 3 , PRF_fn_ulGetFunctionDuration(PRF_C_ulFctAnimPlayer) * g_ulCoefForAnimPlayer * C_lBarLength / ulTotalDuration / 100, 10);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAnimPlayer ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
p -> cNbTramesNotTreated++;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices("Total" , Col1, y);
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode) || M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Total" , lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Average" , lAverageColl , y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Maximum" , lMaxColl , y);
|
|
}
|
|
y+= C_lStep;
|
|
y0 = y;
|
|
|
|
iNbDatas = PRF_fn_iGetNumberOfUserDataForFunction(PRF_C_ulFctAnimPlayer);
|
|
ulNbRestActors = 0;
|
|
ulRestTime = 0;
|
|
|
|
/* Treat all characters present in this frame*/
|
|
for( iCount = 0 ; iCount < iNbDatas ; iCount++ )
|
|
{
|
|
unsigned long ulTime;
|
|
void* p_vData;
|
|
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithIndex(PRF_C_ulFctAnimPlayer,&p_vData,iCount) * g_ulCoefForAnimPlayer / 100;
|
|
|
|
/* Update History : find if this character is in the history*/
|
|
cHistory = 0;
|
|
cFreeHistory = C_lHistorySize;
|
|
p = aDEF_stHistoryMaxValueAnimPlayer;
|
|
/* search th history linked to p_vData and get the first free index*/
|
|
while ((cHistory < C_lHistorySize) && (p -> p_vData != p_vData))
|
|
{
|
|
if ((p -> p_vData == 0) && (cFreeHistory == C_lHistorySize)) cFreeHistory = cHistory;
|
|
cHistory++;
|
|
p++;
|
|
}
|
|
|
|
/* not found and no free index -> continue*/
|
|
if( (cHistory == C_lHistorySize) && (cFreeHistory == C_lHistorySize)) continue;
|
|
|
|
if (cHistory == C_lHistorySize) /* not found and free index*/
|
|
{ /* The character is not in the history : we add it*/
|
|
p = & aDEF_stHistoryMaxValueAnimPlayer [cFreeHistory];
|
|
p -> p_vData = p_vData;
|
|
p -> cNbTramesTreated = 0;
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ 0 ] = ulTime;
|
|
p -> ucDisplayLineNumber = ucAnimPlayerFirstUnusedLineNumber ++;
|
|
}
|
|
else
|
|
{ /* The character is already in the history*/
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> cNbTramesNotTreated = 0;
|
|
p -> ulValues [ p -> cNbTramesTreated ] = ulTime;
|
|
}
|
|
}
|
|
|
|
/* Treat the characters present in the previous frames but not in this frame*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAnimPlayer ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p -> p_vData != 0 && p -> cNbTramesNotTreated > 0)
|
|
{
|
|
p -> cNbTramesTreated = (char) ((p -> cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
p -> ulValues [ p -> cNbTramesTreated ] = 0;
|
|
}
|
|
|
|
/* Display the result for all characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAnimPlayer ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
{
|
|
unsigned long * pValue;
|
|
unsigned long ulCount , ulTime;
|
|
HIE_tdxHandleToSuperObject hActorSuperObject;
|
|
char * p_cActorName;
|
|
unsigned long ulMaxValue = 0;
|
|
unsigned long ulTotalValue = 0;
|
|
|
|
if (p -> p_vData == NULL) continue;
|
|
|
|
pValue = p -> ulValues;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
|
|
ulTime = p -> ulValues [p -> cNbTramesTreated];
|
|
|
|
if ((ulTime / 10) > 0)
|
|
{
|
|
if (p -> ucDisplayLineNumber == 0 ||
|
|
p -> ucDisplayLineNumber >= ucAnimPlayerFirstUnusedLineNumber)
|
|
p -> ucDisplayLineNumber = ucAnimPlayerFirstUnusedLineNumber ++;
|
|
}
|
|
else
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
|
|
if (((ulTime / 10) > 0) && (HIE_fn_ulGetSuperObjectType ((HIE_tdxHandleToSuperObject)p -> p_vData) == HIE_C_ulActor))
|
|
{
|
|
hActorSuperObject = (HIE_tdxHandleToSuperObject) p -> p_vData;
|
|
p_cActorName = fn_p_cGetActorFamilyName (hActorSuperObject);
|
|
|
|
y = y0 + (p -> ucDisplayLineNumber - 1) * C_lStep;
|
|
if (p_cActorName) DisplayPolices(p_cActorName,0,y);
|
|
else DisplayPolices("Unknown",0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text,"%3i", ulTime / 10,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
/**/
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulTotalValue / PRF_C_lNbTramesForAverage / ulAverageTotalDuration,lAverageColl,y);
|
|
/**/
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayDecimalValue(text,100 * ulMaxValue / ulMaxTotalDuration,lMaxColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
}
|
|
else
|
|
if (ulMaxValue > 0) /* Maximum time is not big enough -> we don't show the character*/
|
|
{
|
|
ulNbRestActors++;
|
|
ulRestTime += ulTime;
|
|
}
|
|
/* ??? NON else p -> p_vData = NULL; // Time is 0 for all the previous time -> we remove the character from the history*/
|
|
}
|
|
|
|
if( ulNbRestActors > 0 )
|
|
{
|
|
y = y0 + (ucAnimPlayerFirstUnusedLineNumber - 1) * C_lStep + 10;
|
|
|
|
sprintf (text,"%2i others",ulNbRestActors);
|
|
DisplayPolices(text,0,y);
|
|
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text, "%3i", ulRestTime / 10,Col1,y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,100 * ulRestTime / ulTotalDuration,Col1,y);
|
|
DrawBar (Col2 + 20 , y + 3 , ulRestTime * C_lBarLength / ulTotalDuration, 10 );
|
|
}
|
|
}
|
|
|
|
/* Remove the unused characters*/
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAnimPlayer ; cHistory < C_lHistorySize ; cHistory ++ , p ++)
|
|
if (p ->cNbTramesNotTreated == PRF_C_lNbTramesForAverage)
|
|
{
|
|
memset (p, 0, sizeof (tdstHistoryMaxValue));
|
|
}
|
|
else if (p ->cNbTramesNotTreated > 0)
|
|
{
|
|
p -> ucDisplayLineNumber = 0;
|
|
}
|
|
|
|
/* Remove the unused lines*/
|
|
for (i = 1 ; i < ucAnimPlayerFirstUnusedLineNumber ; i ++)
|
|
{
|
|
p = aDEF_stHistoryMaxValueAnimPlayer;
|
|
cHistory = 0;
|
|
/* Search the actor that is displayed at the line # i*/
|
|
while (cHistory < C_lHistorySize && p -> ucDisplayLineNumber != i)
|
|
{
|
|
cHistory ++;
|
|
p ++;
|
|
}
|
|
|
|
if (cHistory == C_lHistorySize)
|
|
{
|
|
/* Not found : the line # i does not exist anymore -> we decreaze all the line number greater than i*/
|
|
bFound = FALSE;
|
|
for (cHistory = 0 , p = aDEF_stHistoryMaxValueAnimPlayer ; cHistory < C_lHistorySize ; cHistory ++ , p ++ )
|
|
{
|
|
if (p -> ucDisplayLineNumber > i)
|
|
{
|
|
p -> ucDisplayLineNumber --;
|
|
bFound = TRUE;
|
|
}
|
|
}
|
|
|
|
if (! bFound) /* No line number greater that i*/
|
|
{
|
|
ucAnimPlayerFirstUnusedLineNumber = (unsigned char)i;
|
|
break;
|
|
}
|
|
|
|
ucAnimPlayerFirstUnusedLineNumber --;
|
|
i --; /* Try the new line # i*/
|
|
}
|
|
}
|
|
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
}
|
|
/*###########################################################################################*
|
|
* *
|
|
* S L O W D O W N E N G I N E *
|
|
* *
|
|
*###########################################################################################*/
|
|
void GAM_fn_vSlowDownEngine(unsigned long _lTimeSpentToComputeRaster)
|
|
{
|
|
#ifndef U64
|
|
ACP_tdxBool bU64DisplayMode = (ACP_tdxBool) (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulU64Mode);
|
|
ACP_tdxBool bFinalMode = (ACP_tdxBool) (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulFinalMode);
|
|
|
|
if (bU64DisplayMode)
|
|
{
|
|
/* compute real Time*/
|
|
unsigned long ulTotal = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctMainLoop);
|
|
unsigned long ulDisplay = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplay);
|
|
unsigned long ulDisplaySpecific = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDisplaySpecific);
|
|
unsigned long ulInput = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctInput);
|
|
unsigned long ulEditor = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctEditor);
|
|
unsigned long ulSound = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctSound);
|
|
unsigned long ulFlip = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctFlip);
|
|
unsigned long ulAI = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAI);
|
|
unsigned long ulCollision = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctCollisions);
|
|
unsigned long ulMechanic = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctDNM);
|
|
unsigned long ulAnimPlayer = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctAnimPlayer);
|
|
unsigned long ulHierarchyRest = PRF_fn_ulGetFunctionDuration (PRF_C_ulFctIADNMPLAMisc);
|
|
unsigned long ulWaitFor3dFx = PRF_fn_ulGetFunctionDuration (PRF_C_ulWaitFor3dFx);
|
|
|
|
/* compute wanted time*/
|
|
unsigned long ulTotalU64;
|
|
unsigned long ulDiff;
|
|
|
|
if( bFinalMode )
|
|
{
|
|
ulDisplay = (unsigned long)((float)ulDisplay / gs_fEvalCoefForDisplay);
|
|
ulDisplaySpecific = (unsigned long)((float)ulDisplaySpecific / gs_fEvalCoefForDisplaySpecific);
|
|
ulAI = (unsigned long)((float)ulAI / gs_fEvalCoefForAI);
|
|
ulCollision = (unsigned long)((float)ulCollision / gs_fEvalCoefForCollision);
|
|
ulMechanic = (unsigned long)((float)ulMechanic / gs_fEvalCoefForMechanic);
|
|
ulAnimPlayer = (unsigned long)((float)ulAnimPlayer / gs_fEvalCoefForAnimPlayer);
|
|
|
|
ulTotal = ulDisplay +
|
|
ulDisplaySpecific +
|
|
ulWaitFor3dFx +
|
|
ulInput +
|
|
ulEditor +
|
|
ulSound +
|
|
ulAI +
|
|
ulCollision +
|
|
ulMechanic +
|
|
ulAnimPlayer +
|
|
ulHierarchyRest;
|
|
ulFlip = 9999 - ((ulTotal - 1) % 10000);
|
|
}
|
|
ulTotal = (ulTotal + _lTimeSpentToComputeRaster + ulFlip) / 10;
|
|
ulTotalU64 = ((ulDisplay * gs_ulU64CoefForDisplay ) +
|
|
(ulDisplaySpecific * gs_ulU64CoefForDisplaySpecific) +
|
|
(ulInput * gs_ulU64CoefForInput ) +
|
|
(ulSound * gs_ulU64CoefForSound ) +
|
|
(ulAI * gs_ulU64CoefForAI ) +
|
|
(ulCollision * gs_ulU64CoefForCollision ) +
|
|
(ulMechanic * gs_ulU64CoefForMechanic ) +
|
|
(ulAnimPlayer * gs_ulU64CoefForAnimPlayer )) / 100;
|
|
|
|
ulTotalU64 += 9999 - ((ulTotalU64 - 1) % 10000);
|
|
ulTotalU64 /= 10;
|
|
/* wait for needed time*/
|
|
if(ulTotalU64 > ulTotal)
|
|
{
|
|
ulDiff = (((ulTotalU64 + 500) / 1000) * 1000) - (((ulTotal + 500) / 1000) * 1000);
|
|
if( ulDiff > 500 )
|
|
{
|
|
ulDiff = (ulDiff - 500) / 60;
|
|
ulDiff = min( ulDiff , 500 );
|
|
TMR_fn_wWait( ulDiff );
|
|
#if defined (ACTIVE_EDITOR)
|
|
#ifndef USE_DIRECTX
|
|
//while (!grSstVRetraceOn());
|
|
//while (grSstVRetraceOn());
|
|
GLI_fn_vWaitRetrace();
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
#endif /* U64 */
|
|
}
|
|
|
|
void fn_vDrawPageIndependantVariable(tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 150
|
|
long i,y,lValue;
|
|
char *szName;
|
|
char text[256];
|
|
float fValue;
|
|
y = 0;
|
|
|
|
/* display mode*/
|
|
if (M_bPCRealMode(_p_stDisplayMode)) DisplayPolices ("PC" , 0 , 0);
|
|
else if (M_bPCFinalMode(_p_stDisplayMode)) DisplayPolices ("PC Eval" , 0 , 0);
|
|
else if (M_bU64RealMode(_p_stDisplayMode)) DisplayPolices ("U64" , 0 , 0);
|
|
else if (M_bU64FinalMode(_p_stDisplayMode)) DisplayPolices ("U64 Eval" , 0 , 0);
|
|
|
|
DisplayPolices ("Independant Variables" , 100 , 0);
|
|
y+= C_lStep + 10;
|
|
|
|
/* show long independant variable*/
|
|
for (i = 0 ; i < PRF_C_lMaxNbIndependantVariable ; i++)
|
|
{
|
|
szName = PRF_fn_szGetIndependantVariableName (i);
|
|
lValue = PRF_fn_lGetIndependantVariable (i);
|
|
if (szName)
|
|
{
|
|
DisplayPolices (szName, 0 , y);
|
|
sprintf (text , "%i" , lValue);
|
|
DisplayPolices (text, Col1 , y);
|
|
y+= C_lStep;
|
|
}
|
|
}
|
|
/* show float independant variable*/
|
|
for (i = 0 ; i < PRF_C_lMaxNbFloatIndependantVariable ; i++)
|
|
{
|
|
szName = PRF_fn_szGetFloatIndependantVariableName (i);
|
|
fValue = PRF_fn_fGetFloatIndependantVariable (i);
|
|
if (szName)
|
|
{
|
|
DisplayPolices (szName, 0 , y);
|
|
sprintf (text , "%.3f" , fValue);
|
|
DisplayPolices (text, Col1 , y);
|
|
y+= C_lStep;
|
|
}
|
|
}
|
|
#undef Col1
|
|
}
|
|
|
|
void fn_vDrawPGMScreen(tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 150
|
|
long y;
|
|
char text[256];
|
|
|
|
y = 0;
|
|
|
|
/* display mode*/
|
|
if (M_bPCRealMode(_p_stDisplayMode)) DisplayPolices ("PC" , 0 , 0);
|
|
else if (M_bPCFinalMode(_p_stDisplayMode)) DisplayPolices ("PC Eval" , 0 , 0);
|
|
else if (M_bU64RealMode(_p_stDisplayMode)) DisplayPolices ("U64" , 0 , 0);
|
|
else if (M_bU64FinalMode(_p_stDisplayMode)) DisplayPolices ("U64 Eval" , 0 , 0);
|
|
|
|
y+= C_lStep + 10;
|
|
|
|
DisplayPolices ("Display Common" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDuration(PRF_C_ulFctDisplayCommon) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- GetDevice" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvGetDevice) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- SendToViewPort" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvSendToViewPort) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- Lights" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvLight) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- Stack" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvStack) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- Shadow" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvShadow) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
DisplayPolices ("-- SendToFix" , 0 , y);
|
|
M_DisplayValue(text,"%5i",PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDisplayCommon,PRF_C_pvSendFix) ,Col1,y);
|
|
y += C_lStep;
|
|
|
|
#undef Col1
|
|
}
|
|
|
|
void fn_vDrawActorPage(tdstDisplayMode *_p_stDisplayMode)
|
|
{
|
|
#define Col1 100
|
|
#define Col2 150
|
|
#define Col3 200
|
|
#define Col4 250
|
|
long a_Tab[4] = { Col1 , Col2 , Col3 , Col4 };
|
|
long lCurrentColl , lAverageColl , lMaxColl , lMiscColl;
|
|
long lColl = 0;
|
|
char text[256],szNumber[3];
|
|
HIE_tdxHandleToSuperObject hSO_Character, hSO_Sector;
|
|
unsigned long ulTime , ulTime1;
|
|
unsigned long ulTotalDuration, ulMaxTotalDuration, ulAverageTotalDuration;
|
|
int y;
|
|
HIE_tdxHandleToSuperObject a100_SOCharacter[100], *hCurrentSO , *hLastSO, *hMaxSO;
|
|
HIE_tdxHandleToSuperObject hCharacter,hChild;
|
|
long i,j,lIndexCurrent;
|
|
tdstHistoryMaxValue *p = NULL;
|
|
unsigned long ulTotalValue , ulMaxValue , ulCustomBits;
|
|
unsigned long ulTotalActor;
|
|
/*================================================================================================*/
|
|
hCurrentSO = a100_SOCharacter;
|
|
hSO_Character = (HIE_tdxHandleToSuperObject)g_p_vDisplayedActor;
|
|
lIndexCurrent = -1;
|
|
hMaxSO = a100_SOCharacter+98;
|
|
HIE_M_ForEachChildOf(gp_stDynamicWorld,hCharacter,i)
|
|
{
|
|
if(HIE_fn_ulGetSuperObjectType(hCharacter) == HIE_C_ulActor)
|
|
{
|
|
*hCurrentSO++ = hCharacter;
|
|
/**/
|
|
if(hCharacter == hSO_Character) lIndexCurrent = (hCurrentSO - a100_SOCharacter) -1;
|
|
if( hCurrentSO == hMaxSO ) break;
|
|
|
|
if( M_GetMSHandle(hCharacter,StandardGame) && fn_ucStandardGameGetPlatFormType(M_GetMSHandle(hCharacter,StandardGame))!=0 )
|
|
{
|
|
HIE_M_ForEachChildOf(hCharacter,hChild,j)
|
|
{
|
|
if (HIE_fn_ulGetSuperObjectType(hChild) == HIE_C_ulActor)
|
|
{
|
|
*hCurrentSO++ = hChild;
|
|
if(hChild == hSO_Character) lIndexCurrent = (hCurrentSO - a100_SOCharacter) -1;
|
|
if( hCurrentSO == hMaxSO ) break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
/*if(lIndexCurrent == -1) hSO_Character = *a100_SOCharacter;
|
|
else */if(_p_stDisplayMode -> bActorChanged)
|
|
{
|
|
lIndexCurrent++;
|
|
if(a100_SOCharacter+lIndexCurrent == hCurrentSO)
|
|
hSO_Character = *a100_SOCharacter;
|
|
else
|
|
hSO_Character = a100_SOCharacter [lIndexCurrent];
|
|
/* re-init historic*/
|
|
memset (&aDEF_stHistoryMaxValueOneAI , 0 , sizeof(tdstHistoryMaxValue));
|
|
memset (&aDEF_stHistoryMaxValueOneCollision , 0 , sizeof(tdstHistoryMaxValue));
|
|
memset (&aDEF_stHistoryMaxValueOneMechanic , 0 , sizeof(tdstHistoryMaxValue));
|
|
memset (&aDEF_stHistoryMaxValueOneAnimPlayer, 0 , sizeof(tdstHistoryMaxValue));
|
|
}
|
|
g_p_vDisplayedActor = (void*)hSO_Character;
|
|
/*================================================================================================*/
|
|
y = 0;
|
|
fn_vDisplayMode (_p_stDisplayMode,&y);
|
|
|
|
hLastSO = hCurrentSO;
|
|
|
|
for( hCurrentSO = a100_SOCharacter , lIndexCurrent = 0; hCurrentSO < hLastSO ; hCurrentSO++,lIndexCurrent++ )
|
|
{
|
|
int xX = lIndexCurrent % 6;
|
|
int xY = 1 + lIndexCurrent / 6;
|
|
|
|
if( *hCurrentSO == hSO_Character ) sprintf( text , "<%s>" , fn_p_cGetActorFamilyName (*hCurrentSO) );
|
|
else sprintf( text , "%s" , fn_p_cGetActorFamilyName (*hCurrentSO) );
|
|
|
|
DisplayPolices( text, xX * 100 , xY * C_lStep );
|
|
}
|
|
y = (3 + lIndexCurrent / 6) * C_lStep + 10;
|
|
|
|
/*================================================================================================*/
|
|
if(lIndexCurrent == -1 || hSO_Character == NULL) return;
|
|
/*================================================================================================*/
|
|
lCurrentColl = lAverageColl = lMaxColl = 0;
|
|
|
|
if (M_bShowCurrent(_p_stDisplayMode)) lCurrentColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowAverage(_p_stDisplayMode)) lAverageColl = a_Tab[ lColl ++ ];
|
|
if (M_bShowMaximum(_p_stDisplayMode)) lMaxColl = a_Tab[ lColl ++ ];
|
|
lMiscColl = a_Tab[ lColl ++ ];
|
|
|
|
/*================================================================================================*/
|
|
fn_vGetTotalTimeValues( _p_stDisplayMode , & ulTotalDuration , & ulMaxTotalDuration , & ulAverageTotalDuration );
|
|
if( (ulTotalDuration == 0) || (ulMaxTotalDuration == 0) || (ulAverageTotalDuration == 0) ) return;
|
|
|
|
if( M_GetMSHandle(hSO_Character,StandardGame) == NULL ) return;
|
|
/*================================================================================================*/
|
|
DisplayPolices (fn_p_cGetActorName (hSO_Character) , 0, y);
|
|
y+= C_lStep;
|
|
if(M_bShowCurrent(_p_stDisplayMode)) DisplayPolices("Cur" , lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) DisplayPolices("Ave" , lAverageColl, y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) DisplayPolices("Max" , lMaxColl, y);
|
|
y+= C_lStep;
|
|
|
|
|
|
ulTotalActor = 0;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices ("PLA :" , 0 , y);
|
|
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctAnimPlayer,g_p_vDisplayedActor) * g_ulCoefForAnimPlayer / 100;
|
|
ulTotalActor += ulTime;
|
|
|
|
aDEF_stHistoryMaxValueOneAnimPlayer . cNbTramesTreated = (char) ((aDEF_stHistoryMaxValueOneAnimPlayer . cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
aDEF_stHistoryMaxValueOneAnimPlayer . cNbTramesNotTreated = 0;
|
|
aDEF_stHistoryMaxValueOneAnimPlayer . ulValues [ aDEF_stHistoryMaxValueOneAnimPlayer . cNbTramesTreated ] = ulTime;
|
|
|
|
/* compute average and max values*/
|
|
ulTotalValue = 0;
|
|
ulMaxValue = 0;
|
|
|
|
{
|
|
unsigned long * pValue = aDEF_stHistoryMaxValueOneAnimPlayer . ulValues;
|
|
unsigned long ulCount;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
}
|
|
|
|
/* display values*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTime / 10, lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10, lAverageColl, y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10, lMaxColl, y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, ulTime / g_ulCoefForAnimPlayer / 10,lCurrentColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / g_ulCoefForAnimPlayer,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / g_ulCoefForAnimPlayer / 1000, 10);
|
|
}
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices ("AI :" , 0 , y);
|
|
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctAI,g_p_vDisplayedActor) * g_ulCoefForAI / 100;
|
|
ulTotalActor += ulTime;
|
|
|
|
aDEF_stHistoryMaxValueOneAI . cNbTramesTreated = (char) ((aDEF_stHistoryMaxValueOneAI . cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
aDEF_stHistoryMaxValueOneAI . cNbTramesNotTreated = 0;
|
|
aDEF_stHistoryMaxValueOneAI . ulValues [ aDEF_stHistoryMaxValueOneAI . cNbTramesTreated ] = ulTime;
|
|
|
|
/* compute average and max values*/
|
|
ulTotalValue = 0;
|
|
ulMaxValue = 0;
|
|
|
|
{
|
|
unsigned long * pValue = aDEF_stHistoryMaxValueOneAI . ulValues;
|
|
unsigned long ulCount;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
}
|
|
|
|
/* display values*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTime / 10, lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10, lAverageColl, y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10, lMaxColl, y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, ulTime / C_lIALoopWanted / 10,lCurrentColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / C_lIALoopWanted,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / C_lIALoopWanted / 1000, 10);
|
|
}
|
|
}
|
|
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices ("MEC :" , 0 , y);
|
|
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctDNM,g_p_vDisplayedActor) * g_ulCoefForMechanic / 100;
|
|
ulTotalActor += ulTime;
|
|
|
|
aDEF_stHistoryMaxValueOneMechanic . cNbTramesTreated = (char) ((aDEF_stHistoryMaxValueOneMechanic . cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
aDEF_stHistoryMaxValueOneMechanic . cNbTramesNotTreated = 0;
|
|
aDEF_stHistoryMaxValueOneMechanic . ulValues [ aDEF_stHistoryMaxValueOneMechanic . cNbTramesTreated ] = ulTime;
|
|
|
|
/* compute average and max values*/
|
|
ulTotalValue = 0;
|
|
ulMaxValue = 0;
|
|
|
|
{
|
|
unsigned long * pValue = aDEF_stHistoryMaxValueOneMechanic . ulValues;
|
|
unsigned long ulCount;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
}
|
|
|
|
/* display values*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTime / 10, lCurrentColl, y);
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10, lAverageColl, y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10, lMaxColl, y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, ulTime / g_ulCoefForMechanic / 10,lCurrentColl,y);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / g_ulCoefForMechanic,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / g_ulCoefForMechanic / 1000, 10);
|
|
}
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices ("COL :" , 0 , y);
|
|
DisplayPolices (" with Act :" , 0 , y+C_lStep);
|
|
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
MS_tdxHandleToCollSet hCollSet;
|
|
|
|
ulTime = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctCollisions,g_p_vDisplayedActor) * g_ulCoefForCollision / 100;
|
|
ulTime1 = PRF_fn_ulGetFunctionDurationWithData(PRF_C_ulFctCollisionsChar,g_p_vDisplayedActor) * g_ulCoefForCollision / 100;
|
|
ulTotalActor += ulTime;
|
|
|
|
aDEF_stHistoryMaxValueOneCollision . cNbTramesTreated = (char) ((aDEF_stHistoryMaxValueOneCollision . cNbTramesTreated+1) % PRF_C_lNbTramesForAverage);
|
|
aDEF_stHistoryMaxValueOneCollision . cNbTramesNotTreated = 0;
|
|
aDEF_stHistoryMaxValueOneCollision . ulValues [ aDEF_stHistoryMaxValueOneCollision . cNbTramesTreated ] = ulTime;
|
|
|
|
/* compute average and max values*/
|
|
ulTotalValue = 0;
|
|
ulMaxValue = 0;
|
|
|
|
{
|
|
unsigned long * pValue = aDEF_stHistoryMaxValueOneCollision . ulValues;
|
|
unsigned long ulCount;
|
|
|
|
for (ulCount = 0 ; ulCount < PRF_C_lNbTramesForAverage ; ulCount++ , pValue++ )
|
|
{
|
|
ulTotalValue += * pValue;
|
|
if (* pValue > ulMaxValue) ulMaxValue = * pValue;
|
|
}
|
|
}
|
|
|
|
/* display values*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
M_DisplayValue(text, "%3i", ulTime / 10, lCurrentColl, y);
|
|
M_DisplayValue(text, "%3i", ulTime1 / 10, lCurrentColl, y+C_lStep);
|
|
}
|
|
if(M_bShowAverage(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalValue / PRF_C_lNbTramesForAverage / 10, lAverageColl, y);
|
|
if(M_bShowMaximum(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulMaxValue / 10, lMaxColl, y);
|
|
}
|
|
else if (M_bAbsolutePercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
M_DisplayDecimalValue(text, 100 * ulTime1 / ulTotalDuration,lCurrentColl,y+C_lStep);
|
|
}
|
|
else if (M_bWantedPercentMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, ulTime / g_ulCoefForMechanic / 10,lCurrentColl,y);
|
|
M_DisplayDecimalValue(text, ulTime1 / g_ulCoefForMechanic / 10,lCurrentColl,y+C_lStep);
|
|
}
|
|
else if (M_bAbsoluteGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text, 100 * ulTime / ulTotalDuration,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / ulTotalDuration, 10);
|
|
M_DisplayDecimalValue(text, 100 * ulTime1 / ulTotalDuration,lCurrentColl,y+C_lStep);
|
|
DrawBar (lCurrentColl + 50 , y + 3 + C_lStep, ulTime1 * C_lBarLength / ulTotalDuration, 10);
|
|
}
|
|
else if (M_bWantedGraphicMode(_p_stDisplayMode))
|
|
{
|
|
M_DisplayDecimalValue(text,ulTime / g_ulCoefForMechanic,lCurrentColl,y);
|
|
DrawBar (lCurrentColl + 50 , y + 3 , ulTime * C_lBarLength / g_ulCoefForMechanic / 1000, 10);
|
|
M_DisplayDecimalValue(text,ulTime1 / g_ulCoefForMechanic,lCurrentColl,y+C_lStep);
|
|
DrawBar (lCurrentColl + 50 , y + 3 + C_lStep, ulTime1 * C_lBarLength / g_ulCoefForMechanic / 1000, 10);
|
|
}
|
|
y+= C_lStep;
|
|
y+= C_lStep;
|
|
|
|
hCollSet = M_GetMSHandle (hSO_Character , CollSet);
|
|
|
|
strcpy ((char *) text, " ");
|
|
if (hCollSet)
|
|
{
|
|
unsigned char ucCollisionFrequency;
|
|
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithMap (hCollSet)) text [0] = 'M';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithMainCharacter (hCollSet)) text [1] = 'R';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithProjectile (hCollSet)) text [2] = 'P';
|
|
if (! fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter (hCollSet)) text [3] = 'A';
|
|
if ( fn_bCollSetGetCharacterForceCollisionWhenNotMoving (hCollSet)) text [4] = 'F';
|
|
|
|
ucCollisionFrequency = fn_ucCollSetGetCollComputeFrequency (hCollSet);
|
|
if (ucCollisionFrequency > 1)
|
|
{
|
|
if (ucCollisionFrequency < 10) text [5] = (unsigned char) (ucCollisionFrequency + '0');
|
|
else text [5] = '*';
|
|
}
|
|
}
|
|
DisplayPolices (text , 0 , y);
|
|
}
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
DisplayPolices ("TOT :" , 0 , y);
|
|
|
|
if(M_bShowCurrent(_p_stDisplayMode))
|
|
{
|
|
/* display values*/
|
|
if (M_bAbsoluteValueMode(_p_stDisplayMode))
|
|
{
|
|
if(M_bShowCurrent(_p_stDisplayMode)) M_DisplayValue(text, "%3i", ulTotalActor / 10, lCurrentColl, y);
|
|
}
|
|
}
|
|
y+= C_lStep;
|
|
|
|
|
|
/*================================================================================================*/
|
|
|
|
#if defined(__DEBUG_AI__) /* {*/
|
|
{
|
|
AI_tdstMind *p_stMind;
|
|
MS_tdxHandleToBrain h_Brain;
|
|
|
|
if( ((h_Brain = M_GetMSHandle(hSO_Character,Brain)) != NULL ) &&
|
|
((p_stMind = M_pstGetMindOfBrain(h_Brain)) != NULL)
|
|
)
|
|
{
|
|
struct tdstIntelligence_ *p_stIntelligence;
|
|
struct tdstIntelligence_ *p_stReflex;
|
|
char *p_cText,*p_cDelimiter;
|
|
|
|
/* current comport*/
|
|
if( ((p_stIntelligence = AI_M_p_stGetIntelligence(p_stMind)) != NULL) &&
|
|
M_GetCurrentComport(p_stIntelligence) )
|
|
{
|
|
p_cText = M_GetNameComport(M_GetCurrentComport(p_stIntelligence));
|
|
p_cDelimiter = strchr(p_cText , ':');
|
|
if(p_cDelimiter)
|
|
{
|
|
DisplayPolices(++p_cDelimiter, 0, y);
|
|
y+= C_lStep;
|
|
}
|
|
}
|
|
|
|
/* current reflex*/
|
|
if( ((p_stReflex = AI_M_p_stGetReflex(p_stMind)) != NULL) &&
|
|
M_GetCurrentComport(p_stReflex) )
|
|
{
|
|
p_cText = M_GetNameComport(M_GetCurrentComport(p_stReflex));
|
|
p_cDelimiter = strchr(p_cText , ':');
|
|
if(p_cDelimiter)
|
|
{
|
|
DisplayPolices(++p_cDelimiter, 0, y);
|
|
y+= C_lStep;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif /* __DEBUG_AI__ }*/
|
|
|
|
/*================================================================================================*/
|
|
|
|
ulCustomBits = fn_ulStandardGameGetCustomBitsSO (hSO_Character);
|
|
|
|
strcpy(text , "CB : ");
|
|
for ( i=0 ; i<32 ; i++ )
|
|
{
|
|
if (ulCustomBits & (1<<i))
|
|
{
|
|
strcat(text,itoa(i+1,szNumber,10));
|
|
strcat(text," ");
|
|
}
|
|
}
|
|
DisplayPolices (text , 0 , y);
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
|
|
hSO_Sector = fn_h_SectInfoGetCurrentSector(M_GetMSHandle(hSO_Character,SectInfo));
|
|
sprintf (text,"Sector:%s",fn_p_cGetSOSectorName(hSO_Sector));
|
|
DisplayPolices (text , 0 , y);
|
|
y+= C_lStep;
|
|
|
|
/*================================================================================================*/
|
|
#undef Col1
|
|
#undef Col2
|
|
#undef Col3
|
|
#undef Col4
|
|
}
|
|
|
|
void fn_vDrawTextToDraw ()
|
|
{
|
|
int i;
|
|
tdstTextToDrawInformation * p;
|
|
|
|
for (i = 0 , p = g_a_stTextToDrawInformation ; i < g_lNumberOfTextToDraw ; i ++ , p ++)
|
|
{
|
|
if (strlen (p -> szTextToDraw) > 0)
|
|
DisplayPolices (p -> szTextToDraw , p -> lX , p -> lY);
|
|
}
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
/*================================================================================================*/
|
|
/*================================================================================================*/
|
|
#define HTML_C_szBeginningOfPage "<HTML>\n<BODY>\n"
|
|
#define HTML_C_szEndOfPage "</BODY>\n</HTML>\n"
|
|
#define HTML_C_szEndOfLine "</p>"
|
|
#define HTML_C_szBold "<b>"
|
|
#define HTML_C_szEndBold "</b>"
|
|
#define HTML_C_szItalic "<i>"
|
|
#define HTML_C_szEndItalic "</i>"
|
|
#define HTML_C_szUnderline "<u>"
|
|
#define HTML_C_szEndUnderline "</u>"
|
|
#define HTML_C_szBiggerOnce "<font size=+1>"
|
|
#define HTML_C_szBiggerTwice "<font size=+2>"
|
|
#define HTML_C_szEndBigger "</font>"
|
|
#define HTML_C_szLowerOnce "<font size=-1>"
|
|
#define HTML_C_szEndLower "</font>"
|
|
#define HTML_C_szTable "<table>"
|
|
#define HTML_C_szTableBorder "<table BORDER>"
|
|
#define HTML_C_szEndTable "</table>"
|
|
#define HTML_C_szTableLine "<TR>"
|
|
#define HTML_C_szTableLineCenter "<TR ALIGN=CENTER>"
|
|
#define HTML_C_szTableLineRight "<TR ALIGN=RIGHT>"
|
|
#define HTML_C_szEndTableLine "</TR>"
|
|
#define HTML_C_szTableColon "<TD>"
|
|
#define HTML_C_szTableColonCenter "<TD ALIGN=CENTER>"
|
|
#define HTML_C_szTable2ColonCenter "<TD ALIGN=CENTER COLSPAN=2>"
|
|
#define HTML_C_szTable3ColonCenter "<TD ALIGN=CENTER COLSPAN=3>"
|
|
#define HTML_C_szTable4ColonCenter "<TD ALIGN=CENTER COLSPAN=4>"
|
|
#define HTML_C_szTableColonRight "<TD ALIGN=RIGHT>"
|
|
#define HTML_C_szEndTableColon "</TD>"
|
|
#define HTML_C_szDrawLine "<HR>"
|
|
#define HTML_C_szTab "  "
|
|
#define HTML_C_szTab2 "   "
|
|
#define HTML_C_szTab4 "   "
|
|
#define HTML_C_szTab8 "   "
|
|
#define HTML_C_szJumpToTarget "<A HREF=\"#"
|
|
#define HTML_C_szMiddleJump "\">"
|
|
#define HTML_C_szEndJump "</A>"
|
|
#define HTML_C_szTarget "<A NAME=\""
|
|
#define HTML_C_szEndTarget "\"></A>"
|
|
|
|
#define HTML_C_szBiggerOnceAndBold "<font size=+1><b>"
|
|
#define HTML_C_szBiggerTwiceAndBold "<font size=+2><b>"
|
|
#define HTML_C_szEndBiggerAndBold "</b></font>"
|
|
|
|
#define HTML_C_szColor(RGB) "<font color=" #RGB ">"
|
|
#define HTML_C_szEndColor "</font>"
|
|
|
|
#define HTML_C_szTableLineBGColor(RGB) "<TR BGCOLOR=" #RGB ">"
|
|
#define HTML_C_szEndTableLineBGColor "</TR>"
|
|
|
|
|
|
/*================================================================================================*/
|
|
static unsigned long *gs_a_AIValue = NULL;
|
|
static unsigned long *gs_a_PLAValue = NULL;
|
|
static unsigned long *gs_a_MECValue = NULL;
|
|
static unsigned long *gs_a_ActiveCount = NULL;
|
|
|
|
static unsigned long *gs_a_AIValueInst = NULL;
|
|
static unsigned long *gs_a_PLAValueInst = NULL;
|
|
static unsigned long *gs_a_MECValueInst = NULL;
|
|
/**/
|
|
static unsigned long *gs_a_AIValueMax = NULL;
|
|
static unsigned long *gs_a_PLAValueMax = NULL;
|
|
static unsigned long *gs_a_MECValueMax = NULL;
|
|
static unsigned long gs_AILoop , gs_PLALoop , gs_MECLoop;
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpReset()
|
|
{
|
|
unsigned long ulNumberOfModels;
|
|
|
|
ulNumberOfModels = LST2_M_DynamicGetNumberOfElements(&g_stObjectTypes.hModelType);
|
|
memset (gs_a_AIValue ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_PLAValue ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_MECValue ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_ActiveCount,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
/**/
|
|
memset (gs_a_AIValueMax ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_PLAValueMax ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_MECValueMax ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpBeginLoop()
|
|
{
|
|
unsigned long ulNumberOfModels;
|
|
|
|
ulNumberOfModels = LST2_M_DynamicGetNumberOfElements(&g_stObjectTypes.hModelType);
|
|
memset (gs_a_AIValueInst ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_PLAValueInst ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
memset (gs_a_MECValueInst ,0 ,ulNumberOfModels * sizeof(unsigned long));
|
|
/**/
|
|
gs_AILoop = gs_PLALoop = gs_MECLoop = 0;
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpInit()
|
|
{
|
|
unsigned long ulNumberOfModels;
|
|
|
|
ulNumberOfModels = LST2_M_DynamicGetNumberOfElements(&g_stObjectTypes.hModelType);
|
|
gs_a_AIValue = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_PLAValue = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_MECValue = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_ActiveCount = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
/**/
|
|
gs_a_AIValueInst = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_PLAValueInst = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_MECValueInst = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
/**/
|
|
gs_a_AIValueMax = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_PLAValueMax = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
gs_a_MECValueMax = (unsigned long*) malloc (ulNumberOfModels * sizeof(unsigned long));
|
|
/**/
|
|
GAM_fn_vRasterDumpReset ();
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpEndLoop()
|
|
{
|
|
unsigned long ulNumberOfModels = LST2_M_DynamicGetNumberOfElements(&g_stObjectTypes.hModelType);
|
|
unsigned long i;
|
|
unsigned long ulPercent;
|
|
|
|
/* AI*/
|
|
if (gs_AILoop)
|
|
{
|
|
for(i=0 ; i<ulNumberOfModels ; i++)
|
|
{
|
|
ulPercent = 10000 * gs_a_AIValueInst [i] / gs_AILoop;
|
|
if (ulPercent > gs_a_AIValueMax [i]) gs_a_AIValueMax [i] = ulPercent;
|
|
}
|
|
}
|
|
/* PLA*/
|
|
if (gs_PLALoop)
|
|
{
|
|
for(i=0 ; i<ulNumberOfModels ; i++)
|
|
{
|
|
ulPercent = 10000 * gs_a_PLAValueInst [i] / gs_PLALoop;
|
|
if (ulPercent > gs_a_PLAValueMax [i]) gs_a_PLAValueMax [i] = ulPercent;
|
|
}
|
|
}
|
|
/* MEC*/
|
|
if (gs_MECLoop)
|
|
{
|
|
for(i=0 ; i<ulNumberOfModels ; i++)
|
|
{
|
|
ulPercent = 10000 * gs_a_MECValueInst [i] / gs_MECLoop;
|
|
if (ulPercent > gs_a_MECValueMax [i]) gs_a_MECValueMax [i] = ulPercent;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpUpdate(unsigned long _ulModel , unsigned long _ulAIValue , unsigned long _ulPLAValue ,
|
|
unsigned long _ulMECValue , unsigned long _ulCount)
|
|
{
|
|
gs_a_AIValue [_ulModel] += _ulAIValue;
|
|
gs_a_PLAValue [_ulModel] += _ulPLAValue;
|
|
gs_a_MECValue [_ulModel] += _ulMECValue;
|
|
gs_a_ActiveCount[_ulModel] += _ulCount;
|
|
/**/
|
|
gs_a_AIValueInst [_ulModel] += _ulAIValue;
|
|
gs_a_PLAValueInst [_ulModel] += _ulPLAValue;
|
|
gs_a_MECValueInst [_ulModel] += _ulMECValue;
|
|
/**/
|
|
gs_AILoop += _ulAIValue;
|
|
gs_PLALoop += _ulPLAValue;
|
|
gs_MECLoop += _ulMECValue;
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDumpDesInit()
|
|
{
|
|
if(gs_a_AIValue) free (gs_a_AIValue);
|
|
if(gs_a_PLAValue) free (gs_a_PLAValue);
|
|
if(gs_a_MECValue) free (gs_a_MECValue);
|
|
if(gs_a_ActiveCount) free (gs_a_ActiveCount);
|
|
/**/
|
|
if(gs_a_AIValueInst) free (gs_a_AIValueInst);
|
|
if(gs_a_PLAValueInst) free (gs_a_PLAValueInst);
|
|
if(gs_a_MECValueInst) free (gs_a_MECValueInst);
|
|
/**/
|
|
if(gs_a_AIValueMax) free (gs_a_AIValueMax);
|
|
if(gs_a_PLAValueMax) free (gs_a_PLAValueMax);
|
|
if(gs_a_MECValueMax) free (gs_a_MECValueMax);
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
void GAM_fn_vRasterDump()
|
|
{
|
|
unsigned long ulNumberOfModels = LST2_M_DynamicGetNumberOfElements(&g_stObjectTypes.hModelType);
|
|
unsigned long i;
|
|
unsigned long ulAITotalTick , ulPLATotalTick, ulMECTotalTick , ulAIPLAMECTotalTick;
|
|
FILE * pFile = fopen ("ModelDump.html" , "wt");
|
|
float fPercent;
|
|
|
|
if (pFile == NULL)
|
|
{
|
|
assert (0);
|
|
return;
|
|
}
|
|
|
|
/**/
|
|
/* total count*/
|
|
/**/
|
|
ulAITotalTick = ulPLATotalTick = ulMECTotalTick = 0;
|
|
|
|
for(i=0 ; i<ulNumberOfModels ; i++)
|
|
{
|
|
ulAITotalTick += gs_a_AIValue[i];
|
|
ulPLATotalTick += gs_a_PLAValue[i];
|
|
ulMECTotalTick += gs_a_MECValue[i];
|
|
}
|
|
ulAIPLAMECTotalTick = ulAITotalTick + ulPLATotalTick + ulMECTotalTick;
|
|
|
|
|
|
fprintf (pFile , "%s%s%s%s%s%s%s\n" , HTML_C_szBeginningOfPage , HTML_C_szDrawLine , HTML_C_szBiggerTwiceAndBold , "RASTER DUMP" , HTML_C_szEndBiggerAndBold ,
|
|
HTML_C_szEndOfLine , HTML_C_szDrawLine);
|
|
|
|
fprintf (pFile , "Map : %s%s%s%s\n" , HTML_C_szBiggerOnceAndBold , fn_p_szGetLevelName(), HTML_C_szEndBiggerAndBold , HTML_C_szEndOfLine);
|
|
|
|
/**/
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableBorder);
|
|
|
|
/* column title*/
|
|
/* begin of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableLineBGColor(8080FF));
|
|
/* name*/
|
|
fprintf (pFile , "%s%sModel%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* count*/
|
|
fprintf (pFile , "%s%sCount%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* AI*/
|
|
fprintf (pFile , "%s%sAI%s%s\n" , HTML_C_szTable4ColonCenter , HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* PLA*/
|
|
fprintf (pFile , "%s%sPLA%s%s\n" , HTML_C_szTable4ColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* MEC*/
|
|
fprintf (pFile , "%s%sMEC%s%s\n" , HTML_C_szTable4ColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* AI+PLA+MEC*/
|
|
fprintf (pFile , "%s%sAI+PLA+MEC%s%s\n" , HTML_C_szTable3ColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
/* end of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTableLineBGColor);
|
|
/**/
|
|
/* begin of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableLineBGColor(00F0F0));
|
|
fprintf (pFile , "%s %s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s %s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
for(i=0;i<4;i++)
|
|
{
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%sTotal%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%sAverage%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%sPercentage%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
if (i!=3) fprintf (pFile , "%s%sPercent Max%s%s\n", HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
}
|
|
/* end of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTableLineBGColor);
|
|
|
|
for(i=0 ; i<ulNumberOfModels ; i++)
|
|
{
|
|
unsigned long ulTotal , ulAverage;
|
|
|
|
ulTotal = 0;
|
|
ulAverage = 0;
|
|
/*fprintf (pFile , "%s\n" , HTML_C_szTableLine);*/
|
|
if(i & 0x1)
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableLineBGColor(F0F0F0));
|
|
else
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableLine);
|
|
/* name*/
|
|
fprintf (pFile , "%s%s%s\n" , HTML_C_szTableColon , fn_szFindModelTypeNameOfModelType((tdObjectType)i) , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* count*/
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , gs_a_ActiveCount[i] , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* AI*/
|
|
if(gs_a_ActiveCount[i])
|
|
{
|
|
/* AI*/
|
|
ulTotal += gs_a_AIValue[i];
|
|
ulAverage += gs_a_AIValue[i] / gs_a_ActiveCount[i];
|
|
fPercent = (100.0f * gs_a_AIValue[i]) / ulAITotalTick;
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , gs_a_AIValue[i] , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , gs_a_AIValue[i] / gs_a_ActiveCount[i] , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , fPercent , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , (gs_a_AIValueMax [i] / 100.00) , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* PLA*/
|
|
ulTotal += gs_a_PLAValue[i];
|
|
ulAverage += gs_a_PLAValue[i] / gs_a_ActiveCount[i];
|
|
fPercent = (100.0f * gs_a_PLAValue[i]) / ulPLATotalTick;
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , gs_a_PLAValue[i] , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , gs_a_PLAValue[i] / gs_a_ActiveCount[i] , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , fPercent , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , (gs_a_PLAValueMax [i] / 100.00) , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* MEC*/
|
|
ulTotal += gs_a_MECValue[i];
|
|
ulAverage += gs_a_MECValue[i] / gs_a_ActiveCount[i];
|
|
fPercent = (100.0f * gs_a_MECValue[i]) / ulMECTotalTick;
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , gs_a_MECValue[i] , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , gs_a_MECValue[i] / gs_a_ActiveCount[i] , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , fPercent , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , (gs_a_MECValueMax [i] / 100.00) , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
}
|
|
else
|
|
{
|
|
/* AI*/
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , 0 , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , 0 , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* PLA*/
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , 0 , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , 0 , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* MEC*/
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , 0 , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , 0 , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(008000) , "0.00 %" , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
}
|
|
/* AI+PLA+MEC*/
|
|
fPercent = ((float)100 * ulTotal) / ulAIPLAMECTotalTick;
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , ulTotal , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%u%s\n" , HTML_C_szTableColonRight , ulAverage , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%5.2f %%%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , fPercent , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
/* end of line*/
|
|
if(i & 0x1)
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTableLineBGColor);
|
|
else
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTableLine);
|
|
}
|
|
/* total*/
|
|
/* begin of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szTableLineBGColor(80FF80));
|
|
/* name*/
|
|
fprintf (pFile , "%s%sTotal%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* count*/
|
|
fprintf (pFile , "%s%s %s%s\n" , HTML_C_szTableColonCenter, HTML_C_szBold , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* AI*/
|
|
fPercent = (100.0f * ulAITotalTick) / ulAIPLAMECTotalTick;
|
|
fprintf (pFile , "%s%s%s%u%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , HTML_C_szBold , ulAITotalTick , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%5.2f %%%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , HTML_C_szBold , fPercent , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* PLA*/
|
|
fPercent = (100.0f * ulPLATotalTick) / ulAIPLAMECTotalTick;
|
|
fprintf (pFile , "%s%s%s%u%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , HTML_C_szBold , ulPLATotalTick , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%5.2f %%%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , HTML_C_szBold , fPercent , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* MEC*/
|
|
fPercent = (100.0f * ulMECTotalTick) / ulAIPLAMECTotalTick;
|
|
fprintf (pFile , "%s%s%s%u%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , HTML_C_szBold , ulMECTotalTick , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%5.2f %%%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , HTML_C_szBold , fPercent , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s\n" , HTML_C_szTableColonCenter, HTML_C_szEndTableColon);
|
|
/* AI+PLA+MEC*/
|
|
fPercent = (100.0f * (ulAITotalTick+ulPLATotalTick+ulMECTotalTick)) / ulAIPLAMECTotalTick;
|
|
fprintf (pFile , "%s%s%s%u%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(FF0000) , HTML_C_szBold , ulAITotalTick+ulPLATotalTick+ulMECTotalTick , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%u%s%s\n" , HTML_C_szTableColonRight , HTML_C_szBold , 0 , HTML_C_szEndBold , HTML_C_szEndTableColon);
|
|
fprintf (pFile , "%s%s%s%s%s%s%s\n" , HTML_C_szTableColonRight , HTML_C_szColor(0000FF) , HTML_C_szBold , "100.00 %" , HTML_C_szEndBold , HTML_C_szEndColor , HTML_C_szEndTableColon);
|
|
/* end of line*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTableLineBGColor);
|
|
/* end of table*/
|
|
fprintf (pFile , "%s\n" , HTML_C_szEndTable);
|
|
|
|
/* end of file*/
|
|
fprintf (pFile , HTML_C_szEndOfPage);
|
|
|
|
fclose (pFile);
|
|
}
|
|
|
|
/*================================================================================================*/
|
|
|
|
#endif /* USE_PROFILER */
|
|
|
|
#endif /* PRESS_DEMO */ |