10 Dec 2011

This commit is contained in:
g-cont 2011-12-10 00:00:00 +04:00 committed by Alibek Omarov
parent f26cd6d73e
commit 7739f5d071
25 changed files with 163 additions and 120 deletions

View File

@ -1,4 +1,4 @@
build ????
build 1766
Client: add command "on"-"off" for virtual CD-player
Client: add command "snapshot" that save screenshots into root folder
@ -50,7 +50,29 @@ Engine: fix potentially crash during parsing titles.txt when file is empty
Engine: increase MAX_VALUE field up to 2048 characters
Console: rename con_gamemaps to con_mapfilter
Sound: add check by PVS for dynamic entity channels
Sound: add sound culling by geometry (cvar 's_cull' for enable or disable)
Sound: add sound culling by geometry (cvar 's_cull' for enable or disable)
Server: fix changelevel bug
Engine: fix sound pathes with backward slash
Engine: rewrite COM_LoadFile and LoadFileForMe for use malloc instead of engine Mem_Alloc
Server: check date for entitypatch to avoid loading too old pathes (when map is never than path)
Server: bug fixed in CreateNamedEntity (on create not existed entities).
Server: rewrite engine func pfnAlertMessage to avoid crash in AM:Rebrith
Server: align memory for edicts by 4 (this help to avoid crash in Poke646)
Render: bugfixed with rotational brush culling (perfomance)
Server: changelevel bug fixed (accumulate global entities)
Server: changelevel bug when entitypath on new level is too old (new level is never than him entitypath)
Server: physical inetrface for custom physic implementation is updated to version 5
Physic: fix bug with MOVETYPE_COMPOUND
Server: fix bug with force_retouch on start the level (to avoid crash in Todesangst2 on t2e1m10)
Render: fix rendering for FACE_UPRIGHT sprite types (doom-like sprite monsters)
Protocol: shifted up additional EF_ flags to avoid collisions with Trinity Renderers
Render: now hardware gamma-control is fixed
Client: implement new render interface for custom renderer implementation (current version is 12)
Client: added two new funcstions into event API (IndexForEvent and EventForIndex)
Client: added new function into IEngineStudio interface (StudioGetTexture) for custom rendering implementation
Client: passed server beam entity through client function HUD_AddEntity, make force to add menu entity (player setup)
Client: passed static client entities through client function HUD_AddEntity
Physic: add support for rotational water and triggers
build 1662

View File

@ -208,6 +208,8 @@ typedef struct mextrasurf_s
int mirrortexturenum; // gl texnum
float mirrormatrix[4][4];
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
int reserved[8]; // just for future expansions or mod-makers
} mextrasurf_t;
typedef struct hull_s

View File

@ -109,7 +109,7 @@ typedef struct render_api_s
long (*AVI_GetAudioChunk)( void *Avi, char *audiodata, long offset, long length );
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, const byte *data );
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
void (*AVI_FreeVideo)( void *Avi );
int (*AVI_IsActive)( void *Avi );
} render_api_t;
@ -126,6 +126,8 @@ typedef struct render_interface_s
void (*GL_OrthoBounds)( const float *mins, const float *maxs );
// handle decals which hit mod_studio or mod_sprite
void (*R_DecalShoot)( int decalTexture, struct cl_entity_s *ent, struct model_s *mod, const float *pos, int flags );
// detach all entity effects on remove
void (*CL_EntityRemoved)( struct cl_entity_s *ent, qboolean removedFromServer );
} render_interface_t;
#endif//RENDER_API_H

View File

@ -476,12 +476,17 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
Msg( "Entity %i was removed from server\n", newnum );
else Msg( "Entity %i was removed from delta-message\n", newnum );
#endif
#if 0
// waiting for static entity implimentation
if( state->number == -1 )
R_RemoveEfrags( ent );
#endif
// tell the client about removed entity
if( clgame.drawFuncs.CL_EntityRemoved )
{
// build lightmaps on the client-side
clgame.drawFuncs.CL_EntityRemoved( ent, ( state->number == - 1));
}
// entity was delta removed
return;
}

View File

@ -204,7 +204,7 @@ int CL_TruePointContents( const vec3_t p )
int i, contents;
int oldhull;
hull_t *hull;
vec3_t test;
vec3_t test, offset;
physent_t *pe;
// sanity check
@ -228,11 +228,19 @@ int CL_TruePointContents( const vec3_t p )
// check water brushes accuracy
clgame.pmove->usehull = 2;
hull = PM_HullForBsp( pe, clgame.pmove, test );
hull = PM_HullForBsp( pe, clgame.pmove, offset );
clgame.pmove->usehull = oldhull;
// offset the test point appropriately for this hull.
VectorSubtract( p, test, test );
VectorSubtract( p, offset, test );
if( (pe->model->flags & MODEL_HAS_ORIGIN) && !VectorIsNull( pe->angles ))
{
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_VectorITransform( matrix, p, test );
}
// test hull for intersection with this model
if( PM_HullPointContents( hull, hull->firstclipnode, test ) == CONTENTS_EMPTY )
@ -256,7 +264,7 @@ int CL_WaterEntity( const float *rgflPos )
{
physent_t *pe;
hull_t *hull;
vec3_t test;
vec3_t test, offset;
int i, oldhull;
if( !rgflPos ) return -1;
@ -276,11 +284,19 @@ int CL_WaterEntity( const float *rgflPos )
// check water brushes accuracy
clgame.pmove->usehull = 2;
hull = PM_HullForBsp( pe, clgame.pmove, test );
hull = PM_HullForBsp( pe, clgame.pmove, offset );
clgame.pmove->usehull = oldhull;
// offset the test point appropriately for this hull.
VectorSubtract( rgflPos, test, test );
VectorSubtract( rgflPos, offset, test );
if( (pe->model->flags & MODEL_HAS_ORIGIN) && !VectorIsNull( pe->angles ))
{
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_VectorITransform( matrix, rgflPos, test );
}
// test hull for intersection with this model
if( PM_HullPointContents( hull, hull->firstclipnode, test ) == CONTENTS_EMPTY )

View File

@ -126,8 +126,6 @@ void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
{
modelIndex = CL_FindModelIndex( pmodel->name );
Mod_GetFrames( modelIndex, &frameCount );
VectorCopy( pmodel->mins, pTemp->entity.curstate.mins );
VectorCopy( pmodel->maxs, pTemp->entity.curstate.maxs );
}
else
{

View File

@ -582,6 +582,7 @@ void R_ShowTextures( void )
case TEX_LIGHTMAP:
case TEX_VGUI:
case TEX_DETAIL:
case TEX_CUSTOM:
// draw lightmaps as big images
base_w = 5;
base_h = 4;

View File

@ -804,12 +804,10 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos
// transform decal position in local bmodel space
if( !VectorIsNull( ent->angles ))
{
matrix4x4 matrix, imatrix;
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, ent->angles, ent->origin, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, pos, pos_l );
Matrix4x4_VectorITransform( matrix, pos, pos_l );
}
else
{

View File

@ -192,25 +192,28 @@ void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, c
R_UploadStretchRaw
=============
*/
void R_UploadStretchRaw( int texture, int cols, int rows, const byte *data )
void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height, const byte *data )
{
byte *raw = NULL;
gltexture_t *tex;
if( !GL_Support( GL_ARB_TEXTURE_NPOT_EXT ))
{
int width = 1, height = 1;
// check the dimensions
width = NearestPOW( cols, true );
height = NearestPOW( rows, false );
width = NearestPOW( width, true );
height = NearestPOW( height, false );
}
else
{
width = bound( 128, width, glConfig.max_2d_texture_size );
height = bound( 128, height, glConfig.max_2d_texture_size );
}
if( cols != width || rows != height )
{
raw = GL_ResampleTexture( data, cols, rows, width, height, false );
cols = width;
rows = height;
}
if( cols != width || rows != height )
{
raw = GL_ResampleTexture( data, cols, rows, width, height, false );
cols = width;
rows = height;
}
else
{

View File

@ -285,7 +285,7 @@ void R_ClearDecals( void );
//
void R_Set2DMode( qboolean enable );
void R_DrawTileClear( int x, int y, int w, int h );
void R_UploadStretchRaw( int texture, int cols, int rows, const byte *data );
void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height, const byte *data );
//
// gl_image.c

View File

@ -399,7 +399,6 @@ void R_FindBmodelMirrors( cl_entity_t *e, qboolean static_entity )
model_t *clmodel;
qboolean rotated;
int i, clipFlags;
matrix4x4 imatrix;
clmodel = e->model;
@ -441,12 +440,9 @@ void R_FindBmodelMirrors( cl_entity_t *e, qboolean static_entity )
}
else Matrix4x4_LoadIdentity( RI.objectMatrix );
if( rotated ) Matrix4x4_Invert_Simple( imatrix, RI.objectMatrix );
else Matrix4x4_LoadIdentity( imatrix ); // just to have something valid here
e->visframe = tr.framecount; // visible
if( rotated ) Matrix4x4_VectorTransform( imatrix, RI.cullorigin, tr.modelorg );
if( rotated ) Matrix4x4_VectorITransform( RI.objectMatrix, RI.cullorigin, tr.modelorg );
else VectorSubtract( RI.cullorigin, e->origin, tr.modelorg );
clipFlags = 0;

View File

@ -385,13 +385,9 @@ void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLig
// rotate start and end into the models frame of reference
if( !VectorIsNull( m_pGround->angles ))
{
matrix4x4 imatrix;
Matrix4x4_CreateFromEntity( matrix, m_pGround->angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, start, start_l );
Matrix4x4_VectorTransform( imatrix, end, end_l );
Matrix4x4_VectorITransform( matrix, start, start_l );
Matrix4x4_VectorITransform( matrix, end, end_l );
}
// copy transformed pos back

View File

@ -169,18 +169,18 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
{
VectorAverage( ent1->model->mins, ent1->model->maxs, org );
VectorAdd( ent1->origin, org, org );
VectorSubtract( RI.pvsorigin, org, vecLen );
VectorSubtract( RI.vieworg, org, vecLen );
}
else VectorSubtract( RI.pvsorigin, ent1->origin, vecLen );
else VectorSubtract( RI.vieworg, ent1->origin, vecLen );
len1 = VectorLength( vecLen );
if( ent2->model->type == mod_brush )
{
VectorAverage( ent2->model->mins, ent2->model->maxs, org );
VectorAdd( ent2->origin, org, org );
VectorSubtract( RI.pvsorigin, org, vecLen );
VectorSubtract( RI.vieworg, org, vecLen );
}
else VectorSubtract( RI.pvsorigin, ent2->origin, vecLen );
else VectorSubtract( RI.vieworg, ent2->origin, vecLen );
len2 = VectorLength( vecLen );
if( len1 > len2 )
@ -1131,11 +1131,12 @@ void R_BeginFrame( qboolean clearScene )
pglClear( GL_COLOR_BUFFER_BIT );
}
// update gamma (wait until game is fully initialized)
// update gamma
if( vid_gamma->modified )
{
if( glConfig.deviceSupportsGamma )
{
SCR_RebuildGammaTable();
GL_UpdateGammaRamp();
vid_gamma->modified = false;
}

View File

@ -386,7 +386,6 @@ void R_AddDynamicLights( msurface_t *surf )
int lnum, s, t, sd, td, smax, tmax;
float sl, tl, sacc, tacc;
vec3_t impact, origin_l;
matrix4x4 imatrix;
mtexinfo_t *tex;
dlight_t *dl;
uint *bl;
@ -398,8 +397,6 @@ void R_AddDynamicLights( msurface_t *surf )
tmax = (surf->extents[1] >> 4) + 1;
tex = surf->texinfo;
Matrix4x4_Invert_Simple( imatrix, RI.objectMatrix );
for( lnum = 0; lnum < MAX_DLIGHTS; lnum++ )
{
if(!( surf->dlightbits & BIT( lnum )))
@ -409,7 +406,7 @@ void R_AddDynamicLights( msurface_t *surf )
// transform light origin to local bmodel space
if( !tr.modelviewIdentity )
Matrix4x4_VectorTransform( imatrix, dl->origin, origin_l );
Matrix4x4_VectorITransform( RI.objectMatrix, dl->origin, origin_l );
else VectorCopy( dl->origin, origin_l );
rad = dl->radius;
@ -1219,9 +1216,9 @@ static int R_SurfaceCompare( const msurface_t **a, const msurface_t **b )
VectorAdd( RI.currententity->origin, info1->origin, org1 );
VectorAdd( RI.currententity->origin, info2->origin, org2 );
VectorSubtract( RI.pvsorigin, org1, vecLength );
VectorSubtract( RI.vieworg, org1, vecLength );
len1 = VectorLength( vecLength );
VectorSubtract( RI.pvsorigin, org2, vecLength );
VectorSubtract( RI.vieworg, org2, vecLength );
len2 = VectorLength( vecLength );
if( len1 > len2 )
@ -1246,7 +1243,6 @@ void R_DrawBrushModel( cl_entity_t *e )
msurface_t *psurf;
model_t *clmodel;
qboolean rotated;
matrix4x4 imatrix;
dlight_t *l;
clmodel = e->model;
@ -1277,13 +1273,9 @@ void R_DrawBrushModel( cl_entity_t *e )
if( rotated ) R_RotateForEntity( e );
else R_TranslateForEntity( e );
if( R_CountDlights( ) || rotated )
Matrix4x4_Invert_Simple( imatrix, RI.objectMatrix );
else Matrix4x4_LoadIdentity( imatrix ); // just to have something valid here
e->visframe = tr.framecount; // visible
if( rotated ) Matrix4x4_VectorTransform( imatrix, RI.cullorigin, tr.modelorg );
if( rotated ) Matrix4x4_VectorITransform( RI.objectMatrix, RI.cullorigin, tr.modelorg );
else VectorSubtract( RI.cullorigin, e->origin, tr.modelorg );
// calculate dynamic lighting for bmodel
@ -1293,7 +1285,7 @@ void R_DrawBrushModel( cl_entity_t *e )
continue;
VectorCopy( l->origin, oldorigin ); // save lightorigin
Matrix4x4_VectorTransform( imatrix, l->origin, origin_l );
Matrix4x4_VectorITransform( RI.objectMatrix, l->origin, origin_l );
VectorCopy( origin_l, l->origin ); // move light in bmodel space
R_MarkLights( l, 1<<k, clmodel->nodes + clmodel->hulls[0].firstclipnode );
VectorCopy( oldorigin, l->origin ); // restore lightorigin

View File

@ -1448,7 +1448,7 @@ void GL_InitCommands( void )
gl_luminance_textures = Cvar_Get( "gl_luminance_textures", "0", CVAR_GLCONFIG, "force all textures to luminance" );
gl_allow_static = Cvar_Get( "gl_allow_static", "1", CVAR_ARCHIVE, "force to drawing non-moveable brushes as part of world (save FPS)" );
gl_allow_mirrors = Cvar_Get( "gl_allow_mirrors", "1", CVAR_ARCHIVE, "allow to draw mirror surfaces" );
gl_showtextures = Cvar_Get( "r_showtextures", "0", CVAR_CHEAT, "show all uploaded textures (type values from 1 to 9)" );
gl_showtextures = Cvar_Get( "r_showtextures", "0", CVAR_CHEAT, "show all uploaded textures (type values from 1 to 13)" );
gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_clear = Cvar_Get( "gl_clear", "0", CVAR_ARCHIVE, "clearing screen after each frame" );
gl_test = Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" );

View File

@ -641,11 +641,6 @@ AVIKit user interface
=============
*/
movie_state_t *AVI_AllocState( void )
{
return Mem_Alloc( cls.mempool, sizeof( movie_state_t ));
}
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio, qboolean ignore_hwgamma )
{
movie_state_t *Avi;

View File

@ -79,7 +79,7 @@ typedef enum
#include "com_model.h"
#include "crtlib.h"
#define XASH_VERSION 0.91f // engine current version
#define XASH_VERSION 0.95f // engine current version
// PERFORMANCE INFO
#define MIN_FPS 15.0 // host minimum fps value for maxfps.

View File

@ -671,7 +671,7 @@ load_wad_textures:
if( R_GetTexture( tx->gl_texturenum )->flags & TF_HAS_LUMA || load_external_luma )
{
if( !load_external_luma )
Q_snprintf( texname, sizeof( texname ), "%s%s_luma.mip", mt->offsets[0] > 0 ? "#" : "", mt->name );
Q_snprintf( texname, sizeof( texname ), "#%s_luma.mip", mt->name );
else MsgDev( D_NOTE, "loading luma HQ: %s\n", texname );
if( mt->offsets[0] > 0 && !load_external_luma )
@ -685,8 +685,17 @@ load_wad_textures:
}
else
{
// okay, loading it from wad
tx->fb_texturenum = GL_LoadTexture( texname, NULL, 0, TF_NOMIPMAP|TF_MAKELUMA );
size_t srcSize = 0;
byte *src = NULL;
// NOTE: we can't loading it from wad as normal because _luma texture doesn't exist
// and not be loaded. But original texture is already loaded and can't be modified
// So load original texture manually and convert it to luma
if( !load_external_luma ) src = FS_LoadFile( va( "%s.mip", tx->name ), &srcSize, false );
// okay, loading it from wad or hi-res version
tx->fb_texturenum = GL_LoadTexture( texname, src, srcSize, TF_NOMIPMAP|TF_MAKELUMA );
if( src ) Mem_Free( src );
if( !tx->fb_texturenum && load_external_luma )
{

View File

@ -896,13 +896,11 @@ qboolean PM_StudioTrace( playermove_t *pmove, physent_t *pe, const vec3_t start,
// go to check individual hitboxes
for( i = 0; i < pm_studiohdr->numhitboxes; i++ )
{
mstudiobbox_t *phitbox = (mstudiobbox_t *)((byte*)pm_studiohdr + pm_studiohdr->hitboxindex) + i;
matrix3x4 bonemat;
mstudiobbox_t *phitbox = (mstudiobbox_t *)((byte*)pm_studiohdr + pm_studiohdr->hitboxindex) + i;
// transform traceline into local bone space
Matrix3x4_Invert_Simple( bonemat, pm_studiobones[phitbox->bone] );
Matrix3x4_VectorTransform( bonemat, start, start_l );
Matrix3x4_VectorTransform( bonemat, end, end_l );
Matrix3x4_VectorITransform( pm_studiobones[phitbox->bone], start, start_l );
Matrix3x4_VectorITransform( pm_studiobones[phitbox->bone], end, end_l );
PM_HullForHitbox( phitbox->bbmin, phitbox->bbmax );

View File

@ -121,13 +121,9 @@ const char *PM_TraceTexture( physent_t *pe, vec3_t start, vec3_t end )
// rotate start and end into the models frame of reference
if( !VectorIsNull( pe->angles ))
{
matrix4x4 imatrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, start, start_l );
Matrix4x4_VectorTransform( imatrix, end, end_l );
Matrix4x4_VectorITransform( matrix, start, start_l );
Matrix4x4_VectorITransform( matrix, end, end_l );
}
surf = PM_RecursiveSurfCheck( bmodel, &bmodel->nodes[hull->firstclipnode], start_l, end_l );

View File

@ -345,13 +345,9 @@ static qboolean PM_BmodelTrace( physent_t *pe, const vec3_t start, vec3_t mins,
// rotate start and end into the models frame of reference
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
{
matrix4x4 imatrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, start, start_l );
Matrix4x4_VectorTransform( imatrix, end, end_l );
Matrix4x4_VectorITransform( matrix, start, start_l );
Matrix4x4_VectorITransform( matrix, end, end_l );
}
// do trace
@ -533,11 +529,9 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pfnIgnore pmFilter )
// CM_TransformedPointContents :-)
if( pe->solid == SOLID_BSP && !VectorIsNull( pe->angles ))
{
matrix4x4 matrix, imatrix;
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, pos, pos_l );
Matrix4x4_VectorITransform( matrix, pos, pos_l );
}
if( PM_HullPointContents( hull, hull->firstclipnode, pos_l ) == CONTENTS_SOLID )

View File

@ -3460,7 +3460,7 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
if( angles && !VectorIsNull( angles ))
{
VectorCopy( angles, args.angles );
args.flags |= FEVENT_ORIGIN;
args.flags |= FEVENT_ANGLES;
}
// copy other parms
@ -3564,7 +3564,10 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = Mod_PointLeafnum( viewOrg ) - 1;
if( leafnum != -1 && (!( mask[leafnum>>3] & (1<<( leafnum & 7 )))))
{
Msg( "skipped()\n" );
continue;
}
}
if( flags & FEV_NOTHOST && cl == svs.currentPlayer && cl->local_weapons )
@ -3649,8 +3652,12 @@ byte *pfnSetFatPVS( const float *org )
ASSERT( svs.currentPlayerNum >= 0 && svs.currentPlayerNum < MAX_CLIENTS );
// save viewpoint in case this overrided by custom camera code
VectorCopy( org, viewPoint[svs.currentPlayerNum] );
// portals can't change viewpoint!
if(!( sv.hostflags & SVF_PORTALPASS ))
{
// save viewpoint in case this overrided by custom camera code
VectorCopy( org, viewPoint[svs.currentPlayerNum] );
}
bitvector = fatpvs;
fatbytes = (sv.worldmodel->numleafs+31)>>3;

View File

@ -911,7 +911,7 @@ SV_PushRotate
static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
{
int i, e, block, oldsolid;
matrix4x4 start_l, end_l, temp_l;
matrix4x4 start_l, end_l;
vec3_t lmove, amove;
sv_pushed_t *p, *pushed_p;
vec3_t org, org2, temp;
@ -927,8 +927,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
amove[i] = pusher->v.avelocity[i] * movetime;
// create pusher initial position
Matrix4x4_CreateFromEntity( temp_l, pusher->v.angles, pusher->v.origin, 1.0f );
Matrix4x4_Invert_Simple( start_l, temp_l );
Matrix4x4_CreateFromEntity( start_l, pusher->v.angles, pusher->v.origin, 1.0f );
pushed_p = svgame.pushed;
@ -1002,7 +1001,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
VectorAverage( check->v.absmin, check->v.absmax, org );
else VectorCopy( check->v.origin, org );
Matrix4x4_VectorTransform( start_l, org, temp );
Matrix4x4_VectorITransform( start_l, org, temp );
Matrix4x4_VectorTransform( end_l, temp, org2 );
VectorSubtract( org2, org, lmove );

View File

@ -933,13 +933,11 @@ trace_t SV_TraceHitbox( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t ma
// go to check individual hitboxes
for( i = 0; i < sv_studiohdr->numhitboxes; i++ )
{
mstudiobbox_t *phitbox = (mstudiobbox_t *)((byte*)sv_studiohdr + sv_studiohdr->hitboxindex) + i;
matrix3x4 bonemat;
mstudiobbox_t *phitbox = (mstudiobbox_t *)((byte*)sv_studiohdr + sv_studiohdr->hitboxindex) + i;
// transform traceline into local bone space
Matrix3x4_Invert_Simple( bonemat, sv_studiobones[phitbox->bone] );
Matrix3x4_VectorTransform( bonemat, start, start_l );
Matrix3x4_VectorTransform( bonemat, end, end_l );
Matrix3x4_VectorITransform( sv_studiobones[phitbox->bone], start, start_l );
Matrix3x4_VectorITransform( sv_studiobones[phitbox->bone], end, end_l );
SV_HullForHitbox( phitbox->bbmin, phitbox->bbmax );

View File

@ -401,7 +401,7 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node )
link_t *l, *next;
edict_t *touch;
hull_t *hull;
vec3_t test;
vec3_t test, offset;
// touch linked edicts
for( l = node->trigger_edicts.next; l != &node->trigger_edicts; l = next )
@ -432,11 +432,22 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node )
// check brush triggers accuracy
if( Mod_GetType( touch->v.modelindex ) == mod_brush )
{
model_t *mod = Mod_Handle( touch->v.modelindex );
// force to select bsp-hull
hull = SV_HullForBsp( touch, ent->v.mins, ent->v.maxs, test );
hull = SV_HullForBsp( touch, ent->v.mins, ent->v.maxs, offset );
// offset the test point appropriately for this hull.
VectorSubtract( ent->v.origin, test, test );
VectorSubtract( ent->v.origin, offset, test );
// support for rotational triggers
if( (mod->flags & MODEL_HAS_ORIGIN) && !VectorIsNull( touch->v.angles ))
{
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, touch->v.angles, offset, 1.0f );
Matrix4x4_VectorITransform( matrix, ent->v.origin, test );
}
// test hull for intersection with this model
if( PM_HullPointContents( hull, hull->firstclipnode, test ) == CONTENTS_EMPTY )
@ -615,7 +626,8 @@ void SV_WaterLinks( const vec3_t origin, int *pCont, areanode_t *node )
link_t *l, *next;
edict_t *touch;
hull_t *hull;
vec3_t test;
vec3_t test, offset;
model_t *mod;
// get water edicts
for( l = node->water_edicts.next; l != &node->water_edicts; l = next )
@ -640,11 +652,22 @@ void SV_WaterLinks( const vec3_t origin, int *pCont, areanode_t *node )
if( !BoundsIntersect( origin, origin, touch->v.absmin, touch->v.absmax ))
continue;
mod = Mod_Handle( touch->v.modelindex );
// check water brushes accuracy
hull = SV_HullForBsp( touch, vec3_origin, vec3_origin, test );
hull = SV_HullForBsp( touch, vec3_origin, vec3_origin, offset );
// offset the test point appropriately for this hull.
VectorSubtract( origin, test, test );
VectorSubtract( origin, offset, test );
// support for rotational water
if( (mod->flags & MODEL_HAS_ORIGIN) && !VectorIsNull( touch->v.angles ))
{
matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, touch->v.angles, offset, 1.0f );
Matrix4x4_VectorITransform( matrix, origin, test );
}
// test hull for intersection with this model
if( PM_HullPointContents( hull, hull->firstclipnode, test ) == CONTENTS_EMPTY )
@ -900,13 +923,9 @@ trace_t SV_TraceHull( edict_t *ent, int hullNum, const vec3_t start, vec3_t mins
// rotate start and end into the models frame of reference
if( ent->v.solid == SOLID_BSP && !VectorIsNull( ent->v.angles ))
{
matrix4x4 imatrix;
Matrix4x4_CreateFromEntity( matrix, ent->v.angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, start, start_l );
Matrix4x4_VectorTransform( imatrix, end, end_l );
Matrix4x4_VectorITransform( matrix, start, start_l );
Matrix4x4_VectorITransform( matrix, end, end_l );
}
// trace a line through the apropriate clipping hull
@ -1043,13 +1062,9 @@ const char *SV_TraceTexture( edict_t *ent, const vec3_t start, const vec3_t end
// rotate start and end into the models frame of reference
if( !VectorIsNull( ent->v.angles ))
{
matrix4x4 imatrix;
Matrix4x4_CreateFromEntity( matrix, ent->v.angles, offset, 1.0f );
Matrix4x4_Invert_Simple( imatrix, matrix );
Matrix4x4_VectorTransform( imatrix, start, start_l );
Matrix4x4_VectorTransform( imatrix, end, end_l );
Matrix4x4_VectorITransform( matrix, start, start_l );
Matrix4x4_VectorITransform( matrix, end, end_l );
}
surf = SV_RecursiveSurfCheck( bmodel, &bmodel->nodes[hull->firstclipnode], start_l, end_l );