16 Oct 2009

This commit is contained in:
g-cont 2009-10-16 00:00:00 +04:00 committed by Alibek Omarov
parent 143276bcfc
commit 43e1b7dc46
23 changed files with 272 additions and 174 deletions

View File

@ -65,6 +65,7 @@ inline void CL_PlaySound( int iSound, float flVolume, Vector &pos, float pitch =
#define GetMaxClients (*g_engfuncs.pfnGetMaxClients)
#define GetViewModel (*g_engfuncs.pfnGetViewModel)
#define GetModelPtr (*g_engfuncs.pfnGetModelPtr)
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
#define MAKE_LEVELSHOT (*g_engfuncs.pfnMakeLevelShot)
#define POINT_CONTENTS (*g_engfuncs.pfnPointContents)
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)

View File

@ -17,6 +17,7 @@ void HUD_CreateEntities( void )
void HUD_StudioEvent( const dstudioevent_t *event, edict_t *entity )
{
float pitch;
Vector pos;
switch( event->event )
{
@ -37,14 +38,16 @@ void HUD_StudioEvent( const dstudioevent_t *event, edict_t *entity )
break;
case 5004:
// Client side sound
CL_PlaySound( event->options, 1.0f, entity->v.attachment[0] );
GET_ATTACHMENT( entity, 1, pos, NULL );
CL_PlaySound( event->options, 1.0f, pos );
// ALERT( at_console, "CL_PlaySound( %s )\n", event->options );
break;
case 5005:
// Client side sound with random pitch
pitch = 85 + RANDOM_LONG( 0, 0x1F );
// ALERT( at_console, "CL_PlaySound( %s )\n", event->options );
CL_PlaySound( event->options, RANDOM_FLOAT( 0.7f, 0.9f ), entity->v.attachment[0], pitch );
GET_ATTACHMENT( entity, 1, pos, NULL );
CL_PlaySound( event->options, RANDOM_FLOAT( 0.7f, 0.9f ), pos, pitch );
break;
case 5050:
// Special event for displacer

View File

@ -293,7 +293,7 @@ void V_CalcGunAngle( ref_params_t *pparams )
if( !viewent->v.modelindex ) return;
viewent->serialnumber = -1; // viewentity are handled with special number. don't change this
viewent->serialnumber = VIEWENT_INDEX; // viewentity are handled with special number. don't change this
viewent->v.effects |= EF_MINLIGHT;
viewent->v.angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];

View File

@ -132,6 +132,8 @@ typedef struct cl_enginefuncs_s
void* (*pfnGetModelPtr)( edict_t* pEdict );
void (*pfnMakeLevelShot)( void ); // level shot will be created at next frame
void (*pfnGetAttachment)( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
int (*pfnPointContents)( const float *rgflVector );
void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr );

View File

@ -333,8 +333,8 @@ typedef enum
#define MAP_DEFAULT_SHADER "*black"
// client modelindexes
#define VMODEL_ENTINDEX -1 // can get viewmodel for local client
#define WMODEL_ENTINDEX -2 // engine always return NULL, only for internal use
#define NULLENT_INDEX -1 // engine always return NULL, only for internal use
#define VIEWENT_INDEX -2 // can get viewmodel for local client
// basic console charwidths
#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)

View File

@ -79,7 +79,6 @@ typedef struct entvars_s
float framerate; // NET [all], animation playback rate (-8x to 8x)
float controller[16]; // NET [all], bone controller setting (0..255)
float blending[16]; // NET [all], blending amount between sub-sequences (0..255)
vec3_t attachment[16]; // ENG [all], filled by engine on the client-side
float scale; // NET [all], sprites and models rendering scale (0..255)
int rendermode; // NET [all]

View File

@ -23,8 +23,8 @@ edict_t *CL_GetEdictByIndex( int index )
{
if( index < 0 || index > clgame.globals->numEntities )
{
if( index == VMODEL_ENTINDEX ) return &cl.viewent;
if( index == WMODEL_ENTINDEX ) return NULL;
if( index == VIEWENT_INDEX ) return &cl.viewent;
if( index == NULLENT_INDEX ) return NULL;
MsgDev( D_ERROR, "CL_GetEntityByIndex: invalid entindex %i\n", index );
return NULL;
}
@ -70,6 +70,52 @@ void CL_StudioFxTransform( edict_t *ent, float transform[4][4] )
clgame.dllFuncs.pfnStudioFxTransform( ent, transform );
}
bool CL_GetAttachment( int entityIndex, int number, vec3_t origin, vec3_t angles )
{
edict_t *ed = CL_GetEdictByIndex( entityIndex );
if( !ed || ed->free || !ed->pvClientData )
return false;
number = bound( 1, number, MAXSTUDIOATTACHMENTS );
if( origin ) VectorCopy( ed->pvClientData->origin[number-1], origin );
if( angles ) VectorCopy( ed->pvClientData->angles[number-1], angles );
return true;
}
bool CL_SetAttachment( int entityIndex, int number, vec3_t origin, vec3_t angles )
{
edict_t *ed = CL_GetEdictByIndex( entityIndex );
if( !ed || ed->free || !ed->pvClientData )
return false;
if( number > MAXSTUDIOATTACHMENTS )
number = MAXSTUDIOATTACHMENTS;
if( origin ) VectorCopy( origin, ed->pvClientData->origin[number-1] );
if( angles ) VectorCopy( angles, ed->pvClientData->angles[number-1] );
return true;
}
float CL_GetMouthOpen( int entityIndex )
{
edict_t *ed;
if( entityIndex <= 0 || entityIndex >= clgame.globals->numEntities )
return 0.0f;
ed = CL_GetEdictByIndex( entityIndex );
if( !ed || ed->free || !ed->pvClientData )
return 0.0f;
return (float)ed->pvClientData->mouth.open;
}
static trace_t CL_TraceToss( edict_t *tossent, edict_t *ignore)
{
int i;
@ -967,6 +1013,23 @@ void pfnMakeLevelShot( void )
Cbuf_AddText( "wait 1\nlevelshot\n" );
}
/*
=============
pfnGetAttachment
=============
*/
static void pfnGetAttachment( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles )
{
if( !pEdict )
{
if( rgflOrigin ) VectorClear( rgflOrigin );
if( rgflAngles ) VectorClear( rgflAngles );
return;
}
CL_GetAttachment( pEdict->serialnumber, iAttachment, rgflOrigin, rgflAngles );
}
/*
=============
pfnPointContents
@ -1381,6 +1444,7 @@ static cl_enginefuncs_t gEngfuncs =
pfnGetViewModel,
pfnGetModelPtr,
pfnMakeLevelShot,
pfnGetAttachment,
pfnPointContents,
pfnTraceLine,
pfnTraceToss,

View File

@ -178,12 +178,25 @@ typedef enum
scrshot_savegame, // saveshot
} e_scrshot;
typedef struct
{
byte open; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
// cl_private_edict_t
struct cl_priv_s
{
int serverframe; // if not current, this ent isn't in the frame
entity_state_t current;
entity_state_t prev; // will always be valid, but might just be a copy of current
// studiomodels attachments
vec3_t origin[MAXSTUDIOATTACHMENTS];
vec3_t angles[MAXSTUDIOATTACHMENTS];
mouth_t mouth; // shared mouth info
};
typedef struct serverinfo_s
@ -434,6 +447,7 @@ void CL_StopPlayback( void );
void CL_StopRecord( void );
void CL_PlayDemo_f( void );
void CL_StartDemos_f( void );
void CL_NextDemo( void );
void CL_Demos_f( void );
void CL_Record_f( void );
void CL_Stop_f( void );
@ -463,6 +477,9 @@ float CL_GetLerpFrac( void );
edict_t *CL_AllocEdict( void );
void CL_InitEdict( edict_t *pEdict );
void CL_FreeEdict( edict_t *pEdict );
bool CL_GetAttachment( int entityIndex, int number, vec3_t origin, vec3_t angles );
bool CL_SetAttachment( int entityIndex, int number, vec3_t origin, vec3_t angles );
float CL_GetMouthOpen( int entityIndex );
string_t CL_AllocString( const char *szValue );
const char *CL_GetString( string_t iString );
bool CL_RenderTrace( const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end );
@ -557,7 +574,7 @@ int CL_ContentsMask( const edict_t *passedict );
trace_t CL_Trace( const vec3_t s1, const vec3_t m1, const vec3_t m2, const vec3_t s2, int type, edict_t *e, int mask );
//
// cl_ents.c
// cl_frame.c
//
void CL_GetEntitySoundSpatialization( int ent, vec3_t origin, vec3_t velocity );
void CL_AddLoopingSounds( void );

View File

@ -713,7 +713,7 @@ MSG_ReadDeltaEntity
The entity number has already been read from the message, which
is how the from state is identified.
If the delta removes the entity, entity_state_t->number will be set to -1
If the delta removes the entity, entity_state_t->number will be set to MAX_EDICTS - 1
Can go from either a baseline or a previous packet_entity
==================

View File

@ -169,12 +169,15 @@ bool Host_InitRender( void )
ri.StudioEvent = CL_StudioEvent;
ri.StudioFxTransform = CL_StudioFxTransform;
ri.ShowCollision = pe->DrawCollision;
ri.GetAttachment = CL_GetAttachment;
ri.SetAttachment = CL_SetAttachment;
ri.GetClientEdict = CL_GetEdictByIndex;
ri.GetMouthOpen = CL_GetMouthOpen;
ri.GetLocalPlayer = CL_GetLocalPlayer;
ri.GetMaxClients = CL_GetMaxClients;
ri.GetLerpFrac = CL_GetLerpFrac;
ri.WndProc = IN_WndProc;
ri.WndProc = IN_WndProc;
Sys_LoadLibrary( host_video->string, &render_dll );
if( render_dll.link )

View File

@ -2611,7 +2611,7 @@ pfnGetAttachment
=============
*/
void pfnGetAttachment( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles )
static void pfnGetAttachment( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles )
{
// FIXME: implement
}

View File

@ -399,9 +399,7 @@ static void UI_PlayerSetup_Init( void )
uiPlayerSetup.refdef.fov_y = UI_PlayerSetup_CalcFov( uiPlayerSetup.refdef.fov_x, uiPlayerSetup.refdef.viewport[2], uiPlayerSetup.refdef.viewport[3] );
uiPlayerSetup.refdef.flags = RDF_NOWORLDMODEL;
// NOTE: CL_GetEdictByIndex returns NULL for WMODEL_ENTINDEX
// also it's special case, don't touch!
uiPlayerSetup.ent.serialnumber = WMODEL_ENTINDEX;
uiPlayerSetup.ent.serialnumber = NULLENT_INDEX;
uiPlayerSetup.ent.v.sequence = 1;
uiPlayerSetup.ent.v.scale = 1.0f;
uiPlayerSetup.ent.v.frame = -1.0f;

View File

@ -1,63 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: launch - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9B.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\launch\!debug/" /Fo"..\temp\launch\!debug/" /Fd"..\temp\launch\!debug/" /FD /GZ /c
"D:\Xash3D\src_main\launch\filesystem.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9B.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9C.tmp" with contents
[
zlib.lib png.lib jpg.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib /nologo /dll /incremental:yes /pdb:"..\temp\launch\!debug/launch.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\launch\!debug/launch.dll" /implib:"..\temp\launch\!debug/launch.lib" /pdbtype:sept /libpath:"./imagelib"
"\Xash3D\src_main\temp\launch\!debug\cmd.obj"
"\Xash3D\src_main\temp\launch\!debug\console.obj"
"\Xash3D\src_main\temp\launch\!debug\cpuinfo.obj"
"\Xash3D\src_main\temp\launch\!debug\crclib.obj"
"\Xash3D\src_main\temp\launch\!debug\cvar.obj"
"\Xash3D\src_main\temp\launch\!debug\export.obj"
"\Xash3D\src_main\temp\launch\!debug\filesystem.obj"
"\Xash3D\src_main\temp\launch\!debug\img_bmp.obj"
"\Xash3D\src_main\temp\launch\!debug\img_dds.obj"
"\Xash3D\src_main\temp\launch\!debug\img_jpg.obj"
"\Xash3D\src_main\temp\launch\!debug\img_main.obj"
"\Xash3D\src_main\temp\launch\!debug\img_pcx.obj"
"\Xash3D\src_main\temp\launch\!debug\img_png.obj"
"\Xash3D\src_main\temp\launch\!debug\img_tga.obj"
"\Xash3D\src_main\temp\launch\!debug\img_utils.obj"
"\Xash3D\src_main\temp\launch\!debug\img_vtf.obj"
"\Xash3D\src_main\temp\launch\!debug\img_wad.obj"
"\Xash3D\src_main\temp\launch\!debug\memlib.obj"
"\Xash3D\src_main\temp\launch\!debug\network.obj"
"\Xash3D\src_main\temp\launch\!debug\parselib.obj"
"\Xash3D\src_main\temp\launch\!debug\patch.obj"
"\Xash3D\src_main\temp\launch\!debug\stdlib.obj"
"\Xash3D\src_main\temp\launch\!debug\system.obj"
"\Xash3D\src_main\temp\launch\!debug\utils.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9C.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9D.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\launch\!debug\launch.dll "D:\Xash3D\bin\launch.dll"
]
Creating command line ""C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP2E9D.bat""
Compiling...
filesystem.c
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\launch\!debug\launch.dll
‘Ş®Ż¨ŕ®˘ ­® ä ©«®˘: 1.
<h3>Results</h3>
launch.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -118,9 +118,11 @@ typedef struct render_imp_s
void (*StudioEvent)( dstudioevent_t *event, edict_t *ent );
void (*StudioFxTransform)( edict_t *ent, float matrix[4][4] );
void (*ShowCollision)( cmdraw_t callback ); // debug
bool (*Trace)( const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end );
long (*WndProc)( void *hWnd, uint uMsg, uint wParam, long lParam );
bool (*GetAttachment)( int entityIndex, int number, vec3_t origin, vec3_t angles );
bool (*SetAttachment)( int entityIndex, int number, vec3_t origin, vec3_t angles );
edict_t *(*GetClientEdict)( int index );
float (*GetMouthOpen)( int entityIndex );
edict_t *(*GetLocalPlayer)( void );
int (*GetMaxClients)( void );
float (*GetLerpFrac)( void );

View File

@ -1072,12 +1072,12 @@ void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline )
if( pNet->pev->groundentity )
to->groundent = ENTINDEX( pNet->pev->groundentity );
else to->groundent = -1;
else to->groundent = NULLENT_INDEX;
// translate attached entity
if( pNet->pev->aiment )
to->aiment = ENTINDEX( pNet->pev->aiment );
else to->aiment = -1;
else to->aiment = NULLENT_INDEX;
// studio model sequence
if( pNet->pev->sequence != -1 ) to->sequence = pNet->pev->sequence;
@ -1109,7 +1109,7 @@ void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline )
if( pNet->pev->aiment )
to->aiment = ENTINDEX( pNet->pev->aiment );
else to->aiment = -1;
else to->aiment = NULLENT_INDEX;
to->viewoffset = pNet->pev->view_ofs;
to->viewangles = pNet->pev->viewangles;
@ -1157,7 +1157,7 @@ void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline )
// translate StartBeamEntity
if( pNet->pev->owner )
to->owner = ENTINDEX( pNet->pev->owner );
else to->owner = -1;
else to->owner = NULLENT_INDEX;
}
}

View File

@ -475,6 +475,7 @@ void CBaseTurret::EyeOff( )
if (m_eyeBrightness > 0)
{
m_eyeBrightness = max( 0, m_eyeBrightness - 30 );
Msg( "SetBrightness %i\n", m_eyeBrightness );
m_pEyeGlow->SetBrightness( m_eyeBrightness );
}
}

View File

@ -1,16 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: server - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1391,8 +1391,8 @@ static void R_ShaderpassRenderMode( ref_stage_t *pass )
break;
case mod_sprite:
pass->glState = (GLSTATE_SRCBLEND_ONE_MINUS_SRC_ALPHA|GLSTATE_DSTBLEND_ONE|GLSTATE_NO_DEPTH_TEST);
pass->rgbGen.type = RGBGEN_IDENTITY_LIGHTING; // sprites ignore color in 'add' mode
pass->alphaGen.type = ALPHAGEN_ENTITY;
pass->rgbGen.type = RGBGEN_VERTEX;
pass->alphaGen.type = ALPHAGEN_VERTEX;
break;
}
break;
@ -1441,8 +1441,8 @@ static void R_ShaderpassRenderMode( ref_stage_t *pass )
break;
case mod_sprite:
pass->glState = (GLSTATE_SRCBLEND_SRC_ALPHA|GLSTATE_DSTBLEND_ONE);
pass->rgbGen.type = RGBGEN_IDENTITY_LIGHTING; // sprites ignore color in 'add' mode
pass->alphaGen.type = ALPHAGEN_ENTITY;
pass->rgbGen.type = RGBGEN_VERTEX;
pass->alphaGen.type = ALPHAGEN_VERTEX;
break;
}
break;

View File

@ -205,13 +205,6 @@ typedef struct
float stOffset[LM_STYLES][2];
} superLightStyle_t;
typedef struct
{
byte open; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
typedef struct lerpframe_s
{
float frame; // lastframe from previous frame
@ -261,7 +254,6 @@ typedef struct studiovars_s
studiolerp_t prev; // latched values from previous frame
studiolatched_t latched; // latched values from previous sequence
mouth_t mouth; // UNDONE: for synchronizing mouth movements.
float blending[MAXSTUDIOBLENDS];
float controller[MAXSTUDIOCONTROLLERS];
vec3_t gaitorigin; // client oldorigin used to calc velocity
@ -830,6 +822,7 @@ msurface_t *R_TransformedTraceLine( trace_t *tr, const vec3_t start, const vec3_
void R_SpriteInit( void );
mspriteframe_t *R_GetSpriteFrame( ref_entity_t *ent );
bool R_DrawSpriteModel( const meshbuffer_t *mb );
bool R_SpriteOccluded( ref_entity_t *e );
//
// r_studio.c

View File

@ -686,6 +686,8 @@ bool R_PushSpritePoly( const meshbuffer_t *mb )
return R_PushSprite( mb, -1, -e->radius, e->radius, e->radius, -e->radius );
}
/*
=================
R_AddSpriteModelToList
@ -709,24 +711,8 @@ static void R_AddSpriteModelToList( ref_entity_t *e )
frame = R_GetSpriteFrame( e );
shader = &r_shaders[frame->shader];
if( e->rendermode == kRenderGlow )
{
trace_t tr;
msurface_t *surf;
if( R_SpriteOccluded( e )) return;
surf = R_TraceLine( &tr, e->origin, RI.viewOrigin, 0 );
if( e->renderfx == kRenderFxNoDissipation );
else if( surf == NULL && tr.fraction == 1.0f )
{
float dist = VectorDistance( e->origin, RI.viewOrigin );
e->scale = bound( 1.0, dist * 0.005f, 10.0f );
e->renderamt = 255 * bound( 0, dist / 1000, 1.0f );
if( e->renderamt >= 255 ) return; // faded
}
else return; // occluded
}
if( RI.refdef.flags & (RDF_PORTALINVIEW|RDF_SKYPORTALINVIEW) || ( RI.params & RP_SKYPORTALVIEW ))
{
if( R_VisCullSphere( e->origin, frame->radius ))
@ -1267,7 +1253,7 @@ R_CategorizeEntities
*/
static void R_CategorizeEntities( void )
{
uint i;
uint i, j;
r_numnullentities = 0;
r_numbmodelentities = 0;
@ -1290,6 +1276,25 @@ static void R_CategorizeEntities( void )
continue;
}
// setup entity parents
if( RI.currententity->movetype == MOVETYPE_FOLLOW )
{
edict_t *pEdict = ri.GetClientEdict( RI.currententity->index );
edict_t *pParent = NULL;
if( pEdict && pEdict->v.aiment )
{
for( j = 1; j < r_numEntities; j++ )
{
if( r_entities[j].index == pEdict->v.aiment->serialnumber )
{
RI.currententity->parent = r_entities + j;
break;
}
}
}
}
switch( RI.currentmodel->type )
{
case mod_brush:
@ -2127,21 +2132,6 @@ bool R_AddGenericEntity( edict_t *pRefEntity, ref_entity_t *refent )
else VectorClear( center );
VectorAdd( pRefEntity->v.origin, center, refent->lightingOrigin );
if( pRefEntity->v.aiment )
{
int i;
// search for parent in ref_entities
for( i = 0; i < r_numEntities; i++ )
{
if( r_entities[i].index == pRefEntity->v.aiment->serialnumber )
{
refent->parent = r_entities + i;
break;
}
}
}
// setup light origin
if( refent->model ) VectorAverage( refent->model->mins, refent->model->maxs, center );
else VectorClear( center );
@ -2268,7 +2258,7 @@ bool R_AddEntityToScene( edict_t *pRefEntity, int ed_type )
if( !pRefEntity || (r_numEntities >= MAX_ENTITIES))
return false;
if( pRefEntity->serialnumber == VMODEL_ENTINDEX )
if( pRefEntity->serialnumber == VIEWENT_INDEX )
{
// viewmodel always uses this slot for properly store
// and playing client-side animation
@ -2325,7 +2315,7 @@ bool R_AddEntityToScene( edict_t *pRefEntity, int ed_type )
}
// viewmodel already reserve slot
if( pRefEntity->serialnumber != VMODEL_ENTINDEX )
if( pRefEntity->serialnumber != VIEWENT_INDEX )
r_numEntities++;
// never adding child entity without parent
@ -2336,7 +2326,7 @@ bool R_AddEntityToScene( edict_t *pRefEntity, int ed_type )
// create attached entity
FollowEntity.v.modelindex = pRefEntity->v.weaponmodel;
FollowEntity.serialnumber = WMODEL_ENTINDEX;
FollowEntity.serialnumber = NULLENT_INDEX;
FollowEntity.v.movetype = MOVETYPE_FOLLOW;
FollowEntity.v.weaponmodel = 0;

View File

@ -463,6 +463,60 @@ float R_GetSpriteFrameInterpolant( ref_entity_t *ent, mspriteframe_t **oldframe,
return lerpFrac;
}
static float R_GlowSightDistance( vec3_t glowOrigin )
{
float dist;
vec3_t glowDist;
trace_t tr;
VectorSubtract( glowOrigin, RI.viewOrigin, glowDist );
dist = VectorLength( glowDist );
R_TraceLine( &tr, glowOrigin, RI.viewOrigin, MASK_OPAQUE );
if(( 1.0 - tr.fraction ) * dist > 8 )
return -1;
return dist;
}
static float R_SpriteGlowBlend( ref_entity_t *e )
{
float dist = R_GlowSightDistance( e->origin );
float brightness;
if( dist <= 0 )
return false; // occluded
if( e->renderfx == kRenderFxNoDissipation )
{
return (float)e->renderamt * (1.0f/255.0f);
}
// UNDONE: Tweak these magic numbers (19000 - falloff & 200 - sprite size)
brightness = 19000.0 / (dist * dist);
brightness = bound( 0.05f, brightness, 1.0f );
// Make the glow fixed size in screen space, taking into consideration the scale setting.
if( e->scale == 0 ) e->scale = 1.0f;
e->scale *= dist * (1.0f / 200.0f );
return brightness;
}
bool R_SpriteOccluded( ref_entity_t *e )
{
if( e->rendermode == kRenderGlow )
{
float blend = 1.0f;
blend *= R_SpriteGlowBlend( e );
e->renderamt *= blend;
if( blend <= 0.0f )
return true; // occluded
}
return false;
}
/*
=================
R_DrawSpriteModel
@ -476,7 +530,6 @@ bool R_DrawSpriteModel( const meshbuffer_t *mb )
ref_model_t *model = e->model;
float lerp = 1.0f, ilerp;
meshbuffer_t *rb = (meshbuffer_t *)mb;
rgb_t rendercolor;
byte renderamt;
psprite = (msprite_t * )model->extradata;
@ -503,13 +556,12 @@ bool R_DrawSpriteModel( const meshbuffer_t *mb )
{
if( e->skin > 0 && e->parent->model && e->parent->model->type == mod_studio )
{
// FIXME: pev->body hardcoded to attachment number :(
edict_t *cl_ent = ri.GetClientEdict( e->parent->index );
vec3_t pos;
if( cl_ent && e->body < MAXSTUDIOATTACHMENTS )
{
VectorAdd( e->parent->origin, cl_ent->v.attachment[e->skin-1], e->origin2 );
}
// FIXME: pev->skin hardcoded to attachment number :(
if( ri.GetAttachment( e->parent->index, e->skin, pos, NULL ))
VectorAdd( e->parent->origin, pos, e->origin2 );
else VectorCopy( e->parent->origin, e->origin2 );
}
else VectorCopy( e->parent->origin, e->origin2 );
}
@ -526,8 +578,6 @@ bool R_DrawSpriteModel( const meshbuffer_t *mb )
else
{
// draw two combined lerped frames
VectorCopy( e->rendercolor, rendercolor );
renderamt = e->renderamt;
lerp = bound( 0, lerp, 1 );

View File

@ -656,7 +656,7 @@ StudioCalcBoneAdj
====================
*/
void R_StudioCalcBoneAdj( float dadt, float *adj, const float *pcontroller1, const float *pcontroller2, byte mouthopen )
void R_StudioCalcBoneAdj( float dadt, float *adj, const float *pcontroller1, const float *pcontroller2, float mouthopen )
{
int i, j;
float value;
@ -1062,9 +1062,9 @@ void R_StudioCalcRotations( float pos[][3], vec4_t *q, dstudioseqdesc_t *pseqdes
dstudiobone_t *pbone;
studiovars_t *pstudio;
float s;
float adj[MAXSTUDIOCONTROLLERS];
float dadt;
float s, mouthopen;
float adj[MAXSTUDIOCONTROLLERS];
float dadt;
if( f > pseqdesc->numframes - 1 ) f = 0; // bah, fix this bug with changing sequences too fast
else if ( f < -0.01f )
@ -1089,8 +1089,9 @@ void R_StudioCalcRotations( float pos[][3], vec4_t *q, dstudioseqdesc_t *pseqdes
// add in programtic controllers
pbone = (dstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);
mouthopen = ri.GetMouthOpen( RI.currententity->index );
R_StudioCalcBoneAdj( dadt, adj, pstudio->controller, pstudio->prev.controller, pstudio->mouth.open );
R_StudioCalcBoneAdj( dadt, adj, pstudio->controller, pstudio->prev.controller, mouthopen );
for (i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++)
{
@ -1400,15 +1401,18 @@ StudioCalcAttachments
====================
*/
static void R_StudioCalcAttachments( ref_entity_t *e, edict_t *cl )
static void R_StudioCalcAttachments( ref_entity_t *e )
{
int i;
dstudioattachment_t *pattachment;
dstudioattachment_t *pAtt;
vec3_t axis[3];
vec3_t localOrg, localAng;
if( m_pStudioHeader->numattachments <= 0 )
{
// clear attachments
Mem_Set( cl->v.attachment, 0, sizeof( vec3_t ) * MAXSTUDIOATTACHMENTS );
for( i = 1; i < MAXSTUDIOATTACHMENTS+1; i++ )
ri.SetAttachment( e->index, i, vec3_origin, vec3_origin );
return;
}
else if( m_pStudioHeader->numattachments > MAXSTUDIOATTACHMENTS )
@ -1418,10 +1422,16 @@ static void R_StudioCalcAttachments( ref_entity_t *e, edict_t *cl )
}
// calculate attachment points
pattachment = (dstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex);
pAtt = (dstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex);
for( i = 0; i < m_pStudioHeader->numattachments; i++ )
{
Matrix4x4_VectorTransform( m_pbonestransform[pattachment[i].bone], pattachment[i].org, cl->v.attachment[i] );
// compute pos and angles
Matrix4x4_VectorTransform( m_pbonestransform[pAtt[i].bone], pAtt[i].org, localOrg );
Matrix4x4_VectorTransform( m_pbonestransform[pAtt[i].bone], pAtt[i].vectors[0], axis[0] );
Matrix4x4_VectorTransform( m_pbonestransform[pAtt[i].bone], pAtt[i].vectors[1], axis[1] );
Matrix4x4_VectorTransform( m_pbonestransform[pAtt[i].bone], pAtt[i].vectors[2], axis[2] );
Matrix3x3_ToAngles( axis, localAng, true ); // FIXME: dll's uses FLU ?
ri.SetAttachment( e->index, i+1, localOrg, localAng );
}
}
@ -2197,7 +2207,7 @@ static bool R_StudioSetupModel( ref_entity_t *e, ref_model_t *mod )
dstudioevent_t event;
Mem_Set( &event, 0, sizeof( event ));
R_StudioCalcAttachments( e, m_pEntity );
R_StudioCalcAttachments( e );
pstudio->m_flLastEventCheck = e->animtime + flInterval;
pstudio->m_fSequenceFinished = false;

View File

@ -6,14 +6,35 @@
--------------------Configuration: vid_gl - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP398.tmp" with contents
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1EB.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\vid_gl\!debug/" /Fo"..\temp\vid_gl\!debug/" /Fd"..\temp\vid_gl\!debug/" /FD /c
"D:\Xash3D\src_main\vid_gl\cin.c"
"D:\Xash3D\src_main\vid_gl\r_aliasq.c"
"D:\Xash3D\src_main\vid_gl\r_backend.c"
"D:\Xash3D\src_main\vid_gl\r_bloom.c"
"D:\Xash3D\src_main\vid_gl\r_cin.c"
"D:\Xash3D\src_main\vid_gl\r_cull.c"
"D:\Xash3D\src_main\vid_gl\r_draw.c"
"D:\Xash3D\src_main\vid_gl\r_image.c"
"D:\Xash3D\src_main\vid_gl\r_light.c"
"D:\Xash3D\src_main\vid_gl\r_main.c"
"D:\Xash3D\src_main\vid_gl\r_math.c"
"D:\Xash3D\src_main\vid_gl\r_mesh.c"
"D:\Xash3D\src_main\vid_gl\r_model.c"
"D:\Xash3D\src_main\vid_gl\r_opengl.c"
"D:\Xash3D\src_main\vid_gl\r_poly.c"
"D:\Xash3D\src_main\vid_gl\r_program.c"
"D:\Xash3D\src_main\vid_gl\r_register.c"
"D:\Xash3D\src_main\vid_gl\r_shader.c"
"D:\Xash3D\src_main\vid_gl\r_shadow.c"
"D:\Xash3D\src_main\vid_gl\r_sky.c"
"D:\Xash3D\src_main\vid_gl\r_sprite.c"
"D:\Xash3D\src_main\vid_gl\r_studio.c"
"D:\Xash3D\src_main\vid_gl\r_surf.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP398.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP399.tmp" with contents
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1EB.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1EC.tmp" with contents
[
msvcrtd.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\vid_gl\!debug/vid_gl.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\temp\vid_gl\!debug/vid_gl.dll" /implib:"..\temp\vid_gl\!debug/vid_gl.lib" /pdbtype:sept
"\Xash3D\src_main\temp\vid_gl\!debug\cin.obj"
@ -40,16 +61,39 @@ msvcrtd.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:ye
"\Xash3D\src_main\temp\vid_gl\!debug\r_studio.obj"
"\Xash3D\src_main\temp\vid_gl\!debug\r_surf.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP399.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP39A.bat" with contents
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1EC.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1ED.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\vid_gl\!debug\vid_gl.dll "D:\Xash3D\bin\vid_gl.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP39A.bat""
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1ED.bat""
Compiling...
cin.c
r_aliasq.c
r_backend.c
r_bloom.c
r_cin.c
r_cull.c
r_draw.c
r_image.c
r_light.c
r_main.c
r_math.c
r_mesh.c
r_model.c
r_opengl.c
r_poly.c
r_program.c
r_register.c
r_shader.c
r_shadow.c
r_sky.c
Generating Code...
Compiling...
r_sprite.c
r_studio.c
r_surf.c
Generating Code...
Linking...
Creating library ..\temp\vid_gl\!debug/vid_gl.lib and object ..\temp\vid_gl\!debug/vid_gl.exp