mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-17 21:00:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf51e14cf5 | ||
|
|
7fb383c810 | ||
|
|
34f66963e3 | ||
|
|
6059063b67 | ||
|
|
8bf57017ac | ||
|
|
9f1d35a11b | ||
|
|
aa51987077 | ||
|
|
64055d2580 | ||
|
|
45e82c590e | ||
|
|
0c92890ef2 | ||
|
|
03e8a64283 | ||
|
|
4e14535f08 | ||
|
|
356e7c51fc | ||
|
|
52a146d664 |
No files matched your search
@@ -85,6 +85,11 @@ These are the tools required on Unix :
|
||||
|
||||
Visual Studio (2019 or 2022) is generally preferred.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## Third party
|
||||
|
||||
### SDL
|
||||
|
||||
+30
-14
@@ -414,6 +414,25 @@ void CG_Portal(centity_t* cent)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
BG_EvaluateTrajectory
|
||||
================
|
||||
*/
|
||||
void BG_EvaluateTrajectory(const trajectory_t* tr, int atTime, const vec3_t base, vec3_t result) {
|
||||
float deltaTime;
|
||||
|
||||
if (atTime > cg_smoothClientsTime->integer + tr->trTime) {
|
||||
atTime = cg_smoothClientsTime->integer + tr->trTime;
|
||||
}
|
||||
|
||||
deltaTime = (float)(atTime - tr->trTime) / 1000.0;
|
||||
|
||||
result[0] = tr->trDelta[0] * deltaTime + base[0];
|
||||
result[1] = tr->trDelta[1] * deltaTime + base[1];
|
||||
result[2] = tr->trDelta[2] * deltaTime + base[2];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_CalcEntityLerpPositions
|
||||
@@ -477,8 +496,8 @@ void CG_CalcEntityLerpPositions( centity_t *cent )
|
||||
|
||||
// this will linearize a sine or parabolic curve, but it is important
|
||||
// to not extrapolate player positions if more recent data is available
|
||||
BG_EvaluateTrajectory(¢->currentState.pos, cg.snap->serverTime, current);
|
||||
BG_EvaluateTrajectory(¢->nextState.pos, cg.nextSnap->serverTime, next);
|
||||
BG_EvaluateTrajectory(¢->currentState.pos, cg.snap->serverTime, cent->currentState.origin, current);
|
||||
BG_EvaluateTrajectory(¢->nextState.pos, cg.nextSnap->serverTime, cent->nextState.origin, next);
|
||||
|
||||
cent->lerpOrigin[0] = current[0] + f * (next[0] - current[0]);
|
||||
cent->lerpOrigin[1] = current[1] + f * (next[1] - current[1]);
|
||||
@@ -494,17 +513,11 @@ void CG_CalcEntityLerpPositions( centity_t *cent )
|
||||
QuatToMat(quat, mat);
|
||||
MatrixToEulerAngles(mat, cent->lerpAngles);
|
||||
}
|
||||
|
||||
// Lerp legs, torso, and head angles
|
||||
for (i = 0; i < 3; i++) {
|
||||
cent->lerpAngles[i] = LerpAngle(current[i], next[i], f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// just use the current frame and evaluate as best we can
|
||||
BG_EvaluateTrajectory(¢->currentState.pos, cg.time, cent->lerpOrigin);
|
||||
BG_EvaluateTrajectory(¢->currentState.pos, cg.time, cent->currentState.origin, cent->lerpOrigin);
|
||||
VectorCopy(cent->currentState.angles, cent->lerpAngles);
|
||||
//BG_EvaluateTrajectory(¢->currentState.apos, cg.time, cent->lerpAngles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,10 +558,10 @@ void CG_AddCEntity(centity_t* cent)
|
||||
CG_ModelAnim(cent, qtrue);
|
||||
break;
|
||||
case ET_PLAYER:
|
||||
CG_Player(cent);
|
||||
case ET_ITEM:
|
||||
case ET_EXEC_COMMANDS:
|
||||
CG_ModelAnim(cent, qfalse);
|
||||
CG_Player(cent);
|
||||
CG_Splash(cent);
|
||||
case ET_ITEM:
|
||||
CG_ModelAnim(cent, qfalse);
|
||||
break;
|
||||
case ET_GENERAL:
|
||||
CG_General(cent);
|
||||
@@ -575,7 +588,10 @@ void CG_AddCEntity(centity_t* cent)
|
||||
break;
|
||||
case ET_ROPE: // skip
|
||||
CG_Rope(cent);
|
||||
break;
|
||||
break;
|
||||
case ET_EXEC_COMMANDS:
|
||||
CG_ModelAnim(cent, qfalse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -590,6 +590,7 @@ void CG_PredictPlayerState( void );
|
||||
//
|
||||
// cg_ents.c
|
||||
//
|
||||
void BG_EvaluateTrajectory(const trajectory_t* tr, int atTime, const vec3_t base, vec3_t result);
|
||||
void CG_SetEntitySoundPosition( centity_t *cent );
|
||||
void CG_AddPacketEntities( void );
|
||||
void CG_Beam( centity_t *cent );
|
||||
|
||||
@@ -956,7 +956,7 @@ void CG_ModelAnim(centity_t* cent, qboolean bDoShaderTime)
|
||||
VectorCopy(model.origin, cg.sky_origin);
|
||||
}
|
||||
|
||||
model.reType = ET_MODELANIM_SKEL;
|
||||
model.reType = RT_MODEL;
|
||||
if (!(s1->renderfx & RF_DONTDRAW))
|
||||
{
|
||||
cgi.R_Model_GetHandle(model.hModel);
|
||||
|
||||
@@ -29,14 +29,10 @@ key up events are sent even if in console mode
|
||||
|
||||
*/
|
||||
|
||||
field_t historyEditLines[COMMAND_HISTORY];
|
||||
|
||||
int nextHistoryLine; // the last line in the history buffer, not masked
|
||||
int historyLine; // the line being displayed from history buffer
|
||||
// will be <= nextHistoryLine
|
||||
|
||||
field_t g_consoleField;
|
||||
field_t chatField;
|
||||
qboolean chat_team;
|
||||
|
||||
int chat_playerNum;
|
||||
@@ -1198,136 +1194,3 @@ Key_SetCatcher
|
||||
void Key_SetCatcher( int catcher ) {
|
||||
keyCatchers = catcher;
|
||||
}
|
||||
|
||||
// This must not exceed MAX_CMD_LINE
|
||||
#define MAX_CONSOLE_SAVE_BUFFER 1024
|
||||
#define CONSOLE_HISTORY_FILE "omhistory"
|
||||
static char consoleSaveBuffer[ MAX_CONSOLE_SAVE_BUFFER ];
|
||||
static int consoleSaveBufferSize = 0;
|
||||
|
||||
/*
|
||||
================
|
||||
CL_LoadConsoleHistory
|
||||
|
||||
Load the console history from cl_consoleHistory
|
||||
================
|
||||
*/
|
||||
void CL_LoadConsoleHistory( void )
|
||||
{
|
||||
const char *token;
|
||||
char *text_p;
|
||||
int i, numChars, numLines = 0;
|
||||
fileHandle_t f;
|
||||
|
||||
consoleSaveBufferSize = FS_FOpenFileRead( CONSOLE_HISTORY_FILE, &f, qfalse, qtrue );
|
||||
if( !f )
|
||||
{
|
||||
Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
|
||||
return;
|
||||
}
|
||||
|
||||
if( consoleSaveBufferSize <= MAX_CONSOLE_SAVE_BUFFER &&
|
||||
FS_Read( consoleSaveBuffer, consoleSaveBufferSize, f ) == consoleSaveBufferSize )
|
||||
{
|
||||
text_p = consoleSaveBuffer;
|
||||
|
||||
for( i = COMMAND_HISTORY - 1; i >= 0; i-- )
|
||||
{
|
||||
if( !*( token = COM_Parse( &text_p ) ) )
|
||||
break;
|
||||
|
||||
historyEditLines[ i ].cursor = atoi( token );
|
||||
|
||||
if( !*( token = COM_Parse( &text_p ) ) )
|
||||
break;
|
||||
|
||||
historyEditLines[ i ].scroll = atoi( token );
|
||||
|
||||
if( !*( token = COM_Parse( &text_p ) ) )
|
||||
break;
|
||||
|
||||
numChars = atoi( token );
|
||||
text_p++;
|
||||
if( numChars > ( strlen( consoleSaveBuffer ) - ( text_p - consoleSaveBuffer ) ) )
|
||||
{
|
||||
Com_DPrintf( S_COLOR_YELLOW "WARNING: probable corrupt history\n" );
|
||||
break;
|
||||
}
|
||||
Com_Memcpy( historyEditLines[ i ].buffer,
|
||||
text_p, numChars );
|
||||
historyEditLines[ i ].buffer[ numChars ] = '\0';
|
||||
text_p += numChars;
|
||||
|
||||
numLines++;
|
||||
}
|
||||
|
||||
memmove( &historyEditLines[ 0 ], &historyEditLines[ i + 1 ],
|
||||
numLines * sizeof( field_t ) );
|
||||
for( i = numLines; i < COMMAND_HISTORY; i++ )
|
||||
Field_Clear( &historyEditLines[ i ] );
|
||||
|
||||
historyLine = nextHistoryLine = numLines;
|
||||
}
|
||||
else
|
||||
Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
|
||||
|
||||
FS_FCloseFile( f );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CL_SaveConsoleHistory
|
||||
|
||||
Save the console history into the cvar cl_consoleHistory
|
||||
so that it persists across invocations of q3
|
||||
================
|
||||
*/
|
||||
void CL_SaveConsoleHistory( void )
|
||||
{
|
||||
int i;
|
||||
int lineLength, saveBufferLength, additionalLength;
|
||||
fileHandle_t f;
|
||||
|
||||
consoleSaveBuffer[ 0 ] = '\0';
|
||||
|
||||
i = ( nextHistoryLine - 1 ) % COMMAND_HISTORY;
|
||||
do
|
||||
{
|
||||
if( historyEditLines[ i ].buffer[ 0 ] )
|
||||
{
|
||||
lineLength = strlen( historyEditLines[ i ].buffer );
|
||||
saveBufferLength = strlen( consoleSaveBuffer );
|
||||
|
||||
//ICK
|
||||
additionalLength = lineLength + strlen( "999 999 999 " );
|
||||
|
||||
if( saveBufferLength + additionalLength < MAX_CONSOLE_SAVE_BUFFER )
|
||||
{
|
||||
Q_strcat( consoleSaveBuffer, MAX_CONSOLE_SAVE_BUFFER,
|
||||
va( "%d %d %d %s ",
|
||||
historyEditLines[ i ].cursor,
|
||||
historyEditLines[ i ].scroll,
|
||||
lineLength,
|
||||
historyEditLines[ i ].buffer ) );
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
i = ( i - 1 + COMMAND_HISTORY ) % COMMAND_HISTORY;
|
||||
}
|
||||
while( i != ( nextHistoryLine - 1 ) % COMMAND_HISTORY );
|
||||
|
||||
consoleSaveBufferSize = strlen( consoleSaveBuffer );
|
||||
|
||||
f = FS_FOpenFileWrite( CONSOLE_HISTORY_FILE );
|
||||
if( !f )
|
||||
{
|
||||
Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
|
||||
return;
|
||||
}
|
||||
|
||||
if( FS_Write( consoleSaveBuffer, consoleSaveBufferSize, f ) < consoleSaveBufferSize )
|
||||
Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
|
||||
|
||||
FS_FCloseFile( f );
|
||||
}
|
||||
@@ -42,6 +42,7 @@ void CL_ShutdownUI( void );
|
||||
//
|
||||
extern inventory_t client_inv;
|
||||
extern bind_t client_bind;
|
||||
extern cvar_t* cl_greenfps;
|
||||
|
||||
const char *CvarGetForUI( const char *name, const char *defval );
|
||||
void UI_ClearState( void );
|
||||
|
||||
+380
-12
@@ -438,7 +438,173 @@ void UIFakkLabel::LayoutRenderModelAnim( Event *ev )
|
||||
|
||||
void UIFakkLabel::DrawStatbar( float frac )
|
||||
{
|
||||
// FIXME: stub
|
||||
vec4_t col;
|
||||
float alpha;
|
||||
|
||||
col[0] = col[1] = col[2] = col[3] = 1.0;
|
||||
|
||||
switch (m_statbar_or)
|
||||
{
|
||||
case L_STATBAR_CIRCULAR:
|
||||
DrawStatCircle(frac);
|
||||
return;
|
||||
case L_STATBAR_NEEDLE:
|
||||
DrawStatNeedle(frac);
|
||||
return;
|
||||
case L_STATBAR_ROTATOR:
|
||||
DrawStatRotator(frac);
|
||||
return;
|
||||
case L_STATBAR_COMPASS:
|
||||
DrawStatCompass(frac);
|
||||
return;
|
||||
case L_STATBAR_SPINNER:
|
||||
case L_STATBAR_HEADING_SPINNER:
|
||||
DrawStatSpinner(frac);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!frac) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (frac != m_lastfrac) {
|
||||
m_flashtime = uid.time;
|
||||
}
|
||||
m_lastfrac = frac;
|
||||
|
||||
alpha = 1.0 - ((float)uid.time - m_flashtime) / 1500.0;
|
||||
if (alpha < 0.0) alpha = 0.0;
|
||||
else if (alpha > 1.0) alpha = 1.0;
|
||||
|
||||
col[3] = alpha;
|
||||
|
||||
if (m_statbar_material)
|
||||
{
|
||||
if (m_flags & WF_TILESHADER)
|
||||
{
|
||||
switch (m_statbar_or)
|
||||
{
|
||||
case L_STATBAR_HORIZONTAL:
|
||||
{
|
||||
float width = frac * m_frame.size.width;
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material->GetMaterial());
|
||||
|
||||
if (alpha != 0.0 && m_statbar_material_flash)
|
||||
{
|
||||
re.SetColor(col);
|
||||
m_statbar_material_flash->ReregisterMaterial();
|
||||
re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case L_STATBAR_VERTICAL:
|
||||
case L_STATBAR_VERTICAL_REVERSE:
|
||||
case L_STATBAR_VERTICAL_STAGGER_EVEN:
|
||||
case L_STATBAR_VERTICAL_STAGGER_ODD:
|
||||
{
|
||||
float y = m_frame.size.height * (1.0 - frac);
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material->GetMaterial());
|
||||
|
||||
if (alpha != 0.0 && m_statbar_material_flash)
|
||||
{
|
||||
re.SetColor(col);
|
||||
m_statbar_material_flash->ReregisterMaterial();
|
||||
re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_statbar_or)
|
||||
{
|
||||
case L_STATBAR_HORIZONTAL:
|
||||
{
|
||||
float width = frac * m_frame.size.width;
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0.0, 0.0, 1.0, 1.0, m_statbar_material->GetMaterial());
|
||||
|
||||
if(alpha != 0.0 && m_statbar_material_flash)
|
||||
{
|
||||
re.SetColor(col);
|
||||
m_statbar_material_flash->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0.0, 0.0, 1.0, 1.0, m_statbar_material_flash->GetMaterial());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case L_STATBAR_VERTICAL:
|
||||
case L_STATBAR_VERTICAL_STAGGER_EVEN:
|
||||
case L_STATBAR_VERTICAL_STAGGER_ODD:
|
||||
{
|
||||
float y = m_frame.size.height * (1.0 - frac);
|
||||
float height = m_frame.size.height * frac;
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, y, m_frame.size.width, height, 0.0, 1.0 - frac, 1.0, 1.0, m_statbar_material->GetMaterial());
|
||||
|
||||
if (alpha != 0.0 && m_statbar_material_flash)
|
||||
{
|
||||
re.SetColor(col);
|
||||
m_statbar_material_flash->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, y, m_frame.size.width, height, 0.0, 1.0 - frac, 1.0, 1.0, m_statbar_material_flash->GetMaterial());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case L_STATBAR_VERTICAL_REVERSE:
|
||||
{
|
||||
float height = m_frame.size.height * frac;
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, 0.0, m_frame.size.width, height, 0.0, 0.0, 1.0, frac, m_statbar_material->GetMaterial());
|
||||
|
||||
if (alpha != 0.0 && m_statbar_material_flash)
|
||||
{
|
||||
re.SetColor(col);
|
||||
m_statbar_material_flash->ReregisterMaterial();
|
||||
re.DrawStretchPic(0.0, 0.0, m_frame.size.width, height, 0.0, 0.0, 1.0, frac, m_statbar_material_flash->GetMaterial());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_statbar_or)
|
||||
{
|
||||
case L_STATBAR_VERTICAL:
|
||||
case L_STATBAR_VERTICAL_STAGGER_EVEN:
|
||||
case L_STATBAR_VERTICAL_STAGGER_ODD:
|
||||
DrawBox(
|
||||
0.0,
|
||||
m_frame.size.height * (1.0 - frac),
|
||||
m_frame.size.width,
|
||||
m_frame.size.height,
|
||||
m_foreground_color,
|
||||
1.0
|
||||
);
|
||||
break;
|
||||
case L_STATBAR_HORIZONTAL:
|
||||
DrawBox(
|
||||
0.0,
|
||||
0.0,
|
||||
frac * m_frame.size.width,
|
||||
m_frame.size.height,
|
||||
m_foreground_color,
|
||||
1.0
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIFakkLabel::DrawStatCircle( float frac )
|
||||
@@ -458,7 +624,212 @@ void UIFakkLabel::DrawStatRotator( float frac )
|
||||
|
||||
void UIFakkLabel::DrawStatCompass( float frac )
|
||||
{
|
||||
// FIXME: stub
|
||||
vec4_t col;
|
||||
float fTargAng;
|
||||
float fSinVal, fCosVal;
|
||||
vec2_t vCenter;
|
||||
vec2_t vVerts[3];
|
||||
vec2_t vTexCoords[3];
|
||||
vec2_t vCompassDir;
|
||||
vec2_t vSideDir;
|
||||
|
||||
col[0] = col[1] = col[2] = col[3] = 1.0;
|
||||
|
||||
if (!cge) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int iLastCompassTime = -9999, iLastTimeDelta = 0;
|
||||
static float fLastPitch = 0, fLastYaw = 0, fLastYawDelta = 0;
|
||||
static float fYawOffset = 0, fYawSpeed = 0;
|
||||
static float fNeedleOffset = 0, fNeedleSpeed = 0;
|
||||
int iTimeCount, iTimeDelta;
|
||||
float fYawDelta, fYawDeltaDiff;
|
||||
vec3_t vViewAngles;
|
||||
|
||||
cge->CG_EyeAngles(&vViewAngles);
|
||||
|
||||
vViewAngles[1] -= cl.snap.ps.stats[STAT_COMPASSNORTH] / 182.0f;
|
||||
|
||||
iTimeCount = uid.time - iLastCompassTime;
|
||||
if (iTimeCount <= 1000)
|
||||
{
|
||||
fYawDelta = AngleSubtract(vViewAngles[1], fLastYaw);
|
||||
if (fYawDelta > 0.1)
|
||||
{
|
||||
if ((fYawDelta > 0.0 && fLastYawDelta < fYawDelta)
|
||||
|| (fYawDelta < 0.0 && fLastYawDelta > fYawDelta))
|
||||
{
|
||||
|
||||
fYawSpeed += (fYawDelta - fLastYawDelta) * 0.75;
|
||||
fYawOffset += (fYawDelta - fLastYawDelta) * 0.75;
|
||||
}
|
||||
|
||||
if (fYawSpeed > 90.0) {
|
||||
fYawSpeed = 90.0;
|
||||
}
|
||||
else if (fYawSpeed < 0.05) {
|
||||
fYawSpeed = 0.05;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while (iTimeCount > 0)
|
||||
{
|
||||
iTimeDelta = iTimeCount;
|
||||
if (iTimeCount > 15) {
|
||||
iTimeDelta = 15;
|
||||
}
|
||||
iTimeCount -= iTimeDelta;
|
||||
|
||||
if (fabs(fYawOffset) >= 0.1 || fabs(fYawSpeed) >= 0.01)
|
||||
{
|
||||
fYawOffset += fYawSpeed * iTimeDelta;
|
||||
if (fYawOffset > 0.0) {
|
||||
fYawSpeed -= iTimeDelta * 0.00175;
|
||||
}
|
||||
else if (fYawOffset < 0.0) {
|
||||
fYawSpeed += iTimeDelta * 0.00175;
|
||||
}
|
||||
|
||||
if (fYawOffset > 40.0) {
|
||||
fYawOffset = 40.0;
|
||||
fYawSpeed = 0.0;
|
||||
}
|
||||
else if (fYawOffset < -40.0) {
|
||||
fYawOffset = -40.0;
|
||||
fYawSpeed = 0.0;
|
||||
}
|
||||
|
||||
fYawSpeed -= iTimeDelta * 0.003;
|
||||
if (fYawSpeed > 0.0) {
|
||||
fYawSpeed -= iTimeDelta * 0.0004;
|
||||
}
|
||||
else {
|
||||
fYawSpeed += iTimeDelta * 0.0004;
|
||||
if (fYawSpeed > 0.0) {
|
||||
fYawSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iTimeCount = 0;
|
||||
fYawOffset = 0.0;
|
||||
fYawSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
fLastYawDelta = fYawDelta;
|
||||
iLastTimeDelta = uid.time - iLastCompassTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
fLastYawDelta = 0;
|
||||
fYawOffset = 0;
|
||||
fYawSpeed = 0;
|
||||
iLastTimeDelta = 0;
|
||||
}
|
||||
|
||||
fLastPitch = vViewAngles[0];
|
||||
fLastYaw = vViewAngles[1];
|
||||
iLastCompassTime = uid.time;
|
||||
|
||||
if (iLastTimeDelta)
|
||||
{
|
||||
if (fabs(fLastYawDelta) > 0.1) {
|
||||
fNeedleOffset -= fLastYawDelta;
|
||||
}
|
||||
|
||||
iTimeCount = iLastTimeDelta;
|
||||
while (iTimeCount > 0)
|
||||
{
|
||||
iTimeDelta = iTimeCount;
|
||||
if (iTimeCount > 15) {
|
||||
iTimeDelta = 15;
|
||||
}
|
||||
iTimeCount -= iTimeDelta;
|
||||
|
||||
if (fabs(fNeedleOffset) >= 0.1 || fabs(fNeedleSpeed) >= 0.01) {
|
||||
|
||||
fNeedleOffset += iTimeDelta * fNeedleSpeed;
|
||||
if (fNeedleOffset > 180.0) {
|
||||
fNeedleOffset -= 360.0;
|
||||
}
|
||||
else if (fNeedleOffset < -180.0) {
|
||||
fNeedleOffset += 360.0;
|
||||
}
|
||||
|
||||
if (fNeedleOffset > 0.0) {
|
||||
fNeedleSpeed -= iTimeDelta * 0.00175;
|
||||
}
|
||||
else if (fNeedleOffset < 0.0) {
|
||||
fNeedleSpeed += iTimeDelta * 0.00175;
|
||||
}
|
||||
|
||||
fNeedleSpeed -= fNeedleSpeed * 0.0025 * iTimeDelta;
|
||||
if (fNeedleSpeed > 0.0) {
|
||||
fNeedleSpeed -= iTimeDelta * 0.00035;
|
||||
if (fNeedleSpeed < 0.0) {
|
||||
fNeedleSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fNeedleSpeed += iTimeDelta * 0.00035;
|
||||
if (fNeedleSpeed > 0.0) {
|
||||
fNeedleSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iTimeCount = 0;
|
||||
fNeedleOffset = 0.0;
|
||||
fNeedleSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fNeedleOffset = 0.0;
|
||||
fNeedleSpeed = 0.0;
|
||||
}
|
||||
|
||||
fSinVal = sin(anglemod(fNeedleOffset + fLastYaw) / (180 / M_PI));
|
||||
fCosVal = cos(anglemod(fNeedleOffset + fLastYaw) / (180 / M_PI));
|
||||
|
||||
vCompassDir[0] = fSinVal;
|
||||
vCompassDir[1] = -fCosVal;
|
||||
|
||||
vCenter[0] = m_frame.size.width * 0.5;
|
||||
vCenter[1] = m_frame.size.height * 0.5;
|
||||
vTexCoords[0][0] = 0.0;
|
||||
vTexCoords[0][1] = 0.0;
|
||||
vTexCoords[1][0] = 1.0;
|
||||
vTexCoords[1][1] = 0.0;
|
||||
vTexCoords[2][0] = 0.0;
|
||||
vTexCoords[2][1] = 1.0;
|
||||
|
||||
vVerts[0][0] = vCenter[0] + vCompassDir[0] * vCenter[0] - fCosVal * vCenter[1];
|
||||
vVerts[1][0] = vCenter[0] + vCompassDir[0] * vCenter[0] + fCosVal * vCenter[1];
|
||||
vVerts[2][0] = vCenter[0] - vCompassDir[0] * vCenter[0] - fCosVal * vCenter[1];
|
||||
vVerts[0][1] = vCenter[1] + vCompassDir[1] * vCenter[1] - fSinVal * vCenter[0];
|
||||
vVerts[1][1] = vCenter[1] + vCompassDir[1] * vCenter[1] + fSinVal * vCenter[0];
|
||||
vVerts[2][1] = vCenter[1] - vCompassDir[1] * vCenter[1] - fSinVal * vCenter[0];
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
|
||||
|
||||
vVerts[0][0] = vVerts[2][0];
|
||||
vVerts[0][1] = vVerts[2][1];
|
||||
vTexCoords[0][0] = vTexCoords[2][0];
|
||||
vTexCoords[0][1] = vTexCoords[2][1];
|
||||
vTexCoords[2][0] = 1.0;
|
||||
vTexCoords[2][1] = 1.0;
|
||||
|
||||
vVerts[2][0] = vCenter[0] + fCosVal * vCenter[1] - vCompassDir[0] * vCenter[0];
|
||||
vVerts[2][1] = vCenter[1] * fSinVal + vCenter[0] - vCompassDir[1] * vCenter[1];
|
||||
|
||||
m_statbar_material->ReregisterMaterial();
|
||||
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
|
||||
}
|
||||
|
||||
void UIFakkLabel::DrawStatSpinner( float frac )
|
||||
@@ -506,7 +877,7 @@ void UIFakkLabel::Draw( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_stat != -1 )
|
||||
if( m_stat == -1 )
|
||||
{
|
||||
float scale;
|
||||
qhandle_t handle;
|
||||
@@ -516,7 +887,7 @@ void UIFakkLabel::Draw( void )
|
||||
vec3_t angles;
|
||||
vec3_t offset;
|
||||
vec3_t rotateoffset;
|
||||
vec3_t color;
|
||||
vec4_t color;
|
||||
str sAnimName;
|
||||
float height;
|
||||
|
||||
@@ -686,23 +1057,20 @@ _shitlabel01:
|
||||
|
||||
float frac;
|
||||
|
||||
if( m_maxstat )
|
||||
if( m_maxstat >= 0 )
|
||||
{
|
||||
frac = delta / ( m_statbar_max - m_statbar_min );
|
||||
frac = (float)delta / (float)cl.snap.ps.stats[m_maxstat];
|
||||
}
|
||||
else
|
||||
{
|
||||
frac = delta / cl.snap.ps.stats[ m_maxstat ];
|
||||
frac = (float)delta / (float)(m_statbar_max - m_statbar_min);
|
||||
}
|
||||
|
||||
if( frac > 1.0 )
|
||||
frac = 1.0;
|
||||
if( frac < 0.0 )
|
||||
frac = 0.0;
|
||||
if( frac > 1.0 ) frac = 1.0;
|
||||
else if( frac < 0.0 ) frac = 0.0;
|
||||
|
||||
DrawStatbar( frac );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,72 @@ void View3D::DrawFPS
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
char string[128];
|
||||
|
||||
setFont("verdana-14");
|
||||
if (fps->integer == 2)
|
||||
{
|
||||
re.SetColor(UBlack);
|
||||
re.DrawBox(
|
||||
0.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 4.0,
|
||||
m_frame.pos.x + m_frame.size.width,
|
||||
m_font->getHeight(qfalse) * 4.0
|
||||
);
|
||||
}
|
||||
|
||||
sprintf(string, "FPS %4.1f", currentfps);
|
||||
if (currentfps > 23.94) {
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
} else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
} else if (currentfps > 18.0) {
|
||||
m_font->setColor(UYellow);
|
||||
} else {
|
||||
// low fps
|
||||
m_font->setColor(URed);
|
||||
}
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 3.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
// Draw elements count
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
}
|
||||
else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
|
||||
sprintf(string, "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 2.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
sprintf(string, "t%5d v%5d Mtex%5.2f", cls.total_tris, cls.total_verts, (float)cls.total_texels * 0.00000095367432);
|
||||
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse),
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
}
|
||||
|
||||
void View3D::DrawProf
|
||||
|
||||
@@ -578,9 +578,6 @@ void Con_PageDown( void );
|
||||
void Con_Top( void );
|
||||
void Con_Bottom( void );
|
||||
|
||||
void CL_LoadConsoleHistory( void );
|
||||
void CL_SaveConsoleHistory( void );
|
||||
|
||||
//
|
||||
// cl_scrn.c
|
||||
//
|
||||
|
||||
@@ -34,17 +34,6 @@ typedef struct {
|
||||
extern qboolean key_overstrikeMode;
|
||||
extern qkey_t keys[K_LASTKEY];
|
||||
|
||||
// NOTE TTimo the declaration of field_t and Field_Clear is now in qcommon/qcommon.h
|
||||
void Field_KeyDownEvent( field_t *edit, int key );
|
||||
void Field_CharEvent( field_t *edit, int ch );
|
||||
void Field_Draw(fontInfo_t *font, field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape );
|
||||
void Field_BigDraw(fontInfo_t *font, field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape );
|
||||
|
||||
#define COMMAND_HISTORY 32
|
||||
extern field_t historyEditLines[COMMAND_HISTORY];
|
||||
|
||||
extern field_t g_consoleField;
|
||||
extern field_t chatField;
|
||||
extern int anykeydown;
|
||||
extern qboolean chat_team;
|
||||
extern int chat_playerNum;
|
||||
|
||||
@@ -25,15 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "bg_public.h"
|
||||
|
||||
/*
|
||||
================
|
||||
BG_EvaluateTrajectory
|
||||
================
|
||||
*/
|
||||
void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
BG_EvaluateTrajectoryDelta
|
||||
|
||||
@@ -609,9 +609,6 @@ typedef enum {
|
||||
ET_EXEC_COMMANDS
|
||||
} entityType_t;
|
||||
|
||||
// su44; yes, I know there is no q3 trajectory_t in MoHAA,
|
||||
// but I need it for fgame rotating doors code.
|
||||
void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
|
||||
void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
|
||||
|
||||
void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap );
|
||||
|
||||
+31
-210
@@ -31,6 +31,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
// FPS
|
||||
#include <chrono>
|
||||
|
||||
#include <tiki.h>
|
||||
|
||||
qboolean CL_FinishedIntro(void);
|
||||
@@ -72,7 +75,6 @@ fileHandle_t com_journalDataFile; // config files are written here
|
||||
cvar_t *paused;
|
||||
cvar_t *config;
|
||||
cvar_t *fps;
|
||||
float currentfps;
|
||||
cvar_t *com_speeds;
|
||||
cvar_t *developer;
|
||||
cvar_t *com_dedicated;
|
||||
@@ -126,6 +128,18 @@ static char *rd_buffer;
|
||||
static int rd_buffersize;
|
||||
static void (*rd_flush)( char *buffer );
|
||||
|
||||
#define MAX_FPS_TIMES 16
|
||||
|
||||
using fps_clock_t = std::chrono::high_resolution_clock;
|
||||
using fps_time_t = fps_clock_t::time_point;
|
||||
using fps_delta_t = fps_clock_t::duration;
|
||||
|
||||
static int fpsindex;
|
||||
static fps_delta_t fpstimes[MAX_FPS_TIMES];
|
||||
static fps_delta_t fpstotal;
|
||||
static fps_time_t fpslasttime;
|
||||
float currentfps;
|
||||
|
||||
void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)( char *) )
|
||||
{
|
||||
if (!buffer || !buffersize || !flush)
|
||||
@@ -1752,6 +1766,22 @@ void Com_Frame( void ) {
|
||||
com_frameNumber, all, sv, ev, cl, time_game, time_frontend, time_backend );
|
||||
}
|
||||
|
||||
if (fps->integer) {
|
||||
fps_time_t fpstime = fps_clock_t::now();
|
||||
fps_delta_t delta = fpstime - fpslasttime;
|
||||
|
||||
fpstotal = (fpstime - fpslasttime) + (fpstotal - fpstimes[fpsindex]);
|
||||
fpstimes[fpsindex] = fpstime - fpslasttime;
|
||||
fpsindex = (fpsindex + 1) % MAX_FPS_TIMES;
|
||||
fpslasttime = fpstime;
|
||||
|
||||
if (fpstotal.count()) {
|
||||
currentfps = 16.0 / std::chrono::duration<long double>(fpstotal).count();
|
||||
} else {
|
||||
currentfps = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// trace optimization tracking
|
||||
//
|
||||
@@ -1893,23 +1923,10 @@ command line completion
|
||||
===========================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
Field_Clear
|
||||
==================
|
||||
*/
|
||||
void Field_Clear( field_t *edit ) {
|
||||
memset(edit->buffer, 0, MAX_EDIT_LINE);
|
||||
edit->cursor = 0;
|
||||
edit->scroll = 0;
|
||||
}
|
||||
|
||||
static const char *completionString;
|
||||
static char shortestMatch[MAX_TOKEN_CHARS];
|
||||
static int matchCount;
|
||||
// field we are working on, passed to Field_AutoComplete(&g_consoleCommand for instance)
|
||||
static field_t *completionField;
|
||||
|
||||
/*
|
||||
===============
|
||||
FindMatches
|
||||
@@ -1968,200 +1985,4 @@ static void PrintCvarMatches( const char *s ) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_FindFirstSeparator
|
||||
===============
|
||||
*/
|
||||
static char *Field_FindFirstSeparator( char *s )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < strlen( s ); i++ )
|
||||
{
|
||||
if( s[ i ] == ';' )
|
||||
return &s[ i ];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef DEDICATED
|
||||
/*
|
||||
===============
|
||||
Field_CompleteKeyname
|
||||
===============
|
||||
*/
|
||||
static void Field_CompleteKeyname( void )
|
||||
{
|
||||
matchCount = 0;
|
||||
shortestMatch[ 0 ] = 0;
|
||||
|
||||
Key_KeynameCompletion( FindMatches );
|
||||
|
||||
if( matchCount == 0 )
|
||||
return;
|
||||
|
||||
Q_strncpyz( &completionField->buffer[ strlen( completionField->buffer ) -
|
||||
strlen( completionString ) ], shortestMatch,
|
||||
sizeof( completionField->buffer ) );
|
||||
completionField->cursor = ( int )strlen( completionField->buffer );
|
||||
|
||||
if( matchCount == 1 )
|
||||
{
|
||||
Q_strcat( completionField->buffer, sizeof( completionField->buffer ), " " );
|
||||
completionField->cursor++;
|
||||
return;
|
||||
}
|
||||
|
||||
Com_Printf( "]%s\n", completionField->buffer );
|
||||
|
||||
Key_KeynameCompletion( PrintMatches );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_CompleteFilename
|
||||
===============
|
||||
*/
|
||||
static void Field_CompleteFilename( const char *dir,
|
||||
const char *ext, qboolean stripExt )
|
||||
{
|
||||
size_t pos;
|
||||
|
||||
matchCount = 0;
|
||||
shortestMatch[ 0 ] = 0;
|
||||
|
||||
FS_FilenameCompletion( dir, ext, stripExt, FindMatches );
|
||||
|
||||
if( matchCount == 0 )
|
||||
return;
|
||||
|
||||
pos = strlen( completionField->buffer ) - strlen( completionString );
|
||||
Q_strncpyz( &completionField->buffer[ pos ], shortestMatch,
|
||||
sizeof( completionField->buffer ) - pos );
|
||||
completionField->cursor = ( int )strlen( completionField->buffer );
|
||||
|
||||
if( matchCount == 1 )
|
||||
{
|
||||
Q_strcat( completionField->buffer, sizeof( completionField->buffer ), " " );
|
||||
completionField->cursor++;
|
||||
return;
|
||||
}
|
||||
|
||||
Com_Printf( "]%s\n", completionField->buffer );
|
||||
|
||||
FS_FilenameCompletion( dir, ext, stripExt, PrintMatches );
|
||||
}
|
||||
|
||||
static void keyConcatArgs(void) {
|
||||
int i;
|
||||
char* arg;
|
||||
|
||||
for (i = 1; i < Cmd_Argc(); i++) {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), " ");
|
||||
arg = Cmd_Argv(i);
|
||||
while (*arg) {
|
||||
if (*arg == ' ') {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), "\"");
|
||||
break;
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), Cmd_Argv(i));
|
||||
if (*arg == ' ') {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ConcatRemaining(const char* src, const char* start) {
|
||||
const char* str;
|
||||
|
||||
str = strstr(src, start);
|
||||
if (!str) {
|
||||
keyConcatArgs();
|
||||
return;
|
||||
}
|
||||
|
||||
str += strlen(start);
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), str);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_CompleteCommand
|
||||
|
||||
perform Tab expansion
|
||||
NOTE TTimo this was originally client code only
|
||||
moved to common code when writing tty console for *nix dedicated server
|
||||
===============
|
||||
*/
|
||||
void Field_CompleteCommand(field_t* field) {
|
||||
field_t temp;
|
||||
|
||||
completionField = field;
|
||||
|
||||
// only look at the first token for completion purposes
|
||||
Cmd_TokenizeString(completionField->buffer);
|
||||
|
||||
completionString = Cmd_Argv(0);
|
||||
if (completionString[0] == '\\' || completionString[0] == '/') {
|
||||
completionString++;
|
||||
}
|
||||
matchCount = 0;
|
||||
shortestMatch[0] = 0;
|
||||
|
||||
if (strlen(completionString) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Cmd_CommandCompletion(FindMatches);
|
||||
Cvar_CommandCompletion(FindMatches);
|
||||
|
||||
if (matchCount == 0) {
|
||||
return; // no matches
|
||||
}
|
||||
|
||||
Com_Memcpy(&temp, completionField, sizeof(field_t));
|
||||
|
||||
if (matchCount == 1) {
|
||||
Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s", shortestMatch);
|
||||
if (Cmd_Argc() == 1) {
|
||||
Q_strcat(completionField->buffer, sizeof(completionField->buffer), " ");
|
||||
}
|
||||
else {
|
||||
ConcatRemaining(temp.buffer, completionString);
|
||||
}
|
||||
completionField->cursor = strlen(completionField->buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// multiple matches, complete to shortest
|
||||
Com_sprintf(completionField->buffer, sizeof(completionField->buffer), "\\%s", shortestMatch);
|
||||
completionField->cursor = strlen(completionField->buffer);
|
||||
ConcatRemaining(temp.buffer, completionString);
|
||||
|
||||
Com_Printf("]%s\n", completionField->buffer);
|
||||
|
||||
// run through again, printing matches
|
||||
Cmd_CommandCompletion(PrintMatches);
|
||||
Cvar_CommandCompletion(PrintMatches);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_AutoComplete
|
||||
|
||||
Perform Tab expansion
|
||||
===============
|
||||
*/
|
||||
void Field_AutoComplete( field_t *field )
|
||||
{
|
||||
completionField = field;
|
||||
|
||||
Field_CompleteCommand(field);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-21
@@ -798,26 +798,6 @@ MISC
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
Edit fields and command line history/completion
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
#define MAX_EDIT_LINE 256
|
||||
typedef struct {
|
||||
int cursor;
|
||||
int scroll;
|
||||
int widthInChars;
|
||||
char buffer[MAX_EDIT_LINE];
|
||||
} field_t;
|
||||
|
||||
void Field_Clear( field_t *edit );
|
||||
void Field_CompleteCommand( field_t *edit );
|
||||
void Field_AutoComplete( field_t *edit );
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
MISC
|
||||
|
||||
==============================================================
|
||||
@@ -882,10 +862,10 @@ void Com_StartupVariable( const char *match );
|
||||
// only a set with the exact name. Only used during startup.
|
||||
|
||||
|
||||
extern float currentfps;
|
||||
extern cvar_t *paused;
|
||||
extern cvar_t *config;
|
||||
extern cvar_t *fps;
|
||||
extern float currentfps;
|
||||
extern cvar_t *developer;
|
||||
extern cvar_t *com_dedicated;
|
||||
extern cvar_t *com_speeds;
|
||||
|
||||
@@ -708,6 +708,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
depthRange = qfalse;
|
||||
|
||||
backEnd.pc.c_surfaces += numDrawSurfs;
|
||||
backEnd.numSpheresUsed = 0;
|
||||
|
||||
for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) {
|
||||
if ( drawSurf->sort == oldSort ) {
|
||||
@@ -852,7 +853,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
||||
}
|
||||
else
|
||||
{
|
||||
backEnd.currentSphere = &backEnd.spheres[backEnd.currentEntity->lightingSphere];
|
||||
backEnd.currentSphere = &backEnd.spheres[backEnd.numSpheresUsed];
|
||||
backEnd.currentEntity->lightingSphere = backEnd.numSpheresUsed++;
|
||||
backEnd.currentEntity->sphereCalculated = 1;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,16 @@ R_PerformanceCounters
|
||||
=====================
|
||||
*/
|
||||
void R_PerformanceCounters( void ) {
|
||||
if (fps->integer) {
|
||||
ri.SetPerformanceCounters(
|
||||
backEnd.pc.c_totalIndexes / 3,
|
||||
backEnd.pc.c_vertexes,
|
||||
R_SumOfUsedImages(pc_save.c_totalIndexes / 3, pc_save.c_vertexes),
|
||||
pc_save.c_totalIndexes / 3,
|
||||
pc_save.c_vertexes,
|
||||
backEnd.pc.c_characterlights
|
||||
);
|
||||
}
|
||||
if ( !r_speeds->integer ) {
|
||||
// clear the counters even if we aren't printing
|
||||
Com_Memset( &tr.pc, 0, sizeof( tr.pc ) );
|
||||
|
||||
@@ -330,10 +330,10 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
|
||||
vec3_t lightOrigin;
|
||||
|
||||
// lighting calculations
|
||||
if ( ent->lightingCalculated ) {
|
||||
if ( ent->bLightGridCalculated ) {
|
||||
return;
|
||||
}
|
||||
ent->lightingCalculated = qtrue;
|
||||
ent->bLightGridCalculated = qtrue;
|
||||
|
||||
//
|
||||
// trace a sample point down to find ambient light
|
||||
|
||||
+13
-11
@@ -129,7 +129,7 @@ typedef struct {
|
||||
vec3_t traceOrigin;
|
||||
float radius;
|
||||
struct mnode_s* leaves[8];
|
||||
void(*TessFunction) ();
|
||||
void(*TessFunction) (unsigned char* dstColors);
|
||||
union {
|
||||
unsigned char level[4];
|
||||
int value;
|
||||
@@ -170,17 +170,19 @@ typedef struct {
|
||||
float axisLength; // compensate for non-normalized axis
|
||||
|
||||
qboolean needDlights; // true for bmodels that touch a dlight
|
||||
qboolean lightingCalculated;
|
||||
vec3_t lightDir; // normalized direction towards light
|
||||
vec3_t ambientLight; // color normalized to 0-255
|
||||
int ambientLightInt; // 32 bit rgba packed
|
||||
vec3_t directedLight;
|
||||
|
||||
qboolean bLightGridCalculated;
|
||||
int iGridLighting;
|
||||
float lodpercentage[2];
|
||||
qboolean sphereCalculated;
|
||||
int lightingSphere;
|
||||
|
||||
//
|
||||
// old lighting variables
|
||||
//
|
||||
vec3_t lightDir; // normalized direction towards light
|
||||
vec3_t ambientLight; // color normalized to 0-255
|
||||
int ambientLightInt; // 32 bit rgba packed
|
||||
vec3_t directedLight;
|
||||
} trRefEntity_t;
|
||||
|
||||
typedef struct refSprite_s {
|
||||
@@ -724,9 +726,9 @@ typedef struct drawSurf_s {
|
||||
typedef struct srfPoly_s {
|
||||
surfaceType_t surfaceType;
|
||||
qhandle_t hShader;
|
||||
int fogIndex;
|
||||
int numVerts;
|
||||
polyVert_t *verts;
|
||||
int renderfx;
|
||||
} srfPoly_t;
|
||||
|
||||
typedef struct srfMarkFragment_s {
|
||||
@@ -1962,7 +1964,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent, int parentEntityNumber);
|
||||
void RE_AddRefSpriteToScene(const refEntity_t* ent);
|
||||
void RE_AddTerrainMarkToScene(int iTerrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx);
|
||||
refEntity_t* RE_GetRenderEntity(int entityNumber);
|
||||
qboolean RE_AddPolyToScene(qhandle_t hShader, int numVerts, const polyVert_t* verts, int numPolys);
|
||||
qboolean RE_AddPolyToScene(qhandle_t hShader, int numVerts, polyVert_t* verts, int renderfx);
|
||||
void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int type );
|
||||
void RE_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b );
|
||||
void RE_RenderScene( const refdef_t *fd );
|
||||
@@ -2253,8 +2255,8 @@ typedef enum {
|
||||
// these are sort of arbitrary limits.
|
||||
// the limits apply to the sum of all scenes in a frame --
|
||||
// the main view, all the 3D icons, etc
|
||||
#define MAX_POLYS 600
|
||||
#define MAX_POLYVERTS 3000
|
||||
#define MAX_POLYS 4096
|
||||
#define MAX_POLYVERTS 16384
|
||||
#define MAX_TERMARKS 1024
|
||||
|
||||
// all of the information needed by the back end must be
|
||||
|
||||
+39
-68
@@ -131,83 +131,28 @@ RE_AddPolyToScene
|
||||
|
||||
=====================
|
||||
*/
|
||||
qboolean RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys ) {
|
||||
qboolean RE_AddPolyToScene(qhandle_t hShader, int numVerts, polyVert_t* verts, int renderfx) {
|
||||
srfPoly_t *poly;
|
||||
int i, j;
|
||||
int fogIndex;
|
||||
fog_t *fog;
|
||||
vec3_t bounds[2];
|
||||
|
||||
if ( !tr.registered ) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( !hShader ) {
|
||||
ri.Printf( PRINT_WARNING, "WARNING: RE_AddPolyToScene: NULL poly shader\n");
|
||||
if (numVerts + r_numpolyverts > max_polyverts || r_numpolys >= max_polys) {
|
||||
ri.Printf(PRINT_WARNING, "Exceeded MAX POLYS\n");
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
for ( j = 0; j < numPolys; j++ ) {
|
||||
if ( r_numpolyverts + numVerts > max_polyverts || r_numpolys >= max_polys ) {
|
||||
/*
|
||||
NOTE TTimo this was initially a PRINT_WARNING
|
||||
but it happens a lot with high fighting scenes and particles
|
||||
since we don't plan on changing the const and making for room for those effects
|
||||
simply cut this message to developer only
|
||||
*/
|
||||
ri.Printf( PRINT_DEVELOPER, "WARNING: RE_AddPolyToScene: r_max_polys or r_max_polyverts reached\n");
|
||||
return qfalse;
|
||||
}
|
||||
poly = &backEndData[tr.smpFrame]->polys[r_numpolys];
|
||||
poly->surfaceType = SF_POLY;
|
||||
poly->hShader = hShader;
|
||||
poly->numVerts = numVerts;
|
||||
poly->verts = &backEndData[tr.smpFrame]->polyVerts[r_numpolyverts];
|
||||
poly->renderfx = renderfx;
|
||||
|
||||
poly = &backEndData[tr.smpFrame]->polys[r_numpolys];
|
||||
poly->surfaceType = SF_POLY;
|
||||
poly->hShader = hShader;
|
||||
poly->numVerts = numVerts;
|
||||
poly->verts = &backEndData[tr.smpFrame]->polyVerts[r_numpolyverts];
|
||||
|
||||
Com_Memcpy( poly->verts, &verts[numVerts*j], numVerts * sizeof( *verts ) );
|
||||
|
||||
if ( glConfig.hardwareType == GLHW_RAGEPRO ) {
|
||||
poly->verts->modulate[0] = 255;
|
||||
poly->verts->modulate[1] = 255;
|
||||
poly->verts->modulate[2] = 255;
|
||||
poly->verts->modulate[3] = 255;
|
||||
}
|
||||
// done.
|
||||
r_numpolys++;
|
||||
r_numpolyverts += numVerts;
|
||||
|
||||
// if no world is loaded
|
||||
if ( tr.world == NULL ) {
|
||||
fogIndex = 0;
|
||||
}
|
||||
// see if it is in a fog volume
|
||||
else if ( tr.world->numfogs == 1 ) {
|
||||
fogIndex = 0;
|
||||
} else {
|
||||
// find which fog volume the poly is in
|
||||
VectorCopy( poly->verts[0].xyz, bounds[0] );
|
||||
VectorCopy( poly->verts[0].xyz, bounds[1] );
|
||||
for ( i = 1 ; i < poly->numVerts ; i++ ) {
|
||||
AddPointToBounds( poly->verts[i].xyz, bounds[0], bounds[1] );
|
||||
}
|
||||
for ( fogIndex = 1 ; fogIndex < tr.world->numfogs ; fogIndex++ ) {
|
||||
fog = &tr.world->fogs[fogIndex];
|
||||
if ( bounds[1][0] >= fog->bounds[0][0]
|
||||
&& bounds[1][1] >= fog->bounds[0][1]
|
||||
&& bounds[1][2] >= fog->bounds[0][2]
|
||||
&& bounds[0][0] <= fog->bounds[1][0]
|
||||
&& bounds[0][1] <= fog->bounds[1][1]
|
||||
&& bounds[0][2] <= fog->bounds[1][2] ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( fogIndex == tr.world->numfogs ) {
|
||||
fogIndex = 0;
|
||||
}
|
||||
}
|
||||
poly->fogIndex = fogIndex;
|
||||
}
|
||||
Com_Memcpy(poly->verts, verts, sizeof(polyVert_t) * numVerts);
|
||||
++r_numpolys;
|
||||
r_numpolyverts += numVerts;
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
@@ -268,7 +213,33 @@ void RE_AddRefEntityToScene( const refEntity_t *ent, int parentEntityNumber) {
|
||||
}
|
||||
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].e = *ent;
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].lightingCalculated = qfalse;
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].bLightGridCalculated = qfalse;
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].sphereCalculated = qfalse;
|
||||
|
||||
if (parentEntityNumber != ENTITYNUM_NONE)
|
||||
{
|
||||
int i;
|
||||
|
||||
//
|
||||
// Find the parent entity to attach to
|
||||
//
|
||||
for (i = r_firstSceneEntity; i < r_numentities; i++)
|
||||
{
|
||||
if (backEndData[tr.smpFrame]->entities[i].e.entityNumber == parentEntityNumber)
|
||||
{
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].e.parentEntity = i - r_firstSceneEntity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == r_numentities) {
|
||||
backEndData[tr.smpFrame]->entities[i].e.parentEntity = ENTITYNUM_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].e.parentEntity = ENTITYNUM_NONE;
|
||||
}
|
||||
|
||||
r_numentities++;
|
||||
}
|
||||
|
||||
@@ -810,9 +810,98 @@ static void ComputeColors( shaderStage_t *pStage )
|
||||
break;
|
||||
case CGEN_LIGHTING_SPHERICAL:
|
||||
case CGEN_STATIC:
|
||||
if (!r_drawspherelights->integer)
|
||||
if (!r_drawspherelights->integer) {
|
||||
break;
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
if (!backEnd.currentStaticModel) {
|
||||
if (backEnd.currentSphere->TessFunction) {
|
||||
backEnd.currentSphere->TessFunction((unsigned char*)tess.svars.colors);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!tess.vertexColorValid) {
|
||||
ri.Printf(PRINT_WARNING, "Vertex color specified for shader '%s', but vertex colors are not valid for this model\n", tess.shader->name);
|
||||
}
|
||||
|
||||
if (backEnd.currentStaticModel->useSpecialLighting)
|
||||
{
|
||||
for (i = 0; i < tess.numVertexes; i++)
|
||||
{
|
||||
int j;
|
||||
vec3_t colorout;
|
||||
int r, g, b;
|
||||
|
||||
colorout[0] = tess.vertexColors[i][0];
|
||||
colorout[1] = tess.vertexColors[i][1];
|
||||
colorout[2] = tess.vertexColors[i][2];
|
||||
|
||||
for (j = 0; j < backEnd.currentStaticModel->numdlights; j++)
|
||||
{
|
||||
float ooLightDistSquared;
|
||||
float dot;
|
||||
vec3_t diff;
|
||||
dlight_t* dl;
|
||||
|
||||
dl = &backEnd.refdef.dlights[backEnd.currentStaticModel->dlights[j].index];
|
||||
VectorSubtract(backEnd.currentStaticModel->dlights[j].transformed, tess.xyz[i], diff);
|
||||
|
||||
dot = DotProduct(diff, tess.normal[i]);
|
||||
if (dot >= 0)
|
||||
{
|
||||
float ooLen;
|
||||
|
||||
ooLen = 1.0 / VectorLengthSquared(diff);
|
||||
ooLightDistSquared = dot * (7500.0 * dl->radius * ooLen * sqrt(ooLen));
|
||||
colorout[0] = dl->color[0] * ooLightDistSquared + colorout[0];
|
||||
colorout[1] = dl->color[1] * ooLightDistSquared + colorout[1];
|
||||
colorout[2] = dl->color[2] * ooLightDistSquared + colorout[2];
|
||||
}
|
||||
}
|
||||
|
||||
r = colorout[0];
|
||||
g = colorout[1];
|
||||
b = colorout[2];
|
||||
|
||||
if (tr.overbrightShift)
|
||||
{
|
||||
r = (int)((float)r * tr.overbrightMult);
|
||||
g = (int)((float)g * tr.overbrightMult);
|
||||
b = (int)((float)b * tr.overbrightMult);
|
||||
}
|
||||
|
||||
if (r > 0xFF || g > 0xFF || b > 0xFF)
|
||||
{
|
||||
float t;
|
||||
|
||||
t = 255.0 / (float)max(r, max(g, b));
|
||||
|
||||
r = (int)((float)r * t);
|
||||
g = (int)((float)g * t);
|
||||
b = (int)((float)b * t);
|
||||
}
|
||||
|
||||
tess.svars.colors[i][0] = r;
|
||||
tess.svars.colors[i][1] = g;
|
||||
tess.svars.colors[i][2] = b;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tr.identityLight == 1.0)
|
||||
{
|
||||
Com_Memcpy(tess.svars.colors, tess.vertexColors, tess.numVertexes * sizeof(tess.vertexColors[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < tess.numVertexes; i++) {
|
||||
tess.svars.colors[i][0] = tess.vertexColors[i][0] * tr.identityLight;
|
||||
tess.svars.colors[i][1] = tess.vertexColors[i][1] * tr.identityLight;
|
||||
tess.svars.colors[i][2] = tess.vertexColors[i][2] * tr.identityLight;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CGEN_CONSTANT:
|
||||
RB_CalcColorFromConstant((unsigned char*)tess.svars.colors, pStage->colorConst);
|
||||
|
||||
@@ -871,7 +871,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
||||
ParseWaveForm( text, &stage->rgbWave );
|
||||
stage->rgbGen = CGEN_WAVEFORM;
|
||||
}
|
||||
else if ( !Q_stricmp( token, "const" ) )
|
||||
else if ( !Q_stricmp( token, "const" ) || !Q_stricmp(token, "constant"))
|
||||
{
|
||||
vec3_t color;
|
||||
|
||||
|
||||
@@ -600,7 +600,14 @@ void MenuManager::RealignMenus
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: stub
|
||||
int i;
|
||||
int num;
|
||||
|
||||
num = m_menulist.NumObjects();
|
||||
for (i = 1; i <= num; i++)
|
||||
{
|
||||
m_menulist.ObjectAt(i)->RealignWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuManager::AddMenu
|
||||
|
||||
@@ -1601,7 +1601,7 @@ void UIWidget::TextAlignment
|
||||
)
|
||||
|
||||
{
|
||||
for( int i = 1; i < ev->NumArgs(); i++ )
|
||||
for( int i = 1; i <= ev->NumArgs(); i++ )
|
||||
{
|
||||
str align = ev->GetString( 1 );
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 996 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 881 KiB |
Reference in new issue
Block a user