06 Feb 2011

This commit is contained in:
g-cont 2011-02-06 00:00:00 +03:00 committed by Alibek Omarov
parent feb79fa260
commit b788bd3277
18 changed files with 205 additions and 131 deletions

View File

@ -325,7 +325,7 @@
// byte (color) // byte (color)
// short (count) // short (count)
// short (base speed) // short (base speed)
// short (ramdon velocity) // short (random velocity)
#define TE_BEAMHOSE 26 // obsolete #define TE_BEAMHOSE 26 // obsolete
@ -333,7 +333,6 @@
// coord, coord, coord (pos) // coord, coord, coord (pos)
// byte (radius in 10's) // byte (radius in 10's)
// byte byte byte (color) // byte byte byte (color)
// byte (brightness)
// byte (life in 10's) // byte (life in 10's)
// byte (decay rate in 10's) // byte (decay rate in 10's)

View File

@ -100,7 +100,6 @@ qboolean UI_IsVisible( void )
static void UI_DrawLogo( const char *filename, float x, float y, float width, float height ) static void UI_DrawLogo( const char *filename, float x, float y, float width, float height )
{ {
static float video_duration;
static float cin_time; static float cin_time;
static int last_frame = -1; static int last_frame = -1;
byte *cin_data = NULL; byte *cin_data = NULL;
@ -129,7 +128,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
} }
AVI_OpenVideo( cin_state, fullpath, false, false, true ); AVI_OpenVideo( cin_state, fullpath, false, false, true );
if( !( AVI_GetVideoInfo( cin_state, &menu.logo_xres, &menu.logo_yres, &video_duration ))) if( !( AVI_GetVideoInfo( cin_state, &menu.logo_xres, &menu.logo_yres, &menu.logo_length )))
{ {
AVI_CloseVideo( cin_state ); AVI_CloseVideo( cin_state );
menu.drawLogo = false; menu.drawLogo = false;
@ -152,7 +151,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
cin_time += host.realframetime; cin_time += host.realframetime;
// restarts the cinematic // restarts the cinematic
if( cin_time > video_duration ) if( cin_time > menu.logo_length )
cin_time = 0.0f; cin_time = 0.0f;
// read the next frame // read the next frame
@ -180,6 +179,11 @@ static int UI_GetLogoHeight( void )
return menu.logo_yres; return menu.logo_yres;
} }
static float UI_GetLogoLength( void )
{
return menu.logo_length;
}
static void UI_UpdateUserinfo( void ) static void UI_UpdateUserinfo( void )
{ {
player_info_t *player; player_info_t *player;
@ -861,6 +865,7 @@ static ui_enginefuncs_t gEngfuncs =
UI_DrawLogo, UI_DrawLogo,
UI_GetLogoWidth, UI_GetLogoWidth,
UI_GetLogoHeight, UI_GetLogoHeight,
UI_GetLogoLength,
pfnDrawCharacter, pfnDrawCharacter,
pfnDrawConsoleString, pfnDrawConsoleString,
pfnDrawSetTextColor, pfnDrawSetTextColor,

View File

@ -1814,16 +1814,12 @@ void CL_ParseTempEntity( sizebuf_t *msg )
dl->origin[0] = BF_ReadCoord( &buf ); dl->origin[0] = BF_ReadCoord( &buf );
dl->origin[1] = BF_ReadCoord( &buf ); dl->origin[1] = BF_ReadCoord( &buf );
dl->origin[2] = BF_ReadCoord( &buf ); dl->origin[2] = BF_ReadCoord( &buf );
dl->radius = (float)(BF_ReadByte( &buf ) * 0.1f); dl->radius = (float)(BF_ReadByte( &buf ) * 10.0f);
dl->color.r = BF_ReadByte( &buf ); dl->color.r = BF_ReadByte( &buf );
dl->color.g = BF_ReadByte( &buf ); dl->color.g = BF_ReadByte( &buf );
dl->color.b = BF_ReadByte( &buf ); dl->color.b = BF_ReadByte( &buf );
brightness = (float)BF_ReadByte( &buf );
dl->color.r *= brightness;
dl->color.g *= brightness;
dl->color.b *= brightness;
dl->die = cl.time + (float)(BF_ReadByte( &buf ) * 0.1f); dl->die = cl.time + (float)(BF_ReadByte( &buf ) * 0.1f);
dl->decay = (float)(BF_ReadByte( &buf ) * 0.1f); dl->decay = (float)(BF_ReadByte( &buf ) * 10.0f);
break; break;
case TE_ELIGHT: case TE_ELIGHT:
dl = CL_AllocElight( 0 ); dl = CL_AllocElight( 0 );
@ -2288,20 +2284,24 @@ void CL_DecayLights( void )
for( i = 0, dl = cl_dlights; i < MAX_DLIGHTS; i++, dl++ ) for( i = 0, dl = cl_dlights; i < MAX_DLIGHTS; i++, dl++ )
{ {
if( dl->die < cl.time || !dl->radius ) if( !dl->radius ) continue;
continue;
dl->radius -= time * dl->decay; dl->radius -= time * dl->decay;
if( dl->radius < 0 ) dl->radius = 0; if( dl->radius < 0 ) dl->radius = 0;
if( dl->die < cl.time || !dl->radius )
Mem_Set( dl, 0, sizeof( *dl ));
} }
for( i = 0, dl = cl_elights; i < MAX_ELIGHTS; i++, dl++ ) for( i = 0, dl = cl_elights; i < MAX_ELIGHTS; i++, dl++ )
{ {
if( dl->die < cl.time || !dl->radius ) if( !dl->radius ) continue;
continue;
dl->radius -= time * dl->decay; dl->radius -= time * dl->decay;
if( dl->radius < 0 ) dl->radius = 0; if( dl->radius < 0 ) dl->radius = 0;
if( dl->die < cl.time || !dl->radius )
Mem_Set( dl, 0, sizeof( *dl ));
} }
} }

View File

@ -379,6 +379,7 @@ typedef struct
qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted
long logo_xres; long logo_xres;
long logo_yres; long logo_yres;
float logo_length;
} menu_static_t; } menu_static_t;
typedef struct typedef struct

View File

@ -771,6 +771,7 @@ void R_DrawTextureChains( void )
// make sure what color is reset // make sure what color is reset
pglColor4ub( 255, 255, 255, 255 ); pglColor4ub( 255, 255, 255, 255 );
R_LoadIdentity(); // set identity matrix
// clip skybox surfaces // clip skybox surfaces
for( s = skychain; s != NULL; s = s->texturechain ) for( s = skychain; s != NULL; s = s->texturechain )
@ -1241,8 +1242,11 @@ void R_RecursiveWorldNode( mnode_t *node, uint clipflags )
} }
else else
{ {
surf->texturechain = surf->texinfo->texture->texturechain; if( surf->texinfo && surf->texinfo->texture )
surf->texinfo->texture->texturechain = surf; {
surf->texturechain = surf->texinfo->texture->texturechain;
surf->texinfo->texture->texturechain = surf;
}
} }
} }

View File

@ -14,6 +14,7 @@
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_CAPTION|WS_VISIBLE) #define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_CAPTION|WS_VISIBLE)
#define WINDOW_EX_STYLE (0) #define WINDOW_EX_STYLE (0)
#define GL_DRIVER_OPENGL "OpenGL32" #define GL_DRIVER_OPENGL "OpenGL32"
#define WINDOW_NAME "Xash Window" // Half-Life
convar_t *renderinfo; convar_t *renderinfo;
convar_t *gl_allow_software; convar_t *gl_allow_software;
@ -949,7 +950,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
wc.hInstance = host.hInst; wc.hInstance = host.hInst;
wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (void *)COLOR_3DSHADOW; wc.hbrBackground = (void *)COLOR_3DSHADOW;
wc.lpszClassName = "Xash Window"; wc.lpszClassName = WINDOW_NAME;
wc.lpszMenuName = 0; wc.lpszMenuName = 0;
// find the icon file in the filesystem // find the icon file in the filesystem
@ -970,7 +971,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
if( !RegisterClass( &wc )) if( !RegisterClass( &wc ))
{ {
MsgDev( D_ERROR, "VID_CreateWindow: couldn't register window class %s\n" "Xash Window" ); MsgDev( D_ERROR, "VID_CreateWindow: couldn't register window class %s\n" WINDOW_NAME );
return false; return false;
} }
@ -1010,7 +1011,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
} }
} }
CreateWindowEx( exstyle, "Xash Window", wndname, stylebits, x, y, w, h, NULL, NULL, host.hInst, NULL ); CreateWindowEx( exstyle, WINDOW_NAME, wndname, stylebits, x, y, w, h, NULL, NULL, host.hInst, NULL );
// host.hWnd will be filled in IN_WndProc // host.hWnd will be filled in IN_WndProc
@ -1030,7 +1031,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
DestroyWindow( host.hWnd ); DestroyWindow( host.hWnd );
host.hWnd = NULL; host.hWnd = NULL;
UnregisterClass( "Xash Window", host.hInst ); UnregisterClass( WINDOW_NAME, host.hInst );
MsgDev( D_ERROR, "OpenGL driver not installed\n" ); MsgDev( D_ERROR, "OpenGL driver not installed\n" );
return false; return false;
} }
@ -1071,7 +1072,7 @@ void VID_DestroyWindow( void )
host.hWnd = NULL; host.hWnd = NULL;
} }
UnregisterClass( "Xash Window", host.hInst ); UnregisterClass( WINDOW_NAME, host.hInst );
if( glState.fullScreen ) if( glState.fullScreen )
{ {

View File

@ -1520,6 +1520,10 @@ void Con_VidInit( void )
} }
} }
// missed console image will be replaced as white (GoldSrc rules)
if( con.background == tr.defaultTexture )
con.background = tr.whiteTexture;
Con_LoadConchars(); Con_LoadConchars();
} }

View File

@ -83,6 +83,7 @@
#define MakeRGBA( out, x, y, z, w ) Vector4Set( out, x, y, z, w ) #define MakeRGBA( out, x, y, z, w ) Vector4Set( out, x, y, z, w )
#define PlaneDist(point,plane) ((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) #define PlaneDist(point,plane) ((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal))
#define PlaneDiff(point,plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist) #define PlaneDiff(point,plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist)
#define PlaneDiff2(point, plane) ((((plane)->type < 3) ? (point)[(plane)->type] - (plane)->dist : DotProduct((point), (plane)->normal) - (plane)->dist))
float rsqrt( float number ); float rsqrt( float number );
float anglemod( const float a ); float anglemod( const float a );

View File

@ -54,13 +54,11 @@ public:
virtual bool hasFocus( void ) virtual bool hasFocus( void )
{ {
Msg( "hasFocus()\n" );
return false; return false;
} }
virtual bool isWithin( int x, int y ) virtual bool isWithin( int x, int y )
{ {
Msg( "isWithin()\n" );
return false; return false;
} }
protected: protected:
@ -155,9 +153,8 @@ protected:
class CEngineApp : public App class CEngineApp : public App
{ {
public: public:
CEngineApp( void ) CEngineApp( bool externalMain = true ):App( externalMain )
{ {
App::reset();
} }
virtual void main( int argc, char* argv[] ) virtual void main( int argc, char* argv[] )
@ -167,13 +164,12 @@ public:
virtual void setCursorPos( int x, int y ) virtual void setCursorPos( int x, int y )
{ {
Msg( "setCursorPos: %i %i\n", x, y ); App::setCursorPos( x, y );
} }
virtual void getCursorPos( int &x,int &y ) virtual void getCursorPos( int &x,int &y )
{ {
App::getCursorPos( x, y ); App::getCursorPos( x, y );
Msg( "getCursorPos: %i %i\n", x, y );
} }
virtual App* getApp( void ) virtual App* getApp( void )
{ {
@ -262,7 +258,7 @@ void VGui_Paint( void )
{ {
if( !rootpanel ) return; if( !rootpanel ) return;
rootpanel->paintBackground(); // pApp->externalTick();
} }
void VGui_ViewportPaintBackground( int extents[4] ) void VGui_ViewportPaintBackground( int extents[4] )

View File

@ -10,89 +10,152 @@
#include<VGUI.h> #include<VGUI.h>
#include<VGUI_App.h> #include<VGUI_App.h>
#include<VGUI_Panel.h> #include<VGUI_Panel.h>
#include<VGUI_SurfaceGL.h> #include<VGUI_SurfaceBase.h>
#include<VGUI_ActionSignal.h> #include<VGUI_ActionSignal.h>
#include<VGUI_BorderLayout.h> #include<VGUI_BorderLayout.h>
using namespace vgui; using namespace vgui;
SurfaceGL::SurfaceGL( Panel* embeddedPanel ):Surface( embeddedPanel ) class CEngineSurface : public SurfaceBase
{ {
_embeddedPanel = embeddedPanel; public:
} CEngineSurface( Panel *embeddedPanel ):SurfaceBase( embeddedPanel )
{
_embeddedPanel = embeddedPanel;
}
public:
virtual void setTitle( const char *title )
{
Msg( "SetTitle: %s\n", title );
}
bool SurfaceGL::recreateContext( void ) virtual bool setFullscreenMode( int wide, int tall, int bpp )
{ {
Msg( "recreate context\n" ); return false;
return Surface::recreateContext(); }
}
void SurfaceGL::createPopup(Panel* embeddedPanel)
{
}
void SurfaceGL::pushMakeCurrent( Panel* panel, bool useInsets ) virtual void setWindowedMode( void )
{ {
Surface::pushMakeCurrent( panel, useInsets ); }
}
void SurfaceGL::popMakeCurrent( Panel* panel ) virtual void setAsTopMost( bool state )
{ {
Surface::popMakeCurrent( panel ); }
}
void SurfaceGL::makeCurrent( void ) virtual int getModeInfoCount( void )
{ {
Msg( "make current\n" ); Msg( "getModeInfoCount()\n" );
} return 0;
}
void SurfaceGL::swapBuffers( void ) virtual void createPopup( Panel* embeddedPanel )
{ {
Surface::swapBuffers(); }
}
void SurfaceGL::setColor( int r, int g, int b ) virtual bool hasFocus( void )
{ {
} // Msg( "hasFocus()\n" );
return false;
}
void SurfaceGL::filledRect( int x0, int y0, int x1, int y1 ) virtual bool isWithin( int x, int y )
{ {
} // Msg( "isWithin()\n" );
return false;
}
protected:
virtual int createNewTextureID( void )
{
Msg( "createNewTextureID()\n" );
return 0;
}
void SurfaceGL::outlinedRect( int x0, int y0, int x1, int y1 ) virtual void drawSetColor( int r, int g, int b, int a )
{ {
} }
void SurfaceGL::setTextFont( Font* font ) virtual void drawFilledRect( int x0, int y0, int x1, int y1 )
{ {
} }
void SurfaceGL::setTextColor( int r, int g, int b ) virtual void drawOutlinedRect( int x0,int y0,int x1,int y1 )
{ {
} }
virtual void drawSetTextFont( Font *font )
{
}
void SurfaceGL::setDrawPos( int x, int y ) virtual void drawSetTextColor( int r, int g, int b, int a )
{ {
} }
void SurfaceGL::printText( const char *str, int strlen ) virtual void drawSetTextPos( int x, int y )
{ {
Msg( "Con_Printf( %s )\n", str ); }
}
void SurfaceGL::setTextureRGBA( int id, const char *rgba, int wide, int tall ) virtual void drawPrintText( const char* text, int textLen )
{ {
Msg( "SetTexture( %i )\n", id ); }
}
void SurfaceGL::setTexture( int id ) virtual void drawSetTextureRGBA( int id, const char* rgba, int wide, int tall )
{ {
Msg( "SetTexture( %i )\n", id ); Msg( "drawSetTextureRGBA()\n" );
} }
virtual void drawSetTexture( int id )
{
Msg( "drawSetTexture()\n" );
}
virtual void drawTexturedRect( int x0, int y0, int x1, int y1 )
{
}
void SurfaceGL::texturedRect( int x0, int y0, int x1, int y1 ) virtual void invalidate( Panel *panel )
{ {
} }
virtual bool createPlat()
{
Msg( "createPlat()\n" );
return false;
}
virtual bool recreateContext()
{
Msg( "recreateContext()\n" );
return false;
}
virtual void enableMouseCapture(bool state)
{
}
virtual void setCursor(Cursor* cursor)
{
}
virtual void swapBuffers()
{
Msg( "swapBuffers()\n" );
}
virtual void pushMakeCurrent(Panel* panel,bool useInsets)
{
}
virtual void popMakeCurrent(Panel* panel)
{
}
virtual void applyChanges( void )
{
}
protected:
friend class App;
friend class Panel;
};
class CEngineApp : public App class CEngineApp : public App
{ {
@ -109,13 +172,11 @@ public:
virtual void setCursorPos( int x, int y ) virtual void setCursorPos( int x, int y )
{ {
App::setCursorPos( x, y ); App::setCursorPos( x, y );
Msg( "setCursorPos: %i %i\n", x, y );
} }
virtual void getCursorPos( int &x,int &y ) virtual void getCursorPos( int &x,int &y )
{ {
App::getCursorPos( x, y ); App::getCursorPos( x, y );
Msg( "getCursorPos: %i %i\n", x, y );
} }
virtual App* getApp( void ) virtual App* getApp( void )
{ {
@ -124,7 +185,7 @@ public:
}; };
RECT window_rect; RECT window_rect;
SurfaceGL *surface = NULL; CEngineSurface *surface = NULL;
CEngineApp *pApp = NULL; CEngineApp *pApp = NULL;
Panel *rootpanel = NULL; Panel *rootpanel = NULL;
#define WND_BORDER 3 #define WND_BORDER 3
@ -144,25 +205,23 @@ void VGui_Startup( void )
if( rootpanel ) if( rootpanel )
{ {
// rootpanel->reset(); // rootpanel->reset();
// rootpanel->setSize( menu.globals->scrWidth, menu.globals->scrHeight ); rootpanel->setSize( menu.globals->scrWidth, menu.globals->scrHeight );
return; return;
} }
Scheme *pScheme = new Scheme();
pApp = new CEngineApp( true ); pApp = new CEngineApp( true );
pApp->setScheme( pScheme );
rootpanel = new Panel(); rootpanel = new Panel();
rootpanel->setPaintEnabled( true ); rootpanel->setPaintEnabled( false );
rootpanel->setPaintBorderEnabled( false ); rootpanel->setPaintBorderEnabled( false );
rootpanel->setPaintBackgroundEnabled( true ); rootpanel->setPaintBackgroundEnabled( true );
rootpanel->setVisible( true ); rootpanel->setVisible( true );
rootpanel->setEnabled( true ); rootpanel->setEnabled( false );
rootpanel->setCursor( new Cursor( Cursor::dc_none )); rootpanel->setCursor( new Cursor( Cursor::dc_none ));
VGui_SetBounds(); VGui_SetBounds();
surface = new SurfaceGL( rootpanel ); surface = new CEngineSurface( rootpanel );
ASSERT( rootpanel->getApp() != NULL ); ASSERT( rootpanel->getApp() != NULL );
ASSERT( rootpanel->getSurfaceBase() != NULL ); ASSERT( rootpanel->getSurfaceBase() != NULL );
@ -184,7 +243,7 @@ void VGui_Paint( void )
if( !rootpanel ) return; if( !rootpanel ) return;
pApp->externalTick(); pApp->externalTick();
// rootpanel->paintBackground(); // rootpanel->repaint();
} }
void VGui_ViewportPaintBackground( int extents[4] ) void VGui_ViewportPaintBackground( int extents[4] )
@ -195,11 +254,8 @@ void VGui_ViewportPaintBackground( int extents[4] )
Panel *pVPanel = surface->getPanel(); Panel *pVPanel = surface->getPanel();
if( !pVPanel ) return; if( !pVPanel ) return;
rootpanel->setBounds( extents[0], extents[1], extents[2], extents[3] ); rootpanel->setBounds( extents[0], extents[1], menu.globals->scrWidth, menu.globals->scrHeight );
// rootpanel->repaint(); // rootpanel->repaint();
// paint everything
rootpanel->paintTraverse();
} }
void *VGui_GetPanel( void ) void *VGui_GetPanel( void )

View File

@ -71,6 +71,7 @@ typedef struct ui_enginefuncs_s
void (*pfnDrawLogo)( const char *filename, float x, float y, float width, float height ); void (*pfnDrawLogo)( const char *filename, float x, float y, float width, float height );
int (*pfnGetLogoWidth)( void ); int (*pfnGetLogoWidth)( void );
int (*pfnGetLogoHeight)( void ); int (*pfnGetLogoHeight)( void );
float (*pfnGetLogoLength)( void );
// text message system // text message system
void (*pfnDrawCharacter)( int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont ); void (*pfnDrawCharacter)( int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont );

View File

@ -375,6 +375,8 @@ extern convar_t *sv_unlagpush;
extern convar_t *sv_unlagsamples; extern convar_t *sv_unlagsamples;
extern convar_t *sv_allow_upload; extern convar_t *sv_allow_upload;
extern convar_t *sv_allow_download; extern convar_t *sv_allow_download;
extern convar_t *sv_allow_studio_scaling;
extern convar_t *sv_allow_studio_attachment_angles;
extern convar_t *sv_send_resources; extern convar_t *sv_send_resources;
extern convar_t *sv_send_logos; extern convar_t *sv_send_logos;
extern convar_t *sv_sendvelocity; extern convar_t *sv_sendvelocity;

View File

@ -82,19 +82,13 @@ void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max )
return; return;
} }
} }
#if 0
// FIXME: enable this when other server parts will be done and tested if( sv_allow_studio_scaling->integer && e->v.scale != 0.0f )
if( e->v.scale > 0.0f && e->v.scale != 1.0f )
{ {
switch( Mod_GetType( e->v.modelindex )) if( Mod_GetType( e->v.modelindex ) == mod_studio )
{
case mod_sprite:
case mod_studio:
scale = e->v.scale; scale = e->v.scale;
break;
}
} }
#endif
VectorScale( min, scale, e->v.mins ); VectorScale( min, scale, e->v.mins );
VectorScale( max, scale, e->v.maxs ); VectorScale( max, scale, e->v.maxs );
VectorSubtract( max, min, e->v.size ); VectorSubtract( max, min, e->v.size );

View File

@ -50,6 +50,8 @@ convar_t *sv_reconnect_limit; // minimum seconds between connect messages
convar_t *sv_failuretime; convar_t *sv_failuretime;
convar_t *sv_allow_upload; convar_t *sv_allow_upload;
convar_t *sv_allow_download; convar_t *sv_allow_download;
convar_t *sv_allow_studio_scaling;
convar_t *sv_allow_studio_attachment_angles;
convar_t *sv_send_resources; convar_t *sv_send_resources;
convar_t *sv_send_logos; convar_t *sv_send_logos;
convar_t *sv_sendvelocity; convar_t *sv_sendvelocity;
@ -626,6 +628,8 @@ void SV_Init( void )
zombietime = Cvar_Get( "zombietime", "2", CVAR_SERVERNOTIFY, "timeout for clients-zombie (who died but not respawned)" ); zombietime = Cvar_Get( "zombietime", "2", CVAR_SERVERNOTIFY, "timeout for clients-zombie (who died but not respawned)" );
sv_pausable = Cvar_Get( "pausable", "1", CVAR_SERVERNOTIFY, "allow players to pause or not" ); sv_pausable = Cvar_Get( "pausable", "1", CVAR_SERVERNOTIFY, "allow players to pause or not" );
allow_download = Cvar_Get( "allow_download", "0", CVAR_ARCHIVE, "allow download resources" ); allow_download = Cvar_Get( "allow_download", "0", CVAR_ARCHIVE, "allow download resources" );
sv_allow_studio_scaling = Cvar_Get( "sv_allow_studio_scaling", "0", CVAR_ARCHIVE, "allow to scale physics hull for studio models (visible hull scaled on the client-side)" );
sv_allow_studio_attachment_angles = Cvar_Get( "sv_allow_studio_attachment_angles", "0", CVAR_ARCHIVE, "enable calc angles for attachment points (on studio models)" );
sv_wallbounce = Cvar_Get( "sv_wallbounce", "1.0", CVAR_PHYSICINFO, "bounce factor for client with MOVETYPE_BOUNCE" ); sv_wallbounce = Cvar_Get( "sv_wallbounce", "1.0", CVAR_PHYSICINFO, "bounce factor for client with MOVETYPE_BOUNCE" );
sv_spectatormaxspeed = Cvar_Get( "sv_spectatormaxspeed", "500", CVAR_PHYSICINFO, "spectator maxspeed" ); sv_spectatormaxspeed = Cvar_Get( "sv_spectatormaxspeed", "500", CVAR_PHYSICINFO, "spectator maxspeed" );
sv_waterfriction = Cvar_Get( "sv_waterfriction", "1", CVAR_PHYSICINFO, "how fast you slow down in water" ); sv_waterfriction = Cvar_Get( "sv_waterfriction", "1", CVAR_PHYSICINFO, "how fast you slow down in water" );

View File

@ -91,7 +91,7 @@ static void SV_StudioSetUpTransform( edict_t *ent )
VectorCopy( ent->v.angles, ang ); VectorCopy( ent->v.angles, ang );
ang[PITCH] = -ang[PITCH]; // stupid Half-Life bug ang[PITCH] = -ang[PITCH]; // stupid Half-Life bug
if( ent->v.scale != 0.0f ) scale = ent->v.scale; if( ent->v.scale != 0.0f && sv_allow_studio_scaling->integer ) scale = ent->v.scale;
Matrix3x4_CreateFromEntity( sv_studiomatrix, ang, ent->v.origin, scale ); Matrix3x4_CreateFromEntity( sv_studiomatrix, ang, ent->v.origin, scale );
} }
@ -955,13 +955,17 @@ void SV_StudioGetAttachment( edict_t *e, int iAttachment, float *org, float *ang
// compute pos and angles // compute pos and angles
Matrix3x4_VectorTransform( sv_studiobones[pAtt[iAttachment].bone], pAtt[iAttachment].org, localOrg ); Matrix3x4_VectorTransform( sv_studiobones[pAtt[iAttachment].bone], pAtt[iAttachment].org, localOrg );
Matrix3x4_OriginFromMatrix( sv_studiobones[pAtt[iAttachment].bone], bonepos );
VectorSubtract( localOrg, bonepos, forward ); // make forward
VectorNormalizeFast( forward );
VectorAngles( forward, localAng );
if( org ) VectorCopy( localOrg, org ); if( org ) VectorCopy( localOrg, org );
if( ang ) VectorCopy( localAng, ang );
if( sv_allow_studio_attachment_angles->integer )
{
Matrix3x4_OriginFromMatrix( sv_studiobones[pAtt[iAttachment].bone], bonepos );
VectorSubtract( localOrg, bonepos, forward ); // make forward
VectorNormalizeFast( forward );
VectorAngles( forward, localAng );
if( ang ) VectorCopy( localAng, ang );
}
} }
void SV_GetBonePosition( edict_t *e, int iBone, float *org, float *ang ) void SV_GetBonePosition( edict_t *e, int iBone, float *org, float *ang )

View File

@ -112,16 +112,16 @@ hull_t *SV_HullForEntity( edict_t *ent, int hullNumber, vec3_t mins, vec3_t maxs
vec3_t hullmins, hullmaxs; vec3_t hullmins, hullmaxs;
vec3_t size; vec3_t size;
model = CM_ClipHandleToModel( ent->v.modelindex );
// decide which clipping hull to use, based on the size // decide which clipping hull to use, based on the size
if( ent->v.solid == SOLID_BSP || ent->v.skin == CONTENTS_LADDER ) if( model && ( ent->v.solid == SOLID_BSP || ent->v.skin == CONTENTS_LADDER ))
{ {
// explicit hulls in the BSP model // explicit hulls in the BSP model
if( ent->v.movetype != MOVETYPE_PUSH ) if( ent->v.movetype != MOVETYPE_PUSH )
Host_Error( "SOLID_BSP without MOVETYPE_PUSH\n" ); Host_Error( "SOLID_BSP without MOVETYPE_PUSH\n" );
model = CM_ClipHandleToModel( ent->v.modelindex ); if( model->type != mod_brush )
if( !model || model->type != mod_brush )
Host_Error( "MOVETYPE_PUSH with a non bsp model\n" ); Host_Error( "MOVETYPE_PUSH with a non bsp model\n" );
VectorSubtract( maxs, mins, size ); VectorSubtract( maxs, mins, size );

View File

@ -25,6 +25,7 @@
#define PRECACHE_LOGO( x ) (*g_engfuncs.pfnDrawLogo)( x, 0, 0, 0, 0 ) #define PRECACHE_LOGO( x ) (*g_engfuncs.pfnDrawLogo)( x, 0, 0, 0, 0 )
#define GetLogoWidth (*g_engfuncs.pfnGetLogoWidth) #define GetLogoWidth (*g_engfuncs.pfnGetLogoWidth)
#define GetLogoHeight (*g_engfuncs.pfnGetLogoHeight) #define GetLogoHeight (*g_engfuncs.pfnGetLogoHeight)
#define GetLogoLength (*g_engfuncs.pfnGetLogoLength)
inline HIMAGE PIC_Load( const char *szPicName ) inline HIMAGE PIC_Load( const char *szPicName )
{ {

View File

@ -103,14 +103,15 @@ static void UI_Background_Ownerdraw( void *self )
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic ); UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
if( GetLogoLength() <= 0.1 || GetLogoWidth() <= 32 )
return; // don't draw stub logo (GoldSrc rules)
float logoWidth, logoHeight, logoPosY; float logoWidth, logoHeight, logoPosY;
float scaleX, scaleY; float scaleX, scaleY;
scaleX = ScreenWidth / 640.0f; scaleX = ScreenWidth / 640.0f;
scaleY = ScreenHeight / 480.0f; scaleY = ScreenHeight / 480.0f;
if( GetLogoWidth() <= 32 ) return; // don't draw stub logo
logoWidth = GetLogoWidth() * scaleX; logoWidth = GetLogoWidth() * scaleX;
logoHeight = GetLogoHeight() * scaleY; logoHeight = GetLogoHeight() * scaleY;
logoPosY = 70 * scaleY; // 70 it's empirically determined value (magic number) logoPosY = 70 * scaleY; // 70 it's empirically determined value (magic number)