01 Feb 2011
This commit is contained in:
parent
a81e6394e8
commit
feb79fa260
|
@ -150,7 +150,8 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
}
|
||||
|
||||
// don't add himself on firstperson
|
||||
if(( ent->index - 1 ) == cl.playernum && ent != &clgame.viewent && !cl.thirdperson && cls.key_dest != key_menu )
|
||||
if(( ent->index - 1 ) == cl.playernum && ent != &clgame.viewent &&
|
||||
cl.thirdperson == false && cls.key_dest != key_menu && cl.refdef.viewentity == ( cl.playernum + 1 ))
|
||||
{
|
||||
}
|
||||
else
|
||||
|
@ -194,9 +195,9 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
// add light effect
|
||||
if( ent->curstate.effects & EF_LIGHT )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( 0 );
|
||||
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->die = cl.time + 0.001f; // die at next frame
|
||||
dl->die = cl.time; // die at next frame
|
||||
dl->color.r = 100;
|
||||
dl->color.g = 100;
|
||||
dl->color.b = 100;
|
||||
|
@ -213,9 +214,9 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
}
|
||||
else
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( 0 );
|
||||
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->die = cl.time + 0.001f; // die at next frame
|
||||
dl->die = cl.time; // die at next frame
|
||||
dl->color.r = 255;
|
||||
dl->color.g = 255;
|
||||
dl->color.b = 255;
|
||||
|
@ -225,13 +226,13 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
|
||||
if( ent->curstate.effects & EF_BRIGHTLIGHT )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( 0 );
|
||||
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||
VectorSet( dl->origin, ent->origin[0], ent->origin[1], ent->origin[2] + 16 );
|
||||
dl->die = cl.time + 0.001f; // die at next frame
|
||||
dl->die = cl.time; // die at next frame
|
||||
dl->color.r = 255;
|
||||
dl->color.g = 255;
|
||||
dl->color.b = 255;
|
||||
dl->radius = Com_RandomLong( 400, 430 );
|
||||
dl->radius = 400;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
if( newent ) Host_Error( "Cl_DeltaEntity: tried to release new entity\n" );
|
||||
|
||||
CL_KillDeadBeams( ent ); // release dead beams
|
||||
|
||||
/*
|
||||
if( state->number == -1 )
|
||||
{
|
||||
Msg( "Entity %i was removed from server\n", newnum );
|
||||
|
@ -374,7 +375,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
{
|
||||
Msg( "Entity %i was removed from delta-message\n", newnum );
|
||||
}
|
||||
|
||||
*/
|
||||
// FIXME: waiting for static entity implimentation
|
||||
// if( state->number == -1 )
|
||||
// R_RemoveEfrags( ent );
|
||||
|
|
|
@ -351,15 +351,6 @@ void CL_WritePacket( void )
|
|||
if( cls.state == ca_disconnected || cls.state == ca_connecting )
|
||||
return;
|
||||
|
||||
/*
|
||||
if( cls.state == ca_connected )
|
||||
{
|
||||
// just update reliable
|
||||
if( cls.netchan.message.iCurBit || host.realtime - cls.netchan.last_sent > 1.0f )
|
||||
Netchan_Transmit( &cls.netchan, 0, NULL );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
CL_ComputePacketLoss ();
|
||||
|
||||
if( cl_cmdrate->value < MIN_CMD_RATE )
|
||||
|
@ -371,7 +362,6 @@ void CL_WritePacket( void )
|
|||
|
||||
// Determine number of backup commands to send along
|
||||
numbackup = bound( 0, cl_cmdbackup->integer, MAX_BACKUP_COMMANDS );
|
||||
if( cls.state == ca_connected ) numbackup = 0;
|
||||
|
||||
// Check to see if we can actually send this command
|
||||
|
||||
|
@ -497,7 +487,7 @@ void CL_WritePacket( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
// Increment sequence number so we can detect that we've held back packets.
|
||||
// increment sequence number so we can detect that we've held back packets.
|
||||
cls.netchan.outgoing_sequence++;
|
||||
}
|
||||
|
||||
|
@ -1440,7 +1430,7 @@ void CL_InitLocal( void )
|
|||
userinfo = Cvar_Get( "@userinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
|
||||
cl_showfps = Cvar_Get( "cl_showfps", "1", CVAR_ARCHIVE, "show client fps" );
|
||||
cl_smooth = Cvar_Get ("cl_smooth", "0", CVAR_ARCHIVE, "smooth up stair climbing and interpolate position in multiplayer" );
|
||||
cl_cmdbackup = Cvar_Get( "cl_cmdbackup", "2", CVAR_ARCHIVE, "how many additional history commands are sent" );
|
||||
cl_cmdbackup = Cvar_Get( "cl_cmdbackup", "10", CVAR_ARCHIVE, "how many additional history commands are sent" );
|
||||
cl_cmdrate = Cvar_Get( "cl_cmdrate", "30", CVAR_ARCHIVE, "Max number of command packets sent to server per second" );
|
||||
cl_draw_particles = Cvar_Get( "cl_draw_particles", "1", CVAR_ARCHIVE, "Disable any particle effects" );
|
||||
cl_draw_beams = Cvar_Get( "cl_draw_beams", "1", CVAR_ARCHIVE, "Disable view beams" );
|
||||
|
|
|
@ -196,7 +196,7 @@ int CL_TruePointContents( const vec3_t p )
|
|||
continue;
|
||||
|
||||
// only brushes can have special contents
|
||||
if( pe->model->type != mod_brush )
|
||||
if( !pe->model || pe->model->type != mod_brush )
|
||||
continue;
|
||||
|
||||
// check water brushes accuracy
|
||||
|
|
|
@ -430,7 +430,7 @@ void CL_FizzEffect( cl_entity_t *pent, int modelIndex, int density )
|
|||
|
||||
Mod_GetBounds( pent->curstate.modelindex, mins, maxs );
|
||||
|
||||
maxHeight = maxs[2] - mins[2];
|
||||
maxHeight = ( maxs[2] - mins[2] ) * 0.5f;
|
||||
width = maxs[0] - mins[0];
|
||||
depth = maxs[1] - mins[1];
|
||||
speed = ( pent->curstate.rendercolor.r<<8 | pent->curstate.rendercolor.g );
|
||||
|
@ -838,7 +838,7 @@ void CL_BloodSprite( const vec3_t org, int colorIndex, int modelIndex, int model
|
|||
pTemp->entity.curstate.rendercolor.g = clgame.palette[colorIndex][1];
|
||||
pTemp->entity.curstate.rendercolor.b = clgame.palette[colorIndex][2];
|
||||
pTemp->entity.curstate.framerate = frameCount * 4; // Finish in 0.250 seconds
|
||||
pTemp->die = cl.time + Com_RandomFloat( 4.0f, 16.0f );
|
||||
pTemp->die = cl.time + Com_RandomFloat( 3.0f, 6.0f );
|
||||
|
||||
pTemp->entity.angles[2] = Com_RandomLong( 0, 360 );
|
||||
pTemp->bounceFactor = 0;
|
||||
|
|
|
@ -753,6 +753,7 @@ void VGui_Startup( void );
|
|||
void VGui_Shutdown( void );
|
||||
void *VGui_GetPanel( void );
|
||||
void VGui_Paint( void );
|
||||
void VGui_SetBounds( void );
|
||||
void VGui_ViewportPaintBackground( int extents[4] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -226,7 +226,7 @@ int R_CullModel( cl_entity_t *e, vec3_t mins, vec3_t maxs, float radius )
|
|||
if( e->curstate.effects & EF_REFLECTONLY && !( RI.params & RP_MIRRORVIEW ))
|
||||
return 1;
|
||||
|
||||
if( RP_LOCALCLIENT( e ) && !RI.thirdPerson )
|
||||
if( RP_LOCALCLIENT( e ) && !RI.thirdPerson && cl.refdef.viewentity == ( cl.playernum + 1 ))
|
||||
{
|
||||
if(!( RI.params & ( RP_MIRRORVIEW|RP_SHADOWMAPVIEW )))
|
||||
return 1;
|
||||
|
|
|
@ -809,7 +809,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||
model_t *model;
|
||||
int alpha;
|
||||
int i, state = 0;
|
||||
float angle, sr, cr;
|
||||
float angle, dot, sr, cr;
|
||||
float lerp = 1.0f, ilerp, scale;
|
||||
vec3_t v_forward, v_right, v_up;
|
||||
vec3_t origin;
|
||||
|
@ -910,8 +910,12 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||
VectorNormalize( v_right );
|
||||
break;
|
||||
case SPR_FWD_PARALLEL_UPRIGHT:
|
||||
VectorSet( v_right, RI.vforward[1], -RI.vforward[0], 0.0f );
|
||||
dot = RI.vforward[2];
|
||||
if(( dot > 0.999848f ) || ( dot < -0.999848f )) // cos(1 degree) = 0.999848
|
||||
return; // invisible
|
||||
VectorSet( v_up, 0.0f, 0.0f, 1.0f );
|
||||
VectorSet( v_right, RI.vforward[1], -RI.vforward[0], 0.0f );
|
||||
VectorNormalize( v_right );
|
||||
break;
|
||||
case SPR_FWD_PARALLEL_ORIENTED:
|
||||
angle = e->angles[ROLL] * (M_PI * 2.0f / 360.0f);
|
||||
|
@ -923,14 +927,12 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||
}
|
||||
break;
|
||||
case SPR_FWD_PARALLEL: // normal sprite
|
||||
default:
|
||||
if( e->curstate.entityType == ET_TEMPENTITY )
|
||||
angle = e->angles[ROLL]; // for support rotating muzzleflashes
|
||||
else angle = 0.0f;
|
||||
default: // gold src support rotating sprites
|
||||
angle = e->angles[ROLL];
|
||||
|
||||
if( angle != 0.0f )
|
||||
{
|
||||
RotatePointAroundVector( v_up, RI.vforward, RI.vright, angle ); // make up
|
||||
RotatePointAroundVector( v_up, RI.vforward, RI.vright, angle-90.0f ); // make up
|
||||
CrossProduct( RI.vforward, v_up, v_right ); // make right
|
||||
}
|
||||
else
|
||||
|
|
|
@ -140,8 +140,16 @@ typedef struct host_parm_s
|
|||
int numsounds;
|
||||
} host_parm_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern host_parm_t host;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// build.c
|
||||
//
|
||||
|
|
|
@ -95,7 +95,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||
com.strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
||||
FS_StripExtension( entfilename );
|
||||
FS_DefaultExtension( entfilename, ".ent" );
|
||||
ents = Com_OpenScript( entfilename, NULL, 0 );
|
||||
ents = Com_OpenScriptExt( entfilename, NULL, 0, true );
|
||||
|
||||
if( !ents && lumplen >= 10 )
|
||||
{
|
||||
|
@ -679,7 +679,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||
com.strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
||||
FS_StripExtension( entfilename );
|
||||
FS_DefaultExtension( entfilename, ".ent" );
|
||||
ents = Com_OpenScript( entfilename, NULL, 0 );
|
||||
ents = Com_OpenScriptExt( entfilename, NULL, 0, true );
|
||||
|
||||
if( !ents && lumplen >= 10 )
|
||||
{
|
||||
|
|
|
@ -474,6 +474,8 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
S_Activate( fActivate, host.hWnd );
|
||||
Key_ClearStates(); // FIXME!!!
|
||||
|
||||
VGui_SetBounds();
|
||||
|
||||
if( host.state == HOST_FRAME )
|
||||
{
|
||||
SetForegroundWindow( hWnd );
|
||||
|
@ -501,6 +503,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
Cvar_SetFloat( "r_xpos", xPos + rect.left );
|
||||
Cvar_SetFloat( "r_ypos", yPos + rect.top );
|
||||
GetWindowRect( host.hWnd, &real_rect );
|
||||
VGui_SetBounds();
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
|
|
|
@ -520,7 +520,7 @@ pmtrace_t PM_PlayerTrace( playermove_t *pmove, vec3_t start, vec3_t end, int fla
|
|||
}
|
||||
|
||||
// g-cont. needs for global test!!!
|
||||
if( trace.allsolid || trace.startsolid || trace.fraction < total.fraction )
|
||||
if( trace.allsolid || /*trace.startsolid ||*/ trace.fraction < total.fraction )
|
||||
{
|
||||
trace.ent = i;
|
||||
|
||||
|
@ -532,7 +532,10 @@ pmtrace_t PM_PlayerTrace( playermove_t *pmove, vec3_t start, vec3_t end, int fla
|
|||
else total = trace;
|
||||
}
|
||||
else if( trace.startsolid )
|
||||
{
|
||||
total.startsolid = true;
|
||||
total.ent = i;
|
||||
}
|
||||
|
||||
if( i == 0 && ( flags & PM_WORLD_ONLY ))
|
||||
break; // done
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
#define FDECAL_USESAXIS 0x20 // Uses the s axis field to determine orientation (footprints)
|
||||
|
||||
// Max number of history commands to send ( 2 by default ) in case of dropped packets
|
||||
#define NUM_BACKUP_COMMAND_BITS 3
|
||||
#define NUM_BACKUP_COMMAND_BITS 4
|
||||
#define MAX_BACKUP_COMMANDS (1 << NUM_BACKUP_COMMAND_BITS)
|
||||
|
||||
// world size
|
||||
|
|
|
@ -219,6 +219,10 @@ friend class Image;
|
|||
|
||||
CEnginePanel *rootpanel = NULL;
|
||||
|
||||
void VGui_SetBounds( void )
|
||||
{
|
||||
}
|
||||
|
||||
void VGui_Startup( void )
|
||||
{
|
||||
if( rootpanel )
|
||||
|
|
|
@ -0,0 +1,208 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// vgi_int.c - vgui dll interaction
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "const.h"
|
||||
|
||||
#include<VGUI.h>
|
||||
#include<VGUI_App.h>
|
||||
#include<VGUI_Panel.h>
|
||||
#include<VGUI_SurfaceGL.h>
|
||||
#include<VGUI_ActionSignal.h>
|
||||
#include<VGUI_BorderLayout.h>
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
SurfaceGL::SurfaceGL( Panel* embeddedPanel ):Surface( embeddedPanel )
|
||||
{
|
||||
_embeddedPanel = embeddedPanel;
|
||||
}
|
||||
|
||||
bool SurfaceGL::recreateContext( void )
|
||||
{
|
||||
Msg( "recreate context\n" );
|
||||
return Surface::recreateContext();
|
||||
}
|
||||
|
||||
void SurfaceGL::createPopup(Panel* embeddedPanel)
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::pushMakeCurrent( Panel* panel, bool useInsets )
|
||||
{
|
||||
Surface::pushMakeCurrent( panel, useInsets );
|
||||
}
|
||||
|
||||
void SurfaceGL::popMakeCurrent( Panel* panel )
|
||||
{
|
||||
Surface::popMakeCurrent( panel );
|
||||
}
|
||||
|
||||
void SurfaceGL::makeCurrent( void )
|
||||
{
|
||||
Msg( "make current\n" );
|
||||
}
|
||||
|
||||
void SurfaceGL::swapBuffers( void )
|
||||
{
|
||||
Surface::swapBuffers();
|
||||
}
|
||||
|
||||
void SurfaceGL::setColor( int r, int g, int b )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::filledRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::outlinedRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextFont( Font* font )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextColor( int r, int g, int b )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setDrawPos( int x, int y )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::printText( const char *str, int strlen )
|
||||
{
|
||||
Msg( "Con_Printf( %s )\n", str );
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextureRGBA( int id, const char *rgba, int wide, int tall )
|
||||
{
|
||||
Msg( "SetTexture( %i )\n", id );
|
||||
}
|
||||
|
||||
void SurfaceGL::setTexture( int id )
|
||||
{
|
||||
Msg( "SetTexture( %i )\n", id );
|
||||
}
|
||||
|
||||
void SurfaceGL::texturedRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
class CEngineApp : public App
|
||||
{
|
||||
public:
|
||||
CEngineApp( bool externalMain ):App( externalMain )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void main( int argc, char* argv[] )
|
||||
{
|
||||
Msg( "App main()\n" );
|
||||
}
|
||||
|
||||
virtual void setCursorPos( int x, int y )
|
||||
{
|
||||
App::setCursorPos( x, y );
|
||||
Msg( "setCursorPos: %i %i\n", x, y );
|
||||
}
|
||||
|
||||
virtual void getCursorPos( int &x,int &y )
|
||||
{
|
||||
App::getCursorPos( x, y );
|
||||
Msg( "getCursorPos: %i %i\n", x, y );
|
||||
}
|
||||
virtual App* getApp( void )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
RECT window_rect;
|
||||
SurfaceGL *surface = NULL;
|
||||
CEngineApp *pApp = NULL;
|
||||
Panel *rootpanel = NULL;
|
||||
#define WND_BORDER 3
|
||||
|
||||
void VGui_SetBounds( void )
|
||||
{
|
||||
int head = GetSystemMetrics( SM_CYCAPTION ) + WND_BORDER;
|
||||
|
||||
GetWindowRect( host.hWnd, &window_rect );
|
||||
if( !rootpanel ) return;
|
||||
|
||||
rootpanel->setBounds( window_rect.left+3, window_rect.top+head, window_rect.right-3, window_rect.bottom-3 );
|
||||
}
|
||||
|
||||
void VGui_Startup( void )
|
||||
{
|
||||
if( rootpanel )
|
||||
{
|
||||
// rootpanel->reset();
|
||||
// rootpanel->setSize( menu.globals->scrWidth, menu.globals->scrHeight );
|
||||
return;
|
||||
}
|
||||
Scheme *pScheme = new Scheme();
|
||||
|
||||
pApp = new CEngineApp( true );
|
||||
pApp->setScheme( pScheme );
|
||||
|
||||
rootpanel = new Panel();
|
||||
rootpanel->setPaintEnabled( true );
|
||||
rootpanel->setPaintBorderEnabled( false );
|
||||
rootpanel->setPaintBackgroundEnabled( true );
|
||||
rootpanel->setVisible( true );
|
||||
rootpanel->setEnabled( true );
|
||||
rootpanel->setCursor( new Cursor( Cursor::dc_none ));
|
||||
|
||||
VGui_SetBounds();
|
||||
|
||||
surface = new SurfaceGL( rootpanel );
|
||||
|
||||
ASSERT( rootpanel->getApp() != NULL );
|
||||
ASSERT( rootpanel->getSurfaceBase() != NULL );
|
||||
}
|
||||
|
||||
void VGui_Shutdown( void )
|
||||
{
|
||||
delete rootpanel;
|
||||
delete surface;
|
||||
delete pApp;
|
||||
|
||||
rootpanel = NULL;
|
||||
surface = NULL;
|
||||
pApp = NULL;
|
||||
}
|
||||
|
||||
void VGui_Paint( void )
|
||||
{
|
||||
if( !rootpanel ) return;
|
||||
|
||||
pApp->externalTick();
|
||||
// rootpanel->paintBackground();
|
||||
}
|
||||
|
||||
void VGui_ViewportPaintBackground( int extents[4] )
|
||||
{
|
||||
if( !rootpanel ) return;
|
||||
|
||||
Msg( "ViewportPaintBackground()\n" );
|
||||
Panel *pVPanel = surface->getPanel();
|
||||
if( !pVPanel ) return;
|
||||
|
||||
rootpanel->setBounds( extents[0], extents[1], extents[2], extents[3] );
|
||||
// rootpanel->repaint();
|
||||
|
||||
// paint everything
|
||||
rootpanel->paintTraverse();
|
||||
}
|
||||
|
||||
void *VGui_GetPanel( void )
|
||||
{
|
||||
return (void *)rootpanel;
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// vgi_int.c - vgui dll interaction
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "const.h"
|
||||
|
||||
#include<VGUI.h>
|
||||
#include<VGUI_App.h>
|
||||
#include<VGUI_Panel.h>
|
||||
#include<VGUI_SurfaceGL.h>
|
||||
#include<VGUI_ActionSignal.h>
|
||||
#include<VGUI_BorderLayout.h>
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
void App::main(int argc,char* argv[])
|
||||
{
|
||||
}
|
||||
|
||||
SurfaceGL::SurfaceGL( Panel* embeddedPanel ):Surface( embeddedPanel )
|
||||
{
|
||||
_embeddedPanel = embeddedPanel;
|
||||
}
|
||||
|
||||
bool SurfaceGL::recreateContext( void )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SurfaceGL::createPopup(Panel* embeddedPanel)
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::pushMakeCurrent( Panel* panel, bool useInsets )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::popMakeCurrent( Panel* panel )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::makeCurrent( void )
|
||||
{
|
||||
Msg( "makeCurrent()\n" );
|
||||
}
|
||||
|
||||
void SurfaceGL::swapBuffers( void )
|
||||
{
|
||||
Msg( "swapBuffers()\n" );
|
||||
V_PostRender ();
|
||||
}
|
||||
|
||||
void SurfaceGL::setColor( int r, int g, int b )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::filledRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::outlinedRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextFont( Font* font )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextColor( int r, int g, int b )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::setDrawPos( int x, int y )
|
||||
{
|
||||
}
|
||||
|
||||
void SurfaceGL::printText( const char *str, int strlen )
|
||||
{
|
||||
Msg( "Con_Printf( %s )\n", str );
|
||||
}
|
||||
|
||||
void SurfaceGL::setTextureRGBA( int id, const char *rgba, int wide, int tall )
|
||||
{
|
||||
Msg( "SetTexture( %i )\n", id );
|
||||
}
|
||||
|
||||
void SurfaceGL::setTexture( int id )
|
||||
{
|
||||
Msg( "SetTexture( %i )\n", id );
|
||||
}
|
||||
|
||||
void SurfaceGL::texturedRect( int x0, int y0, int x1, int y1 )
|
||||
{
|
||||
}
|
||||
|
||||
class CEngineApp : public App
|
||||
{
|
||||
public:
|
||||
CEngineApp( bool externalMain ):App( externalMain )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void main( int argc, char* argv[] )
|
||||
{
|
||||
Msg( "App main()\n" );
|
||||
}
|
||||
|
||||
virtual void setCursorPos( int x, int y )
|
||||
{
|
||||
Msg( "setCursorPos: %i %i\n", x, y );
|
||||
}
|
||||
|
||||
virtual void getCursorPos( int &x,int &y )
|
||||
{
|
||||
App::getCursorPos( x, y );
|
||||
Msg( "getCursorPos: %i %i\n", x, y );
|
||||
}
|
||||
virtual App* getApp( void )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
SurfaceGL *surface = NULL;
|
||||
CEngineApp *pApp = NULL;
|
||||
Panel *rootpanel = NULL;
|
||||
|
||||
void VGui_SetBounds( void )
|
||||
{
|
||||
convar_t *r_xpos = Cvar_FindVar( "r_xpos" );
|
||||
convar_t *r_ypos = Cvar_FindVar( "r_ypos" );
|
||||
|
||||
if( !rootpanel || !r_xpos || !r_ypos ) return;
|
||||
|
||||
rootpanel->setBounds( r_xpos->integer, r_ypos->integer, menu.globals->scrWidth, menu.globals->scrHeight );
|
||||
}
|
||||
|
||||
void VGui_Startup( void )
|
||||
{
|
||||
if( rootpanel )
|
||||
{
|
||||
// rootpanel->reset();
|
||||
return;
|
||||
}
|
||||
|
||||
pApp = new CEngineApp( true );
|
||||
rootpanel = new Panel( 0, 0, menu.globals->scrWidth, menu.globals->scrHeight );
|
||||
surface = new SurfaceGL( rootpanel );
|
||||
|
||||
rootpanel->setVisible( true );
|
||||
rootpanel->setEnabled( true );
|
||||
// rootpanel->setPaintEnabled( false );
|
||||
// rootpanel->setPaintBorderEnabled( false );
|
||||
// rootpanel->setPaintBackgroundEnabled( true );
|
||||
|
||||
VGui_SetBounds();
|
||||
|
||||
ASSERT( rootpanel->getApp() != NULL );
|
||||
ASSERT( rootpanel->getSurfaceBase() != NULL );
|
||||
ASSERT( rootpanel->getApp() == pApp );
|
||||
}
|
||||
|
||||
void VGui_Shutdown( void )
|
||||
{
|
||||
delete rootpanel;
|
||||
delete surface;
|
||||
delete pApp;
|
||||
|
||||
rootpanel = NULL;
|
||||
surface = NULL;
|
||||
pApp = NULL;
|
||||
}
|
||||
|
||||
void VGui_Paint( void )
|
||||
{
|
||||
if( !rootpanel ) return;
|
||||
|
||||
pApp->externalTick();
|
||||
// rootpanel->paintBackground();
|
||||
}
|
||||
|
||||
void VGui_ViewportPaintBackground( int extents[4] )
|
||||
{
|
||||
if( !rootpanel ) return;
|
||||
|
||||
Msg( "ViewportPaintBackground( %i, %i, %i, %i )\n", extents[0], extents[1], extents[2], extents[3] );
|
||||
|
||||
V_RenderView();
|
||||
rootpanel->repaint();
|
||||
|
||||
// paint everything
|
||||
// rootpanel->paintTraverse();
|
||||
}
|
||||
|
||||
void *VGui_GetPanel( void )
|
||||
{
|
||||
return (void *)rootpanel;
|
||||
}
|
|
@ -96,7 +96,7 @@ void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_
|
|||
trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch )
|
||||
{
|
||||
// g-cont. needs for global test!!!
|
||||
if( trace->allsolid || trace->startsolid || trace->fraction < cliptrace->fraction )
|
||||
if( trace->allsolid || /*trace->startsolid ||*/ trace->fraction < cliptrace->fraction )
|
||||
{
|
||||
trace->ent = touch;
|
||||
|
||||
|
@ -108,8 +108,10 @@ trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch
|
|||
else *cliptrace = *trace;
|
||||
}
|
||||
else if( trace->startsolid )
|
||||
{
|
||||
cliptrace->startsolid = true;
|
||||
|
||||
cliptrace->ent = touch;
|
||||
}
|
||||
return *cliptrace;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,9 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
|
|||
netclient = SV_ClientFromEdict( ent, true );
|
||||
player = ( netclient != NULL );
|
||||
|
||||
// clear modelindex if model is not set
|
||||
if( !ent->v.model ) ent->v.modelindex = 0;
|
||||
|
||||
// add entity to the net packet
|
||||
if( svgame.dllFuncs.pfnAddToFullPack( state, e, ent, pClient, sv.hostflags, player, pset ))
|
||||
{
|
||||
|
|
|
@ -126,7 +126,7 @@ void SV_SetModel( edict_t *ent, const char *name )
|
|||
i = SV_ModelIndex( name );
|
||||
if( i == 0 ) return;
|
||||
|
||||
ent->v.model = MAKE_STRING( sv.model_precache[i] );
|
||||
ent->v.model = sv.model_precache[i] - svgame.globals->pStringBase;
|
||||
ent->v.modelindex = i;
|
||||
|
||||
mod_type = Mod_GetType( ent->v.modelindex );
|
||||
|
@ -526,7 +526,7 @@ script_t *SV_GetEntityScript( const char *filename, int *flags )
|
|||
|
||||
// check for entfile too
|
||||
com.strncpy( entfilename, va( "maps/%s.ent", filename ), sizeof( entfilename ));
|
||||
ents = Com_OpenScript( entfilename, NULL, 0 );
|
||||
ents = Com_OpenScriptExt( entfilename, NULL, 0, true ); // grab .ent files only from gamedir
|
||||
|
||||
if( !ents && lumplen >= 10 )
|
||||
{
|
||||
|
@ -607,6 +607,8 @@ void SV_InitEdict( edict_t *pEdict )
|
|||
ASSERT( pEdict );
|
||||
ASSERT( pEdict->pvPrivateData == NULL );
|
||||
|
||||
Mem_Set( &pEdict->v, 0, sizeof( entvars_t ));
|
||||
|
||||
pEdict->v.pContainingEntity = pEdict; // make cross-links for consistency
|
||||
pEdict->pvPrivateData = NULL; // will be alloced later by pfnAllocPrivateData
|
||||
pEdict->free = false;
|
||||
|
@ -641,11 +643,16 @@ void SV_FreeEdict( edict_t *pEdict )
|
|||
pEdict->pvPrivateData = NULL;
|
||||
}
|
||||
|
||||
Mem_Set( &pEdict->v, 0, sizeof( entvars_t ));
|
||||
// Mem_Set( &pEdict->v, 0, sizeof( entvars_t ));
|
||||
|
||||
// mark edict as freed
|
||||
pEdict->freetime = sv_time();
|
||||
pEdict->freetime = sv.time;
|
||||
pEdict->serialnumber++; // now EHANDLE is invalidate
|
||||
pEdict->v.solid = SOLID_NOT;
|
||||
pEdict->v.flags = 0;
|
||||
pEdict->v.model = 0;
|
||||
pEdict->v.takedamage = 0;
|
||||
pEdict->v.modelindex = 0;
|
||||
pEdict->v.nextthink = -1;
|
||||
pEdict->free = true;
|
||||
}
|
||||
|
@ -1120,9 +1127,11 @@ edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, cons
|
|||
case FIELD_MODELNAME:
|
||||
case FIELD_SOUNDNAME:
|
||||
t = STRING( *(string_t *)&((byte *)&ed->v)[desc->fieldOffset] );
|
||||
if( !t ) t = "";
|
||||
if( !com.strcmp( t, pszValue ))
|
||||
return ed;
|
||||
if( t != NULL && t != svgame.globals->pStringBase )
|
||||
{
|
||||
if( !com.strcmp( t, pszValue ))
|
||||
return ed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1264,7 +1273,8 @@ pfnEntitiesInPVS
|
|||
*/
|
||||
edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
||||
{
|
||||
edict_t *pEdict, *chain;
|
||||
edict_t *chain;
|
||||
edict_t *pEdict, *pEdict2;
|
||||
vec3_t viewpoint;
|
||||
int i;
|
||||
|
||||
|
@ -1273,13 +1283,30 @@ edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
|||
|
||||
VectorAdd( pplayer->v.origin, pplayer->v.view_ofs, viewpoint );
|
||||
|
||||
for( chain = NULL, i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
||||
for( chain = EDICT_NUM( 0 ), i = 1; i < svgame.numEntities; i++ )
|
||||
{
|
||||
pEdict = EDICT_NUM( i );
|
||||
|
||||
if( !SV_IsValidEdict( pEdict )) continue;
|
||||
|
||||
if( SV_BoxInPVS( viewpoint, pEdict->v.absmin, pEdict->v.absmax ))
|
||||
if( pEdict->v.movetype == MOVETYPE_FOLLOW && SV_IsValidEdict( pEdict->v.aiment ))
|
||||
{
|
||||
// HACKHACK to transfer weapons across the levels
|
||||
if( pEdict->v.aiment == EDICT_NUM( 1 ))
|
||||
{
|
||||
pEdict->v.chain = chain;
|
||||
chain = pEdict;
|
||||
continue;
|
||||
}
|
||||
|
||||
pEdict2 = pEdict->v.aiment;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEdict2 = pEdict;
|
||||
}
|
||||
|
||||
if( SV_BoxInPVS( viewpoint, pEdict2->v.absmin, pEdict2->v.absmax ))
|
||||
{
|
||||
pEdict->v.chain = chain;
|
||||
chain = pEdict;
|
||||
|
|
|
@ -164,7 +164,7 @@ script_t *SV_EntityScript( void )
|
|||
FS_StripExtension( entfilename );
|
||||
FS_DefaultExtension( entfilename, ".ent" );
|
||||
|
||||
if(( ents = Com_OpenScript( entfilename, NULL, 0 )))
|
||||
if(( ents = Com_OpenScriptExt( entfilename, NULL, 0, true )))
|
||||
{
|
||||
MsgDev( D_INFO, "^2Read entity patch:^7 %s\n", entfilename );
|
||||
return ents;
|
||||
|
@ -269,7 +269,8 @@ void SV_ActivateServer( void )
|
|||
|
||||
numFrames = (sv.loadgame) ? 1 : 2;
|
||||
svgame.globals->force_retouch++; // g-cont. this is correct ?
|
||||
host.frametime = 0.1f;
|
||||
if( !sv.loadgame || svgame.globals->changelevel )
|
||||
host.frametime = 0.1f;
|
||||
|
||||
// run some frames to allow everything to settle
|
||||
for( i = 0; i < numFrames; i++ )
|
||||
|
@ -429,6 +430,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
sv.paused = paused;
|
||||
sv.loadgame = loadgame;
|
||||
sv.time = 1.0f; // server spawn time it's always 1.0 second
|
||||
svgame.globals->time = sv.time;
|
||||
|
||||
// initialize buffers
|
||||
BF_Init( &sv.datagram, "Datagram", sv.datagram_buf, sizeof( sv.datagram_buf ));
|
||||
|
|
|
@ -414,12 +414,9 @@ int SV_FlyMove( edict_t *ent, float time, trace_t *steptrace )
|
|||
if( trace.plane.normal[2] > 0.7f )
|
||||
{
|
||||
blocked |= 1; // floor
|
||||
#if 1
|
||||
|
||||
if( trace.ent->v.solid == SOLID_BSP || trace.ent->v.solid == SOLID_SLIDEBOX ||
|
||||
trace.ent->v.movetype == MOVETYPE_PUSHSTEP || (trace.ent->v.flags & FL_CLIENT))
|
||||
#else
|
||||
if( trace.ent->v.solid == SOLID_BSP )
|
||||
#endif
|
||||
{
|
||||
ent->v.flags |= FL_ONGROUND;
|
||||
ent->v.groundentity = trace.ent;
|
||||
|
@ -575,15 +572,11 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
|
|||
type = MOVE_NOMONSTERS; // only clip against bmodels
|
||||
else type = MOVE_NORMAL;
|
||||
|
||||
// prevent items and ammo to stuck at spawnpoint
|
||||
if( ent->v.solid == SOLID_TRIGGER )
|
||||
trace = SV_Move( ent->v.origin, vec3_origin, vec3_origin, end, type, ent );
|
||||
else trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
|
||||
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
|
||||
|
||||
if( !trace.allsolid )
|
||||
if( trace.fraction != 0.0f )
|
||||
{
|
||||
VectorCopy( trace.endpos, ent->v.origin );
|
||||
SV_LinkEdict( ent, true );
|
||||
|
||||
if( apush[YAW] && ent->v.flags & FL_CLIENT && ( cl = SV_ClientFromEdict( ent, true )) != NULL )
|
||||
{
|
||||
|
@ -593,11 +586,11 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
|
|||
|
||||
// don't rotate pushables!
|
||||
if( ent->v.movetype != MOVETYPE_PUSHSTEP )
|
||||
{
|
||||
ent->v.angles[YAW] += trace.fraction * apush[YAW];
|
||||
}
|
||||
}
|
||||
|
||||
SV_LinkEdict( ent, true );
|
||||
|
||||
if( blocked ) *blocked = !VectorCompare( ent->v.origin, end ); // can't move full distance
|
||||
|
||||
// so we can run impact function afterwards.
|
||||
|
@ -741,7 +734,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
|||
sv_pushed_t *p, *pushed_p;
|
||||
edict_t *check;
|
||||
|
||||
if( VectorIsNull( pusher->v.velocity ))
|
||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.velocity ))
|
||||
{
|
||||
pusher->v.ltime += movetime;
|
||||
return NULL;
|
||||
|
@ -768,9 +761,6 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
|||
pusher->v.ltime += movetime;
|
||||
oldsolid = pusher->v.solid;
|
||||
|
||||
// this is non-solid pusher (e.g. water)
|
||||
if( oldsolid == SOLID_NOT ) return NULL;
|
||||
|
||||
// see if any solid entities are inside the final position
|
||||
num_moved = 0;
|
||||
for( e = 1; e < svgame.numEntities; e++ )
|
||||
|
@ -837,12 +827,6 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
|||
}
|
||||
return check;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( check->v.movetype == MOVETYPE_WALK && lmove[2] < 0.0f )
|
||||
check->v.groundentity = NULL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -862,7 +846,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
vec3_t org, org2, temp;
|
||||
edict_t *check;
|
||||
|
||||
if( VectorIsNull( pusher->v.avelocity ))
|
||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.avelocity ))
|
||||
{
|
||||
pusher->v.ltime += movetime;
|
||||
return NULL;
|
||||
|
@ -889,9 +873,6 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
pusher->v.ltime += movetime;
|
||||
oldsolid = pusher->v.solid;
|
||||
|
||||
// this is non-solid pusher (e.g. water)
|
||||
if( oldsolid == SOLID_NOT ) return NULL;
|
||||
|
||||
// create pusher final position
|
||||
Matrix4x4_CreateFromEntity( end_l, pusher->v.angles, pusher->v.origin, 1.0f );
|
||||
|
||||
|
@ -972,10 +953,6 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
}
|
||||
return check;
|
||||
}
|
||||
else
|
||||
{
|
||||
SV_AngularMove( check, movetime, pusher->v.friction );
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -530,7 +530,7 @@ static void PM_SetupMove( playermove_t *pmove, edict_t *clent, usercmd_t *ucmd,
|
|||
pmove->deadflag = clent->v.deadflag;
|
||||
pmove->spectator = 0; // FIXME: implement
|
||||
pmove->movetype = clent->v.movetype;
|
||||
pmove->onground = -1; // will be set later
|
||||
if( pmove->multiplayer ) pmove->onground = -1;
|
||||
pmove->waterlevel = clent->v.waterlevel;
|
||||
pmove->watertype = clent->v.watertype;
|
||||
pmove->maxspeed = svgame.movevars.maxspeed;
|
||||
|
@ -567,16 +567,6 @@ static void PM_SetupMove( playermove_t *pmove, edict_t *clent, usercmd_t *ucmd,
|
|||
|
||||
SV_AddLinksToPmove( sv_areanodes, absmin, absmax );
|
||||
SV_AddLaddersToPmove( sv_areanodes, absmin, absmax );
|
||||
|
||||
// setup ground entity
|
||||
for( i = 0; clent->v.groundentity && i < svgame.pmove->numphysent; i++ )
|
||||
{
|
||||
if( NUM_FOR_EDICT( clent->v.groundentity ) == svgame.pmove->physents[i].info )
|
||||
{
|
||||
pmove->onground = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void PM_FinishMove( playermove_t *pmove, edict_t *clent )
|
||||
|
@ -615,10 +605,21 @@ static void PM_FinishMove( playermove_t *pmove, edict_t *clent )
|
|||
VectorCopy( pmove->vuser2, clent->v.vuser2 );
|
||||
VectorCopy( pmove->vuser3, clent->v.vuser3 );
|
||||
VectorCopy( pmove->vuser4, clent->v.vuser4 );
|
||||
|
||||
#if 1
|
||||
if( svgame.pmove->onground == -1 )
|
||||
{
|
||||
clent->v.flags &= ~FL_ONGROUND;
|
||||
}
|
||||
else if( pmove->onground >= 0 && pmove->onground < pmove->numphysent )
|
||||
{
|
||||
clent->v.flags |= FL_ONGROUND;
|
||||
clent->v.groundentity = EDICT_NUM( svgame.pmove->physents[svgame.pmove->onground].info );
|
||||
}
|
||||
#else
|
||||
if( pmove->onground >= 0 && pmove->onground < pmove->numphysent )
|
||||
clent->v.groundentity = EDICT_NUM( pmove->physents[pmove->onground].info );
|
||||
else clent->v.groundentity = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int nofind = 0;
|
||||
|
|
|
@ -1162,13 +1162,6 @@ int SV_LoadGameState( char const *level, qboolean createPlayers )
|
|||
|
||||
SV_InitEdict( pent );
|
||||
pent = SV_AllocPrivateData( pent, pEntInfo->classname );
|
||||
SaveRestore_Seek( pSaveData, pEntInfo->location );
|
||||
|
||||
if( svgame.dllFuncs.pfnRestore( pent, pSaveData, false ) < 0 )
|
||||
{
|
||||
pEntInfo->pent = NULL;
|
||||
pent->v.flags |= FL_KILLME;
|
||||
}
|
||||
}
|
||||
else if(( pEntInfo->id > 0 ) && ( pEntInfo->id < svgame.globals->maxClients + 1 ))
|
||||
{
|
||||
|
@ -1207,18 +1200,15 @@ int SV_LoadGameState( char const *level, qboolean createPlayers )
|
|||
{
|
||||
pEntInfo = &pSaveData->pTable[i];
|
||||
|
||||
if( pEntInfo->id != 0 )
|
||||
{
|
||||
pent = pEntInfo->pent;
|
||||
SaveRestore_Seek( pSaveData, pEntInfo->location );
|
||||
pent = pEntInfo->pent;
|
||||
SaveRestore_Seek( pSaveData, pEntInfo->location );
|
||||
|
||||
if( pent )
|
||||
if( pent )
|
||||
{
|
||||
if( svgame.dllFuncs.pfnRestore( pent, pSaveData, false ) < 0 )
|
||||
{
|
||||
if( svgame.dllFuncs.pfnRestore( pent, pSaveData, false ) < 0 )
|
||||
{
|
||||
pEntInfo->pent = NULL;
|
||||
pent->v.flags |= FL_KILLME;
|
||||
}
|
||||
pEntInfo->pent = NULL;
|
||||
pent->v.flags |= FL_KILLME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -567,26 +567,35 @@ void SV_LinkEdict( edict_t *ent, qboolean touch_triggers )
|
|||
// set the abs box
|
||||
svgame.dllFuncs.pfnSetAbsBox( ent );
|
||||
|
||||
// link to PVS leafs
|
||||
ent->num_leafs = 0;
|
||||
|
||||
if( ent->v.modelindex )
|
||||
if( ent->v.movetype == MOVETYPE_FOLLOW && SV_IsValidEdict( ent->v.aiment ))
|
||||
{
|
||||
ent->headnode = -1;
|
||||
SV_FindTouchedLeafs( ent, sv.worldmodel->nodes );
|
||||
ent->headnode = ent->v.aiment->headnode;
|
||||
ent->num_leafs = ent->v.aiment->num_leafs;
|
||||
Mem_Copy( ent->leafnums, ent->v.aiment->leafnums, sizeof( ent->leafnums ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// link to PVS leafs
|
||||
ent->num_leafs = 0;
|
||||
|
||||
// if none of the leafs were inside the map, the
|
||||
// entity is outside the world and can be considered unlinked
|
||||
if( !ent->num_leafs )
|
||||
if( ent->v.modelindex )
|
||||
{
|
||||
SV_CheckForOutside( ent );
|
||||
ent->headnode = -1;
|
||||
return;
|
||||
}
|
||||
SV_FindTouchedLeafs( ent, sv.worldmodel->nodes );
|
||||
|
||||
if( ent->num_leafs > MAX_ENT_LEAFS )
|
||||
ent->num_leafs = 0; // so we use headnode instead
|
||||
else ent->headnode = -1; // use normal leafs check
|
||||
// if none of the leafs were inside the map, the
|
||||
// entity is outside the world and can be considered unlinked
|
||||
if( !ent->num_leafs )
|
||||
{
|
||||
SV_CheckForOutside( ent );
|
||||
ent->headnode = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if( ent->num_leafs > MAX_ENT_LEAFS )
|
||||
ent->num_leafs = 0; // so we use headnode instead
|
||||
else ent->headnode = -1; // use normal leafs check
|
||||
}
|
||||
}
|
||||
|
||||
// ignore not solid bodies
|
||||
|
|
|
@ -1107,7 +1107,7 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
|
|||
token_t token;
|
||||
|
||||
if( !GameInfo ) return false;
|
||||
script = PS_LoadScript( filename, NULL, 0 );
|
||||
script = PS_LoadScript( filename, NULL, 0, false );
|
||||
if( !script ) return false;
|
||||
|
||||
// setup default values
|
||||
|
@ -1257,7 +1257,7 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
|
|||
|
||||
if( !GameInfo ) return false; // no dest
|
||||
|
||||
script = PS_LoadScript( filepath, NULL, 0 );
|
||||
script = PS_LoadScript( filepath, NULL, 0, false );
|
||||
if( !script ) return false;
|
||||
|
||||
// setup default values
|
||||
|
@ -2306,6 +2306,25 @@ byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr )
|
|||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
FS_OpenFile
|
||||
|
||||
Simply version of FS_Open
|
||||
============
|
||||
*/
|
||||
file_t *FS_OpenFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
||||
{
|
||||
file_t *file = FS_Open( path, "rb", gamedironly );
|
||||
|
||||
if( filesizeptr )
|
||||
{
|
||||
if( file ) *filesizeptr = file->real_length;
|
||||
else *filesizeptr = 0;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
void FS_FreeFile( void *buffer )
|
||||
{
|
||||
if( buffer && _is_allocated( fs_mempool, buffer ))
|
||||
|
|
|
@ -325,6 +325,7 @@ int W_Check( const char *filename );
|
|||
void W_Close( wfile_t *wad );
|
||||
|
||||
// simply files managment interface
|
||||
file_t *FS_OpenFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||
byte *FS_LoadFile (const char *path, fs_offset_t *filesizeptr );
|
||||
qboolean FS_WriteFile (const char *filename, const void *data, fs_offset_t len);
|
||||
void FS_FreeFile( void *buffer );
|
||||
|
@ -512,7 +513,7 @@ void PS_SetPunctuationsTable( script_t *script, punctuation_t *punctuationsTable
|
|||
void PS_ResetScript( script_t *script );
|
||||
qboolean PS_EndOfScript( script_t *script );
|
||||
|
||||
script_t *PS_LoadScript( const char *filename, const char *buf, size_t size );
|
||||
script_t *PS_LoadScript( const char *filename, const char *buf, size_t size, qboolean gamedironly );
|
||||
void PS_FreeScript( script_t *script );
|
||||
|
||||
//
|
||||
|
|
|
@ -1445,16 +1445,38 @@ static script_t *PS_NewScript( const char *filename, const char *buffer, size_t
|
|||
PS_LoadScriptFile
|
||||
=================
|
||||
*/
|
||||
script_t *PS_LoadScript( const char *filename, const char *buf, size_t size )
|
||||
script_t *PS_LoadScript( const char *filename, const char *buf, size_t size, qboolean gamedironly )
|
||||
{
|
||||
script_t *script;
|
||||
|
||||
if( !buf || size <= 0 )
|
||||
{
|
||||
// trying to get script from disk
|
||||
buf = FS_LoadFile( filename, &size );
|
||||
script = PS_NewScript( filename, buf, size );
|
||||
if( buf ) Mem_Free((char *)buf );
|
||||
file_t *f;
|
||||
|
||||
f = FS_OpenFile( filename, &size, gamedironly );
|
||||
if( !f || size <= 0 ) return NULL;
|
||||
|
||||
// allocate the script_t
|
||||
script = Mem_Alloc( Sys.scriptpool, sizeof( script_t ));
|
||||
com.strncpy( script->name, filename, sizeof( script->name ));
|
||||
script->buffer = Mem_Alloc( Sys.scriptpool, size + 1 ); // escape char
|
||||
|
||||
FS_Read( f, script->buffer, size );
|
||||
script->text = script->buffer;
|
||||
script->allocated = true;
|
||||
script->size = size;
|
||||
script->line = 1;
|
||||
|
||||
script->punctuations = ps_punctuationsTable;
|
||||
script->tokenAvailable = false;
|
||||
script->token.type = TT_EMPTY;
|
||||
script->token.subType = 0;
|
||||
script->token.line = 1;
|
||||
script->token.string[0] = 0;
|
||||
script->token.length = 0;
|
||||
script->token.floatValue = 0.0;
|
||||
script->token.integerValue = 0;
|
||||
FS_Close( f );
|
||||
}
|
||||
else script = PS_NewScript( filename, buf, size ); // from memory
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void Sys_GetStdAPI( void )
|
|||
com.FunctionFromName = Com_FunctionFromName;
|
||||
com.FreeLibrary = Com_FreeLibrary;
|
||||
|
||||
com.Com_OpenScript = PS_LoadScript; // loading script into buffer
|
||||
com.Com_LoadScript = PS_LoadScript; // loading script into buffer
|
||||
com.Com_CloseScript = PS_FreeScript; // release current script
|
||||
com.Com_ResetScript = PS_ResetScript; // jump to start of scriptfile
|
||||
com.Com_EndOfScript = PS_EndOfScript; // returns true if end of script reached
|
||||
|
|
|
@ -3281,6 +3281,8 @@ void PM_Move ( struct playermove_s *ppmove, int server )
|
|||
assert( pm_shared_initialized );
|
||||
|
||||
pmove = ppmove;
|
||||
|
||||
// pmove->Con_Printf( "PM_Move: %g, frametime %g, onground %i\n", pmove->time, pmove->frametime, pmove->onground );
|
||||
|
||||
PM_PlayerMove( ( server != 0 ) ? true : false );
|
||||
|
||||
|
|
|
@ -520,7 +520,7 @@ typedef struct stdilib_api_s
|
|||
void (*FreeLibrary)( void *hInstance );
|
||||
|
||||
// script machine base functions
|
||||
script_t *(*Com_OpenScript)( const char *filename, const char *buf, size_t size );
|
||||
script_t *(*Com_LoadScript)( const char *filename, const char *buf, size_t size, qboolean gamedironly );
|
||||
void (*Com_CloseScript)( script_t *script ); // release current script
|
||||
void (*Com_ResetScript)( script_t *script ); // jump to start of scriptfile
|
||||
qboolean (*Com_EndOfScript)( script_t *script ); // returns true if end of script reached
|
||||
|
@ -772,7 +772,8 @@ struct convar_s
|
|||
parsing manager funcs
|
||||
==========================================
|
||||
*/
|
||||
#define Com_OpenScript com.Com_OpenScript
|
||||
#define Com_OpenScript( fn, buf, siz ) com.Com_LoadScript( fn, buf, siz, false )
|
||||
#define Com_OpenScriptExt com.Com_LoadScript
|
||||
#define Com_CloseScript com.Com_CloseScript
|
||||
#define Com_ResetScript com.Com_ResetScript
|
||||
#define Com_SkipBracedSection com.Com_SkipBracedSection
|
||||
|
|
Reference in New Issue