07 Nov 2007
This commit is contained in:
parent
a7ee473473
commit
6371bb0e42
|
@ -6,6 +6,8 @@
|
|||
Разработать концепцию языка VirtualC\VirtualC++ (базируется на QuakeC)
|
||||
представить func_t как структуру(возвращаемые значения и аргументы)
|
||||
|
||||
ОБЯЗАТЕЛЬНО УБИТЬ VID_ImageScale!!!!!!!
|
||||
|
||||
Quake1 Quake2
|
||||
SV_MoveBounds SV_TraceBounds
|
||||
SV_Move SV_Trace
|
||||
|
@ -28,11 +30,18 @@ scroll = visible_offset
|
|||
2. Исправить работу кнопок для меню OK
|
||||
3. удалить поддержку джойстика OK
|
||||
4. переписать Field_Key для поддержки новых возможностей OK
|
||||
5. дописать проигрывание roq файлов
|
||||
5. дописать проигрывание roq файлов OK
|
||||
6. добавить фонофую картинку за меню (splash.jpg) OK
|
||||
7. включить управление для игрока OK
|
||||
8. переписать вecь код рисования 2d (re->DrawPic)
|
||||
9. Добавить автоматическую систему levelshots OK
|
||||
|
||||
//==================================================
|
||||
// то, что уже готово
|
||||
//==================================================
|
||||
+SC_GetToken теперь умеет парсить слова
|
||||
+добавлена миникарта
|
||||
+спрайты наконец-то пофикшены
|
||||
+добавлена простейшая физика
|
||||
+исправлен баг с проигрыванием видео и демок
|
||||
+исправлен баг с записью сжатых исходников в готовый файл
|
||||
|
|
|
@ -1593,7 +1593,7 @@ bool FS_AddImageToPack( const char *name )
|
|||
|
||||
if(resampled != image_rgba)
|
||||
{
|
||||
MsgDev(D_LOAD, "FS_AddImageToPack: resample %s from [%dx%d] to [%dx%d]\n", name, image_width, image_height, cubemap_width, cubemap_height );
|
||||
MsgDev(D_SPAM, "FS_AddImageToPack: resample %s from [%dx%d] to [%dx%d]\n", name, image_width, image_height, cubemap_width, cubemap_height );
|
||||
Mem_Move( imagepool, &image_rgba, resampled, image_size );// update buffer
|
||||
}
|
||||
|
||||
|
@ -1675,7 +1675,7 @@ rgbdata_t *FS_LoadImage(const char *filename, char *buffer, int buffsize )
|
|||
// first side not found, probably it's not cubemap
|
||||
// it contain info about image_type and dimensions, don't generate black cubemaps
|
||||
if(!image_cubemap) break;
|
||||
MsgDev(D_LOAD, "FS_LoadImage: couldn't load (%s%s.%s), create balck image\n",loadname,suf[i],ext );
|
||||
MsgDev(D_SPAM, "FS_LoadImage: couldn't load (%s%s.%s), create balck image\n",loadname,suf[i],ext );
|
||||
|
||||
// Mem_Alloc already filled memblock with 0x00, no need to do it again
|
||||
image_cubemap = Mem_Realloc( imagepool, image_cubemap, image_ptr + image_size );
|
||||
|
@ -1703,7 +1703,7 @@ rgbdata_t *FS_LoadImage(const char *filename, char *buffer, int buffsize )
|
|||
}
|
||||
}
|
||||
|
||||
MsgDev(D_LOAD, "FS_LoadImage: couldn't load (%s)\n", texname );
|
||||
MsgDev(D_SPAM, "FS_LoadImage: couldn't load (%s)\n", texname );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1769,30 +1769,46 @@ bool SaveTGA( const char *filename, byte *data, int width, int height, bool alph
|
|||
out = buffer + 18 + strlen(comment);
|
||||
|
||||
// get image description
|
||||
switch( image_type )
|
||||
switch( imagetype )
|
||||
{
|
||||
case PF_RGB_24_FLIP:
|
||||
case PF_RGB_24: pixel_size = 3; break;
|
||||
case PF_RGBA_32: pixel_size = 4; break;
|
||||
case PF_RGBA_32: pixel_size = 4; break;
|
||||
default:
|
||||
MsgWarn("SaveTGA: unsupported image type %s\n", PFDesc[image_type].name );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// swap rgba to bgra and flip upside down
|
||||
for (y = height - 1; y >= 0; y--)
|
||||
// flip buffer
|
||||
switch( imagetype )
|
||||
{
|
||||
in = data + y * width * pixel_size;
|
||||
bufend = in + width * pixel_size;
|
||||
for ( ;in < bufend; in += pixel_size)
|
||||
case PF_RGB_24_FLIP:
|
||||
// glReadPixels rotating image at 180 degrees, flip it
|
||||
for (in = data; in < data + width * height * pixel_size; in += pixel_size)
|
||||
{
|
||||
*out++ = in[2];
|
||||
*out++ = in[1];
|
||||
*out++ = in[0];
|
||||
if(alpha) *out++ = in[3];
|
||||
}
|
||||
break;
|
||||
case PF_RGB_24:
|
||||
case PF_RGBA_32:
|
||||
// swap rgba to bgra and flip upside down
|
||||
for (y = height - 1; y >= 0; y--)
|
||||
{
|
||||
in = data + y * width * pixel_size;
|
||||
bufend = in + width * pixel_size;
|
||||
for ( ;in < bufend; in += pixel_size)
|
||||
{
|
||||
*out++ = in[2];
|
||||
*out++ = in[1];
|
||||
*out++ = in[0];
|
||||
if(alpha) *out++ = in[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Msg("Writing %s[%d]\n", filename, alpha ? 32 : 24 );
|
||||
MsgDev(D_SPAM, "Writing %s[%d]\n", filename, alpha ? 32 : 24 );
|
||||
FS_WriteFile (filename, buffer, outsize );
|
||||
|
||||
Free( buffer );
|
||||
|
|
|
@ -141,6 +141,13 @@ bool FS_AddScript( const char *filename, char *buf, int size )
|
|||
return AddScriptToStack(filename, buf, size);
|
||||
}
|
||||
|
||||
void FS_ResetScript( void )
|
||||
{
|
||||
// can parsing again
|
||||
script->line = scriptline = 1;
|
||||
script->script_p = script->buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
GetToken
|
||||
|
@ -149,9 +156,11 @@ GetToken
|
|||
bool GetToken (bool newline)
|
||||
{
|
||||
char *token_p;
|
||||
int c;
|
||||
|
||||
if (tokenready) // is a token allready waiting?
|
||||
if (tokenready)
|
||||
{
|
||||
// is a token allready waiting?
|
||||
tokenready = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -181,7 +190,7 @@ skip_whitespace: // skip whitespace
|
|||
{
|
||||
if (!newline) goto line_incomplete;
|
||||
|
||||
// ets+++
|
||||
// ets++
|
||||
if (*script->script_p == '/') script->script_p++;
|
||||
if (script->script_p[1] == 'T' && script->script_p[2] == 'X')
|
||||
g_TXcommand = script->script_p[3];//TX#"-style comment
|
||||
|
@ -215,7 +224,9 @@ skip_whitespace: // skip whitespace
|
|||
|
||||
// copy token
|
||||
token_p = token;
|
||||
|
||||
c = script->script_p[0];
|
||||
|
||||
// handle quoted strings specially
|
||||
if (*script->script_p == '"')
|
||||
{
|
||||
// quoted token
|
||||
|
@ -224,7 +235,7 @@ skip_whitespace: // skip whitespace
|
|||
{
|
||||
if (token_p == &token[MAX_SYSPATH - 1])
|
||||
{
|
||||
MsgWarn("GetToken: Token too large on line %i\n", scriptline);
|
||||
MsgDev(D_WARN, "GetToken: Token too large on line %i\n", scriptline);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -234,25 +245,34 @@ skip_whitespace: // skip whitespace
|
|||
}
|
||||
script->script_p++;
|
||||
}
|
||||
else // regular token
|
||||
else if (c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ':' || c == ',')
|
||||
{
|
||||
while ( *script->script_p > 32 && *script->script_p != ';')
|
||||
// parse single characters
|
||||
*token_p++ = *script->script_p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// parse regular word
|
||||
while ( *script->script_p > 32 )
|
||||
{
|
||||
if (token_p == &token[MAX_SYSPATH - 1])
|
||||
{
|
||||
MsgWarn("GetToken: Token too large on line %i\n",scriptline);
|
||||
break;
|
||||
}
|
||||
|
||||
*token_p = c;
|
||||
*token_p++ = *script->script_p++;
|
||||
c = *script->script_p;
|
||||
|
||||
if (script->script_p == script->end_p)
|
||||
break;
|
||||
if (c == '{' || c == '}'|| c == ')'|| c == '(' || c == '\'' || c == ':' || c == ',' || c == ';')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*token_p = 0;
|
||||
*token_p = 0; // cutoff other symbols
|
||||
|
||||
//quake style include & default MSVC style
|
||||
// quake style include & default MSVC style
|
||||
if (!strcmp(token, "$include") || !strcmp(token, "#include"))
|
||||
{
|
||||
GetToken (false);
|
||||
|
@ -789,6 +809,7 @@ scriptsystem_api_t Sc_GetAPI( void )
|
|||
|
||||
sc.Load = FS_LoadScript;
|
||||
sc.Include = FS_AddScript;
|
||||
sc.Reset = FS_ResetScript;
|
||||
sc.GetToken = SC_GetToken;
|
||||
sc.TryToken = SC_TryToken;
|
||||
sc.FreeToken = SC_FreeToken;
|
||||
|
|
|
@ -0,0 +1,883 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// cg_user.c - stuff that will moved into client.dat
|
||||
//=======================================================================
|
||||
|
||||
#include "client.h"
|
||||
|
||||
extern cvar_t *scr_centertime;
|
||||
extern cvar_t *scr_showpause;
|
||||
extern bool scr_draw_loading;
|
||||
|
||||
#define FADE_TIME 0.5f
|
||||
|
||||
bool scr_draw_loading;
|
||||
|
||||
/*
|
||||
=================
|
||||
CG_SetSky_f
|
||||
|
||||
Set a specific sky and rotation speed
|
||||
=================
|
||||
*/
|
||||
void CG_SetSky_f( void )
|
||||
{
|
||||
float rotate;
|
||||
vec3_t axis;
|
||||
|
||||
if(Cmd_Argc() < 2)
|
||||
{
|
||||
Msg("Usage: sky <basename> <rotate> <axis x y z>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cmd_Argc() > 2) rotate = atof(Cmd_Argv(2));
|
||||
else rotate = 0;
|
||||
if(Cmd_Argc() == 6)
|
||||
{
|
||||
VectorSet(axis, atof(Cmd_Argv(3)), atof(Cmd_Argv(4)), atof(Cmd_Argv(5)));
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet(axis, 0, 0, 1 );
|
||||
}
|
||||
|
||||
re->SetSky(Cmd_Argv(1), rotate, axis);
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CG Draw Tools
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
================
|
||||
SCR_GetBigStringWidth
|
||||
|
||||
skips color escape codes
|
||||
================
|
||||
*/
|
||||
int CG_GetBigStringWidth( const char *str )
|
||||
{
|
||||
return ColorStrlen( str ) * 16;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CG_FadeColor
|
||||
================
|
||||
*/
|
||||
float *CG_FadeColor( float starttime, float endtime )
|
||||
{
|
||||
static vec4_t color;
|
||||
float time;
|
||||
|
||||
if( starttime == 0 ) return NULL;
|
||||
time = cls.realtime - starttime;
|
||||
if( time >= endtime ) return NULL;
|
||||
|
||||
// fade out
|
||||
if((endtime - time) < FADE_TIME )
|
||||
color[3] = (endtime - time) * 1.0f / FADE_TIME;
|
||||
else color[3] = 1.0;
|
||||
color[0] = color[1] = color[2] = 1.0f;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
CENTER PRINTING
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
/*
|
||||
===================
|
||||
CG_DrawCenterString
|
||||
===================
|
||||
*/
|
||||
void CG_DrawCenterString( void )
|
||||
{
|
||||
char *start;
|
||||
int l, x, y, w;
|
||||
float *color;
|
||||
|
||||
if(!cl.centerPrintTime ) return;
|
||||
|
||||
color = CG_FadeColor( cl.centerPrintTime, scr_centertime->value );
|
||||
if( !color )
|
||||
{
|
||||
cl.centerPrintTime = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
re->SetColor( color );
|
||||
start = cl.centerPrint;
|
||||
y = cl.centerPrintY - cl.centerPrintLines * BIGCHAR_HEIGHT/2;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
char linebuffer[1024];
|
||||
|
||||
for ( l = 0; l < 50; l++ )
|
||||
{
|
||||
if ( !start[l] || start[l] == '\n' )
|
||||
break;
|
||||
linebuffer[l] = start[l];
|
||||
}
|
||||
linebuffer[l] = 0;
|
||||
|
||||
w = cl.centerPrintCharWidth * ColorStrlen( linebuffer );
|
||||
x = ( SCREEN_WIDTH - w ) / 2;
|
||||
|
||||
SCR_DrawStringExt( x, y, cl.centerPrintCharWidth, linebuffer, color, false );
|
||||
|
||||
y += cl.centerPrintCharWidth * 1.5;
|
||||
while ( *start && ( *start != '\n' )) start++;
|
||||
if( !*start ) break;
|
||||
start++;
|
||||
}
|
||||
re->SetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_CenterPrint
|
||||
|
||||
Called for important messages that should stay in the center of the screen
|
||||
for a few moments
|
||||
==============
|
||||
*/
|
||||
void CG_CenterPrint( const char *str, int y, int charWidth )
|
||||
{
|
||||
char *s;
|
||||
|
||||
strncpy( cl.centerPrint, str, sizeof(cl.centerPrint));
|
||||
|
||||
cl.centerPrintTime = cls.realtime;
|
||||
cl.centerPrintY = y;
|
||||
cl.centerPrintCharWidth = charWidth;
|
||||
|
||||
// count the number of lines for centering
|
||||
cl.centerPrintLines = 1;
|
||||
s = cl.centerPrint;
|
||||
while( *s )
|
||||
{
|
||||
if (*s == '\n') cl.centerPrintLines++;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_DrawCenterPic
|
||||
|
||||
Called for important messages that should stay in the center of the screen
|
||||
for a few moments
|
||||
==============
|
||||
*/
|
||||
void CG_DrawCenterPic( int w, int h, char *picname )
|
||||
{
|
||||
SCR_DrawPic((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, picname );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SG_DrawNet
|
||||
==============
|
||||
*/
|
||||
void CG_DrawNet( void )
|
||||
{
|
||||
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1)
|
||||
return;
|
||||
|
||||
SCR_DrawPic( scr_vrect.x+64, scr_vrect.y, 48, 48, "net" );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SG_DrawPause
|
||||
==============
|
||||
*/
|
||||
void CG_DrawPause( void )
|
||||
{
|
||||
// turn off for screenshots
|
||||
if(!cl_paused->value) return;
|
||||
if(!scr_showpause->value) return;
|
||||
|
||||
CG_DrawCenterPic( 128, 32, "pause" );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SG_DrawLoading
|
||||
==============
|
||||
*/
|
||||
void CG_DrawLoading( void )
|
||||
{
|
||||
CG_DrawCenterPic( 128, 32, "loading" );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_MakeLevelShot
|
||||
|
||||
used as splash logo
|
||||
==============
|
||||
*/
|
||||
void CG_MakeLevelShot( void )
|
||||
{
|
||||
if(cl.make_levelshot)
|
||||
{
|
||||
Con_ClearNotify();
|
||||
cl.make_levelshot = false;
|
||||
|
||||
// make levelshot at nextframe()
|
||||
Cbuf_AddText ("levelshot\n");
|
||||
}
|
||||
}
|
||||
|
||||
void DrawString (int x, int y, char *s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
SCR_DrawSmallChar(x, y, *s);
|
||||
x+=8;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAltString (int x, int y, char *s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
SCR_DrawSmallChar(x, y, *s);
|
||||
x+=8;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_BeginLoadingPlaque
|
||||
================
|
||||
*/
|
||||
void SCR_BeginLoadingPlaque (void)
|
||||
{
|
||||
S_StopAllSounds ();
|
||||
cl.sound_prepped = false; // don't play ambients
|
||||
|
||||
if (cls.disable_screen) return;
|
||||
//if (cls.state == ca_disconnected) return; // if at console, don't bring up the plaque
|
||||
//if (cls.key_dest == key_console) return;
|
||||
if (cls.state == ca_cinematic) scr_draw_loading = 2; // clear to black first
|
||||
else scr_draw_loading = 1;
|
||||
|
||||
SCR_UpdateScreen ();
|
||||
cls.disable_screen = Sys_DoubleTime();
|
||||
cls.disable_servercount = cl.servercount;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_EndLoadingPlaque
|
||||
================
|
||||
*/
|
||||
void SCR_EndLoadingPlaque (void)
|
||||
{
|
||||
return;
|
||||
|
||||
cls.disable_screen = 0;
|
||||
Con_ClearNotify ();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_Loading_f
|
||||
================
|
||||
*/
|
||||
void SCR_Loading_f (void)
|
||||
{
|
||||
SCR_BeginLoadingPlaque ();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_TimeRefresh_f
|
||||
================
|
||||
*/
|
||||
int entitycmpfnc( const entity_t *a, const entity_t *b )
|
||||
{
|
||||
/*
|
||||
** all other models are sorted by model then skin
|
||||
*/
|
||||
if ( a->model == b->model )
|
||||
{
|
||||
return ( ( int ) a->image - ( int ) b->image );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( ( int ) a->model - ( int ) b->model );
|
||||
}
|
||||
}
|
||||
|
||||
void SCR_TimeRefresh_f (void)
|
||||
{
|
||||
int i;
|
||||
float start, stop;
|
||||
float time;
|
||||
|
||||
if ( cls.state != ca_active )
|
||||
return;
|
||||
|
||||
start = Sys_DoubleTime();
|
||||
|
||||
if (Cmd_Argc() == 2)
|
||||
{ // run without page flipping
|
||||
re->BeginFrame();
|
||||
for (i=0 ; i<128 ; i++)
|
||||
{
|
||||
cl.refdef.viewangles[1] = i/128.0*360.0;
|
||||
re->RenderFrame (&cl.refdef);
|
||||
}
|
||||
re->EndFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0 ; i<128 ; i++)
|
||||
{
|
||||
cl.refdef.viewangles[1] = i/128.0*360.0;
|
||||
|
||||
re->BeginFrame();
|
||||
re->RenderFrame (&cl.refdef);
|
||||
re->EndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
stop = Sys_DoubleTime();
|
||||
time = stop - start;
|
||||
Msg ("%f seconds (%f fps)\n", time, 128/time);
|
||||
}
|
||||
|
||||
#define STAT_MINUS 10 // num frame for '-' stats digit
|
||||
char *sb_nums[2][11] =
|
||||
{
|
||||
{"num_0", "num_1", "num_2", "num_3", "num_4", "num_5",
|
||||
"num_6", "num_7", "num_8", "num_9", "num_minus"},
|
||||
{"anum_0", "anum_1", "anum_2", "anum_3", "anum_4", "anum_5",
|
||||
"anum_6", "anum_7", "anum_8", "anum_9", "anum_minus"}
|
||||
};
|
||||
|
||||
#define ICON_WIDTH 24
|
||||
#define ICON_HEIGHT 24
|
||||
#define CHAR_WIDTH 16
|
||||
#define ICON_SPACE 8
|
||||
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SizeHUDString
|
||||
|
||||
Allow embedded \n in the string
|
||||
================
|
||||
*/
|
||||
void SizeHUDString (char *string, int *w, int *h)
|
||||
{
|
||||
int lines, width, current;
|
||||
|
||||
lines = 1;
|
||||
width = 0;
|
||||
|
||||
current = 0;
|
||||
while (*string)
|
||||
{
|
||||
if (*string == '\n')
|
||||
{
|
||||
lines++;
|
||||
current = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
current++;
|
||||
if (current > width)
|
||||
width = current;
|
||||
}
|
||||
string++;
|
||||
}
|
||||
|
||||
*w = width * 8;
|
||||
*h = lines * 8;
|
||||
}
|
||||
|
||||
void DrawHUDString (char *string, int x, int y, int centerwidth, int xor)
|
||||
{
|
||||
int margin;
|
||||
char line[1024];
|
||||
int width;
|
||||
int i;
|
||||
|
||||
margin = x;
|
||||
|
||||
while (*string)
|
||||
{
|
||||
// scan out one line of text from the string
|
||||
width = 0;
|
||||
while (*string && *string != '\n')
|
||||
line[width++] = *string++;
|
||||
line[width] = 0;
|
||||
|
||||
if (centerwidth)
|
||||
x = margin + (centerwidth - width*8)/2;
|
||||
else
|
||||
x = margin;
|
||||
for (i=0 ; i<width ; i++)
|
||||
{
|
||||
re->DrawChar (x, y, line[i]^xor);
|
||||
x += 8;
|
||||
}
|
||||
if (*string)
|
||||
{
|
||||
string++; // skip the \n
|
||||
x = margin;
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawField
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawField (int x, int y, int color, int width, int value)
|
||||
{
|
||||
char num[16], *ptr;
|
||||
int l;
|
||||
int frame;
|
||||
|
||||
if (width < 1)
|
||||
return;
|
||||
|
||||
// draw number string
|
||||
if (width > 5)
|
||||
width = 5;
|
||||
|
||||
sprintf (num, "%i", value);
|
||||
l = strlen(num);
|
||||
if (l > width)
|
||||
l = width;
|
||||
x += 2 + CHAR_WIDTH*(width - l);
|
||||
|
||||
ptr = num;
|
||||
while (*ptr && l)
|
||||
{
|
||||
if (*ptr == '-')
|
||||
frame = STAT_MINUS;
|
||||
else
|
||||
frame = *ptr -'0';
|
||||
|
||||
re->DrawPic (x,y,sb_nums[color][frame]);
|
||||
x += CHAR_WIDTH;
|
||||
ptr++;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_TouchPics
|
||||
|
||||
Allows rendering code to cache all needed sbar graphics
|
||||
===============
|
||||
*/
|
||||
void SCR_TouchPics (void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i=0 ; i<2 ; i++)
|
||||
for (j=0 ; j<11 ; j++)
|
||||
re->RegisterPic (sb_nums[i][j]);
|
||||
|
||||
if (crosshair->value)
|
||||
{
|
||||
if (crosshair->value > 3 || crosshair->value < 0)
|
||||
crosshair->value = 3;
|
||||
|
||||
sprintf (crosshair_pic, "ch%i", (int)(crosshair->value));
|
||||
re->DrawGetPicSize (&crosshair_width, &crosshair_height, crosshair_pic);
|
||||
if (!crosshair_width)
|
||||
crosshair_pic[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_ExecuteLayoutString
|
||||
|
||||
================
|
||||
*/
|
||||
void SCR_ExecuteLayoutString( char *section )
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
int value;
|
||||
int width = 3;
|
||||
int index;
|
||||
clientinfo_t *ci;
|
||||
|
||||
COM_ResetScript();
|
||||
|
||||
if (cls.state != ca_active || !cl.refresh_prepped )
|
||||
return;
|
||||
|
||||
while(COM_GetToken( true ))
|
||||
{
|
||||
// first, we must find start of section
|
||||
if(!strcmp(COM_Token, "void"))
|
||||
{
|
||||
// compare section with current
|
||||
COM_GetToken( false );
|
||||
if(!strcmp(COM_Token, section))
|
||||
{
|
||||
// yes, it's
|
||||
Msg("compare found\n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*if(!strcmp(token, "x"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
x = atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "y"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
y = atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "xl"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
x = atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "xr"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
x = viddef.width + atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "xv"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
x = viddef.width/2 - 160 + atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "yt"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
y = atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "yb"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
y = viddef.height + atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "yv"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
y = viddef.height/2 - 120 + atoi(token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "pic"))
|
||||
{
|
||||
// draw a pic from a stat number
|
||||
token = COM_Parse (&s);
|
||||
value = cl.frame.playerstate.stats[atoi(token)];
|
||||
if (value >= MAX_IMAGES) continue;
|
||||
SCR_DrawPic( x, y, 48, 48, cl.configstrings[CS_IMAGES+value] );
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "client"))
|
||||
{
|
||||
// draw a deathmatch client block
|
||||
int score, ping, time;
|
||||
|
||||
token = COM_Parse (&s);
|
||||
x = viddef.width/2 - 160 + atoi(token);
|
||||
token = COM_Parse (&s);
|
||||
y = viddef.height/2 - 120 + atoi(token);
|
||||
|
||||
token = COM_Parse (&s);
|
||||
value = atoi(token);
|
||||
if (value >= MAX_CLIENTS || value < 0)
|
||||
Host_Error("client >= MAX_CLIENTS\n");
|
||||
ci = &cl.clientinfo[value];
|
||||
|
||||
token = COM_Parse (&s);
|
||||
score = atoi(token);
|
||||
|
||||
token = COM_Parse (&s);
|
||||
ping = atoi(token);
|
||||
|
||||
token = COM_Parse (&s);
|
||||
time = atoi(token);
|
||||
|
||||
DrawAltString (x+32, y, ci->name);
|
||||
DrawString (x+32, y+8, "Score: ");
|
||||
DrawAltString (x+32+7*8, y+8, va("%i", score));
|
||||
DrawString (x+32, y+16, va("Ping: %i", ping));
|
||||
DrawString (x+32, y+24, va("Time: %i", time));
|
||||
|
||||
if (!ci->icon)
|
||||
ci = &cl.baseclientinfo;
|
||||
re->DrawPic (x, y, ci->iconname);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "ctf"))
|
||||
{
|
||||
// draw a ctf client block
|
||||
int score, ping;
|
||||
char block[80];
|
||||
|
||||
token = COM_Parse (&s);
|
||||
x = viddef.width/2 - 160 + atoi(token);
|
||||
token = COM_Parse (&s);
|
||||
y = viddef.height/2 - 120 + atoi(token);
|
||||
|
||||
token = COM_Parse (&s);
|
||||
value = atoi(token);
|
||||
if (value >= MAX_CLIENTS || value < 0)
|
||||
Host_Error("client >= MAX_CLIENTS\n");
|
||||
ci = &cl.clientinfo[value];
|
||||
|
||||
token = COM_Parse (&s);
|
||||
score = atoi(token);
|
||||
|
||||
token = COM_Parse (&s);
|
||||
ping = atoi(token);
|
||||
if (ping > 999) ping = 999;
|
||||
|
||||
sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name);
|
||||
|
||||
if (value == cl.playernum)
|
||||
DrawAltString (x, y, block);
|
||||
else DrawString (x, y, block);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "picn"))
|
||||
{
|
||||
// draw a pic from a name
|
||||
token = COM_Parse (&s);
|
||||
re->DrawPic (x, y, token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "num"))
|
||||
{
|
||||
// draw a number
|
||||
token = COM_Parse (&s);
|
||||
width = atoi(token);
|
||||
token = COM_Parse (&s);
|
||||
value = cl.frame.playerstate.stats[atoi(token)];
|
||||
SCR_DrawField (x, y, 0, width, value);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "hnum"))
|
||||
{
|
||||
// health number
|
||||
int color;
|
||||
|
||||
width = 3;
|
||||
value = cl.frame.playerstate.stats[STAT_HEALTH];
|
||||
if (value > 25) color = 0; // green
|
||||
else if (value > 0) color = (cl.frame.serverframe>>2) & 1; // flash
|
||||
else color = 1;
|
||||
|
||||
if (cl.frame.playerstate.stats[STAT_FLASHES] & 1)
|
||||
re->DrawPic (x, y, "field_3");
|
||||
|
||||
SCR_DrawField (x, y, color, width, value);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "anum"))
|
||||
{
|
||||
// ammo number
|
||||
int color;
|
||||
|
||||
width = 3;
|
||||
value = cl.frame.playerstate.stats[STAT_AMMO];
|
||||
if (value > 5) color = 0; // green
|
||||
else if (value >= 0) color = (cl.frame.serverframe>>2) & 1; // flash
|
||||
else continue; // negative number = don't show
|
||||
|
||||
if (cl.frame.playerstate.stats[STAT_FLASHES] & 4)
|
||||
re->DrawPic (x, y, "field_3");
|
||||
|
||||
SCR_DrawField (x, y, color, width, value);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "rnum"))
|
||||
{
|
||||
// armor number
|
||||
int color;
|
||||
|
||||
width = 3;
|
||||
value = cl.frame.playerstate.stats[STAT_ARMOR];
|
||||
if (value < 1) continue;
|
||||
|
||||
color = 0; // green
|
||||
|
||||
if (cl.frame.playerstate.stats[STAT_FLASHES] & 2)
|
||||
re->DrawPic (x, y, "field_3");
|
||||
|
||||
SCR_DrawField (x, y, color, width, value);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "stat_string"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
index = atoi(token);
|
||||
if (index < 0 || index >= MAX_CONFIGSTRINGS)
|
||||
Host_Error("Bad stat_string index\n");
|
||||
index = cl.frame.playerstate.stats[index];
|
||||
if (index < 0 || index >= MAX_CONFIGSTRINGS)
|
||||
Host_Error("Bad stat_string index\n");
|
||||
DrawString (x, y, cl.configstrings[index]);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "cstring"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
DrawHUDString (token, x, y, 320, 0);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "string"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
DrawString (x, y, token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "cstring2"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
DrawHUDString (token, x, y, 320,0x80);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "string2"))
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
DrawAltString (x, y, token);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(token, "if"))
|
||||
{
|
||||
// draw a number
|
||||
token = COM_Parse (&s);
|
||||
value = cl.frame.playerstate.stats[atoi(token)];
|
||||
|
||||
if (!value) //find "}"
|
||||
{
|
||||
while (s && strcmp(token, "}") )
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
}
|
||||
}
|
||||
else // find "{"
|
||||
{
|
||||
while (s && strcmp(token, "{") )
|
||||
{
|
||||
token = COM_Parse (&s);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_DrawStats
|
||||
|
||||
The status bar is a small layout program that
|
||||
is based on the stats array
|
||||
================
|
||||
*/
|
||||
void SCR_DrawStats (void)
|
||||
{
|
||||
SCR_ExecuteLayoutString (cl.configstrings[CS_STATUSBAR]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_DrawLayout
|
||||
|
||||
================
|
||||
*/
|
||||
#define STAT_LAYOUTS 13
|
||||
|
||||
void SCR_DrawLayout (void)
|
||||
{
|
||||
if (!cl.frame.playerstate.stats[STAT_LAYOUTS])
|
||||
return;
|
||||
SCR_ExecuteLayoutString (cl.layout);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
V_RenderHUD
|
||||
|
||||
user hud rendering
|
||||
================
|
||||
*/
|
||||
void V_RenderHUD( void )
|
||||
{
|
||||
CG_MakeLevelShot();
|
||||
CG_DrawCenterString();
|
||||
CG_DrawPause();
|
||||
CG_DrawNet();
|
||||
|
||||
// move into client.dat
|
||||
SCR_DrawStats();
|
||||
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 1) SCR_DrawLayout();
|
||||
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 2) CL_DrawInventory();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
V_RenderSplash
|
||||
|
||||
menu background
|
||||
================
|
||||
*/
|
||||
void V_RenderSplash( void )
|
||||
{
|
||||
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, "splash" );
|
||||
//SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT/3, "clouds" );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
V_RenderLogo
|
||||
|
||||
loading splash
|
||||
================
|
||||
*/
|
||||
void V_RenderLogo( void )
|
||||
{
|
||||
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, cl.levelshot_name );
|
||||
CG_DrawLoading(); // loading.dds
|
||||
}
|
|
@ -33,7 +33,7 @@ static long ROQ_VR_tab[256];
|
|||
static word vq2[256*16*4];
|
||||
static word vq4[256*64*4];
|
||||
static word vq8[256*256*4];
|
||||
e_status CIN_StopCinematic( void );
|
||||
void CIN_StopCinematic( void );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ typedef struct
|
|||
char fileName[MAX_OSPATH];
|
||||
int CIN_WIDTH, CIN_HEIGHT;
|
||||
int xpos, ypos, width, height;
|
||||
bool looping, holdAtEnd, dirty, alterGameState, silent, shader;
|
||||
bool looping, holdAtEnd, dirty, silent;
|
||||
file_t *iFile;
|
||||
e_status status;
|
||||
float startTime;
|
||||
|
@ -83,7 +83,6 @@ typedef struct
|
|||
long roqF1;
|
||||
long t[2];
|
||||
long roqFPS;
|
||||
int playonwalls;
|
||||
byte *buf;
|
||||
long drawX, drawY;
|
||||
} cin_cache;
|
||||
|
@ -918,8 +917,9 @@ static void initRoQ( void )
|
|||
|
||||
static void RoQReset( void )
|
||||
{
|
||||
FS_Close( cinTable.iFile );
|
||||
if(cinTable.iFile) FS_Close( cinTable.iFile );
|
||||
cinTable.iFile = FS_Open(cinTable.fileName, "rb" );
|
||||
|
||||
// let the background thread start reading ahead
|
||||
FS_Read(cinTable.iFile, cin.file, 16 );
|
||||
RoQ_init();
|
||||
|
@ -984,7 +984,7 @@ redump:
|
|||
if (!cinTable.silent)
|
||||
{
|
||||
ssize = RllDecodeMonoToStereo( framedata, sbuf, cinTable.RoQFrameSize, 0, (word)cinTable.roq_flags);
|
||||
S_RawSamples( ssize, 22050, 2, 1, (byte *)sbuf, 1.0f );
|
||||
S_RawSamples( ssize, 22050, 2, 1, (byte *)sbuf, s_volume->value );
|
||||
}
|
||||
break;
|
||||
case ZA_SOUND_STEREO:
|
||||
|
@ -996,7 +996,7 @@ redump:
|
|||
s_rawend = s_soundtime;
|
||||
}
|
||||
ssize = RllDecodeStereoToStereo( framedata, sbuf, cinTable.RoQFrameSize, 0, (word)cinTable.roq_flags);
|
||||
S_RawSamples( ssize, 22050, 2, 2, (byte *)sbuf, 1.0f );
|
||||
S_RawSamples( ssize, 22050, 2, 2, (byte *)sbuf, s_volume->value );
|
||||
}
|
||||
break;
|
||||
case ROQ_QUAD_INFO:
|
||||
|
@ -1058,6 +1058,21 @@ redump:
|
|||
cinTable.RoQPlayed += cinTable.RoQFrameSize+8;
|
||||
}
|
||||
|
||||
const char *CIN_Status( void )
|
||||
{
|
||||
switch(cinTable.status)
|
||||
{
|
||||
case FMV_IDLE: return "IDLE";
|
||||
case FMV_PLAY: return "PLAY";
|
||||
case FMV_EOF: return "END";
|
||||
case FMV_ID_BLT: return "Id Blt";
|
||||
case FMV_ID_IDLE: return "Id idle";
|
||||
case FMV_LOOPED: return "LOOPED";
|
||||
case FMV_ID_WAIT: return "Id wait";
|
||||
default: return "FMV UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
static void RoQ_init( void )
|
||||
{
|
||||
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
|
||||
|
@ -1075,16 +1090,15 @@ static void RoQ_init( void )
|
|||
cinTable.roq_id = cin.file[8] + cin.file[9]*256;
|
||||
cinTable.RoQFrameSize = cin.file[10] + cin.file[11] * 256 + cin.file[12] * 65536;
|
||||
cinTable.roq_flags = cin.file[14] + cin.file[15] * 256;
|
||||
MsgDev(D_INFO, "Movie: %s\n", CIN_Status());
|
||||
}
|
||||
|
||||
static void RoQShutdown( void )
|
||||
{
|
||||
const char *s;
|
||||
if(cinTable.status == FMV_IDLE || !cinTable.buf)
|
||||
return;
|
||||
|
||||
if(!cinTable.buf) return;
|
||||
if(cinTable.status == FMV_IDLE) return;
|
||||
|
||||
MsgDev(D_INFO, "RoQShutdown: finished cinematic\n");
|
||||
MsgDev(D_INFO, "Movie: %s\n", CIN_Status());
|
||||
cinTable.status = FMV_IDLE;
|
||||
|
||||
if (cinTable.iFile)
|
||||
|
@ -1092,23 +1106,12 @@ static void RoQShutdown( void )
|
|||
FS_Close( cinTable.iFile );
|
||||
cinTable.iFile = 0;
|
||||
}
|
||||
|
||||
if (cinTable.alterGameState)
|
||||
{
|
||||
cl.attractloop = false;
|
||||
cls.state = ca_disconnected;
|
||||
// we can't just do a vstr nextmap, because
|
||||
// if we are aborting the intro cinematic with
|
||||
// a devmap command, nextmap would be valid by
|
||||
// the time it was referenced
|
||||
s = Cvar_VariableString( "nextmap" );
|
||||
if ( s[0] )
|
||||
{
|
||||
Cbuf_ExecuteText( EXEC_APPEND, va("%s\n", s));
|
||||
Cvar_Set( "nextmap", "" );
|
||||
}
|
||||
}
|
||||
cinTable.fileName[0] = 0;
|
||||
|
||||
// let game known about movie state
|
||||
cl.attractloop = false;
|
||||
cls.state = ca_disconnected;
|
||||
Cbuf_AddText ("killserver\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1116,20 +1119,14 @@ static void RoQShutdown( void )
|
|||
CIN_StopCinematic
|
||||
==================
|
||||
*/
|
||||
e_status CIN_StopCinematic( void )
|
||||
void CIN_StopCinematic( void )
|
||||
{
|
||||
if(cinTable.status == FMV_EOF || !cinTable.buf)
|
||||
return FMV_EOF;
|
||||
|
||||
if (cinTable.alterGameState)
|
||||
{
|
||||
if ( cls.state != ca_cinematic )
|
||||
return cinTable.status;
|
||||
}
|
||||
// not playing
|
||||
if( cls.state != ca_cinematic )
|
||||
return;
|
||||
|
||||
cinTable.status = FMV_EOF;
|
||||
RoQShutdown();
|
||||
return FMV_EOF;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1145,20 +1142,9 @@ e_status CIN_RunCinematic( void )
|
|||
float thisTime = 0;
|
||||
|
||||
if(cinTable.status == FMV_EOF) return FMV_EOF;
|
||||
if (cinTable.playonwalls < -1) return cinTable.status;
|
||||
if(cl_paused->integer) return FMV_IDLE;
|
||||
|
||||
if (cinTable.alterGameState)
|
||||
{
|
||||
if ( cls.state != ca_cinematic )
|
||||
return cinTable.status;
|
||||
}
|
||||
|
||||
if (cinTable.status == FMV_IDLE) return cinTable.status;
|
||||
if ( cls.state != ca_cinematic ) return cinTable.status;
|
||||
|
||||
thisTime = cls.realtime;
|
||||
if (cinTable.shader && (fabs(thisTime - cinTable.lastTime)) > 0.01)
|
||||
cinTable.startTime += thisTime - cinTable.lastTime;
|
||||
|
||||
cinTable.tfps = ((((cls.realtime) - cinTable.startTime) * 0.3) / 0.01); // 30.0 fps as default
|
||||
start = cinTable.startTime;
|
||||
|
@ -1168,14 +1154,14 @@ e_status CIN_RunCinematic( void )
|
|||
RoQInterrupt();
|
||||
if (start != cinTable.startTime)
|
||||
{
|
||||
// we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
|
||||
cinTable.tfps = ((((cls.realtime) - cinTable.startTime)*0.3)/0.01);
|
||||
start = cinTable.startTime;
|
||||
}
|
||||
}
|
||||
|
||||
cinTable.lastTime = thisTime;
|
||||
if(cinTable.status == FMV_LOOPED) cinTable.status = FMV_PLAY;
|
||||
if(cinTable.status == FMV_LOOPED)
|
||||
cinTable.status = FMV_PLAY;
|
||||
|
||||
if (cinTable.status == FMV_EOF)
|
||||
{
|
||||
|
@ -1221,32 +1207,18 @@ bool CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemB
|
|||
|
||||
cinTable.ROQSize = 0;
|
||||
cinTable.iFile = FS_Open(cinTable.fileName, "rb" );
|
||||
|
||||
if(!cinTable.iFile) goto shutdown;
|
||||
if(!cinTable.iFile) goto shutdown; // not found
|
||||
|
||||
FS_Seek(cinTable.iFile, 0, SEEK_END);
|
||||
cinTable.ROQSize = FS_Tell(cinTable.iFile);
|
||||
FS_Seek(cinTable.iFile, 0, SEEK_SET);
|
||||
|
||||
if (cinTable.ROQSize <= 0)
|
||||
{
|
||||
MsgDev(D_WARN, "play(%s), ROQSize <= 0\n", arg);
|
||||
cinTable.fileName[0] = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
CIN_SetExtents(x, y, w, h);
|
||||
CIN_SetLooping((systemBits & CIN_loop) != 0);
|
||||
|
||||
cinTable.CIN_HEIGHT = DEFAULT_CIN_HEIGHT;
|
||||
cinTable.CIN_WIDTH = DEFAULT_CIN_WIDTH;
|
||||
cinTable.holdAtEnd = (systemBits & CIN_hold) != 0;
|
||||
cinTable.alterGameState = (systemBits & CIN_system) != 0;
|
||||
cinTable.playonwalls = 1;
|
||||
cinTable.silent = (systemBits & CIN_silent) != 0;
|
||||
cinTable.shader = (systemBits & CIN_shader) != 0;
|
||||
|
||||
M_ForceMenuOff();
|
||||
|
||||
initRoQ();
|
||||
FS_Read (cinTable.iFile, cin.file, 16 );
|
||||
|
@ -1257,6 +1229,8 @@ bool CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemB
|
|||
RoQ_init();
|
||||
cinTable.status = FMV_PLAY;
|
||||
cls.state = ca_cinematic;
|
||||
|
||||
M_ForceMenuOff();
|
||||
Con_Close();
|
||||
|
||||
s_rawend = s_soundtime;
|
||||
|
@ -1264,7 +1238,7 @@ bool CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemB
|
|||
}
|
||||
|
||||
shutdown:
|
||||
MsgWarn("CIN_PlayCinematic: invalid RoQ ID\n");
|
||||
MsgWarn("CIN_PlayCinematic: can't loading %s\n", arg );
|
||||
RoQShutdown();
|
||||
return false;
|
||||
}
|
||||
|
@ -1284,7 +1258,6 @@ void CIN_DrawCinematic( void )
|
|||
return;
|
||||
|
||||
if(cls.state != ca_cinematic) return;
|
||||
if(cl_paused->integer) return;
|
||||
|
||||
x = cinTable.xpos;
|
||||
y = cinTable.ypos;
|
||||
|
@ -1364,36 +1337,20 @@ void CIN_DrawCinematic( void )
|
|||
cinTable.dirty = false;
|
||||
}
|
||||
|
||||
void CL_PlayCinematic_f( void )
|
||||
{
|
||||
char *arg, *s;
|
||||
bool holdatend;
|
||||
int bits = CIN_system;
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
if (cls.state == ca_cinematic)
|
||||
SCR_StopCinematic();
|
||||
|
||||
arg = Cmd_Argv( 1 );
|
||||
s = Cmd_Argv(2);
|
||||
|
||||
holdatend = false;
|
||||
if (s && s[0] == '1') bits |= CIN_hold;
|
||||
if (s && s[0] == '2') bits |= CIN_loop;
|
||||
|
||||
S_StopAllSounds();
|
||||
|
||||
if (CIN_PlayCinematic( arg, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bits ))
|
||||
SCR_RunCinematic(); // load first frame
|
||||
}
|
||||
|
||||
void SCR_PlayCinematic( char *name )
|
||||
Cinematic user interface
|
||||
==============================================================================
|
||||
*/
|
||||
void SCR_PlayCinematic( char *name, int bits )
|
||||
{
|
||||
if (cls.state == ca_cinematic)
|
||||
SCR_StopCinematic();
|
||||
|
||||
S_StopAllSounds();
|
||||
|
||||
if (CIN_PlayCinematic( name, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ))
|
||||
if (CIN_PlayCinematic( name, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bits ))
|
||||
SCR_RunCinematic(); // load first frame
|
||||
}
|
||||
|
||||
|
@ -1402,12 +1359,12 @@ void SCR_DrawCinematic( void )
|
|||
CIN_DrawCinematic();
|
||||
}
|
||||
|
||||
void SCR_RunCinematic (void)
|
||||
void SCR_RunCinematic( void )
|
||||
{
|
||||
CIN_RunCinematic();
|
||||
}
|
||||
|
||||
void SCR_StopCinematic(void)
|
||||
void SCR_StopCinematic( void )
|
||||
{
|
||||
CIN_StopCinematic();
|
||||
S_StopAllSounds();
|
||||
|
@ -1420,7 +1377,7 @@ SCR_FinishCinematic
|
|||
Called when either the cinematic completes, or it is aborted
|
||||
====================
|
||||
*/
|
||||
void SCR_FinishCinematic (void)
|
||||
void SCR_FinishCinematic( void )
|
||||
{
|
||||
// tell the server to advance to the next map / cinematic
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// cl_cmds.c - client console commnds
|
||||
//=======================================================================
|
||||
|
||||
#include "client.h"
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ScreenshotGetName
|
||||
==================
|
||||
*/
|
||||
void CL_ScreenshotGetName( int lastnum, char *filename )
|
||||
{
|
||||
int a, b, c, d;
|
||||
|
||||
if(!filename) return;
|
||||
if(lastnum < 0 || lastnum > 9999)
|
||||
{
|
||||
// bound
|
||||
sprintf( filename, "screenshots/%s/shot9999.tga", cl.configstrings[CS_NAME] );
|
||||
return;
|
||||
}
|
||||
|
||||
a = lastnum / 1000;
|
||||
lastnum -= a * 1000;
|
||||
b = lastnum / 100;
|
||||
lastnum -= b * 100;
|
||||
c = lastnum / 10;
|
||||
lastnum -= c * 10;
|
||||
d = lastnum;
|
||||
|
||||
sprintf( filename, "screenshots/%s/shot%i%i%i%i.tga", cl.configstrings[CS_NAME], a, b, c, d );
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
SCREEN SHOTS
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
==================
|
||||
CL_ScreenShot_f
|
||||
|
||||
normal screenshot
|
||||
==================
|
||||
*/
|
||||
void CL_ScreenShot_f( void )
|
||||
{
|
||||
int i;
|
||||
char checkname[MAX_OSPATH];
|
||||
|
||||
// scan for a free filename
|
||||
for (i = 0; i <= 9999; i++ )
|
||||
{
|
||||
CL_ScreenshotGetName( i, checkname );
|
||||
if(!FS_FileExists( checkname )) break;
|
||||
}
|
||||
|
||||
Con_ClearNotify();
|
||||
re->ScrShot( checkname, false );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_LevelShot_f
|
||||
|
||||
splash logo while map is loading
|
||||
==================
|
||||
*/
|
||||
void CL_LevelShot_f( void )
|
||||
{
|
||||
char checkname[MAX_OSPATH];
|
||||
|
||||
// check for exist
|
||||
sprintf( checkname, "textures/background/%s.tga", cl.configstrings[CS_NAME] );
|
||||
if(!FS_FileExists( checkname )) re->ScrShot( checkname, true );
|
||||
|
||||
}
|
|
@ -1,23 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// console.c
|
||||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 Š
|
||||
// cl_console.c - client console
|
||||
//=======================================================================
|
||||
|
||||
#include "client.h"
|
||||
|
||||
|
@ -55,49 +39,6 @@ typedef struct
|
|||
|
||||
static console_t con;
|
||||
|
||||
void DrawString (int x, int y, char *s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
re->DrawChar (x, y, *s);
|
||||
x+=8;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAltString (int x, int y, char *s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
re->DrawChar (x, y, *s ^ 0x80);
|
||||
x+=8;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
// strlen that discounts color sequences
|
||||
int Con_PrintStrlen( const char *string )
|
||||
{
|
||||
int len;
|
||||
const char *p;
|
||||
|
||||
if( !string ) return 0;
|
||||
|
||||
len = 0;
|
||||
p = string;
|
||||
while( *p )
|
||||
{
|
||||
if(IsColorString( p ))
|
||||
{
|
||||
p += 2;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Con_ToggleConsole_f
|
||||
|
@ -647,24 +588,31 @@ void Con_DrawConsole( void )
|
|||
Con_CheckResize ();
|
||||
|
||||
// if disconnected, render console full screen
|
||||
if( cls.state == ca_connecting)
|
||||
switch( cls.state )
|
||||
{
|
||||
Con_DrawSolidConsole( 0.5 );
|
||||
SCR_FillRect( 0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0] );
|
||||
}
|
||||
|
||||
// if disconnected, render console full screen
|
||||
if ( cls.state == ca_disconnected )
|
||||
{
|
||||
if(cls.key_dest != key_menu && cls.key_dest != key_game)
|
||||
case ca_uninitialized:
|
||||
break;
|
||||
case ca_connected:
|
||||
case ca_connecting:
|
||||
if(host.developer)
|
||||
{
|
||||
// show console in devmode
|
||||
Con_DrawSolidConsole( 0.5 );
|
||||
SCR_FillRect( 0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0] );
|
||||
}
|
||||
break;
|
||||
case ca_disconnected:
|
||||
if(cls.key_dest != key_menu)
|
||||
{
|
||||
Con_DrawSolidConsole( 1.0 );
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case ca_active:
|
||||
case ca_cinematic:
|
||||
if( con.displayFrac ) Con_DrawSolidConsole( con.displayFrac );
|
||||
else if ( cls.state == ca_active ) Con_DrawNotify(); // draw notify lines
|
||||
break;
|
||||
}
|
||||
|
||||
if ( con.displayFrac ) Con_DrawSolidConsole( con.displayFrac );
|
||||
else if ( cls.state == ca_active ) Con_DrawNotify(); // draw notify lines
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -678,18 +626,22 @@ void Con_RunConsole( void )
|
|||
{
|
||||
// decide on the destination height of the console
|
||||
if (cls.key_dest == key_console)
|
||||
con.finalFrac = 0.5; // half screen
|
||||
{
|
||||
if ( cls.state == ca_disconnected )
|
||||
con.finalFrac = 1.0;// full screen
|
||||
else con.finalFrac = 0.5; // half screen
|
||||
}
|
||||
else con.finalFrac = 0; // none visible
|
||||
|
||||
if (con.finalFrac < con.displayFrac)
|
||||
{
|
||||
con.displayFrac -= con_speed->value*cls.frametime;
|
||||
con.displayFrac -= con_speed->value * cls.frametime;
|
||||
if (con.finalFrac > con.displayFrac)
|
||||
con.displayFrac = con.finalFrac;
|
||||
}
|
||||
else if (con.finalFrac > con.displayFrac)
|
||||
{
|
||||
con.displayFrac += con_speed->value*cls.frametime;
|
||||
con.displayFrac += con_speed->value * cls.frametime;
|
||||
if (con.finalFrac < con.displayFrac)
|
||||
con.displayFrac = con.finalFrac;
|
||||
}
|
||||
|
|
|
@ -674,12 +674,6 @@ void CL_AddPacketEntities (frame_t *frame)
|
|||
ent.model = cl.model_draw[s1->modelindex];
|
||||
}
|
||||
}
|
||||
|
||||
// only used for black hole model right now, FIXME: do better
|
||||
if (renderfx == RF_TRANSLUCENT)
|
||||
{
|
||||
ent.alpha = 0.70;
|
||||
}
|
||||
// render effects (fullbright, translucent, etc)
|
||||
if ((effects & EF_COLOR_SHELL))
|
||||
ent.flags = 0; // renderfx go on color shell entity
|
||||
|
|
|
@ -237,7 +237,7 @@ CL_AdjustAngles
|
|||
Moves the local angle positions
|
||||
================
|
||||
*/
|
||||
void CL_AdjustAngles (void)
|
||||
void CL_AdjustAngles( void )
|
||||
{
|
||||
float speed;
|
||||
float up, down;
|
||||
|
@ -378,10 +378,8 @@ usercmd_t CL_CreateCmd (void)
|
|||
usercmd_t cmd;
|
||||
|
||||
frame_msec = host.cl_timer - old_sys_frame_time;
|
||||
if (frame_msec < 1)
|
||||
frame_msec = 1;
|
||||
if (frame_msec > 200)
|
||||
frame_msec = 200;
|
||||
if (frame_msec < 1) frame_msec = 1;
|
||||
if (frame_msec > 200) frame_msec = 200;
|
||||
|
||||
// get basic movement from keyboard
|
||||
CL_BaseMove (&cmd);
|
||||
|
|
|
@ -96,9 +96,6 @@ void CL_DrawInventory (void)
|
|||
x = (viddef.width-256)/2;
|
||||
y = (viddef.height-240)/2;
|
||||
|
||||
// repaint everything next frame
|
||||
SCR_DirtyScreen ();
|
||||
|
||||
re->DrawPic (x, y+8, "inventory");
|
||||
|
||||
y += 24;
|
||||
|
|
|
@ -307,7 +307,7 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, b
|
|||
if( key_overstrikeMode ) cursorChar = 11;
|
||||
else cursorChar = 95;
|
||||
|
||||
i = drawLen - (Con_PrintStrlen(str) + 1);
|
||||
i = drawLen - (ColorStrlen(str) + 1);
|
||||
|
||||
if(size == SMALLCHAR_WIDTH) SCR_DrawSmallChar( x + (edit->cursor - prestep - i) * size, y, cursorChar );
|
||||
else
|
||||
|
@ -362,8 +362,6 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||
{
|
||||
int len;
|
||||
|
||||
Msg("Field_KeyDownEvent %s, key %d\n", Key_KeynumToString(key), key );
|
||||
|
||||
// shift-insert is paste
|
||||
if((( key == K_INS ) || ( key == K_KP_INS )) && keys[K_SHIFT].down )
|
||||
{
|
||||
|
@ -437,8 +435,6 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||
{
|
||||
int len;
|
||||
|
||||
Msg("Field_CharEvent %s, key %d\n", Key_KeynumToString(ch), ch );
|
||||
|
||||
if ( ch == 'v' - 'a' + 1 )
|
||||
{
|
||||
// ctrl-v is paste
|
||||
|
@ -634,7 +630,7 @@ void Key_Console(int key)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
if( key < 127 && !Key_IsDown(K_CTRL))
|
||||
{
|
||||
// pass to the normal editline routine
|
||||
|
@ -1084,10 +1080,6 @@ void Key_Event(int key, bool down, uint time)
|
|||
return;
|
||||
}
|
||||
|
||||
// any key during the attract mode will bring up the menu
|
||||
//if (cl.attractloop && cls.key_dest != key_menu && !(key >= K_F1 && key <= K_F12))
|
||||
// key = K_ESCAPE;
|
||||
|
||||
// escape is always handled special
|
||||
if ( key == K_ESCAPE && down )
|
||||
{
|
||||
|
@ -1133,26 +1125,23 @@ void Key_Event(int key, bool down, uint time)
|
|||
// distribute the key down event to the apropriate handler
|
||||
if(cls.key_dest == key_message)
|
||||
{
|
||||
Key_Message(key);
|
||||
Key_Message( key );
|
||||
}
|
||||
else if(cls.key_dest == key_menu)
|
||||
{
|
||||
M_Keydown(key);
|
||||
M_Keydown( key );
|
||||
}
|
||||
else if(cls.key_dest == key_game || cls.key_dest == key_console)
|
||||
else if(cls.key_dest == key_console)
|
||||
{
|
||||
Key_Console (key);
|
||||
Key_Console( key );
|
||||
}
|
||||
else
|
||||
else if(cls.key_dest == key_game )
|
||||
{
|
||||
// send the bound action
|
||||
kb = keys[key].binding;
|
||||
if ( !kb )
|
||||
{
|
||||
if (key >= 200)
|
||||
{
|
||||
Msg("%s is unbound, use controls menu to set.\n", Key_KeynumToString( key ));
|
||||
}
|
||||
if (key >= 200) Msg("%s is unbound, use controls menu to set.\n", Key_KeynumToString(key));
|
||||
}
|
||||
else if (kb[0] == '+')
|
||||
{
|
||||
|
|
|
@ -1473,6 +1473,9 @@ void CL_InitLocal (void)
|
|||
|
||||
Cmd_AddCommand ("quit", CL_Quit_f);
|
||||
|
||||
Cmd_AddCommand ("screenshot", CL_ScreenShot_f);
|
||||
Cmd_AddCommand ("levelshot", CL_LevelShot_f);
|
||||
|
||||
Cmd_AddCommand ("connect", CL_Connect_f);
|
||||
Cmd_AddCommand ("reconnect", CL_Reconnect_f);
|
||||
|
||||
|
@ -1703,8 +1706,8 @@ void CL_Frame (float time)
|
|||
CL_RunDLights ();
|
||||
CL_RunLightStyles ();
|
||||
|
||||
SCR_RunCinematic ();
|
||||
Con_RunConsole ();
|
||||
SCR_RunCinematic();
|
||||
Con_RunConsole();
|
||||
|
||||
cls.framecount++;
|
||||
}
|
||||
|
@ -1729,6 +1732,7 @@ void CL_Init (void)
|
|||
S_Init (); // sound must be initialized after window is created
|
||||
V_Init ();
|
||||
|
||||
COM_LoadScript( "scripts/hud.txt", NULL, 0 );
|
||||
net_message.data = net_message_buffer;
|
||||
net_message.maxsize = sizeof(net_message_buffer);
|
||||
|
||||
|
@ -1742,7 +1746,6 @@ void CL_Init (void)
|
|||
|
||||
Cbuf_AddText ("exec autoexec.cfg\n");
|
||||
Cbuf_Execute ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ void CL_ParseServerData (void)
|
|||
if (cl.playernum == -1)
|
||||
{
|
||||
// playing a cinematic or showing a pic, not a level
|
||||
SCR_PlayCinematic (str);
|
||||
SCR_PlayCinematic( str, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -668,7 +668,7 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_centerprint:
|
||||
SCR_CenterPrint (MSG_ReadString (&net_message));
|
||||
CG_CenterPrint(MSG_ReadString (&net_message), SCREEN_HEIGHT/2, BIGCHAR_WIDTH );
|
||||
break;
|
||||
|
||||
case svc_stufftext:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,6 +38,7 @@ cvar_t *cl_testblend;
|
|||
|
||||
cvar_t *cl_stats;
|
||||
|
||||
extern bool scr_initialized;
|
||||
|
||||
int r_numdlights;
|
||||
dlight_t r_dlights[MAX_DLIGHTS];
|
||||
|
@ -67,6 +68,21 @@ void V_ClearScene (void)
|
|||
r_numparticles = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
void V_CalcRect( void )
|
||||
|
||||
Sets scr_vrect, the coordinates of the rendered window
|
||||
=================
|
||||
*/
|
||||
void V_CalcRect( void )
|
||||
{
|
||||
scr_vrect.width = viddef.width;
|
||||
scr_vrect.width &= ~7;
|
||||
scr_vrect.height = viddef.height;
|
||||
scr_vrect.height &= ~1;
|
||||
scr_vrect.y = scr_vrect.x = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
|
@ -245,10 +261,10 @@ CL_PrepRefresh
|
|||
Call before entering a new level, or after changing dlls
|
||||
=================
|
||||
*/
|
||||
void CL_PrepRefresh (void)
|
||||
void CL_PrepRefresh( void )
|
||||
{
|
||||
char mapname[32];
|
||||
int i;
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
float rotate;
|
||||
vec3_t axis;
|
||||
|
@ -256,12 +272,17 @@ void CL_PrepRefresh (void)
|
|||
if (!cl.configstrings[CS_MODELS+1][0])
|
||||
return; // no map loaded
|
||||
|
||||
SCR_AddDirtyPoint (0, 0);
|
||||
SCR_AddDirtyPoint (viddef.width-1, viddef.height-1);
|
||||
// get splash name
|
||||
sprintf( cl.levelshot_name, "/textures/background/%s.tga", cl.configstrings[CS_NAME] );
|
||||
if(!FS_FileExists( cl.levelshot_name ))
|
||||
{
|
||||
strcpy( cl.levelshot_name, "/textures/common/black" );
|
||||
cl.make_levelshot = true; // make levelshot
|
||||
}
|
||||
|
||||
// let the render dll load the map
|
||||
strcpy (mapname, cl.configstrings[CS_MODELS+1] + 5); // skip "maps/"
|
||||
mapname[strlen(mapname)-4] = 0; // cut off ".bsp"
|
||||
mapname[strlen(mapname)-4] = 0; // cut off ".bsp"
|
||||
|
||||
// register models, pics, and skins
|
||||
Msg ("Map: %s\r", mapname);
|
||||
|
@ -437,11 +458,8 @@ void V_RenderView( void )
|
|||
{
|
||||
extern int entitycmpfnc( const entity_t *, const entity_t * );
|
||||
|
||||
if (cls.state != ca_active)
|
||||
return;
|
||||
|
||||
if (!cl.refresh_prepped)
|
||||
return; // still loading
|
||||
if (cls.state != ca_active) return;
|
||||
if (!cl.refresh_prepped) return; // still loading
|
||||
|
||||
if (cl_timedemo->value)
|
||||
{
|
||||
|
@ -515,21 +533,55 @@ void V_RenderView( void )
|
|||
cl.refdef.rdflags = cl.frame.playerstate.rdflags;
|
||||
|
||||
// sort entities for better cache locality
|
||||
qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof( cl.refdef.entities[0] ), (int (*)(const void *, const void *))entitycmpfnc );
|
||||
qsort( cl.refdef.entities, cl.refdef.num_entities, sizeof( cl.refdef.entities[0] ), (int (*)(const void *, const void *))entitycmpfnc );
|
||||
}
|
||||
|
||||
cl.refdef.rdflags |= RDF_BLOOM;
|
||||
re->RenderFrame (&cl.refdef);
|
||||
if (cl_stats->value)
|
||||
Msg ("ent:%i lt:%i part:%i\n", r_numentities, r_numdlights, r_numparticles);
|
||||
|
||||
SCR_AddDirtyPoint (scr_vrect.x, scr_vrect.y);
|
||||
SCR_AddDirtyPoint (scr_vrect.x+scr_vrect.width-1,
|
||||
scr_vrect.y+scr_vrect.height-1);
|
||||
if (cl_stats->value) Msg ("ent:%i lt:%i part:%i\n", r_numentities, r_numdlights, r_numparticles);
|
||||
|
||||
SCR_DrawCrosshair ();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_PreRender
|
||||
|
||||
==================
|
||||
*/
|
||||
bool V_PreRender( void )
|
||||
{
|
||||
if(!scr_initialized)
|
||||
return false;
|
||||
|
||||
re->BeginFrame();
|
||||
|
||||
// wide aspect ratio screens need to have the sides cleared
|
||||
// unless they are displaying game renderings
|
||||
if ( cls.state != ca_active )
|
||||
{
|
||||
if( viddef.width * 480 > viddef.height * 640 )
|
||||
{
|
||||
re->SetColor( g_color_table[0] );
|
||||
re->DrawStretchPic( 0, 0, viddef.width, viddef.height, 0, 0, 1, 1, "backtile" );
|
||||
re->SetColor( NULL );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_PostRender
|
||||
|
||||
==================
|
||||
*/
|
||||
void V_PostRender( void )
|
||||
{
|
||||
Con_DrawConsole();
|
||||
M_Draw();
|
||||
re->EndFrame();
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef struct
|
|||
bool sound_prepped; // ambient sounds can start
|
||||
bool force_refdef; // vid has changed, so we can't use a paused refdef
|
||||
|
||||
int parse_entities; // index (not anded off) into cl_parse_entities[]
|
||||
int parse_entities; // index (not anded off) into cl_parse_entities[]
|
||||
|
||||
usercmd_t cmd;
|
||||
usercmd_t cmds[CMD_BACKUP]; // each mesage will send several old cmds
|
||||
|
@ -132,10 +132,20 @@ typedef struct
|
|||
// is rendering at. always <= cls.realtime
|
||||
float lerpfrac; // between oldframe and frame
|
||||
|
||||
refdef_t refdef;
|
||||
refdef_t refdef;
|
||||
|
||||
vec3_t v_forward, v_right, v_left, v_up; // set when refdef.angles is set
|
||||
|
||||
// centerprint stuff
|
||||
float centerPrintTime;
|
||||
int centerPrintCharWidth;
|
||||
int centerPrintY;
|
||||
char centerPrint[1024];
|
||||
int centerPrintLines;
|
||||
|
||||
char levelshot_name[MAX_QPATH];
|
||||
bool make_levelshot;
|
||||
|
||||
//
|
||||
// transient data from server
|
||||
//
|
||||
|
@ -145,10 +155,10 @@ typedef struct
|
|||
//
|
||||
// server state information
|
||||
//
|
||||
bool attractloop; // running the attract loop, any key will menu
|
||||
int servercount; // server identification for prespawns
|
||||
bool attractloop; // running the attract loop, any key will menu
|
||||
int servercount; // server identification for prespawns
|
||||
char gamedir[MAX_QPATH];
|
||||
int playernum;
|
||||
int playernum;
|
||||
|
||||
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH];
|
||||
|
||||
|
@ -233,6 +243,9 @@ typedef struct
|
|||
bool demorecording;
|
||||
bool demowaiting; // don't record until a non-delta message is received
|
||||
file_t *demofile;
|
||||
byte *hud_program;
|
||||
uint hud_program_size;
|
||||
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
|
@ -413,7 +426,8 @@ void CL_PrepRefresh (void);
|
|||
void CL_RegisterSounds (void);
|
||||
|
||||
void CL_Quit_f (void);
|
||||
|
||||
void CL_ScreenShot_f( void );
|
||||
void CL_LevelShot_f( void );
|
||||
void IN_Accumulate (void);
|
||||
|
||||
void CL_ParseLayout (void);
|
||||
|
@ -492,7 +506,13 @@ extern int gun_frame;
|
|||
extern model_t *gun_model;
|
||||
|
||||
void V_Init (void);
|
||||
void V_CalcRect( void );
|
||||
bool V_PreRender( void );
|
||||
void V_RenderHUD( void );
|
||||
void V_PostRender( void );
|
||||
void V_RenderView( void );
|
||||
void V_RenderLogo( void );
|
||||
void V_RenderSplash( void );
|
||||
void V_AddEntity (entity_t *ent);
|
||||
void V_AddParticle (vec3_t org, int color, float alpha);
|
||||
void V_AddLight (vec3_t org, float intensity, float r, float g, float b);
|
||||
|
@ -596,4 +616,13 @@ char *Key_KeynumToString (int keynum);
|
|||
int Key_StringToKeynum (char *str);
|
||||
int Key_GetKey( char *binding );
|
||||
|
||||
//
|
||||
// cl_cin.c
|
||||
//
|
||||
void SCR_PlayCinematic( char *name, int bits );
|
||||
void SCR_DrawCinematic( void );
|
||||
void SCR_RunCinematic( void );
|
||||
void SCR_StopCinematic( void );
|
||||
void SCR_FinishCinematic( void );
|
||||
|
||||
#endif//CLIENT_H
|
|
@ -49,11 +49,10 @@ typedef enum
|
|||
FMV_ID_WAIT
|
||||
} e_status;
|
||||
|
||||
#define CIN_system 1
|
||||
#define CIN_loop 2
|
||||
#define CIN_hold 4
|
||||
#define CIN_silent 8
|
||||
#define CIN_shader 16
|
||||
// cinematic flags
|
||||
#define CIN_loop 1
|
||||
#define CIN_hold 2
|
||||
#define CIN_silent 4
|
||||
|
||||
#define COLOR_0 NULL
|
||||
#define COLOR_4 GetRGBA(1.0f, 0.5f, 0.0f, 1.0f)
|
||||
|
@ -77,12 +76,8 @@ void SCR_TouchPics (void);
|
|||
|
||||
void SCR_RunConsole (void);
|
||||
|
||||
extern float scr_con_current;
|
||||
extern float scr_conlines; // lines of console to display
|
||||
|
||||
extern int sb_lines;
|
||||
|
||||
extern cvar_t *scr_viewsize;
|
||||
extern cvar_t *crosshair;
|
||||
|
||||
extern vrect_t scr_vrect; // position of render window
|
||||
|
@ -97,15 +92,20 @@ void SCR_DrawPic( float x, float y, float width, float height, char *picname );
|
|||
void SCR_FillRect( float x, float y, float width, float height, const float *color );
|
||||
void SCR_DrawSmallChar( int x, int y, int ch );
|
||||
void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, bool forceColor );
|
||||
void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, bool forceColor );
|
||||
void SCR_DrawBigString( int x, int y, const char *s, float alpha );
|
||||
void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
|
||||
|
||||
//
|
||||
// cl_cin.c
|
||||
// cl_user.c
|
||||
//
|
||||
void SCR_PlayCinematic (char *name);
|
||||
void SCR_DrawCinematic (void);
|
||||
void SCR_RunCinematic (void);
|
||||
void SCR_StopCinematic (void);
|
||||
void SCR_FinishCinematic (void);
|
||||
void CG_SetSky_f( void );
|
||||
void CG_DrawCenterString( void );
|
||||
void CG_CenterPrint( const char *str, int y, int charWidth );
|
||||
void CG_DrawCenterPic( int w, int h, char *picname );
|
||||
void CG_MakeLevelShot( void );
|
||||
void CG_DrawLoading( void );
|
||||
void CG_DrawNet( void );
|
||||
void CG_DrawPause( void );
|
||||
|
||||
#endif//SCREEN_H
|
|
@ -1770,7 +1770,7 @@ cmodel_t *CM_SpriteModel (char *name, byte *buffer)
|
|||
|
||||
phdr = (dsprite_t *)buffer;
|
||||
|
||||
if(phdr->version != SPRITE_VERSION_HALF || phdr->version != SPRITE_VERSION_XASH)
|
||||
if(phdr->version != SPRITE_VERSION_HALF && phdr->version != SPRITE_VERSION_XASH)
|
||||
{
|
||||
MsgWarn("CM_SpriteModel: %s has wrong version number (%i should be %i or %i)\n", name, phdr->version, SPRITE_VERSION_HALF, SPRITE_VERSION_XASH);
|
||||
return NULL;
|
||||
|
|
|
@ -380,7 +380,7 @@ void Com_DPrintf (int level, char *fmt, ...)
|
|||
case D_ERROR:
|
||||
Com_Print(va("^1Error:^7 %s", msg));
|
||||
break;
|
||||
case D_LOAD:
|
||||
case D_SPAM:
|
||||
Com_Print(msg);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3275,11 +3275,9 @@ const char *M_Quit_Key (int key)
|
|||
|
||||
}
|
||||
|
||||
extern void SCR_DrawString (char *str);
|
||||
|
||||
void M_Quit_Draw (void)
|
||||
{
|
||||
SCR_DrawString("QUIT? (Yes/No)");
|
||||
CG_DrawCenterPic( 320, 240, "quit" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1062,7 +1062,7 @@ const char *PRVM_ED_ParseEdict (const char *data, edict_t *ent)
|
|||
PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
|
||||
|
||||
newline = (COM_Token[0] == '}') ? true : false;
|
||||
if(!newline) MsgDev(D_LOAD, "Key: \"%s\"", COM_Token);
|
||||
if(!newline) MsgDev(D_SPAM, "Key: \"%s\"", COM_Token);
|
||||
else break;
|
||||
|
||||
// anglehack is to allow QuakeEd to write single scalar angles
|
||||
|
@ -1087,7 +1087,7 @@ const char *PRVM_ED_ParseEdict (const char *data, edict_t *ent)
|
|||
// parse value
|
||||
if (!COM_Parse(&data))
|
||||
PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
|
||||
MsgDev(D_LOAD, " \"%s\"\n", COM_Token);
|
||||
MsgDev(D_SPAM, " \"%s\"\n", COM_Token);
|
||||
|
||||
if (COM_Token[0] == '}')
|
||||
PRVM_ERROR ("PRVM_ED_ParseEdict: closing brace without data");
|
||||
|
@ -2029,7 +2029,7 @@ int PRVM_SetEngineString(const char *s)
|
|||
if (prog->knownstrings[i] == s)
|
||||
return -1 - i;
|
||||
// new unknown engine string
|
||||
MsgDev(D_LOAD, "new engine string %p\n", s );
|
||||
MsgDev(D_SPAM, "new engine string %p\n", s );
|
||||
for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++)
|
||||
if (!prog->knownstrings[i])
|
||||
break;
|
||||
|
|
|
@ -114,10 +114,18 @@ SOURCE="$(InputPath)"
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cg_user.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_cin.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_cmds.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_console.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -378,7 +386,7 @@ SOURCE=.\common\qmenu.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\screen.h
|
||||
SOURCE=.\client\screen.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -394,7 +402,7 @@ SOURCE=.\sound.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\vid.h
|
||||
SOURCE=.\screen\vid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
|
|
@ -143,6 +143,16 @@ scriptsystem manager
|
|||
#define COM_Parse(data) Com->Script.ParseToken(data)
|
||||
#define COM_Token Com->Script.Token
|
||||
#define COM_Filter Com->Script.FilterToken
|
||||
|
||||
#define COM_LoadScript Com->Script.Load
|
||||
#define COM_IncludeScript Com->Script.Include
|
||||
#define COM_ResetScript Com->Script.Reset
|
||||
#define COM_GetToken Com->Script.GetToken
|
||||
#define COM_TryToken Com->Script.TryToken
|
||||
#define COM_FreeToken Com->Script.FreeToken
|
||||
#define COM_SkipToken Com->Script.SkipToken
|
||||
#define COM_MatchToken Com->Script.MatchToken
|
||||
|
||||
/*
|
||||
===========================================
|
||||
infostring manager
|
||||
|
|
|
@ -1126,10 +1126,7 @@ void S_GetSoundtime( void )
|
|||
|
||||
// check to make sure that we haven't overshot
|
||||
if (s_paintedtime < s_soundtime)
|
||||
{
|
||||
Msg("S_Update_ : overflow\n");
|
||||
s_paintedtime = s_soundtime;
|
||||
}
|
||||
|
||||
if ( dma.submission_chunk < 256 )
|
||||
s_paintedtime = s_soundtime + s_mixPreStep->value * dma.speed;
|
||||
|
|
|
@ -243,7 +243,7 @@ LONG WINAPI MainWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
|
||||
case WM_PAINT:
|
||||
SCR_DirtyScreen (); // force entire screen to update next frame
|
||||
SCR_FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0]);
|
||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
case WM_DESTROY:
|
||||
// let sound and input know about this?
|
||||
|
@ -285,8 +285,7 @@ LONG WINAPI MainWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
Cvar_SetValue( "vid_ypos", yPos + r.top);
|
||||
vid_xpos->modified = false;
|
||||
vid_ypos->modified = false;
|
||||
if (ActiveApp)
|
||||
IN_Activate (true);
|
||||
if (ActiveApp) IN_Activate (true);
|
||||
}
|
||||
}
|
||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
|
@ -337,6 +336,9 @@ LONG WINAPI MainWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_KEYUP:
|
||||
Key_Event( MapKey( lParam ), false, host.sv_timer);
|
||||
break;
|
||||
case WM_CHAR:
|
||||
CL_CharEvent( wParam );
|
||||
break;
|
||||
default: // pass all unhandled messages to DefWindowProc
|
||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_gamma;
|
||||
extern cvar_t *scr_viewsize;
|
||||
|
||||
static cvar_t *gl_mode;
|
||||
static cvar_t *gl_picmip;
|
||||
|
@ -42,7 +41,6 @@ MENU INTERACTION
|
|||
static menuframework_s s_video_menu;
|
||||
static menulist_s s_mode_list;
|
||||
static menuslider_s s_tq_slider;
|
||||
static menuslider_s s_screensize_slider;
|
||||
static menuslider_s s_brightness_slider;
|
||||
static menulist_s s_fs_box;
|
||||
static menulist_s s_stipple_box;
|
||||
|
@ -118,11 +116,9 @@ void VID_MenuInit( void )
|
|||
if ( !gl_picmip ) gl_picmip = Cvar_Get( "gl_picmip", "0", 0 );
|
||||
if ( !gl_mode ) gl_mode = Cvar_Get( "gl_mode", "3", 0 );
|
||||
if ( !gl_finish ) gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE );
|
||||
if ( !scr_viewsize ) scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);
|
||||
if ( !gl_ext_palettedtexture ) gl_ext_palettedtexture = Cvar_Get( "gl_ext_palettedtexture", "1", CVAR_ARCHIVE );
|
||||
|
||||
s_mode_list.curvalue = gl_mode->value;
|
||||
s_screensize_slider.curvalue = scr_viewsize->value/10;
|
||||
|
||||
s_video_menu.x = viddef.width * 0.50;
|
||||
s_video_menu.y = viddef.height / 2 - 58;
|
||||
|
@ -134,17 +130,9 @@ void VID_MenuInit( void )
|
|||
s_mode_list.generic.y = 0;
|
||||
s_mode_list.itemnames = resolutions;
|
||||
|
||||
s_screensize_slider.generic.type = MTYPE_SLIDER;
|
||||
s_screensize_slider.generic.x = 0;
|
||||
s_screensize_slider.generic.y = 10;
|
||||
s_screensize_slider.generic.name = "screen size";
|
||||
s_screensize_slider.minvalue = 3;
|
||||
s_screensize_slider.maxvalue = 12;
|
||||
s_screensize_slider.generic.callback = ScreenSizeCallback;
|
||||
|
||||
s_brightness_slider.generic.type = MTYPE_SLIDER;
|
||||
s_brightness_slider.generic.x = 0;
|
||||
s_brightness_slider.generic.y = 20;
|
||||
s_brightness_slider.generic.y = 10;
|
||||
s_brightness_slider.generic.name = "brightness";
|
||||
s_brightness_slider.generic.callback = BrightnessCallback;
|
||||
s_brightness_slider.minvalue = 5;
|
||||
|
@ -153,14 +141,14 @@ void VID_MenuInit( void )
|
|||
|
||||
s_fs_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_fs_box.generic.x = 0;
|
||||
s_fs_box.generic.y = 30;
|
||||
s_fs_box.generic.y = 20;
|
||||
s_fs_box.generic.name = "fullscreen";
|
||||
s_fs_box.itemnames = yesno_names;
|
||||
s_fs_box.curvalue = vid_fullscreen->value;
|
||||
|
||||
s_tq_slider.generic.type = MTYPE_SLIDER;
|
||||
s_tq_slider.generic.x = 0;
|
||||
s_tq_slider.generic.y = 40;
|
||||
s_tq_slider.generic.y = 30;
|
||||
s_tq_slider.generic.name = "texture quality";
|
||||
s_tq_slider.minvalue = 0;
|
||||
s_tq_slider.maxvalue = 3;
|
||||
|
@ -168,14 +156,14 @@ void VID_MenuInit( void )
|
|||
|
||||
s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_paletted_texture_box.generic.x = 0;
|
||||
s_paletted_texture_box.generic.y = 50;
|
||||
s_paletted_texture_box.generic.y = 40;
|
||||
s_paletted_texture_box.generic.name = "8-bit textures";
|
||||
s_paletted_texture_box.itemnames = yesno_names;
|
||||
s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;
|
||||
|
||||
s_finish_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_finish_box.generic.x = 0;
|
||||
s_finish_box.generic.y = 60;
|
||||
s_finish_box.generic.y = 50;
|
||||
s_finish_box.generic.name = "sync every frame";
|
||||
s_finish_box.curvalue = gl_finish->value;
|
||||
s_finish_box.itemnames = yesno_names;
|
||||
|
@ -183,17 +171,16 @@ void VID_MenuInit( void )
|
|||
s_defaults_action.generic.type = MTYPE_ACTION;
|
||||
s_defaults_action.generic.name = "reset to defaults";
|
||||
s_defaults_action.generic.x = 0;
|
||||
s_defaults_action.generic.y = 80;
|
||||
s_defaults_action.generic.y = 70;
|
||||
s_defaults_action.generic.callback = ResetDefaults;
|
||||
|
||||
s_cancel_action.generic.type = MTYPE_ACTION;
|
||||
s_cancel_action.generic.name = "cancel";
|
||||
s_cancel_action.generic.x = 0;
|
||||
s_cancel_action.generic.y = 90;
|
||||
s_cancel_action.generic.y = 80;
|
||||
s_cancel_action.generic.callback = CancelChanges;
|
||||
|
||||
Menu_AddItem( &s_video_menu, ( void * ) &s_mode_list );
|
||||
Menu_AddItem( &s_video_menu, ( void * ) &s_screensize_slider );
|
||||
Menu_AddItem( &s_video_menu, ( void * ) &s_brightness_slider );
|
||||
Menu_AddItem( &s_video_menu, ( void * ) &s_fs_box );
|
||||
Menu_AddItem( &s_video_menu, ( void * ) &s_tq_slider );
|
||||
|
|
|
@ -84,7 +84,7 @@ void Sys_InitLog( void )
|
|||
if(!logfile) Sys_Error("Sys_InitLog: can't create log file %s\n", log_path );
|
||||
|
||||
fprintf (logfile, "=======================================================================\n" );
|
||||
fprintf (logfile, "\t%s started at %s\n", caption, Log_Timestamp());
|
||||
fprintf (logfile, "\t%s started at %s\n", caption, time_stamp(TIME_FULL));
|
||||
fprintf (logfile, "=======================================================================\n");
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void Sys_CloseLog( void )
|
|||
|
||||
fprintf (logfile, "\n");
|
||||
fprintf (logfile, "=======================================================================");
|
||||
fprintf (logfile, "\n\t%s stopped at %s\n", caption, Log_Timestamp());
|
||||
fprintf (logfile, "\n\t%s stopped at %s\n", caption, time_stamp(TIME_FULL));
|
||||
fprintf (logfile, "=======================================================================");
|
||||
|
||||
fclose(logfile);
|
||||
|
|
|
@ -69,7 +69,6 @@ char *va(const char *format, ...);
|
|||
//
|
||||
// utils.c
|
||||
//
|
||||
const char* Log_Timestamp( void );
|
||||
int CheckParm (const char *parm);
|
||||
void ParseCommandLine (LPSTR lpCmdLine);
|
||||
void UpdateEnvironmentVariables( void );
|
||||
|
|
|
@ -24,27 +24,6 @@ void Sys_SendKeyEvents( void )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Log_Timestamp
|
||||
====================
|
||||
*/
|
||||
const char* Log_Timestamp( void )
|
||||
{
|
||||
static char timestamp [128];
|
||||
time_t crt_time;
|
||||
const struct tm *crt_tm;
|
||||
char timestring [64];
|
||||
|
||||
// Build the time stamp (ex: "Apr03 2007 [23:31:55]");
|
||||
time (&crt_time);
|
||||
crt_tm = localtime (&crt_time);
|
||||
strftime (timestring, sizeof (timestring), "%b%d %Y [%H:%M:%S]", crt_tm);
|
||||
strcpy( timestamp, timestring );
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
float CalcEngineVersion( void )
|
||||
{
|
||||
return LAUNCH_VERSION + COMMON_VERSION + RENDER_VERSION + PHYSIC_API_VERSION + ENGINE_VERSION;
|
||||
|
|
|
@ -428,6 +428,28 @@ _inline vec_t ColorNormalize (vec3_t in, vec3_t out)
|
|||
return max;
|
||||
}
|
||||
|
||||
_inline int ColorStrlen( const char *string )
|
||||
{
|
||||
int len;
|
||||
const char *p;
|
||||
|
||||
if( !string ) return 0;
|
||||
|
||||
len = 0;
|
||||
p = string;
|
||||
while( *p )
|
||||
{
|
||||
if(IsColorString( p ))
|
||||
{
|
||||
p += 2;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
#define MAX_INFO_VALUE 64
|
||||
#define MAX_INFO_STRING 512
|
||||
|
||||
#define TIME_FULL 0
|
||||
#define TIME_DATE_ONLY 1
|
||||
#define TIME_TIME_ONLY 2
|
||||
#define TIME_NO_SECONDS 3
|
||||
|
||||
#define COLOR_BLACK '0'
|
||||
#define COLOR_RED '1'
|
||||
#define COLOR_GREEN '2'
|
||||
|
@ -92,6 +97,7 @@ typedef struct { const char *name; void **func; } dllfunc_t;
|
|||
#define O_NONBLOCK 0
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include "byteorder.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -122,6 +128,44 @@ _inline char *va(const char *format, ...)
|
|||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
timestamp
|
||||
====================
|
||||
*/
|
||||
_inline const char* time_stamp( int format )
|
||||
{
|
||||
static char timestamp [128];
|
||||
time_t crt_time;
|
||||
const struct tm *crt_tm;
|
||||
char timestring [64];
|
||||
|
||||
time (&crt_time);
|
||||
crt_tm = localtime (&crt_time);
|
||||
switch( format )
|
||||
{
|
||||
case TIME_FULL:
|
||||
// Build the full timestamp (ex: "Apr2007-03(23.31.55)");
|
||||
strftime(timestring, sizeof (timestring), "%b%Y-%d(%H.%M.%S)", crt_tm);
|
||||
break;
|
||||
case TIME_DATE_ONLY:
|
||||
// Build the date stamp only (ex: "Apr2007-03");
|
||||
strftime(timestring, sizeof (timestring), "%b%Y-%d", crt_tm);
|
||||
break;
|
||||
case TIME_TIME_ONLY:
|
||||
// Build the time stamp only (ex: "(23.31.55)");
|
||||
strftime(timestring, sizeof (timestring), "%b%Y-%d", crt_tm);
|
||||
break;
|
||||
case TIME_NO_SECONDS:
|
||||
// Build the full timestamp (ex: "Apr2007-03(23.31)");
|
||||
strftime(timestring, sizeof (timestring), "%b%Y-%d(%H.%M)", crt_tm);
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy( timestamp, timestring );
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
#define bound(min, num, max) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
|
||||
|
||||
#endif//BASETYPES_H
|
|
@ -132,6 +132,7 @@ enum comp_format
|
|||
PF_RGBA_32, // already prepared ".bmp", ".tga" or ".jpg" image
|
||||
PF_ARGB_32, // uncompressed dds image
|
||||
PF_RGB_24, // uncompressed dds or another 24-bit image
|
||||
PF_RGB_24_FLIP, // flip image for screenshots
|
||||
PF_DXT1, // nvidia DXT1 format
|
||||
PF_DXT2, // nvidia DXT2 format
|
||||
PF_DXT3, // nvidia DXT3 format
|
||||
|
@ -272,7 +273,7 @@ enum dev_level
|
|||
D_INFO = 1, // "-dev 1", shows various system messages
|
||||
D_WARN, // "-dev 2", shows not critical system warnings, same as MsgWarn
|
||||
D_ERROR, // "-dev 3", shows critical warnings
|
||||
D_LOAD, // "-dev 4", display info about loading recources
|
||||
D_SPAM, // "-dev 4", show all system messages
|
||||
};
|
||||
|
||||
// format info table
|
||||
|
@ -295,6 +296,7 @@ static bpc_desc_t PFDesc[] =
|
|||
{PF_RGBA_32, "RGBA 32",GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, -4 },
|
||||
{PF_ARGB_32, "ARGB 32",GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, -4 },
|
||||
{PF_RGB_24, "RGB 24", GL_RGBA, GL_UNSIGNED_BYTE, 3, 1, -3 },
|
||||
{PF_RGB_24_FLIP, "RGB 24", GL_RGBA, GL_UNSIGNED_BYTE, 3, 1, -3 },
|
||||
{PF_DXT1, "DXT1", GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, 8 },
|
||||
{PF_DXT2, "DXT2", GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, 16 },
|
||||
{PF_DXT3, "DXT3", GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, 16 },
|
||||
|
@ -866,6 +868,7 @@ typedef struct scriptsystem_api_s
|
|||
//user interface
|
||||
bool (*Load)( const char *name, char *buf, int size );// load script into stack from file or bufer
|
||||
bool (*Include)( const char *name, char *buf, int size ); // include script from file or buffer
|
||||
void (*Reset)( void ); // reset current script state
|
||||
char *(*GetToken)( bool newline ); // get next token on a line or newline
|
||||
bool (*TryToken)( void ); // return 1 if have token on a line
|
||||
void (*FreeToken)( void ); // free current token to may get it again
|
||||
|
@ -1046,6 +1049,7 @@ typedef struct render_exp_s
|
|||
void (*RenderFrame) (refdef_t *fd);
|
||||
|
||||
void (*SetColor)( const float *rgba );
|
||||
bool (*ScrShot)( const char *filename, bool force_gamma ); // write screenshot with same name
|
||||
void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data, bool redraw );
|
||||
void (*DrawStretchPic)(float x, float y, float w, float h, float s1, float t1, float s2, float t2, char *name);
|
||||
|
||||
|
|
|
@ -62,5 +62,5 @@ if exist vprogs\progdefs.h move vprogs\progdefs.h engine\progdefs.h
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
xash.exe +map qctest -debug -log -dev 4
|
||||
xash.exe +map qctest -debug -log -dev 3
|
||||
:done
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
image_t *draw_chars;
|
||||
|
||||
//byte default_conchar[11356] =
|
||||
byte def_font[] =
|
||||
{
|
||||
#include "lhfont.h"
|
||||
|
@ -147,8 +146,10 @@ void Draw_StretchPic (float x, float y, float w, float h, float s1, float t1, fl
|
|||
|
||||
GL_Bind (gl->texnum[0]);
|
||||
|
||||
qglColor4fv(gl_state.draw_color);
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
GL_EnableBlend();
|
||||
qglBlendFunc(GL_ONE, GL_ZERO);
|
||||
qglColor4fv( gl_state.draw_color );
|
||||
|
||||
qglBegin (GL_QUADS);
|
||||
qglTexCoord2f (s1, t1);
|
||||
|
@ -161,6 +162,7 @@ void Draw_StretchPic (float x, float y, float w, float h, float s1, float t1, fl
|
|||
qglVertex2f (x, y+h);
|
||||
|
||||
qglEnd ();
|
||||
GL_DisableBlend();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ memory manager
|
|||
//malloc-free
|
||||
#define Mem_Alloc(pool,size) ri.Mem.Alloc(pool, size, __FILE__, __LINE__)
|
||||
#define Mem_Free(mem) ri.Mem.Free(mem, __FILE__, __LINE__)
|
||||
#define Mem_Copy(dst, src, size) ri.Mem.Copy(dst, src, size, __FILE__, __LINE__)
|
||||
|
||||
//Hunk_AllocName
|
||||
#define Mem_AllocPool(name) ri.Mem.AllocPool(name, __FILE__, __LINE__)
|
||||
|
@ -76,6 +77,7 @@ filesystem manager
|
|||
*/
|
||||
#define FS_LoadFile(name, size) ri.Fs.LoadFile(name, size)
|
||||
#define FS_LoadImage(name, data, size) ri.Fs.LoadImage(name, data, size)
|
||||
#define FS_SaveImage(name, pic) ri.Fs.SaveImage(name, pic)
|
||||
#define FS_FreeImage(data) ri.Fs.FreeImage(data)
|
||||
#define FS_Search(path) ri.Fs.Search( path, true )
|
||||
#define FS_WriteFile(name, data, size) ri.Fs.WriteFile(name, data, size )
|
||||
|
@ -221,7 +223,7 @@ typedef struct
|
|||
|
||||
extern image_t gltextures[MAX_GLTEXTURES];
|
||||
extern int numgltextures;
|
||||
|
||||
extern byte *r_framebuffer;
|
||||
|
||||
extern image_t *r_notexture;
|
||||
extern image_t *r_particletexture;
|
||||
|
@ -354,6 +356,10 @@ void GL_SetColor( const void *data );
|
|||
void R_SetGL2D ( void );
|
||||
void R_LightPoint (vec3_t p, vec3_t color);
|
||||
void R_PushDlights (void);
|
||||
bool VID_ScreenShot( const char *filename, bool force_gamma );
|
||||
void VID_BuildGammaTable( void );
|
||||
void VID_ImageLightScale (uint *in, int inwidth, int inheight );
|
||||
void VID_ImageBaseScale (uint *in, int inwidth, int inheight );
|
||||
|
||||
//====================================================================
|
||||
|
||||
|
@ -370,7 +376,6 @@ int R_Init( void *hinstance, void *hWnd );
|
|||
void R_Shutdown( void );
|
||||
|
||||
void R_RenderView (refdef_t *fd);
|
||||
void GL_ScreenShot_f (void);
|
||||
void R_DrawStudioModel( int passnum );
|
||||
void R_DrawBrushModel( int passnum );
|
||||
void R_DrawSpriteModel( int passnum );
|
||||
|
@ -452,6 +457,8 @@ void GL_EnableBlend( void );
|
|||
void GL_DisableBlend( void );
|
||||
void GL_EnableAlphaTest ( void );
|
||||
void GL_DisableAlphaTest ( void );
|
||||
void GL_EnableDepthTest( void );
|
||||
void GL_DisableDepthTest( void );
|
||||
|
||||
/*
|
||||
** GL extension emulation functions
|
||||
|
@ -493,6 +500,7 @@ typedef struct
|
|||
int currenttmu;
|
||||
|
||||
bool alpha_test;
|
||||
bool depth_test;
|
||||
bool blend;
|
||||
bool texgen;
|
||||
|
||||
|
|
|
@ -1000,7 +1000,6 @@ void R_Register( void )
|
|||
vid_gamma = ri.Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE );
|
||||
|
||||
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
||||
ri.Cmd_AddCommand( "screenshot", GL_ScreenShot_f );
|
||||
ri.Cmd_AddCommand( "modellist", Mod_Modellist_f );
|
||||
ri.Cmd_AddCommand( "gl_strings", GL_Strings_f );
|
||||
}
|
||||
|
@ -1278,7 +1277,6 @@ R_Shutdown
|
|||
void R_Shutdown (void)
|
||||
{
|
||||
ri.Cmd_RemoveCommand ("modellist");
|
||||
ri.Cmd_RemoveCommand ("screenshot");
|
||||
ri.Cmd_RemoveCommand ("imagelist");
|
||||
ri.Cmd_RemoveCommand ("gl_strings");
|
||||
|
||||
|
@ -1550,6 +1548,7 @@ render_exp_t DLLEXPORT *CreateAPI(render_imp_t *rimp )
|
|||
|
||||
re.DrawStretchRaw = Draw_StretchRaw;
|
||||
re.SetColor = GL_SetColor;
|
||||
re.ScrShot = VID_ScreenShot;
|
||||
|
||||
re.Init = R_Init;
|
||||
re.Shutdown = R_Shutdown;
|
||||
|
|
|
@ -86,92 +86,4 @@ void R_InitParticleTexture (void)
|
|||
r_around = R_FindImage("common/around", NULL, 0, it_pic);
|
||||
|
||||
R_Bloom_InitTextures();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
SCREEN SHOTS
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
====================
|
||||
Log_Timestamp
|
||||
====================
|
||||
*/
|
||||
const char* CurTime( void )
|
||||
{
|
||||
static char timestamp [128];
|
||||
time_t crt_time;
|
||||
const struct tm *crt_tm;
|
||||
char timestring [64];
|
||||
|
||||
// Build the time stamp (ex: "Apr2007-03(23.31.55)");
|
||||
time (&crt_time);
|
||||
crt_tm = localtime (&crt_time);
|
||||
strftime (timestring, sizeof (timestring), "%b%Y-%d(%H.%M.%S)", crt_tm);
|
||||
strcpy( timestamp, timestring );
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
GL_ScreenShot_f
|
||||
==================
|
||||
*/
|
||||
void GL_ScreenShot_f (void)
|
||||
{
|
||||
byte *buffer;
|
||||
char picname[80];
|
||||
char checkname[MAX_OSPATH];
|
||||
int i, c, temp;
|
||||
|
||||
// find a file name to save it to
|
||||
strcpy(picname,"shot00.tga");
|
||||
|
||||
for (i = 0; i <= 99; i++)
|
||||
{
|
||||
picname[4] = i/10 + '0';
|
||||
picname[5] = i%10 + '0';
|
||||
sprintf (checkname, "screenshots/%s", picname);
|
||||
if(!FS_FileExists( checkname )) break; // file doesn't exist
|
||||
}
|
||||
|
||||
if (i == 100)
|
||||
{
|
||||
Msg("SCR_ScreenShot_f: Couldn't create a file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//UNDONE: make folder with name of current map and save screenshot here
|
||||
//sprintf (checkname, "screenshots/%s.tga", CurTime());
|
||||
|
||||
buffer = (byte *)Mem_Alloc(r_temppool, vid.width*vid.height*3 + 18);
|
||||
memset (buffer, 0, 18);
|
||||
buffer[2] = 2; // uncompressed type
|
||||
buffer[12] = vid.width&255;
|
||||
buffer[13] = vid.width>>8;
|
||||
buffer[14] = vid.height&255;
|
||||
buffer[15] = vid.height>>8;
|
||||
buffer[16] = 24; // pixel size
|
||||
|
||||
qglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer + 18 );
|
||||
|
||||
// swap rgb to bgr
|
||||
c = 18 + vid.width * vid.height * 3;
|
||||
for (i = 18; i < c; i += 3)
|
||||
{
|
||||
temp = buffer[i];
|
||||
buffer[i] = buffer[i+2];
|
||||
buffer[i+2] = temp;
|
||||
}
|
||||
|
||||
FS_WriteFile( checkname, buffer, c );
|
||||
|
||||
Mem_Free(buffer);
|
||||
Msg("Wrote %s\n", picname);
|
||||
}
|
|
@ -1676,10 +1676,11 @@ void GL_DrawRadar( void )
|
|||
Vector4Set(fS, 0, 0, -1.0/512.0, 0 );
|
||||
if(r_newrefdef.rdflags & RDF_NOWORLDMODEL ) return;
|
||||
if(!r_minimap->value) return;
|
||||
|
||||
|
||||
qglViewport(vid.width - r_minimap_size->value, 0, r_minimap_size->value, r_minimap_size->value );
|
||||
|
||||
qglDisable(GL_DEPTH_TEST);
|
||||
GL_DisableAlphaTest();
|
||||
GL_DisableDepthTest();
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglPushMatrix();
|
||||
qglLoadIdentity();
|
||||
|
@ -1731,7 +1732,7 @@ void GL_DrawRadar( void )
|
|||
|
||||
qglColorMask(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL_DisableAlphaTest();
|
||||
qglAlphaFunc(GL_GREATER, 0.5f);
|
||||
qglAlphaFunc(GL_GREATER, 0.666f);
|
||||
qglStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
qglStencilFunc(GL_NOTEQUAL, 4.0f, 4.0f);
|
||||
|
||||
|
@ -1812,10 +1813,10 @@ void GL_DrawRadar( void )
|
|||
qglPopMatrix();
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglDisable(GL_STENCIL_TEST);
|
||||
qglStencilMask(0);
|
||||
qglStencilMask( 0 );
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
GL_DisableBlend();
|
||||
qglEnable(GL_DEPTH_TEST);
|
||||
GL_EnableDepthTest();
|
||||
qglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
}
|
|
@ -15,6 +15,9 @@ int gl_tex_alpha_format = 4;
|
|||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||
int gl_filter_max = GL_LINEAR;
|
||||
|
||||
byte gammatable[256];
|
||||
byte basetable[256];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
|
@ -68,15 +71,6 @@ void GL_Strings_f( void )
|
|||
Msg("GL_EXTENSIONS: %s\n", gl_config.extensions_string );
|
||||
}
|
||||
|
||||
#define GLSTATE_DISABLE_ALPHATEST
|
||||
#define GLSTATE_ENABLE_ALPHATEST
|
||||
|
||||
#define GLSTATE_DISABLE_BLEND
|
||||
#define GLSTATE_ENABLE_BLEND
|
||||
|
||||
#define GLSTATE_DISABLE_TEXGEN
|
||||
#define GLSTATE_ENABLE_TEXGEN
|
||||
|
||||
/*
|
||||
===============
|
||||
GL_ArraysState
|
||||
|
@ -104,7 +98,7 @@ void GL_EnableAlphaTest ( void )
|
|||
if (!gl_state.alpha_test)
|
||||
{
|
||||
qglEnable(GL_ALPHA_TEST);
|
||||
gl_state.alpha_test=true;
|
||||
gl_state.alpha_test = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +107,7 @@ void GL_DisableAlphaTest ( void )
|
|||
if (gl_state.alpha_test)
|
||||
{
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
gl_state.alpha_test=false;
|
||||
gl_state.alpha_test = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +121,7 @@ void GL_EnableBlend( void )
|
|||
if (!gl_state.blend)
|
||||
{
|
||||
qglEnable(GL_BLEND);
|
||||
gl_state.blend=true;
|
||||
gl_state.blend = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +130,30 @@ void GL_DisableBlend( void )
|
|||
if (gl_state.blend)
|
||||
{
|
||||
qglDisable(GL_BLEND);
|
||||
gl_state.blend=false;
|
||||
gl_state.blend = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
GL_StateDepthTest
|
||||
===============
|
||||
*/
|
||||
void GL_EnableDepthTest( void )
|
||||
{
|
||||
if (!gl_state.depth_test)
|
||||
{
|
||||
qglEnable( GL_DEPTH_TEST );
|
||||
gl_state.depth_test = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GL_DisableDepthTest( void )
|
||||
{
|
||||
if (gl_state.depth_test)
|
||||
{
|
||||
qglDisable( GL_DEPTH_TEST );
|
||||
gl_state.depth_test = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,4 +627,85 @@ void VID_RestoreSystemGamma(void)
|
|||
// force gamma situation to be reexamined next frame
|
||||
gamma_forcenextframe = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool VID_ScreenShot( const char *filename, bool force_gamma )
|
||||
{
|
||||
rgbdata_t r_shot;
|
||||
|
||||
// shared framebuffer not init
|
||||
if(!r_framebuffer) return false;
|
||||
|
||||
// get screen frame
|
||||
qglReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, r_framebuffer );
|
||||
|
||||
memset(&r_shot, 0, sizeof(r_shot));
|
||||
r_shot.width = vid.width;
|
||||
r_shot.height = vid.height;
|
||||
r_shot.type = PF_RGB_24_FLIP;
|
||||
r_shot.numMips = 1;
|
||||
r_shot.palette = NULL;
|
||||
r_shot.buffer = r_framebuffer;
|
||||
|
||||
// remove any gamma adjust if need
|
||||
if(force_gamma) VID_ImageBaseScale( (uint *)r_framebuffer, vid.width, vid.height );
|
||||
|
||||
// write image
|
||||
FS_SaveImage( filename, &r_shot );
|
||||
return true;
|
||||
}
|
||||
|
||||
void VID_BuildGammaTable( void )
|
||||
{
|
||||
float g = vid_gamma->value;
|
||||
float m = 1 / vid_gamma->value;
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
if ( g == 1 ) gammatable[i] = i;
|
||||
else gammatable[i] = bound(0, 255 * pow ( (i + 0.5)/255.5 , g ) + 0.5, 255);
|
||||
}
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
if ( m == 1 ) basetable[i] = i;
|
||||
else basetable[i] = bound(0, pow(i * (1.0 / 255.0), m ) * 255.0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
VID_ImageLightScale
|
||||
================
|
||||
*/
|
||||
void VID_ImageLightScale (uint *in, int inwidth, int inheight )
|
||||
{
|
||||
int i, c = inwidth * inheight;
|
||||
byte *p = (byte *)in;
|
||||
|
||||
for (i = 0; i < c; i++, p += 4)
|
||||
{
|
||||
p[0] = gammatable[p[0]];
|
||||
p[1] = gammatable[p[1]];
|
||||
p[2] = gammatable[p[2]];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
VID_ImageBaseScale
|
||||
================
|
||||
*/
|
||||
void VID_ImageBaseScale (uint *in, int inwidth, int inheight )
|
||||
{
|
||||
int i, c = inwidth * inheight;
|
||||
byte *p = (byte *)in;
|
||||
|
||||
for (i = 0; i < c; i++, p += 3)
|
||||
{
|
||||
p[0] = basetable[p[0]];
|
||||
p[1] = basetable[p[1]];
|
||||
p[2] = basetable[p[2]];
|
||||
}
|
||||
}
|
|
@ -52,10 +52,11 @@ void *R_SpriteLoadFrame (model_t *mod, void *pin, mspriteframe_t **ppframe, int
|
|||
r_frame.numMips = 1;
|
||||
r_frame.flags = IMAGE_HAS_ALPHA;
|
||||
|
||||
//extract sprite name from path
|
||||
// extract sprite name from path
|
||||
FS_FileBase( mod->name, name );
|
||||
strcat(name, va("_%i", framenum));
|
||||
r_frame.palette = pal;
|
||||
r_frame.size = width * height * 4; // for bounds checking
|
||||
r_frame.buffer = (byte *)(pinframe + 1);
|
||||
|
||||
image = R_LoadImage( name, &r_frame, it_sprite );
|
||||
|
@ -65,7 +66,7 @@ void *R_SpriteLoadFrame (model_t *mod, void *pin, mspriteframe_t **ppframe, int
|
|||
pspriteframe->texnum = image->texnum[0];
|
||||
mod->skins[framenum] = image;
|
||||
}
|
||||
else Msg("Warning: %s has null frame %d\n", image->name, framenum );
|
||||
else MsgWarn("%s has null frame %d\n", image->name, framenum );
|
||||
|
||||
return (void *)((byte *)(pinframe+1) + size);
|
||||
}
|
||||
|
@ -97,7 +98,7 @@ void R_SpriteLoadModel( model_t *mod, void *buffer )
|
|||
rgbacolor[2] = LittleLong((pin->rgbacolor & 0x00FF0000) >> 16);
|
||||
rgbacolor[3] = LittleLong((pin->rgbacolor & 0xFF000000) >> 24);
|
||||
|
||||
TransformRGBA(rgbacolor, rgbacolor );//convert into float
|
||||
TransformRGBA(rgbacolor, rgbacolor ); //convert into float
|
||||
framerate = LittleFloat (pin->framerate);
|
||||
break;
|
||||
default:
|
||||
|
@ -117,7 +118,7 @@ void R_SpriteLoadModel( model_t *mod, void *buffer )
|
|||
psprite->rendermode = LittleLong (pin->texFormat);
|
||||
psprite->framerate = framerate;
|
||||
psprite->numframes = numframes;
|
||||
memcpy(psprite->rgba, rgbacolor, sizeof(psprite->rgba));
|
||||
Mem_Copy(psprite->rgba, rgbacolor, sizeof(psprite->rgba));
|
||||
numi = (short *)(pin + 1);
|
||||
|
||||
mod->mins[0] = mod->mins[1] = -psprite->maxwidth / 2;
|
||||
|
@ -184,12 +185,12 @@ void R_SpriteLoadModel( model_t *mod, void *buffer )
|
|||
}
|
||||
else
|
||||
{
|
||||
Msg("Warning: %s has wrong number of palette colors %i (should be 256)\n", mod->name, numi);
|
||||
MsgWarn("%s has wrong number of palette colors %i (should be 256)\n", mod->name, numi);
|
||||
return;
|
||||
}
|
||||
if(numframes < 1)
|
||||
{
|
||||
Msg("Warning: %s has invalid # of frames: %d\n", mod->name, numframes );
|
||||
MsgWarn("%s has invalid # of frames: %d\n", mod->name, numframes );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,11 +229,11 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
|
|||
|
||||
if ((frame >= psprite->numframes) || (frame < 0))
|
||||
{
|
||||
Msg("R_GetSpriteFrame: no such frame %d (%s)\n", frame, currententity->model->name);
|
||||
MsgDev(D_WARN, "R_GetSpriteFrame: no such frame %d (%s)\n", frame, currententity->model->name);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
if (psprite->frames[frame].frametype == 0) //SPR_SINGLE
|
||||
if (psprite->frames[frame].frametype == 0) // SPR_SINGLE
|
||||
{
|
||||
pspriteframe = psprite->frames[frame].frameptr;
|
||||
}
|
||||
|
@ -241,10 +242,34 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
|
|||
return pspriteframe;
|
||||
}
|
||||
|
||||
bool R_AcceptSpritePass( entity_t *e, int pass )
|
||||
{
|
||||
msprite_t *psprite = (msprite_t *)currentmodel->extradata;
|
||||
|
||||
if(pass == RENDERPASS_SOLID)
|
||||
{
|
||||
// pass for solid ents
|
||||
if(psprite->rendermode == SPR_NORMAL) return true; // solid sprite
|
||||
if(psprite->rendermode == SPR_ADDGLOW) return false; // draw it at second pass
|
||||
if(psprite->rendermode == SPR_ADDITIVE) return false; // must be draw first always
|
||||
if(psprite->rendermode == SPR_ALPHTEST) return true; // already blended by alphatest
|
||||
if(psprite->rendermode == SPR_INDEXALPHA) return true; // already blended by alphatest
|
||||
}
|
||||
if(pass == RENDERPASS_ALPHA)
|
||||
{
|
||||
// pass for blended ents
|
||||
if(e->flags & RF_TRANSLUCENT) return true; // solid sprite with custom blend
|
||||
if(psprite->rendermode == SPR_NORMAL) return false; // solid sprite
|
||||
if(psprite->rendermode == SPR_ADDGLOW) return true; // can draw
|
||||
if(psprite->rendermode == SPR_ADDITIVE) return true; // can draw
|
||||
if(psprite->rendermode == SPR_ALPHTEST) return false; // already drawed
|
||||
if(psprite->rendermode == SPR_INDEXALPHA) return false; // already drawed
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void R_DrawSpriteModel( int passnum )
|
||||
{
|
||||
float alpha= 1.0F;
|
||||
mspriteframe_t *frame;
|
||||
vec3_t point, forward, right, up;
|
||||
msprite_t *psprite;
|
||||
|
@ -252,15 +277,14 @@ void R_DrawSpriteModel( int passnum )
|
|||
model_t *mod = currentmodel;
|
||||
float realtime = r_newrefdef.time;
|
||||
|
||||
if ( (e->flags & RF_TRANSLUCENT) && (passnum == RENDERPASS_SOLID)) return;// solid
|
||||
if (!(e->flags & RF_TRANSLUCENT) && (passnum == RENDERPASS_ALPHA)) return;// solid
|
||||
|
||||
if(!R_AcceptSpritePass( e, passnum )) return;
|
||||
|
||||
// don't even bother culling, because it's just a single
|
||||
// polygon without a surface cache
|
||||
|
||||
psprite = (msprite_t *)mod->extradata;
|
||||
|
||||
//xash auto-animate
|
||||
// xash auto-animate
|
||||
if(psprite->framerate > 0 && psprite->numframes > 1)
|
||||
{
|
||||
float frametime;
|
||||
|
@ -273,16 +297,21 @@ void R_DrawSpriteModel( int passnum )
|
|||
mod->frame += psprite->framerate * frametime;
|
||||
while (mod->frame > psprite->numframes) mod->frame -= psprite->numframes;
|
||||
while (mod->frame < 0) mod->frame += psprite->numframes;
|
||||
e->frame = mod->frame;//set properly frame
|
||||
e->frame = mod->frame; // set properly frame
|
||||
}
|
||||
else e->frame = fmod(e->frame, psprite->numframes);
|
||||
frame = R_GetSpriteFrame(e);
|
||||
|
||||
// merge alpha value
|
||||
if( e->flags & RF_TRANSLUCENT ) psprite->rgba[3] = e->alpha;
|
||||
if( e->scale == 0 ) e->scale = 1.0f; // merge scale
|
||||
|
||||
// setup oriented
|
||||
switch( psprite->type )
|
||||
{
|
||||
case SPR_ORIENTED:
|
||||
AngleVectors(e->angles, forward, right, up);
|
||||
VectorScale(forward, 0.01, forward );//offset for decals
|
||||
VectorScale(forward, 0.01, forward );// offset for decals
|
||||
VectorSubtract(e->origin, forward, e->origin );
|
||||
break;
|
||||
case SPR_FACING_UPRIGHT:
|
||||
|
@ -307,21 +336,29 @@ void R_DrawSpriteModel( int passnum )
|
|||
VectorCopy (vforward, forward);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( e->flags & RF_TRANSLUCENT ) alpha = e->alpha;
|
||||
else alpha = psprite->rgba[3];
|
||||
|
||||
if ( e->scale == 0 ) e->scale = 1.0f;
|
||||
if ( alpha != 1.0f ) qglEnable( GL_BLEND );
|
||||
|
||||
qglColor4f( psprite->rgba[0], psprite->rgba[1], psprite->rgba[2], alpha );
|
||||
if(psprite->rendermode == SPR_ADDGLOW) qglDisable(GL_DEPTH_TEST);
|
||||
|
||||
// setup rendermode
|
||||
switch( psprite->rendermode )
|
||||
{
|
||||
case SPR_NORMAL:
|
||||
// solid sprite
|
||||
break;
|
||||
case SPR_ADDGLOW:
|
||||
GL_DisableDepthTest();
|
||||
// intentional falltrough
|
||||
case SPR_ADDITIVE:
|
||||
GL_EnableBlend();
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
break;
|
||||
case SPR_ALPHTEST:
|
||||
case SPR_INDEXALPHA:
|
||||
GL_EnableAlphaTest();
|
||||
break;
|
||||
}
|
||||
|
||||
GL_Bind(currentmodel->skins[(int)e->frame]->texnum[0]);
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
if ( alpha == 1.0 ) qglEnable (GL_ALPHA_TEST);
|
||||
else qglDisable( GL_ALPHA_TEST );
|
||||
qglColor4fv( psprite->rgba );
|
||||
|
||||
qglDisable(GL_CULL_FACE);
|
||||
qglBegin (GL_QUADS);
|
||||
|
@ -344,15 +381,14 @@ void R_DrawSpriteModel( int passnum )
|
|||
VectorMA (e->origin, frame->down * e->scale, up, point);
|
||||
VectorMA (point, frame->left * e->scale, right, point);
|
||||
qglVertex3fv (point);
|
||||
qglEnd ();
|
||||
qglEnd();
|
||||
|
||||
qglDisable(GL_BLEND);
|
||||
qglDisable (GL_ALPHA_TEST);
|
||||
qglEnable(GL_DEPTH_TEST);
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
|
||||
if(psprite->rendermode == SPR_ADDGLOW) qglEnable(GL_DEPTH_TEST);
|
||||
if ( alpha != 1.0F ) qglDisable( GL_BLEND );
|
||||
// restore states
|
||||
GL_DisableBlend();
|
||||
GL_DisableAlphaTest();
|
||||
GL_EnableDepthTest();
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
qglEnable(GL_CULL_FACE);
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ image_t *R_StudioLoadTexture( model_t *mod, mstudiotexture_t *ptexture, byte *pi
|
|||
r_skin.type = PF_INDEXED_24;
|
||||
r_skin.numMips = 1;
|
||||
r_skin.palette = pin + ptexture->width * ptexture->height + ptexture->index;
|
||||
r_skin.buffer = pin + ptexture->index; //texdata
|
||||
r_skin.buffer = pin + ptexture->index; // texdata
|
||||
r_skin.size = ptexture->width * ptexture->height * 3; // for bounds cheking
|
||||
|
||||
//load studio texture and bind it
|
||||
image = R_LoadImage(ptexture->name, &r_skin, it_skin );
|
||||
|
@ -1166,7 +1167,7 @@ void R_StudioSetupChrome(int *pchrome, int bone, vec3_t normal)
|
|||
pchrome[1] = (n + 1.0) * 32;// FIXME: make this a float
|
||||
}
|
||||
|
||||
bool R_AcceptPass( int flags, int pass )
|
||||
bool R_AcceptStudioPass( int flags, int pass )
|
||||
{
|
||||
if(pass == RENDERPASS_SOLID)
|
||||
{
|
||||
|
@ -1204,7 +1205,7 @@ void R_StudioDrawMeshes ( mstudiotexture_t * ptexture, short *pskinref, int pass
|
|||
for (j = 0; j < m_pSubModel->nummesh; j++)
|
||||
{
|
||||
flags = ptexture[pskinref[pmesh[j].skinref]].flags;
|
||||
if(!R_AcceptPass(flags, pass )) continue;
|
||||
if(!R_AcceptStudioPass(flags, pass )) continue;
|
||||
|
||||
for (i = 0; i < pmesh[j].numnorms; i++, lv += 3, pstudionorms++, pnormbone++)
|
||||
{
|
||||
|
@ -1226,7 +1227,7 @@ void R_StudioDrawMeshes ( mstudiotexture_t * ptexture, short *pskinref, int pass
|
|||
ptricmds = (short *)((byte *)m_pStudioHeader + pmesh->triindex);
|
||||
|
||||
flags = ptexture[pskinref[pmesh->skinref]].flags;
|
||||
if(!R_AcceptPass(flags, pass ))
|
||||
if(!R_AcceptStudioPass(flags, pass ))
|
||||
continue;
|
||||
s = 1.0/(float)ptexture[pskinref[pmesh->skinref]].width;
|
||||
t = 1.0/(float)ptexture[pskinref[pmesh->skinref]].height;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
image_t gltextures[MAX_GLTEXTURES];
|
||||
int numgltextures;
|
||||
byte intensitytable[256];
|
||||
byte gammatable[256];
|
||||
extern cvar_t *gl_picmip;
|
||||
cvar_t *gl_maxsize;
|
||||
byte *r_imagepool;
|
||||
|
@ -243,7 +242,7 @@ bool R_GetPixelFormat( rgbdata_t *pic, imagetype_t type )
|
|||
|
||||
if(r_size != pic->size) // sanity check
|
||||
{
|
||||
//MsgWarn("R_GetPixelFormat: invalid image size\n");
|
||||
MsgDev(D_ERROR, "R_GetPixelFormat: invalid image size\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -254,7 +253,7 @@ bool R_GetPixelFormat( rgbdata_t *pic, imagetype_t type )
|
|||
R_GetPalette
|
||||
===============
|
||||
*/
|
||||
void R_GetPalette (void)
|
||||
void R_GetPalette( void )
|
||||
{
|
||||
uint v;
|
||||
int i, r, g, b;
|
||||
|
@ -303,20 +302,18 @@ R_InitTextures
|
|||
void R_InitTextures( void )
|
||||
{
|
||||
int texsize, i, j;
|
||||
float g = vid_gamma->value;
|
||||
|
||||
|
||||
r_imagepool = Mem_AllocPool("Texture Pool");
|
||||
gl_maxsize = ri.Cvar_Get ("gl_maxsize", "0", 0);
|
||||
|
||||
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, &texsize);
|
||||
if (gl_maxsize->value > texsize)
|
||||
ri.Cvar_SetValue ("gl_maxsize", texsize);
|
||||
if (gl_maxsize->value > texsize) ri.Cvar_SetValue ("gl_maxsize", texsize);
|
||||
|
||||
if(texsize < 2048) imagebufsize = 2048*2048*4;
|
||||
else imagebufsize = texsize * texsize * 4;
|
||||
uploadbufsize = texsize * texsize * 4;
|
||||
|
||||
//create intermediate & upload image buffer
|
||||
// create intermediate & upload image buffer
|
||||
imagebuffer = Mem_Alloc( r_imagepool, imagebufsize );
|
||||
uploadbuffer = Mem_Alloc( r_imagepool, uploadbufsize );
|
||||
|
||||
|
@ -325,29 +322,16 @@ void R_InitTextures( void )
|
|||
// init intensity conversions
|
||||
intensity = ri.Cvar_Get ("intensity", "2", 0);
|
||||
if ( intensity->value <= 1 ) ri.Cvar_Set( "intensity", "1" );
|
||||
|
||||
gl_state.inverse_intensity = 1 / intensity->value;
|
||||
R_GetPalette();
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
if ( g == 1 ) gammatable[i] = i;
|
||||
else
|
||||
{
|
||||
float inf;
|
||||
|
||||
inf = 255 * pow ( (i+0.5)/255.5 , g ) + 0.5;
|
||||
if (inf < 0) inf = 0;
|
||||
if (inf > 255) inf = 255;
|
||||
gammatable[i] = inf;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
j = i * intensity->value;
|
||||
if (j > 255) j = 255;
|
||||
intensitytable[i] = j;
|
||||
intensitytable[i] = bound(0, j, 255);
|
||||
}
|
||||
|
||||
R_GetPalette();
|
||||
VID_BuildGammaTable();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -468,24 +452,6 @@ void R_FilterTexture (int filterindex, uint *data, int width, int height, float
|
|||
Z_Free (temp); // release the temp buffer
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_ImageLightScale
|
||||
================
|
||||
*/
|
||||
void R_ImageLightScale (unsigned *in, int inwidth, int inheight )
|
||||
{
|
||||
int i, c = inwidth * inheight;
|
||||
byte *p = (byte *)in;
|
||||
|
||||
for (i = 0; i < c; i++, p += 4)
|
||||
{
|
||||
p[0] = gammatable[p[0]];
|
||||
p[1] = gammatable[p[1]];
|
||||
p[2] = gammatable[p[2]];
|
||||
}
|
||||
}
|
||||
|
||||
void R_RoundImageDimensions(int *scaled_width, int *scaled_height, bool mipmap)
|
||||
{
|
||||
int width = *scaled_width;
|
||||
|
@ -1014,7 +980,7 @@ bool qrsCompressedTexImage2D( uint target, int level, int internalformat, uint w
|
|||
if (image_desc.type == it_wall && mipmap && r_emboss_bump->value)
|
||||
R_FilterTexture (EMBOSS_FILTER, scaled, scaled_width, scaled_height, 1, 128, true, GL_MODULATE);
|
||||
|
||||
R_ImageLightScale(scaled, scaled_width, scaled_height ); //check for round
|
||||
VID_ImageLightScale(scaled, scaled_width, scaled_height ); //check for round
|
||||
qglTexImage2D ( target, level, samples, scaled_width, scaled_height, border, image_desc.glMask, image_desc.glType, (byte *)scaled );
|
||||
|
||||
if(qglGetError()) return false;
|
||||
|
@ -1070,7 +1036,7 @@ bool R_LoadTexImage( uint *data )
|
|||
R_FilterTexture (EMBOSS_FILTER, data, scaled_width, scaled_height, 1, 128, true, GL_MODULATE);
|
||||
|
||||
R_ResampleTexture (data, image_desc.width, image_desc.height, scaled, scaled_width, scaled_height);
|
||||
R_ImageLightScale(scaled, scaled_width, scaled_height );
|
||||
VID_ImageLightScale(scaled, scaled_width, scaled_height );
|
||||
|
||||
GL_GenerateMipmaps(); //SGIS_ext
|
||||
qglTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, image_desc.glMask, image_desc.glType, scaled);
|
||||
|
@ -1277,7 +1243,7 @@ bool qrsDecompressImageATI( uint target, int level, int internalformat, uint wid
|
|||
}
|
||||
|
||||
// ati images always have power of two sizes
|
||||
R_ImageLightScale((uint *)fout, width, height ); //check for round
|
||||
VID_ImageLightScale((uint *)fout, width, height ); //check for round
|
||||
|
||||
// upload base image or miplevel
|
||||
samples = (image_desc.flags & IMAGE_HAS_ALPHA) ? gl_tex_alpha_format : gl_tex_solid_format;
|
||||
|
@ -1435,7 +1401,7 @@ bool R_StoreImageARGB( uint target, int level, uint width, uint height, uint ima
|
|||
if (image_desc.type == it_wall && mipmap && r_emboss_bump->value)
|
||||
R_FilterTexture (EMBOSS_FILTER, scaled, scaled_width, scaled_height, 1, 128, true, GL_MODULATE);
|
||||
|
||||
R_ImageLightScale(scaled, scaled_width, scaled_height ); //check for round
|
||||
VID_ImageLightScale(scaled, scaled_width, scaled_height ); //check for round
|
||||
qglTexImage2D ( target, level, samples, scaled_width, scaled_height, 0, image_desc.glMask, image_desc.glType, scaled );
|
||||
|
||||
if(qglGetError()) return false;
|
||||
|
@ -1516,10 +1482,10 @@ bool R_LoadImageRGBA (byte *data )
|
|||
}
|
||||
for (i = 0; i < s; i++ )
|
||||
{
|
||||
trans[(i<<2)+0] = gammatable[image_desc.pal[data[i]*4+0]];
|
||||
trans[(i<<2)+1] = gammatable[image_desc.pal[data[i]*4+1]];
|
||||
trans[(i<<2)+2] = gammatable[image_desc.pal[data[i]*4+2]];
|
||||
trans[(i<<2)+3] = gammatable[image_desc.pal[data[i]*4+3]];
|
||||
trans[(i<<2)+0] = image_desc.pal[data[i]*4+0];
|
||||
trans[(i<<2)+1] = image_desc.pal[data[i]*4+1];
|
||||
trans[(i<<2)+2] = image_desc.pal[data[i]*4+2];
|
||||
trans[(i<<2)+3] = image_desc.pal[data[i]*4+3];
|
||||
}
|
||||
return R_LoadTexImage((uint*)trans );
|
||||
}
|
||||
|
@ -1700,7 +1666,7 @@ image_t *R_LoadImage(char *name, rgbdata_t *pic, imagetype_t type )
|
|||
R_SetPixelFormat( image_desc.width, image_desc.height, image_desc.numLayers );
|
||||
offset = image_desc.SizeOfFile;// move pointer
|
||||
|
||||
MsgDev(D_LOAD, "loading %s [%s] \n", name, PFDesc[image_desc.format].name );
|
||||
MsgDev(D_SPAM, "loading %s [%s] \n", name, PFDesc[image_desc.format].name );
|
||||
|
||||
switch(pic->type)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
=======================================================================
|
||||
Xash3D QuakeC Compiler started at Oct27 2007 [18:05:12]
|
||||
Xash3D QuakeC Compiler started at Nov2007-06(23.19.17)
|
||||
=======================================================================
|
||||
------------Configuration: server - Vm16 Release------------
|
||||
Compiling...
|
||||
|
@ -39,8 +39,8 @@ Linking...
|
|||
‘ª®¯¨à®¢ ® ä ©«®¢: 1.
|
||||
|
||||
server.dat - 0 error(s), 0 warning(s)
|
||||
0.737 seconds elapsed
|
||||
0.450 seconds elapsed
|
||||
|
||||
=======================================================================
|
||||
Xash3D QuakeC Compiler stopped at Oct27 2007 [18:05:13]
|
||||
Xash3D QuakeC Compiler stopped at Nov2007-06(23.19.17)
|
||||
=======================================================================
|
|
@ -262,6 +262,17 @@ float TRUE = 1;
|
|||
#define MOVETYPE_BOUNCE 7
|
||||
#define MOVETYPE_FOLLOW 8 // attached models
|
||||
|
||||
#define RF_MINLIGHT 1 // allways have some light (viewmodel)
|
||||
#define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
|
||||
#define RF_WEAPONMODEL 4 // only draw through eyes
|
||||
#define RF_FULLBRIGHT 8 // allways draw full intensity
|
||||
#define RF_DEPTHHACK 16 // for view weapon Z crunching
|
||||
#define RF_TRANSLUCENT 32
|
||||
#define RF_FRAMELERP 64
|
||||
#define RF_BEAM 128
|
||||
#define RF_CUSTOMSKIN 256 // skin is an index in image_precache
|
||||
#define RF_GLOW 512 // pulse lighting for bonus items
|
||||
|
||||
// edict.solid values
|
||||
float SOLID_NOT = 0; // no interaction with other objects
|
||||
float SOLID_TRIGGER = 1; // touch on edge, but not blocking
|
||||
|
|
|
@ -153,4 +153,14 @@ void misc_physbox ( void )
|
|||
setmodel (pev, "models/box.mdl");
|
||||
|
||||
phys_createbox( pev );
|
||||
}
|
||||
|
||||
void env_sprite( void )
|
||||
{
|
||||
precache_model ("sprites/explode01.spr");
|
||||
pev->owner = pev;
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
setmodel (pev, "sprites/explode01.spr");
|
||||
pev->frame = 5;
|
||||
}
|
|
@ -79,8 +79,8 @@ void() EndFrame = {};
|
|||
|
||||
// hud program string
|
||||
string single_statusbar =
|
||||
"yb -24 xv 0 hnum xv 50 pic 0 \
|
||||
if 2 { xv 100 anum xv 150 pic 2 } \
|
||||
"yb -24 xv 0 hnum xv 50 x 0 y 0 pic STAT_HEALTH_ICON \
|
||||
if 2 { xv 100 anum xv 150 pic STAT_AMMO_ICON } \
|
||||
if 4 { xv 200 rnum xv 250 pic 4 } \
|
||||
if 6 { xv 296 pic 6 } yb -50 \
|
||||
if 7 { xv 0 pic 7 xv 26 yb -42 stat_string 8 yb -50 } \
|
||||
|
@ -105,9 +105,9 @@ void worldspawn( void )
|
|||
LightStyles_setup();
|
||||
|
||||
// CS_MAXCLIENTS already sended by engine
|
||||
configstring (CS_STATUSBAR, single_statusbar );
|
||||
configstring (CS_STATUSBAR, "Hud_Single" );
|
||||
configstring (CS_SKY, "sky" );
|
||||
configstring (CS_SKYROTATE, ftoa( pev->speed )); // rotate speed
|
||||
configstring (CS_SKYROTATE, ftoa( pev->speed )); // rotate speed
|
||||
configstring (CS_SKYAXIS, vtoa( pev->angles )); // rotate axis
|
||||
configstring (CS_CDTRACK, ftoa( 0 ));
|
||||
}
|
||||
|
|
Reference in New Issue