24 Jan 2009

This commit is contained in:
g-cont 2009-01-24 00:00:00 +03:00 committed by Alibek Omarov
parent 3e1ed3b432
commit 6099d9d02c
47 changed files with 489 additions and 253 deletions

View File

@ -189,6 +189,7 @@ typedef struct
HSPRITE hCrosshair;
wrect_t rcCrosshair;
Vector rgbCrosshair;
bool noCrosshair;
} draw_stuff_t;
typedef struct
@ -516,13 +517,22 @@ void SetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b )
ds.rcCrosshair = rc;
}
void HideCrosshair( bool hide )
{
ds.noCrosshair = hide;
}
void DrawCrosshair( void )
{
if( ds.hCrosshair == 0 ) return;
if( ds.hCrosshair == 0 || ds.noCrosshair )
return;
// FIXME: apply crosshair angles
int x = (ScreenWidth - (ds.rcCrosshair.right - ds.rcCrosshair.left)) / 2;
int y =(ScreenHeight - (ds.rcCrosshair.bottom - ds.rcCrosshair.top)) / 2;
int y = (ScreenHeight - (ds.rcCrosshair.bottom - ds.rcCrosshair.top)) / 2;
// FIXME: apply crosshair angles properly
x += gHUD.m_CrosshairAngles.x;
y += gHUD.m_CrosshairAngles.y;
ds.hSprite = ds.hCrosshair;
SetParms( ds.hCrosshair, kRenderTransAlpha, 0 );

View File

@ -186,6 +186,7 @@ extern void SPR_DrawAdditive( int frame, int x, int y, int width, int height );
extern void TextMessageDrawChar( int xpos, int ypos, int number, int r, int g, int b );
extern void FillRGBA( float x, float y, float width, float height, int r, int g, int b, int a );
extern void SetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b );
extern void HideCrosshair( bool hide );
extern void DrawCrosshair( void );
extern void DrawPause( void );
extern void SetScreenFade( Vector fadeColor, float alpha, float duration, float holdTime, int fadeFlags );
@ -199,6 +200,7 @@ extern void Draw_VidInit( void );
// from cl_view.c
extern void V_RenderSplash( void );
extern void V_RenderPlaque( void );
extern edict_t *spot;
// stdio stuff
extern char *va( const char *format, ... );

View File

@ -154,10 +154,23 @@ void V_Init( void )
r_debug = g_engfuncs.pfnRegisterVariable( "r_debug", "0", 0, "show renderer state" );
}
void V_PreRender( ref_params_t *pparams )
//==========================
// V_CalcFov
//==========================
float V_CalcFov( float fov_x, float width, float height )
{
pparams->intermission = gHUD.m_iIntermission;
pparams->thirdperson = gHUD.m_iCameraMode;
float fov_y, x, rad = 360.0f * M_PI;
// check to avoid division by zero
if( fov_x == 0 ) HOST_ERROR( "V_CalcFov: null fov!\n" );
// make sure that fov in-range
fov_x = bound( 1, fov_x, 179 );
x = width / tan( fov_x / rad );
fov_y = atan2( height, x );
fov_y = (fov_y * rad);
return fov_y;
}
//==========================
@ -195,9 +208,20 @@ void V_CalcGunAngle( ref_params_t *pparams )
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
viewent->v.angles[PITCH] -= v_idlescale * sin(pparams->time * v_ipitch_cycle->value) * (v_ipitch_level->value * 0.5);
viewent->v.angles[YAW] -= v_idlescale * sin(pparams->time * v_iyaw_cycle->value) * v_iyaw_level->value;
}
viewent->v.oldangles = viewent->v.angles;
viewent->v.oldorigin = viewent->v.origin;
//==========================
// V_PreRender
//==========================
void V_PreRender( ref_params_t *pparams )
{
// input
pparams->intermission = gHUD.m_iIntermission;
pparams->thirdperson = gHUD.m_iCameraMode;
// output
gHUD.m_CrosshairAngles = pparams->crosshairangle;
pparams->fov_y = V_CalcFov( pparams->fov_x, pparams->viewport[2], pparams->viewport[3] );
}
//==========================
@ -228,14 +252,14 @@ float V_CalcBob( ref_params_t *pparams )
cycle = bobtime - (int)( bobtime / cl_bobcycle->value ) * cl_bobcycle->value;
cycle /= cl_bobcycle->value;
if ( cycle < cl_bobup->value )cycle = M_PI * cycle / cl_bobup->value;
if( cycle < cl_bobup->value ) cycle = M_PI * cycle / cl_bobup->value;
else cycle = M_PI + M_PI * ( cycle - cl_bobup->value )/( 1.0 - cl_bobup->value );
vel = pparams->velocity;
vel[2] = 0;
bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value;
bob = bob * 0.3 + bob * 0.7 * sin(cycle);
bob = bob * 0.3 + bob * 0.7 * sin( cycle );
bob = min( bob, 4 );
bob = max( bob, -7 );
return bob;
@ -257,12 +281,17 @@ void V_AddIdle( ref_params_t *pparams )
void V_CalcViewRoll( ref_params_t *pparams )
{
float sign, side, value;
Vector forward, right, up;
if( !pparams->viewentity ) return;
Vector right;
AngleVectors( pparams->viewentity->v.angles, forward, right, up );
side = pparams->velocity.Dot( right );
if( pparams->health <= 0 && pparams->viewheight[2] != 0 )
{
GetViewModel()->v.modelindex = 0; // clear viewmodel
pparams->viewangles[ROLL] = 80; // dead view angle
return;
}
AngleVectors( pparams->angles, NULL, right, NULL );
side = right.Dot( pparams->velocity );
sign = side < 0 ? -1 : 1;
side = fabs( side );
value = pparams->movevars->rollangle;
@ -271,12 +300,6 @@ void V_CalcViewRoll( ref_params_t *pparams )
else side = value;
side = side * sign;
pparams->viewangles[ROLL] += side;
if( pparams->health <= 0 && ( pparams->viewheight[2] != 0 ))
{
pparams->viewangles[ROLL] = 80; // dead view angle
return;
}
}
//==========================
@ -332,7 +355,6 @@ void V_GetChaseOrigin( Vector angles, Vector origin, float distance, Vector &res
AngleVectors( angles, forward, NULL, NULL );
forward *= -1;
vecStart = origin;
vecEnd.MA( distance, vecStart, forward );
while( maxLoops > 0 )
@ -341,13 +363,14 @@ void V_GetChaseOrigin( Vector angles, Vector origin, float distance, Vector &res
if( tr.pHit == NULL ) break; // we hit the world or nothing, stop trace
ent = tr.pHit;
if( ent == NULL ) break;
// hit non-player solid BSP, stop here
if( ent->v.solid == SOLID_BSP && !( ent->v.flags & FL_CLIENT )) break;
if( ent->v.solid == SOLID_BSP && !( ent->v.flags & FL_CLIENT ))
break;
// if close enought to end pos, stop, otherwise continue trace
if( tr.vecEndPos.Distance( vecEnd ) < 1.0f ) break;
if( tr.vecEndPos.Distance( vecEnd ) < 1.0f )
break;
else
{
ignoreent = tr.pHit; // ignore last hit entity
@ -363,7 +386,7 @@ void V_GetChaseOrigin( Vector angles, Vector origin, float distance, Vector &res
//==========================
// V_GetChasePos
//==========================
void V_GetChasePos( edict_t *ent, float *cl_angles, Vector &origin, Vector &angles )
void V_GetChasePos( ref_params_t *pparams, edict_t *ent, float *cl_angles, Vector &origin, Vector &angles )
{
if( !ent )
{
@ -380,7 +403,17 @@ void V_GetChasePos( edict_t *ent, float *cl_angles, Vector &origin, Vector &angl
}
else angles = cl_angles;
origin = ent->v.origin;
// refresh the position
if( !pparams->predicting || pparams->demoplayback )
{
// use interpolated values
for( int i = 0; i < 3; i++ )
{
origin[i] = LerpPoint( pparams->prev.origin[i], pparams->origin[i], pparams->lerpfrac );
origin[i] += LerpPoint( pparams->prev.viewheight[i], pparams->viewheight[i], pparams->lerpfrac );
}
}
origin[2] += 28; // DEFAULT_VIEWHEIGHT - some offset
V_GetChaseOrigin( angles, origin, cl_chasedist->value, origin );
}
@ -390,7 +423,7 @@ void V_GetChasePos( edict_t *ent, float *cl_angles, Vector &origin, Vector &angl
//==========================
void V_CalcNextView( ref_params_t *pparams )
{
if( g_FirstFrame )//first time not actually
if( g_FirstFrame ) // first time not actually
{
g_FirstFrame = false;
g_RenderReady = false;
@ -435,22 +468,28 @@ void V_CalcCameraRefdef( ref_params_t *pparams )
if( viewentity )
{
dstudiohdr_t *viewmonster = (dstudiohdr_t *)GetModelPtr( viewentity );
int i;
if( gHUD.viewFlags & MONSTER_VIEW && viewmonster ) // calc monster view
v_origin = viewentity->v.origin + viewmonster->eyeposition;
else v_origin = viewentity->v.origin;
v_angles = viewentity->v.angles;
for( i = 0; i < 3; i++ )
v_origin[i] = LerpPoint( viewentity->v.oldorigin[i], viewentity->v.origin[i], pparams->lerpfrac );
// calc monster view if supposed
if( gHUD.viewFlags & MONSTER_VIEW && viewmonster )
v_origin += viewmonster->eyeposition;
for( i = 0; i < 3; i++ )
v_angles[i] = LerpAngle( viewentity->v.oldangles[i], viewentity->v.angles[i], pparams->lerpfrac );
if( gHUD.viewFlags & INVERSE_X ) // inverse X coordinate
v_angles[0] = -v_angles[0];
pparams->crosshairangle[PITCH] = 100; // hide crosshair
HideCrosshair( true );
// refresh position
pparams->viewangles = v_angles;
pparams->vieworg = v_origin;
}
}
else pparams->crosshairangle[PITCH] = 0; // show crosshair again
else HideCrosshair( false ); // show crosshair again
}
edict_t *V_FindIntermisionSpot( ref_params_t *pparams )
@ -459,8 +498,8 @@ edict_t *V_FindIntermisionSpot( ref_params_t *pparams )
int spotindex[16]; // max number of intermission spot
int k = 0, j = 0;
// found intermission point
for( int i = 0; i < pparams->max_entities; i++ )
// found intermission points
for( int i = 0; i < pparams->num_entities; i++ )
{
ent = GetEntityByIndex( i );
if( ent && !stricmp( STRING( ent->v.classname ), "info_intermission" ))
@ -495,6 +534,7 @@ void V_CalcIntermisionRefdef( ref_params_t *pparams )
if( !spot ) spot = V_FindIntermisionSpot( pparams );
view = GetViewModel();
// need to lerping position ?
pparams->vieworg = spot->v.origin;
pparams->viewangles = spot->v.angles;
view->v.modelindex = 0;
@ -505,7 +545,7 @@ void V_CalcIntermisionRefdef( ref_params_t *pparams )
V_AddIdle( pparams );
v_idlescale = old;
v_cl_angles = pparams->angles;
v_cl_angles = pparams->cl_viewangles;
v_origin = pparams->vieworg;
v_angles = pparams->viewangles;
}
@ -514,7 +554,7 @@ void V_CalcIntermisionRefdef( ref_params_t *pparams )
// V_PrintDebugInfo
// FIXME: use custom text drawing ?
//==========================
void V_PrintDebugInfo (ref_params_t *pparams) //for future extensions
void V_PrintDebugInfo( ref_params_t *pparams ) // for future extensions
{
if( !r_debug->value ) return; //show OpenGL renderer debug info
ALERT( at_console, "Xash Renderer Info: ");
@ -525,114 +565,6 @@ void V_PrintDebugInfo (ref_params_t *pparams) //for future extensions
if( g_iTotalPortals ) ALERT( at_console, "Visible portals: %d from %d\n", g_iTotalVisiblePortals, g_iTotalPortals );
}
//==========================
// V_CalcFinalPass
//==========================
void V_CalcFinalPass( ref_params_t *pparams )
{
g_FirstFrame = true; // enable calc next passes
V_ResetViewportRefdef( pparams ); // reset view port as default
m_RenderRefCount++; // increase counter
}
//==========================
// V_CalcThirdPersonRefdef
//==========================
void V_CalcThirdPersonRefdef( ref_params_t * pparams )
{
// passed only in third person
if( gHUD.m_iCameraMode == 0 || pparams->intermission ) return;
// get current values
v_cl_angles = pparams->angles;
v_angles = pparams->viewangles;
v_origin = pparams->vieworg;
V_GetChasePos( GetLocalPlayer(), v_cl_angles, v_origin, v_angles );
// write back new values
pparams->angles = v_cl_angles;
pparams->viewangles = v_angles;
pparams->vieworg = v_origin;
}
//==========================
// V_CalcSendOrigin
//==========================
void V_CalcSendOrigin( ref_params_t *pparams )
{
// never let view origin sit exactly on a node line, because a water plane can
// dissapear when viewed with the eye exactly on it.
pparams->vieworg[0] += 1.0 / 32;
pparams->vieworg[1] += 1.0 / 32;
pparams->vieworg[2] += 1.0 / 32;
}
//==========================
// V_CalcWaterLevel
//==========================
float V_CalcWaterLevel( ref_params_t *pparams )
{
float waterOffset = 0;
if( pparams->waterlevel >= 2 )
{
int i, contents, waterDist;
waterDist = cl_waterdist->value;
TraceResult tr;
Vector point;
TRACE_HULL( pparams->origin, Vector(-16,-16,-24), Vector(16,16,32), pparams->origin, 1, GetLocalPlayer(), &tr );
if( tr.pHit && !stricmp( STRING( tr.pHit->v.classname ), "func_water" ))
waterDist += ( tr.pHit->v.scale * 16 );
point = pparams->vieworg;
// eyes are above water, make sure we're above the waves
if( pparams->waterlevel == 2 )
{
point[2] -= waterDist;
for( i = 0; i < waterDist; i++ )
{
contents = POINT_CONTENTS( point );
if( contents > CONTENTS_WATER ) break;
point[2] += 1;
}
waterOffset = (point[2] + waterDist) - pparams->vieworg[2];
}
else
{
// eyes are under water. Make sure we're far enough under
point[2] += waterDist;
for( i = 0; i < waterDist; i++ )
{
contents = POINT_CONTENTS( point );
if( contents <= CONTENTS_WATER ) break;
point[2] -= 1;
}
waterOffset = (point[2] - waterDist) - pparams->vieworg[2];
}
}
pparams->vieworg[2] += waterOffset;
return waterOffset;
}
//==========================
// V_CalcScrOffset
//==========================
void V_CalcScrOffset( ref_params_t *pparams )
{
// don't allow cheats in multiplayer
if( pparams->max_clients > 1 ) return;
for( int i = 0; i < 3; i++ )
{
pparams->vieworg[i] += scr_ofsx->value * pparams->forward[i];
pparams->vieworg[i] += scr_ofsy->value * pparams->right[i];
pparams->vieworg[i] += scr_ofsz->value * pparams->up[i];
}
}
//==========================
// V_CalcShake
//==========================
@ -706,16 +638,142 @@ void V_ApplyShake( Vector& origin, Vector& angles, float factor )
}
//==========================
// V_CalcSmoothAngles
// V_CalcFinalPass
//==========================
void V_CalcSmoothAngles( ref_params_t *pparams )
void V_CalcFinalPass( ref_params_t *pparams )
{
g_FirstFrame = true; // enable calc next passes
V_ResetViewportRefdef( pparams ); // reset view port as default
m_RenderRefCount++; // increase counter
}
//==========================
// V_CalcThirdPersonRefdef
//==========================
void V_CalcThirdPersonRefdef( ref_params_t *pparams )
{
// passed only in third person
if( gHUD.m_iCameraMode == 0 || pparams->intermission )
return;
// clear viewmodel for thirdperson
edict_t *viewent = GetViewModel();
viewent->v.modelindex = 0;
// get current values
v_cl_angles = pparams->cl_viewangles;
v_angles = pparams->viewangles;
v_origin = pparams->vieworg;
V_GetChasePos( pparams, GetLocalPlayer(), v_cl_angles, v_origin, v_angles );
// write back new values
pparams->cl_viewangles = v_cl_angles;
pparams->viewangles = v_angles;
pparams->vieworg = v_origin;
// apply shake for thirdperson too
V_CalcShake();
V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0 );
}
//==========================
// V_CalcSendOrigin
//==========================
void V_CalcSendOrigin( ref_params_t *pparams )
{
// never let view origin sit exactly on a node line, because a water plane can
// dissapear when viewed with the eye exactly on it.
pparams->vieworg[0] += 1.0 / 32;
pparams->vieworg[1] += 1.0 / 32;
pparams->vieworg[2] += 1.0 / 32;
}
//==========================
// V_CalcWaterLevel
//==========================
float V_CalcWaterLevel( ref_params_t *pparams )
{
float waterOffset = 0;
if( pparams->waterlevel >= 2 )
{
int i, contents, waterDist;
waterDist = cl_waterdist->value;
TraceResult tr;
Vector point;
TRACE_HULL( pparams->origin, Vector(-16,-16,-24), Vector(16,16,32), pparams->origin, 1, GetLocalPlayer(), &tr );
if( tr.pHit && !stricmp( STRING( tr.pHit->v.classname ), "func_water" ))
waterDist += ( tr.pHit->v.scale * 16 );
point = pparams->vieworg;
// eyes are above water, make sure we're above the waves
if( pparams->waterlevel == 2 )
{
point[2] -= waterDist;
for( i = 0; i < waterDist; i++ )
{
contents = POINT_CONTENTS( point );
if( contents > CONTENTS_WATER ) break;
point[2] += 1;
}
waterOffset = (point[2] + waterDist) - pparams->vieworg[2];
}
else
{
// eyes are under water. Make sure we're far enough under
point[2] += waterDist;
for( i = 0; i < waterDist; i++ )
{
contents = POINT_CONTENTS( point );
if( contents <= CONTENTS_WATER ) break;
point[2] -= 1;
}
waterOffset = (point[2] - waterDist) - pparams->vieworg[2];
}
}
// underwater refraction
if( pparams->waterlevel == 3 )
{
float f = sin( pparams->time * 0.4 * (M_PI * 2.7));
pparams->fov_x += f;
pparams->fov_y -= f;
}
pparams->vieworg[2] += waterOffset;
return waterOffset;
}
//==========================
// V_CalcScrOffset
//==========================
void V_CalcScrOffset( ref_params_t *pparams )
{
// don't allow cheats in multiplayer
if( pparams->max_clients > 1 ) return;
for( int i = 0; i < 3; i++ )
{
pparams->vieworg[i] += scr_ofsx->value * pparams->forward[i];
pparams->vieworg[i] += scr_ofsy->value * pparams->right[i];
pparams->vieworg[i] += scr_ofsz->value * pparams->up[i];
}
}
//==========================
// V_InterpolateOrigin
//==========================
void V_InterpolateOrigin( ref_params_t *pparams )
{
edict_t *view;
// view is the weapon model (only visible from inside body )
view = GetViewModel();
if( cl_vsmoothing->value && ( pparams->smoothing && pparams->max_clients > 1 ))
if( cl_vsmoothing->value && ( pparams->max_clients > 1 ))
{
int i, foundidx;
float t;
@ -775,19 +833,29 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
bob = V_CalcBob( pparams );
// refresh position
if( !pparams->predicting )
// refresh the position
if( !pparams->predicting || pparams->demoplayback )
{
// use interpolated values
for( i = 0; i < 3; i++ )
{
pparams->vieworg[i] = LerpPoint( pparams->prev.origin[i], pparams->origin[i], pparams->lerpfrac );
pparams->vieworg[i] += LerpPoint( pparams->prev.viewheight[i], pparams->viewheight[i], pparams->lerpfrac );
pparams->viewangles[i] = LerpAngle( pparams->prev.angles[i], pparams->angles[i], pparams->lerpfrac );
}
}
pparams->viewangles[PITCH] = -pparams->viewangles[PITCH];
if( pparams->demoplayback )
{
for( i = 0; i < 3; i++ )
{
pparams->viewangles[i] = LerpAngle( pparams->prev.angles[i], pparams->angles[i], pparams->lerpfrac );
}
}
else
{
// in-game use predicted values
pparams->viewangles = pparams->cl_viewangles;
}
pparams->vieworg[2] += ( bob );
@ -804,13 +872,11 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
AngleVectors( angles, pparams->forward, pparams->right, pparams->up );
V_CalcScrOffset( pparams );
view->v.angles = pparams->viewangles;
view->v.oldangles = pparams->viewangles;
view->v.angles = pparams->cl_viewangles;
V_CalcGunAngle( pparams );
// use predicted origin as view origin.
view->v.origin = pparams->vieworg;
view->v.oldorigin = pparams->vieworg;
view->v.origin[2] += ( waterOffset );
// Let the viewmodel shake at about 10% of the amplitude
@ -823,7 +889,10 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
view->v.angles[YAW] -= bob * 0.5;
view->v.angles[ROLL] -= bob * 1;
view->v.angles[PITCH] -= bob * 0.3;
// view->v.origin[2] -= 1;
view->v.origin[2] -= 1;
view->v.oldangles = view->v.angles;
view->v.oldorigin = view->v.origin;
if( !g_bFinalPass ) pparams->punchangle = -pparams->punchangle; // make inverse for mirror
@ -835,8 +904,7 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
static float oldz = 0;
/*
if( !pparams->smoothing && pparams->onground && pparams->origin[2] - oldz > 0 )
if( pparams->smoothing && pparams->onground && pparams->origin[2] - oldz > 0 )
{
float steptime;
@ -852,7 +920,7 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
view->v.origin[2] += oldz - pparams->origin[2];
}
else oldz = pparams->origin[2];
*/
static Vector lastorg;
Vector delta;
@ -866,7 +934,7 @@ void V_CalcFirstPersonRefdef( ref_params_t *pparams )
lastorg = pparams->origin;
}
V_CalcSmoothAngles( pparams ); // smooth angles in multiplayer
V_InterpolateOrigin( pparams ); // smooth moving in multiplayer
lasttime = pparams->time;
v_origin = pparams->vieworg;

View File

@ -73,6 +73,7 @@ void CHud :: VidInit( void )
m_hsprCursor = 0;
m_hHudError = 0;
m_hHudFont = 0;
spot = NULL; // clear intermission spot
Draw_VidInit();

View File

@ -573,6 +573,7 @@ public:
int m_Teamplay;
int m_iRes;
Vector m_vecSkyPos;
Vector m_CrosshairAngles;
int m_iSkyMode;
int m_iCameraMode;
int m_iLastCameraMode;

View File

@ -73,7 +73,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
pWeapon->hAmmo = 0;
pWeapon->hAmmo2 = 0;
sprintf( sz, "scripts/weapons/%s.txt", pWeapon->szName );
sprintf( sz, "scripts/items/%s.txt", pWeapon->szName );
client_sprite_t *pList = SPR_GetList( sz, &i );
if( !pList ) return;

View File

@ -178,7 +178,6 @@ typedef enum
typedef enum
{
kRenderFxNone = 0,
kRenderFxUnderwater, // client only, applied on engine-side
// legacy stuff are not supported

View File

@ -25,6 +25,7 @@ typedef enum
ED_RIGIDBODY, // simulated physic
ED_TRIGGER, // just for sorting on a server
ED_PORTAL, // realtime display, portal or mirror brush or model
ED_SKYPORTAL, // realtime 3D-sky camera
ED_MISSILE, // greande, rocket e.t.c
ED_DECAL, // render will be merge real coords and normal
ED_VEHICLE, // controllable vehicle

View File

@ -51,14 +51,14 @@ typedef struct ref_params_s
// input
vec3_t velocity;
vec3_t angles; // input viewangles
vec3_t cl_viewangles; // predicted angles
vec3_t angles; // viewangles that came from server
vec3_t origin; // origin + viewheight = vieworg
vec3_t viewheight;
int health;
vec3_t crosshairangle; // pfnCrosshairAngle values from server
vec3_t punchangle; // recivied from server
edict_t *viewentity;
int clientnum;
int viewmodel; // viewmodel index
int num_entities;

View File

@ -130,9 +130,13 @@ public:
}
return *this;
}
_forceinline Vector MA( float scale, const Vector &start, const Vector &direction ) const
_forceinline Vector MA( float scale, const Vector &start, const Vector &direction )
{
return Vector(start.x + scale * direction.x, start.y + scale * direction.y, start.z + scale * direction.z) ;
x = start.x + scale * direction.x;
y = start.y + scale * direction.y;
z = start.z + scale * direction.z;
return *this;
}
// methods

View File

@ -72,5 +72,5 @@ if exist xtools\xtools.plg del /f /q xtools\xtools.plg
echo Build succeeded!
echo Please wait. Xash is now loading
cd D:\Xash3D\
quake.exe -game tmpQuArK -log -debug -dev 3 +map qctest
quake.exe -game xash -log -debug -dev 3 +map dm_qstyle
:done

View File

@ -120,6 +120,12 @@ float *CL_FadeColor( float starttime, float endtime )
void CL_DrawHUD( int state )
{
if( state == CL_LOADING )
{
// fill unused entries with black color
SCR_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0] );
}
cls.dllFuncs.pfnRedraw( cl.time * 0.001f, state );
if( state == CL_ACTIVE )

View File

@ -633,6 +633,7 @@ void CL_InitServerCommands( void )
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
Cmd_AddCommand ("fullupdate", NULL, "re-init HUD on start demo recording" );
Cmd_AddCommand ("give", NULL, "give specified item or weapon" );
Cmd_AddCommand ("intermission", NULL, "go to intermission" );
Cmd_AddCommand ("god", NULL, "classic cheat" );
}

View File

@ -417,6 +417,20 @@ void CL_ParseSetAngle( sizebuf_t *msg )
cl.viewangles[2] = MSG_ReadAngle16( msg );
}
/*
================
CL_ParseCrosshairAngle
offset crosshair angles
================
*/
void CL_ParseCrosshairAngle( sizebuf_t *msg )
{
cl.refdef.crosshairangle[0] = MSG_ReadAngle16( msg );
cl.refdef.crosshairangle[1] = MSG_ReadAngle16( msg );
cl.refdef.crosshairangle[2] = 0; // not used for screen space
}
/*
=====================================================================
@ -489,6 +503,9 @@ void CL_ParseServerMessage( sizebuf_t *msg )
case svc_setangle:
CL_ParseSetAngle( msg );
break;
case svc_crosshairangle:
CL_ParseCrosshairAngle( msg );
break;
case svc_print:
Con_Print( va( "^6%s\n", MSG_ReadString( msg )));
break;

View File

@ -221,6 +221,42 @@ void CL_CheckVelocity( edict_t *ent )
}
}
/*
=============
CL_CheckWater
=============
*/
bool CL_CheckWater( edict_t *ent )
{
int cont;
vec3_t point;
point[0] = ent->v.origin[0];
point[1] = ent->v.origin[1];
point[2] = ent->v.origin[2] + ent->v.mins[2] + 1;
ent->v.waterlevel = 0;
ent->v.watertype = CONTENTS_NONE;
cont = CL_PointContents( point );
if( cont & (MASK_WATER))
{
ent->v.watertype = cont;
ent->v.waterlevel = 1;
point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2]) * 0.5;
if( CL_PointContents( point ) & MASK_WATER )
{
ent->v.waterlevel = 2;
point[2] = ent->v.origin[2] + ent->v.view_ofs[2];
if( CL_PointContents( point ) & MASK_WATER )
{
ent->v.waterlevel = 3;
}
}
}
return ent->v.waterlevel > 1;
}
/*
====================
CL_ClipMoveToEntities

View File

@ -69,6 +69,7 @@ void V_SetupRefDef( void )
float lerp, backlerp;
frame_t *oldframe;
entity_state_t *ps, *ops;
edict_t *clent;
// find the previous frame to interpolate from
ps = &cl.frame.ps;
@ -78,6 +79,8 @@ void V_SetupRefDef( void )
oldframe = &cl.frame; // previous frame was dropped or invalid
ops = &oldframe->ps;
clent = EDICT_NUM( cl.playernum + 1 );
// see if the player entity was teleported this frame
if( ps->ed_flags & ESF_NO_PREDICTION )
ops = ps; // don't interpolate
@ -99,6 +102,9 @@ void V_SetupRefDef( void )
}
else cl.refdef.lerpfrac = 1.0 - (cl.frame.servertime - cl.time) * 0.01f;
// UNDONE: temporary place for detect waterlevel
CL_CheckWater( clent );
// interpolate field of view
cl.data.fov = ops->fov + cl.refdef.lerpfrac * ( ps->fov - ops->fov );
@ -111,12 +117,14 @@ void V_SetupRefDef( void )
VectorCopy( ops->viewoffset, cl.refdef.prev.viewheight );
VectorCopy( ps->punch_angles, cl.refdef.punchangle );
VectorCopy( ops->punch_angles, cl.refdef.prev.punchangle );
VectorCopy( cl.predicted_angles, cl.refdef.cl_viewangles );
cl.refdef.movevars = &clgame.movevars;
if( ps->flags & FL_ONGROUND )
cl.refdef.onground = EDICT_NUM( ps->groundent );
else cl.refdef.onground = NULL;
cl.refdef.areabits = cl.frame.areabits;
cl.refdef.clientnum = cl.playernum; // not a entity num
cl.refdef.viewmodel = ps->viewmodel;
cl.refdef.health = ps->health;
@ -130,12 +138,9 @@ void V_SetupRefDef( void )
cl.refdef.demorecord = cls.demorecording;
cl.refdef.paused = cl_paused->integer;
cl.refdef.predicting = cl_predict->integer;
// invalid values
cl.refdef.waterlevel = 0; // FIXME: calc it again
cl.refdef.smoothing = 0; // FIXME: detect right settings
cl.refdef.viewentity = NULL; // remove ???
VectorClear( cl.refdef.crosshairangle );
cl.refdef.waterlevel = clent->v.waterlevel;
cl.refdef.smoothing = 0; // get rid of this
cl.refdef.nextView = 0;
// calculate the origin
if( cl.refdef.predicting && !cl.refdef.demoplayback )
@ -153,9 +158,6 @@ void V_SetupRefDef( void )
// smooth out stair climbing
delta = cls.realtime - cl.predicted_step_time;
if( delta < Host_FrameTime()) cl.refdef.vieworg[2] -= cl.predicted_step * (Host_FrameTime() - delta) * 0.01f;
// in-game use predicted values
for( i = 0; i < 3; i++ ) cl.refdef.viewangles[i] = cl.predicted_angles[i];
}
}
@ -166,21 +168,10 @@ V_ApplyRefDef
apply pre-calculated values
===============
*/
void V_ApplyRefDef( void )
void V_AddViewModel( void )
{
cl.refdef.areabits = cl.frame.areabits;
cl.refdef.fov_y = V_CalcFov( cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] );
if( cl.frame.ps.renderfx == kRenderFxUnderwater )
{
float f = com.sin( cl.time * 0.001 * 0.4 * (M_PI * 2.7));
cl.refdef.fov_x += f;
cl.refdef.fov_y -= f;
}
if( cl.viewent.v.modelindex )
{
re->AddRefEntity( &cl.viewent, ED_VIEWMODEL, cl.refdef.lerpfrac );
}
if( !cl.viewent.v.modelindex || cl.refdef.nextView ) return;
re->AddRefEntity( &cl.viewent, ED_VIEWMODEL, cl.refdef.lerpfrac );
}
/*
@ -192,7 +183,13 @@ sets cl.refdef view values
*/
void V_CalcRefDef( void )
{
cls.dllFuncs.pfnCalcRefdef( &cl.refdef );
do
{
if( cl.refdef.nextView )
re->RenderFrame( &cl.refdef );
cls.dllFuncs.pfnCalcRefdef( &cl.refdef );
V_AddViewModel();
} while( cl.refdef.nextView );
}
//============================================================================
@ -221,7 +218,6 @@ void V_RenderView( void )
V_SetupRefDef ();
V_CalcRefDef ();
V_ApplyRefDef ();
}
re->RenderFrame( &cl.refdef );
}
@ -238,7 +234,6 @@ bool V_PreRender( void )
if( !re ) return false;
re->BeginFrame();
SCR_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, g_color_table[0] );
return true;
}

View File

@ -562,6 +562,7 @@ void CL_InitPrediction (void);
void CL_PredictMove (void);
void CL_CheckPredictionError( void );
void CL_CheckVelocity( edict_t *ent );
bool CL_CheckWater( edict_t *ent );
int CL_PointContents( const vec3_t point );
int CL_ContentsMask( const edict_t *passedict );
bool CL_AmbientLevel( const vec3_t point, float *volumes );

View File

@ -450,6 +450,50 @@ bool Cmd_GetStringTablesList( const char *s, char *completedname, int length )
return true;
}
/*
=====================================
Cmd_GetItemsList
Prints or complete item classname
=====================================
*/
bool Cmd_GetItemsList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
int i, numitems;
t = FS_Search( va("scripts/items/%s*.txt", s ), true );
if( !t ) return false;
FS_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) com.strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true;
for(i = 0, numitems = 0; i < t->numfilenames; i++)
{
const char *ext = FS_FileExtension( t->filenames[i] );
if( com.stricmp(ext, "txt" )) continue;
FS_FileBase( t->filenames[i], matchbuf );
Msg( "%16s\n", matchbuf );
numitems++;
}
Msg("\n^3 %i items found.\n", numitems );
Mem_Free( t );
// cut shortestMatch to the amount common with s
if( completedname && length )
{
for( i = 0; matchbuf[i]; i++ )
{
if(com.tolower(completedname[i]) != com.tolower(matchbuf[i]))
completedname[i] = 0;
}
}
return true;
}
/*
=====================================
Cmd_GetGameList
@ -604,6 +648,7 @@ autocomplete_list_t cmd_list[] =
{ "setfont", Cmd_GetFontList, },
{ "music", Cmd_GetSoundList, },
{ "movie", Cmd_GetMovieList },
{ "give", Cmd_GetItemsList },
{ "game", Cmd_GetGamesList },
{ "map", Cmd_GetMapList },
{ NULL }, // termiantor

View File

@ -1482,7 +1482,7 @@ void VM_drawmodel( void )
refdef.viewport[3] = size[1];
refdef.fov_x = 50;
refdef.fov_y = V_CalcFov( refdef.fov_x, refdef.viewport[2], refdef.viewport[3] );
refdef.fov_y = V_CalcFov( refdef.fov_x, refdef.viewport[2], refdef.viewport[3] ); // FIXME: use contant!
refdef.time = cls.realtime * 0.001f;
refdef.oldtime = refdef.time - 0.005;
refdef.onlyClientDraw = true;

View File

@ -62,6 +62,7 @@ enum svc_ops_e
svc_sound, // <see code>
svc_setangle, // [short short short] set the view angle to this absolute value
svc_print, // [byte] id [string] null terminated string
svc_crosshairangle, // [short][short][short]
};
// client to server
@ -178,7 +179,7 @@ void _MSG_WritePos( sizebuf_t *sb, vec3_t pos, const char *filename, int filelin
void _MSG_WriteData( sizebuf_t *sb, const void *data, size_t length, const char *filename, int fileline );
void _MSG_WriteDeltaUsercmd( sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd, const char *filename, const int fileline );
void _MSG_WriteDeltaEntity( struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, bool force, bool newentity, const char *filename, int fileline );
void _MSG_Send( msgtype_t to, vec3_t origin, edict_t *ent, const char *filename, int fileline );
void _MSG_Send( msgtype_t to, vec3_t origin, const edict_t *ent, const char *filename, int fileline );
#define MSG_Begin( x ) _MSG_Begin( x, __FILE__, __LINE__)
#define MSG_WriteChar(x,y) _MSG_WriteBits (x, y, NULL, NET_CHAR, __FILE__, __LINE__)

View File

@ -892,7 +892,7 @@ MULTICAST_PVS send to clients potentially visible from org
MULTICAST_PHS send to clients potentially hearable from org
=================
*/
void _MSG_Send( msgtype_t msg_type, vec3_t origin, edict_t *ent, const char *filename, int fileline )
void _MSG_Send( msgtype_t msg_type, vec3_t origin, const edict_t *ent, const char *filename, int fileline )
{
byte *mask = NULL;
int leafnum = 0, cluster = 0;
@ -1091,7 +1091,7 @@ void SV_UserFriction( sv_client_t *cl )
/*
===============
V_CalcRoll
SV_CalcRoll
Used by view and sv_user
===============

View File

@ -196,6 +196,9 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
if( ent->pvServerData->s.ed_type == ED_CLIENT )
force = true;
if( ent->pvServerData->s.ed_type == ED_SKYPORTAL )
force = true;
// never send entities that aren't linked in
if( !ent->pvServerData->linked && !force ) continue;
@ -212,6 +215,7 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
{
case ED_MOVER:
case ED_NORMAL:
case ED_PORTAL:
case ED_MONSTER:
case ED_AMBIENT:
case ED_BSPBRUSH:
@ -282,7 +286,7 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
SV_AddEntToSnapshot( svent, ent, ents );
// if its a portal entity, add everything visible from its camera position
if( svent->s.ed_type == ED_PORTAL )
if( svent->s.ed_type == ED_PORTAL || svent->s.ed_type == ED_SKYPORTAL )
SV_AddEntitiesToPacket( svent->s.origin, frame, ents, true );
}
}

View File

@ -2498,7 +2498,10 @@ pfnCrosshairAngle
*/
void pfnCrosshairAngle( const edict_t *pClient, float pitch, float yaw )
{
// FIXME: implement
MSG_Begin( svc_crosshairangle );
MSG_WriteAngle16( &sv.multicast, pitch );
MSG_WriteAngle16( &sv.multicast, yaw );
MSG_Send( MSG_ONE_R, vec3_origin, pClient );
}
/*
@ -2998,6 +3001,7 @@ void SV_SpawnEntities( const char *mapname, script_t *entities )
SV_ConfigString( CS_AIRACCELERATE, sv_airaccelerate->string );
SV_ConfigString( CS_ACCELERATE, sv_accelerate->string );
SV_ConfigString( CS_FRICTION, sv_friction->string );
SV_ConfigString( CS_MAXCLIENTS, va( "%i", Host_MaxClients( )));
SV_ConfigString( CS_MAXEDICTS, Cvar_VariableString( "host_maxedicts" ));
svgame.globals->mapname = MAKE_STRING( sv.name );

View File

@ -373,6 +373,7 @@ void SV_Init( void )
Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO, "multiplayer fraglimit" );
Cvar_Get ("timelimit", "0", CVAR_SERVERINFO, "multiplayer timelimit" );
Cvar_Get ("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO|CVAR_INIT, "displays server protocol version" );
Cvar_Get ("sv_aim", "1", 0, "enable auto-aiming" );
sv_fps = Cvar_Get( "sv_fps", "60", CVAR_ARCHIVE, "running physics engine at" );
sv_stepheight = Cvar_Get( "sv_stepheight", DEFAULT_STEPHEIGHT, CVAR_ARCHIVE|CVAR_LATCH, "how high you can step up" );

View File

@ -1033,10 +1033,6 @@ bool SV_CheckWater( edict_t *ent )
ent->v.watertype = CONTENTS_NONE;
cont = SV_PointContents( point );
// predict state
if( ent->pvServerData->s.ed_type == ED_CLIENT )
ent->v.renderfx = kRenderFxNone;
if( cont & (MASK_WATER))
{
ent->v.watertype = cont;
@ -1049,12 +1045,9 @@ bool SV_CheckWater( edict_t *ent )
if( SV_PointContents( point ) & MASK_WATER )
{
ent->v.waterlevel = 3;
if( ent->pvServerData->s.ed_type == ED_CLIENT )
ent->v.renderfx = kRenderFxUnderwater;
}
}
}
return ent->v.waterlevel > 1;
}

View File

@ -271,6 +271,7 @@ typedef enum
SURF_MIRROR = BIT(12), // remove face after compile
SURF_CHROME = BIT(13), // chrome surface effect
SURF_GLOW = BIT(14), // sprites glow
SURF_3DSKY = BIT(15), // sky portal
} surfaceType_t;
typedef struct

View File

@ -1091,6 +1091,7 @@ void GL_Setup3D( void )
*/
void GL_Setup2D( void )
{
if( r_refdef.nextView ) return;
if( gl_finish->integer ) pglFinish();
// set 2D virtual screen size

View File

@ -400,6 +400,7 @@ R_BloomBlend
void R_BloomBlend( const ref_params_t *fd )
{
if( !r_bloom->value ) return;
if( r_refdef.nextView ) return;
if( screen_texture_width < BLOOM_SIZE || screen_texture_height < BLOOM_SIZE )
return;

View File

@ -194,7 +194,7 @@ static void R_RecursiveFragmentNode( node_t *node, const vec3_t origin, const ve
continue; // already checked this surface in another node
surf->fragmentFrame = r_fragmentCount;
if( surf->texInfo->surfaceFlags & (SURF_SKY|SURF_NODRAW|SURF_WARP))
if( surf->texInfo->surfaceFlags & (SURF_SKY|SURF_3DSKY|SURF_NODRAW|SURF_WARP))
continue; // don't bother clipping
if( surf->texInfo->shader->flags & SHADER_NOFRAGMENTS )

View File

@ -195,7 +195,7 @@ static bool R_RecursiveLightPoint( node_t *node, const vec3_t start, const vec3_
{
tex = surf->texInfo;
if( tex->surfaceFlags & (SURF_SKY|SURF_WARP|SURF_NODRAW|SURF_NOLIGHTMAP))
if( tex->surfaceFlags & (SURF_SKY|SURF_3DSKY|SURF_WARP|SURF_NODRAW|SURF_NOLIGHTMAP))
continue; // no lightmaps
s = DotProduct(mid, tex->vecs[0]) + tex->vecs[0][3] - surf->textureMins[0];

View File

@ -1131,7 +1131,6 @@ static bool R_AddEntityToScene( edict_t *pRefEntity, int ed_type, float lerpfrac
}
refent->weaponmodel = cl_models[pRefEntity->v.weaponmodel];
if( refent->ent_type == ED_MOVER || refent->ent_type == ED_BSPBRUSH )
{
// store conveyor movedir in pev->velocity
@ -1316,7 +1315,7 @@ R_BeginFrame
void R_BeginFrame( void )
{
// clear r_speeds statistics
Mem_Set(&r_stats, 0, sizeof(refstats_t));
Mem_Set( &r_stats, 0, sizeof( refstats_t ));
if( vid_gamma->modified )
{

View File

@ -265,7 +265,7 @@ void R_LoadShaders( wfile_t *l )
continue;
}
if( surfaceParm & SURF_NODRAW )
if( surfaceParm & (SURF_NODRAW|SURF_3DSKY))
{
m_pLoadModel->shaders[i] = tr.nodrawShader;
continue;
@ -720,7 +720,7 @@ static void R_LoadSurfaces( wfile_t *l )
out->lmWidth = (out->extents[0] >> 4) + 1;
out->lmHeight = (out->extents[1] >> 4) + 1;
if( out->texInfo->surfaceFlags & (SURF_SKY|SURF_WARP|SURF_NODRAW))
if( out->texInfo->surfaceFlags & (SURF_SKY|SURF_3DSKY|SURF_WARP|SURF_NODRAW))
lightofs = -1;
else lightofs = LittleLong( in->lightofs );

View File

@ -99,12 +99,12 @@ bool R_SetPixelformat( void )
1, // version number
flags, // support window|OpenGL|generic accel|double buffer
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
8, 0, 8, 0, 8, 0, // color bits set to 32
8, 0, // alpha bit 8
32, // 32-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, 0, // no alpha buffer
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
24, // 24-bit z-buffer
8, // 8-bit stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer

View File

@ -71,6 +71,7 @@ shaderParm_t infoParms[] =
{"detail", SURF_NONE, CONTENTS_DETAIL, 0}, // don't include in structural bsp
{"fog", SURF_NOLIGHTMAP, CONTENTS_FOG, 0}, // carves surfaces entering
{"sky", SURF_SKY, CONTENTS_SKY, 0}, // emit light from environment map
{"3dsky", SURF_3DSKY, CONTENTS_SKY, 0}, // emit light from environment map
{"hint", SURF_HINT, CONTENTS_NONE, 0}, // use as a primary splitter
{"skip", SURF_SKIP, CONTENTS_NONE, 0}, // use as a secondary splitter
{"null", SURF_NODRAW, CONTENTS_NONE, 0}, // nodraw texture
@ -1063,7 +1064,7 @@ static bool R_ParseGeneralSurfaceParm( ref_shader_t *shader, script_t *script )
return false;
}
if( !Com_ReadToken( script, false, &tok ))
if( !Com_ReadToken( script, SC_PARSE_GENERIC, &tok ))
{
MsgDev( D_WARN, "missing parameters for 'surfaceParm' in shader '%s'\n", shader->name );
return false;
@ -2728,6 +2729,10 @@ static bool R_ParseStageTcMod( ref_shader_t *shader, shaderStage_t *stage, scrip
}
tcMod->type = TCMOD_TRANSFORM;
}
else if( !com.stricmp( tok.string, "conveyor" ))
{
tcMod->type = TCMOD_CONVEYOR;
}
else
{
MsgDev( D_WARN, "unknown 'tcMod' parameter '%s' in shader '%s'\n", tok.string, shader->name );

View File

@ -2055,7 +2055,9 @@ int R_StudioDrawPlayer( int flags )
{
edict_t *pplayer;
if( !r_refdef.thirdperson ) return 0;
if( !r_refdef.thirdperson )
return 0;
if( !( flags & STUDIO_MIRROR ))
{
//m_pCurrentEntity = IEngineStudio.GetCurrentEntity();
@ -2156,6 +2158,10 @@ int R_StudioDrawPlayer( int flags )
{
ref_entity_t saveent = *m_pCurrentEntity;
rmodel_t *pweaponmodel = m_pCurrentEntity->weaponmodel;
// get remap colors
m_nTopColor = m_pCurrentEntity->colormap & 0xFF;
m_nBottomColor = (m_pCurrentEntity->colormap & 0xFF00)>>8;
R_StudioSetRemapColors( m_nTopColor, m_nBottomColor );
m_pStudioHeader = pweaponmodel->phdr;
m_pTextureHeader = pweaponmodel->thdr;
@ -2164,7 +2170,6 @@ int R_StudioDrawPlayer( int flags )
R_StudioRenderModel( );
R_StudioCalcAttachments( );
*m_pCurrentEntity = saveent;
}
}

View File

@ -453,7 +453,7 @@ static void R_RecursiveWorldNode( node_t *node, int clipFlags )
if( !leaf->numMarkSurfaces ) return;
// check for door connected areas
if( r_refdef.areabits )
if( !r_refdef.nextView && r_refdef.areabits ) // HACKHACK for pre-alpha release
{
if(!(r_refdef.areabits[leaf->area>>3] & (1<<(leaf->area&7))))
return; // not visible

View File

@ -112,11 +112,11 @@ LINK_ENTITY_TO_CLASS( env_sky, CEnvSky );
void CEnvSky :: PostSpawn( void )
{
SetObjectClass( ED_SKYPORTAL );
}
void CEnvSky :: StartMessage( CBasePlayer *pPlayer )
{
pev->effects |= EF_NODRAW;
MESSAGE_BEGIN( MSG_ONE, gmsg.SetSky, NULL, pPlayer->pev );
WRITE_BYTE( 1 ); // mode
WRITE_COORD( pev->origin.x ); // view position

View File

@ -93,15 +93,17 @@ public:
//=========================================================
// Multiplayer intermission spots.
//=========================================================
class CInfoIntermission:public CPointEntity
class CInfoIntermission : public CPointEntity
{
void Spawn( void );
void Think( void );
void PostActivate( void );
CBaseEntity *pTarget;
void KeyValue( KeyValueData *pkvd );
};
void CInfoIntermission::Spawn( void )
void CInfoIntermission :: Spawn( void )
{
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NOCLIP;
@ -117,6 +119,20 @@ void CInfoIntermission::PostActivate( void )
if( !pev->speed ) pev->speed = 100;
}
void CInfoIntermission::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "mangle" ))
{
Vector tmp;
// Quake1 intermission angles
UTIL_StringToVector( tmp, pkvd->szValue );
if( tmp != g_vecZero ) pev->angles = tmp;
pkvd->fHandled = TRUE;
}
else CBaseEntity::KeyValue( pkvd );
}
void CInfoIntermission::Think ( void )
{
if( pTarget )

View File

@ -584,9 +584,9 @@ LINK_ENTITY_TO_CLASS( hvr_rocket, CApacheHVR );
CNukeExplode *CNukeExplode::Create ( Vector vecOrigin, CBaseEntity *pOwner )
{
CNukeExplode *pNuke = GetClassPtr( (CNukeExplode *)NULL );
UTIL_SetOrigin( pNuke, vecOrigin );
pNuke->pev->origin = vecOrigin;
pNuke->Spawn();
pNuke->pev->classname = MAKE_STRING("nuclear_explode");
pNuke->pev->classname = MAKE_STRING( "nuclear_explode" );
pNuke->pev->owner = pOwner->edict();
return pNuke;
@ -650,24 +650,24 @@ LINK_ENTITY_TO_CLASS( nuclear_explode, CNukeExplode );
//===========================
// Nuke rocket code
//===========================
CWHRocket *CWHRocket::Create ( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CBasePlayerWeapon *pLauncher, BOOL Control )
CWHRocket *CWHRocket::Create( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CBasePlayerWeapon *pLauncher, BOOL Control )
{
CWHRocket *pRocket = GetClassPtr( (CWHRocket *)NULL );
UTIL_SetOrigin( pRocket, vecOrigin );
pRocket->pev->angles = vecAngles;
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
pRocket->m_pLauncher = pLauncher; // remember what RPG fired me.
pRocket->pev->owner = pOwner->edict();
pRocket->pev->button = Control;//memeber rocket type
pRocket->pev->classname = MAKE_STRING("nuke_rocket");
pRocket->m_pLauncher->m_cActiveRocket++;//register rocket
pRocket->pev->button = Control; // memeber rocket type
pRocket->pev->classname = MAKE_STRING( "nuke_rocket" );
pRocket->m_pLauncher->m_cActiveRocket++;// register rocket
pRocket->Spawn();
pRocket->pev->flags |= FL_PROJECTILE;
return pRocket;
}
TYPEDESCRIPTION CWHRocket::m_SaveData[] =
TYPEDESCRIPTION CWHRocket::m_SaveData[] =
{
DEFINE_FIELD( CWHRocket, m_pLauncher, FIELD_CLASSPTR ),
DEFINE_FIELD( CWHRocket, m_pPlayer, FIELD_CLASSPTR ),
@ -700,24 +700,22 @@ void CWHRocket :: Spawn( void )
pev->health = 10;
pev->speed = WARHEAD_SPEED; // set initial speed
UTIL_SetModel(ENT( pev ), "models/props/whrocket.mdl");
UTIL_SetModel( ENT( pev ), "models/props/whrocket.mdl" );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/warhead/launch.wav", 1, 0.5 );
UTIL_SetOrigin( this, pev->origin );
pev->colormap = ENTINDEX(edict());//manually save our index into colormap
SetThink( FollowThink );
SetTouch( NukeTouch );
UTIL_MakeVectors( pev->angles );
pev->angles.x = -(pev->angles.x);
pev->velocity = gpGlobals->v_forward * pev->speed;
m_Center = pev->angles;
if(pev->button)
if( pev->button )
{
UTIL_SetView( m_pPlayer, this, CAMERA_ON | INVERSE_X );
m_pLauncher->m_iOnControl = 1;//start controlling
m_pPlayer->m_iWarHUD = 1;//enable warhead HUD
UTIL_SetView( m_pPlayer, this, CAMERA_ON|INVERSE_X );
m_pLauncher->m_iOnControl = 1; // start controlling
m_pPlayer->m_iWarHUD = 1; // enable warhead HUD
}
SetNextThink( 0.1 );
}
@ -735,10 +733,10 @@ void CWHRocket :: Precache( void )
void CWHRocket :: CreateTrail( void )
{
if(b_setup)return;//restore function
if( b_setup ) return; // restore function
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/warhead/whfly.wav", 1, 0.5 );
UTIL_SetAurora( this, m_iTrail);
UTIL_SetAurora( this, m_iBurst);
UTIL_SetAurora( this, m_iTrail );
UTIL_SetAurora( this, m_iBurst );
pev->renderfx = kRenderFxAurora;
b_setup = TRUE;
}
@ -748,12 +746,12 @@ void CWHRocket :: FollowThink( void )
Vector angles, velocity;//private angles & velocity to transform
CreateTrail();
if(pev->button)//controllable rocket
if( pev->button ) // controllable rocket
{
UTIL_MakeVectorsPrivate( m_pPlayer->pev->viewangles, forward, NULL, NULL );
angles = m_pPlayer->pev->viewangles;
angles[0] = 0 - angles[0];
angles.x = -angles.x;
float steer = WARHEAD_MAX_SPEED / pev->speed; // steer factor
angles.x = m_Center.x + UTIL_AngleDistance( angles.x, m_Center.x );

View File

@ -386,7 +386,7 @@ int CBasePlayerWeapon :: ParseWeaponFile( ItemInfo *II, const char *filename )
char path[256];
int iResult = 0;
sprintf( path, "scripts/weapons/%s.txt", filename );
sprintf( path, "scripts/items/%s.txt", filename );
char *pfile = (char *)LOAD_FILE( path, NULL );
ResetParse( II );
@ -1771,7 +1771,8 @@ void CBasePlayerWeapon::ItemPostFrame( void )
}
}
m_iPlayEmptySound = 1; // reset empty sound
if(iFlags() & ITEM_FLAG_USEAUTOAIM) m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
if( iFlags() & ITEM_FLAG_USEAUTOAIM )
m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
if(m_flTimeWeaponIdle < UTIL_WeaponTimeBase()) // step reload
{

View File

@ -970,11 +970,15 @@ void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline )
if( to->modelindex != pNet->pev->modelindex )
to->ed_flags |= ESF_NODELTA;
// always set nodelta's for baseline
if( baseline ) to->ed_flags |= ESF_NODELTA;
if( pNet->pev->teleport_time )
{
to->ed_flags |= ESF_NO_PREDICTION;
to->ed_flags |= ESF_NODELTA;
}
// copy progs values to state
to->solid = (solid_t)pNet->pev->solid;
@ -1035,8 +1039,13 @@ void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline )
to->aiment = ENTINDEX( pNet->pev->aiment );
else to->aiment = 0;
to->punch_angles = pNet->pev->punchangle;
// playermodel sequence, that will be playing on a client
to->gaitsequence = pNet->pev->gaitsequence;
if( pNet->pev->weaponmodel != iStringNull )
to->weaponmodel = MODEL_INDEX( STRING( pNet->pev->weaponmodel ));
else to->weaponmodel = 0;
to->weapons = pNet->pev->weapons;
// clamp fov

View File

@ -62,8 +62,17 @@ Beta 13.12.08
31.weapon_egon & weapon_gauss
32.Com_LoadLibrary: searchpaths: game/bin, bin OK
33.prepare resources for pak OK
34.V_CalcRefDef export
35.other unused exports cl & sv
34.V_CalcRefDef export OK
35.other unused exports cl & sv OK
36.V_CalcThirdPerson OK
37. player weaponmodel OK
38. CalcShake OK
39. CrosshairAngle OK
40. FirstPerson RefDef OK
41. 3dsky surfaceParm OK
42. fixup sky rendering OK
43. beta-testing
44. release
Ñïèñîê äîñòóïíûõ ðåíäåðåðîâ: ×òî â íèõ èíòåðåñíîãî

View File

@ -831,7 +831,7 @@ void SubdivideFace( node_t *node, face_t *f )
tex = &texinfo[f->texinfo];
shader = &dshaders[tex->shadernum];
if( shader->surfaceFlags & (SURF_WARP|SURF_SKY) )
if( shader->surfaceFlags & (SURF_WARP|SURF_SKY|SURF_3DSKY))
{
return;
}

View File

@ -1293,7 +1293,7 @@ void BuildFacelights( int facenum )
f = &dsurfaces[facenum];
if( dshaders[texinfo[f->texinfo].shadernum].surfaceFlags & (SURF_WARP|SURF_SKY))
if( dshaders[texinfo[f->texinfo].shadernum].surfaceFlags & (SURF_WARP|SURF_SKY|SURF_3DSKY))
return; // non-lit texture
Mem_Set( styletable, 0, sizeof( styletable ));
@ -1406,7 +1406,7 @@ void FinalLightFace (int facenum)
f = &dsurfaces[facenum];
fl = &facelight[facenum];
if( dshaders[texinfo[f->texinfo].shadernum].surfaceFlags & ( SURF_WARP|SURF_SKY ))
if( dshaders[texinfo[f->texinfo].shadernum].surfaceFlags & ( SURF_WARP|SURF_SKY|SURF_3DSKY ))
return; // non-lit texture
ThreadLock ();

View File

@ -279,7 +279,7 @@ int BrushContents( mapbrush_t *b )
{
s = &b->original_sides[i];
trans |= dshaders[texinfo[s->texinfo].shadernum].surfaceFlags;
if(( s->contents != contents ) && !( trans & (SURF_NODRAW|SURF_SKY)))
if(( s->contents != contents ) && !( trans & (SURF_NODRAW|SURF_SKY|SURF_3DSKY)))
{
CntString( s->contents, cnt1 );
CntString( contents, cnt2 );

View File

@ -154,7 +154,7 @@ bool IsSky( dsurface_t *f )
dshader_t *tx;
tx = &dshaders[texinfo[f->texinfo].shadernum];
if( tx->surfaceFlags & SURF_SKY )
if( tx->surfaceFlags & SURF_SKY|SURF_3DSKY )
return true;
return false;
}

View File

@ -38,6 +38,7 @@ infoParm_t infoParms[] =
{"detail", SURF_NONE, CONTENTS_DETAIL, 0}, // don't include in structural bsp
{"fog", SURF_NOLIGHTMAP, CONTENTS_FOG, 0}, // carves surfaces entering
{"sky", SURF_SKY, CONTENTS_SKY, 0}, // emit light from environment map
{"3dsky", SURF_3DSKY, CONTENTS_SKY, 0}, // emit light from environment map
{"hint", SURF_HINT, CONTENTS_NONE, 0}, // use as a primary splitter
{"skip", SURF_SKIP, CONTENTS_NONE, 0}, // use as a secondary splitter
{"null", SURF_NODRAW, CONTENTS_NONE, 0}, // nodraw texture