08 Mar 2010

This commit is contained in:
g-cont 2010-03-08 00:00:00 +03:00 committed by Alibek Omarov
parent 67f947b3da
commit ba01aea528
30 changed files with 2208 additions and 53 deletions

View File

@ -67,7 +67,10 @@ int CreateAPI( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEng
// copy HUD_FUNCTIONS table to engine, copy engfuncs table from engine
memcpy( pFunctionTable, &gFunctionTable, sizeof( HUD_FUNCTIONS ));
memcpy( &g_engfuncs, pEngfuncsFromEngine, sizeof( cl_enginefuncs_t ));
gpGlobals = pGlobals;
gpViewParams = gpGlobals->pViewParms;
gpMovevars = gpViewParams->movevars;
return TRUE;
}

View File

@ -12,6 +12,21 @@ extern "C"
{
void EV_EjectBrass( event_args_t *args );
void EV_FireNull( event_args_t *args );
void EV_FireCrowbar( event_args_t *args );
void EV_PlayEmptySound( event_args_t *args );
void EV_FireGlock1( event_args_t *args );
void EV_FireMP5( event_args_t *args );
void EV_FirePython( event_args_t *args );
void EV_FireGauss( event_args_t *args );
void EV_SpinGauss( event_args_t *args );
void EV_EgonFire( event_args_t *args );
void EV_EgonStop( event_args_t *args );
void EV_FireShotGunSingle( event_args_t *args );
void EV_FireShotGunDouble( event_args_t *args );
void EV_SnarkFire( event_args_t *args );
void EV_TrainPitchAdjust( event_args_t *args );
void EV_Decals( event_args_t *args );
void EV_Explode( event_args_t *args );
}
//======================
@ -20,6 +35,22 @@ extern "C"
void EV_HookEvents( void )
{
g_engfuncs.pEventAPI->EV_HookEvent( "evEjectBrass", EV_EjectBrass );
g_engfuncs.pEventAPI->EV_HookEvent( "evNull", EV_FireNull );
g_engfuncs.pEventAPI->EV_HookEvent( "evCrowbar", EV_FireCrowbar );
g_engfuncs.pEventAPI->EV_HookEvent( "evEmptySound", EV_PlayEmptySound );
g_engfuncs.pEventAPI->EV_HookEvent( "evGlock1", EV_FireGlock1 );
g_engfuncs.pEventAPI->EV_HookEvent( "evShotgun1", EV_FireShotGunSingle );
g_engfuncs.pEventAPI->EV_HookEvent( "evShotgun2", EV_FireShotGunDouble );
g_engfuncs.pEventAPI->EV_HookEvent( "evMP5", EV_FireMP5 );
g_engfuncs.pEventAPI->EV_HookEvent( "evExplode", EV_Explode );
g_engfuncs.pEventAPI->EV_HookEvent( "evPython", EV_FirePython );
g_engfuncs.pEventAPI->EV_HookEvent( "evGauss", EV_FireGauss );
g_engfuncs.pEventAPI->EV_HookEvent( "evGaussSpin", EV_SpinGauss );
g_engfuncs.pEventAPI->EV_HookEvent( "evEgonFire", EV_EgonFire );
g_engfuncs.pEventAPI->EV_HookEvent( "evEgonStop", EV_EgonStop );
g_engfuncs.pEventAPI->EV_HookEvent( "evTrain", EV_TrainPitchAdjust );
g_engfuncs.pEventAPI->EV_HookEvent( "evSnarkFire", EV_SnarkFire );
g_engfuncs.pEventAPI->EV_HookEvent( "evDecals", EV_Decals );
}
//=================
@ -149,4 +180,9 @@ void HUD_CmdStart( const edict_t *player, int runfuncs )
void HUD_CmdEnd( const edict_t *player, const usercmd_t *cmd, unsigned int random_seed )
{
// Offset final origin by view_offset
if( cl_lw->integer )
{
previousorigin = player->v.origin + player->v.view_ofs;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,118 @@
#define DEFAULT_VIEWHEIGHT gpGlobals->viewheight[0]
#define VEC_DUCK_VIEW gpGlobals->viewheight[1]
#define VEC_HULL_MIN gpGlobals->hullmins[0]
#define VEC_HULL_MAX gpGlobals->hullmaxs[0]
#define VEC_DUCK_HULL_MIN gpGlobals->hullmins[1]
#define VEC_DUCK_HULL_MAX gpGlobals->hullmaxs[1]
enum crowbar_e
{
CROWBAR_IDLE = 0,
CROWBAR_DRAW,
CROWBAR_HOLSTER,
CROWBAR_ATTACK1HIT,
CROWBAR_ATTACK1MISS,
CROWBAR_ATTACK2MISS,
CROWBAR_ATTACK2HIT,
CROWBAR_ATTACK3MISS,
CROWBAR_ATTACK3HIT
};
enum shotgun_e
{
SHOTGUN_IDLE = 0,
SHOTGUN_DRAW,
SHOTGUN_HOLSTER,
SHOTGUN_FIRE,
SHOTGUN_FIRE2,
SHOTGUN_START_RELOAD,
SHOTGUN_RELOAD,
SHOTGUN_PUMP
};
enum glock_e
{
GLOCK_IDLE1 = 0,
GLOCK_IDLE2,
GLOCK_IDLE3,
GLOCK_DRAW,
GLOCK_HOLSTER,
GLOCK_SHOOT,
GLOCK_SHOOT_EMPTY,
GLOCK_RELOAD,
GLOCK_RELOAD_NOT_EMPTY,
GLOCK_HOLSTER2,
GLOCK_ADD_SILENCER,
GLOCK_DEL_SILENCER
};
enum mp5_e
{
MP5_IDLE = 0,
MP5_DEPLOY,
MP5_HOLSTER,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
MP5_LAUNCH,
MP5_RELOAD
};
enum python_e
{
PYTHON_IDLE1 = 0,
PYTHON_FIDGET,
PYTHON_FIRE1,
PYTHON_RELOAD,
PYTHON_HOLSTER,
PYTHON_DRAW,
PYTHON_IDLE2,
PYTHON_IDLE3
};
enum gauss_e
{
GAUSS_IDLE = 0,
GAUSS_IDLE2,
GAUSS_FIDGET,
GAUSS_SPINUP,
GAUSS_SPIN,
GAUSS_FIRE,
GAUSS_FIRE2,
GAUSS_HOLSTER,
GAUSS_DRAW
};
enum egon_e
{
EGON_IDLE1 = 0,
EGON_FIDGET1,
EGON_ALTFIREON,
EGON_ALTFIREOFF,
EGON_FIRESTOP,
EGON_FIRECYCLE,
EGON_DRAW,
EGON_HOLSTER
};
enum squeak_e
{
SQUEAK_IDLE1 = 0,
SQUEAK_FIDGETFIT,
SQUEAK_FIDGETNIP,
SQUEAK_DOWN,
SQUEAK_UP,
SQUEAK_THROW
};
extern Vector previousorigin;
void EV_HookEvents( void );
extern void HUD_CmdStart( const edict_t *player, int runfuncs );
extern void HUD_CmdEnd( const edict_t *player, const usercmd_t *cmd, unsigned int random_seed );
void EV_HLDM_GunshotDecalTrace( TraceResult *pTrace, char *decalName );
void EV_HLDM_DecalGunshot( TraceResult *pTrace, int iBulletType );
int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount );
@ -24,6 +130,7 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
int EV_IsLocal( int idx );
int EV_IsPlayer( int idx );
void EV_MuzzleFlash( void );
void EV_UpdateBeams ( void );
void EV_GetGunPosition( event_args_t *args, float *pos, float *origin );
void EV_CreateTracer( float *start, float *end );
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );

View File

@ -18,6 +18,7 @@ typedef struct
int state;
} kbutton_t;
cvar_t *cl_lw;
cvar_t *cl_run;
cvar_t *cl_upspeed;
cvar_t *cl_yawspeed;
@ -673,6 +674,7 @@ void IN_Init( void )
cl_pitchspeed = CVAR_REGISTER( "cl_pitchspeed", "150", 0, "client pitch speed" );
cl_anglespeedkey = CVAR_REGISTER( "cl_anglespeedkey", "1.5", 0, "client anglespeed" );
cl_run = CVAR_REGISTER( "cl_run", "0", FCVAR_ARCHIVE, "keep client for always run mode" );
cl_lw = CVAR_REGISTER( "cl_lw", "1", FCVAR_ARCHIVE, "enable client weapon predicting" );
cl_movespeedkey = CVAR_REGISTER ( "cl_movespeedkey", "2", 0, "global scale factor between run and walk" );
cl_pitchup = CVAR_REGISTER ( "cl_pitchup", "70", 0, "how many pitch up" );

View File

@ -5,7 +5,6 @@
#include "extdll.h"
#include "utils.h"
#include "beam_def.h"
#include "triangle_api.h"
#include "effects_api.h"
#include "ref_params.h"
@ -563,7 +562,7 @@ Beam_t *CViewRenderBeams::CreateGenericBeam( BeamInfo_t &beamInfo )
// BEAMENT_ENTITY(startEnt -
// Output : Beam_t
//-----------------------------------------------------------------------------
void CViewRenderBeams::CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life,
Beam_t *CViewRenderBeams::CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life,
float width, float endWidth, float fadeLength, float amplitude, float brightness,
float speed, int startFrame, float framerate, float r, float g, float b, int type )
{
@ -588,7 +587,7 @@ void CViewRenderBeams::CreateBeamEnts( int startEnt, int endEnt, int modelIndex,
beamInfo.m_flGreen = g;
beamInfo.m_flBlue = b;
CreateBeamEnts( beamInfo );
return CreateBeamEnts( beamInfo );
}
//-----------------------------------------------------------------------------
@ -647,9 +646,9 @@ Beam_t *CViewRenderBeams::CreateBeamEnts( BeamInfo_t &beamInfo )
// b -
// Output : Beam_t
//-----------------------------------------------------------------------------
void CViewRenderBeams::CreateBeamEntPoint( int nStartEntity, const Vector *pStart, int nEndEntity, const Vector* pEnd,
int modelIndex, float life, float width, float endWidth, float fadeLength, float amplitude,
float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
Beam_t *CViewRenderBeams::CreateBeamEntPoint( int nStartEntity, const Vector *pStart, int nEndEntity,
const Vector* pEnd, int modelIndex, float life, float width, float endWidth, float fadeLength,
float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
{
BeamInfo_t beamInfo;
@ -665,7 +664,7 @@ void CViewRenderBeams::CreateBeamEntPoint( int nStartEntity, const Vector *pStar
// don't start beams out of the PVS
if ( !beamInfo.m_pStartEnt )
return;
return NULL;
}
if ( nEndEntity <= 0 )
@ -680,7 +679,7 @@ void CViewRenderBeams::CreateBeamEntPoint( int nStartEntity, const Vector *pStar
// Don't start beams out of the PVS
if ( !beamInfo.m_pEndEnt )
return;
return NULL;
}
beamInfo.m_nModelIndex = modelIndex;
@ -697,9 +696,31 @@ void CViewRenderBeams::CreateBeamEntPoint( int nStartEntity, const Vector *pStar
beamInfo.m_flGreen = g;
beamInfo.m_flBlue = b;
CreateBeamEntPoint( beamInfo );
return CreateBeamEntPoint( beamInfo );
}
Beam_t *CViewRenderBeams::CreateBeamEntPoint( int startEnt, Vector end, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate,
float r, float g, float b )
{
return CreateBeamEntPoint( startEnt, NULL, 0, &end, modelIndex, life, width, width, 0.0f, amplitude,
brightness, speed, startFrame, framerate, r, g, b );
}
Beam_t *CViewRenderBeams::CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
{
return CreateBeamEnts( startEnt, endEnt, modelIndex, life, width, width, 0.0f, amplitude, brightness, speed,
startFrame, framerate, r, g, b );
}
Beam_t *CViewRenderBeams::CreateBeamPoints( Vector start, Vector end, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
{
return CreateBeamPoints( start, end, modelIndex, life, width, width, 0.0f, amplitude, brightness, speed,
startFrame, framerate, r, g, b );
}
//-----------------------------------------------------------------------------
// Purpose: Creates a beam between an entity and a point.
//-----------------------------------------------------------------------------
@ -764,7 +785,7 @@ Beam_t *CViewRenderBeams::CreateBeamEntPoint( BeamInfo_t &beamInfo )
// b -
// Output : Beam_t
//-----------------------------------------------------------------------------
void CViewRenderBeams::CreateBeamPoints( Vector& start, Vector& end, int modelIndex, float life, float width,
Beam_t *CViewRenderBeams::CreateBeamPoints( Vector& start, Vector& end, int modelIndex, float life, float width,
float endWidth, float fadeLength,float amplitude, float brightness, float speed, int startFrame,
float framerate, float r, float g, float b )
{
@ -786,7 +807,7 @@ void CViewRenderBeams::CreateBeamPoints( Vector& start, Vector& end, int modelIn
beamInfo.m_flGreen = g;
beamInfo.m_flBlue = b;
CreateBeamPoints( beamInfo );
return CreateBeamPoints( beamInfo );
}
//-----------------------------------------------------------------------------
@ -1665,7 +1686,7 @@ void CViewRenderBeams::UpdateBeams( int fTrans )
// Need to store the next one since we may delete this one
pNext = pBeam->next;
if( fTrans ^ pBeam->flags & FBEAM_SOLID )
if( (fTrans && pBeam->flags & FBEAM_SOLID) || (!fTrans && !(pBeam->flags & FBEAM_SOLID)))
continue;
// Update beam state

View File

@ -6,6 +6,7 @@
#ifndef R_BEAMS_H
#define R_BEAMS_H
#include "beam_def.h"
#include "te_message.h"
#define NOISE_DIVISIONS 128
@ -217,16 +218,25 @@ public:
Beam_t *CreateBeamCirclePoints( BeamInfo_t &beamInfo );
Beam_t *CreateBeamFollow( BeamInfo_t &beamInfo );
void CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width,
Beam_t *CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width,
float endWidth, float fadeLength, float amplitude, float brightness, float speed,
int startFrame, float framerate, float r, float g, float b, int type = -1 );
void CreateBeamEntPoint( int nStartEntity, const Vector *pStart, int nEndEntity,
Beam_t *CreateBeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate,
float r, float g, float b );
Beam_t *CreateBeamEntPoint( int nStartEntity, const Vector *pStart, int nEndEntity,
const Vector* pEnd, int modelIndex, float life, float width, float endWidth,
float fadeLength, float amplitude, float brightness, float speed, int startFrame,
float framerate, float r, float g, float b );
void CreateBeamPoints( Vector& start, Vector& end, int modelIndex, float life, float width,
Beam_t *CreateBeamEntPoint( int startEnt, Vector end, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate,
float r, float g, float b );
Beam_t *CreateBeamPoints( Vector& start, Vector& end, int modelIndex, float life, float width,
float endWidth, float fadeLength, float amplitude, float brightness, float speed,
int startFrame, float framerate, float r, float g, float b );
Beam_t *CreateBeamPoints( Vector start, Vector end, int modelIndex, float life, float width,
float amplitude, float brightness, float speed, int startFrame, float framerate,
float r, float g, float b );
void CreateBeamRing( int startEnt, int endEnt, int modelIndex, float life, float width,
float endWidth, float fadeLength, float amplitude, float brightness, float speed,
int startFrame, float framerate, float r, float g, float b );

View File

@ -30,6 +30,8 @@ void HUD_MuzzleFlash( edict_t *m_pEnt, int iAttachment, const char *event )
void HUD_CreateEntities( void )
{
EV_UpdateBeams (); // egon use this
// add in any game specific objects here
g_pViewRenderBeams->UpdateTempEntBeams( );
}
@ -37,7 +39,11 @@ void HUD_CreateEntities( void )
int HUD_UpdateEntity( TEMPENTITY *pTemp, int framenumber )
{
// before first frame when movevars not initialized
if( !gpMovevars ) return true;
if( !gpMovevars )
{
ALERT( at_error, "TempEntUpdate: no movevars!!!\n" );
return true;
}
float gravity, gravitySlow, fastFreq;
float frametime = gpGlobals->frametime;
@ -741,6 +747,17 @@ void CL_PlaceDecal( Vector pos, Vector dir, float scale, HSPRITE hDecal )
g_engfuncs.pEfxAPI->R_SetDecal( pos, dir, rgba, RANDOM_LONG( 0, 360 ), scale, hDecal, flags );
}
void CL_PlaceDecal( Vector pos, edict_t *pEntity, HSPRITE hDecal )
{
float rgba[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
int flags = DECAL_FADEALPHA;
float scale = 5.0f; // FIXME
Vector dir;
g_engfuncs.pEfxAPI->CL_FindExplosionPlane( pos, scale, dir );
g_engfuncs.pEfxAPI->R_SetDecal( pos, dir, rgba, RANDOM_LONG( 0, 360 ), scale, hDecal, flags );
}
void CL_AllocDLight( Vector pos, float radius, float time, int flags )
{
float rgb[3] = { 1.0f, 1.0f, 1.0f };

View File

@ -190,6 +190,29 @@ Vector READ_DIR( void )
return BitsToDir( READ_BYTE() );
}
// Overloaded to add IGNORE_GLASS
void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr )
{
TRACE_LINE( vecStart, vecEnd, (igmon == ignore_monsters ? TRUE : FALSE) | (ignoreGlass?0x100:0), pentIgnore, ptr );
}
void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr )
{
TRACE_LINE( vecStart, vecEnd, (igmon == ignore_monsters ? TRUE : FALSE), pentIgnore, ptr );
}
void UTIL_TraceHull( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr )
{
TRACE_HULL( vecStart, vecEnd, (igmon == ignore_monsters ? TRUE : FALSE), hullNumber, pentIgnore, ptr );
}
void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr )
{
g_engfuncs.pfnTraceModel( vecStart, vecEnd, pentModel, ptr );
}
/*
==============================================================================

View File

@ -174,6 +174,11 @@ extern float READ_ANGLE( void );
extern Vector READ_DIR( void );
extern void END_READ( void );
// engine traces
extern void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceHull( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
// drawing stuff
extern client_sprite_t *SPR_GetList( const char *name, int *count );
extern void ParseHudSprite( const char **pfile, char *psz, client_sprite_t *result );
@ -200,10 +205,17 @@ extern int g_weaponselect;
extern model_t g_muzzleFlash[4];
extern int g_iAlive; // indicates alive local client or not
// tempents.c
extern void HUD_MuzzleFlash( edict_t *m_pEnt, int iAttachment, const char *event );
extern void CL_PlaceDecal( Vector pos, Vector dir, float scale, HSPRITE hDecal );
extern void CL_PlaceDecal( Vector pos, edict_t *pEntity, HSPRITE hDecal );
extern void CL_BulletParticles( const Vector org, const Vector dir );
// input.cpp
extern cvar_t *v_centerspeed;
extern cvar_t *v_centermove;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_lw;
extern int CL_ButtonBits( int bResetState );
extern void CL_ResetButtonBits( int bits );

View File

@ -15,8 +15,6 @@
#define ORIGIN_BACKUP 64
#define ORIGIN_MASK ( ORIGIN_BACKUP - 1 )
extern ref_params_t *gpViewParams;
// global view containers
Vector v_origin, v_angles, v_cl_angles; // base client vectors
float v_idlescale, v_lastDistance; // misc variables
@ -111,6 +109,18 @@ void V_FirstPerson( void )
else gHUD.m_iLastCameraMode = 0; // set new view after release camera
}
/*
=============
V_PunchAxis
Client side punch effect
=============
*/
void V_PunchAxis( int axis, float punch )
{
ev_punchangle[axis] = punch;
}
//==========================
// V_Init
//==========================
@ -1009,9 +1019,6 @@ bool V_CalcSkyRefdef( ref_params_t *pparams )
void V_CalcRefdef( ref_params_t *pparams )
{
gpMovevars = pparams->movevars; // keep movevars an actual
gpViewParams = pparams;
V_CalcNextView( pparams );
if( V_CalcSkyRefdef( pparams ))

View File

@ -565,6 +565,14 @@ private:
#define SKY_OFF 0
#define SKY_ON 1
typedef struct cl_mirror_s
{
vec3_t origin;
int enabled;
float radius;
int type;
} cl_mirror_t;
class CHud
{
private:
@ -599,6 +607,8 @@ public:
int viewEntityIndex;
int m_iHUDColor;
int viewFlags;
cl_mirror_t Mirrors[32]; // limit - 32 mirrors!
int numMirrors;
private:
// the memory for these arrays are allocated in the first call to CHud::VidInit()
// when the hud.txt and associated sprites are loaded. freed in ~CHud()

View File

@ -148,6 +148,9 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
m_flStartDist = 0;
m_flEndDist = 0;
// clear mirrors
numMirrors = 0;
return 1;
}

View File

@ -87,7 +87,11 @@ typedef struct cl_globalvars_s
BOOL coop;
BOOL teamplay;
ref_params_t *pViewParms; // just for easy acess on client
float viewheight[PM_MAXHULLS]; // values from gameinfo.txt
vec3_t hullmins[PM_MAXHULLS];
vec3_t hullmaxs[PM_MAXHULLS];
int serverflags; // shared serverflags
int maxClients;

View File

@ -5,6 +5,10 @@
#ifndef TRACE_DEF_H
#define TRACE_DEF_H
typedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };
typedef enum { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 } IGNORE_MONSTERS;
typedef enum { ignore_glass = 1, dont_ignore_glass = 0 } IGNORE_GLASS;
typedef struct
{
int fAllSolid; // if true, plane is not valid

38
engine/build.c Normal file
View File

@ -0,0 +1,38 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// build.c - returns a engine build number
//=======================================================================
#include "common.h"
static char *date = __DATE__ ;
static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// returns days since Feb 13 2007
int com_buildnum( void )
{
int m = 0, d = 0, y = 0;
static int b = 0;
if( b != 0 ) return b;
for( m = 0; m < 11; m++ )
{
if( !com.strnicmp( &date[0], mon[m], 3 ))
break;
d += mond[m];
}
d += com.atoi( &date[4] ) - 1;
y = com.atoi( &date[7] ) - 1900;
b = d + (int)((y - 1) * 365.25f );
if((( y % 4 ) == 0 ) && m > 1 )
{
b += 1;
}
b -= 38752; // Feb 13 2007
return b;
}

View File

@ -2585,6 +2585,8 @@ bool CL_LoadProgs( const char *name )
// setup globals
clgame.globals = &gpGlobals;
cl.refdef.movevars = &clgame.movevars;
clgame.globals->pViewParms = &cl.refdef;
// initialize TriAPI
clgame.pmove = &gpMove;

View File

@ -331,7 +331,11 @@ void CL_InitClientMove( void )
VectorCopy( GI->client_maxs[3], clgame.pmove->player_maxs[1] );
for( i = 0; i < PM_MAXHULLS; i++ )
{
clgame.pmove->player_view[i] = clgame.globals->viewheight[i] = GI->viewheight[i];
VectorCopy( clgame.pmove->player_mins[i], clgame.globals->hullmins[i] );
VectorCopy( clgame.pmove->player_maxs[i], clgame.globals->hullmaxs[i] );
}
// common utilities
clgame.pmove->PM_Info_ValueForKey = Info_ValueForKey;

View File

@ -94,6 +94,11 @@ typedef struct host_parm_s
extern host_parm_t host;
//
// build.c
//
int com_buildnum( void );
//
// host.c
//

View File

@ -424,9 +424,9 @@ void Con_DrawSolidConsole( float frac )
// draw current time
re->SetColor( g_color_table[ColorIndex(COLOR_YELLOW)] );
com.snprintf( curtime, MAX_STRING, "%s ", timestamp( TIME_TIME_ONLY ));
com.snprintf( curtime, MAX_STRING, "Xash3D %g (build %i)", SI->version, com_buildnum( ));
i = com.strlen( curtime );
for (x = 0; x < i; x++)
for( x = 0; x < i; x++ )
SCR_DrawSmallChar( scr_width->integer - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), curtime[x] );
re->SetColor(NULL);
@ -542,12 +542,12 @@ void Con_RunConsole( void )
if( cls.key_dest == key_console )
{
if( cls.state == ca_disconnected )
con.finalFrac = 1.0;// full screen
else con.finalFrac = 0.5; // half screen
con.finalFrac = 1.0f;// full screen
else con.finalFrac = 0.5f; // half screen
}
else con.finalFrac = 0; // none visible
if (con.finalFrac < con.displayFrac)
if( con.finalFrac < con.displayFrac )
{
con.displayFrac -= con_speed->value * cls.frametime;
if( con.finalFrac > con.displayFrac )

View File

@ -114,6 +114,10 @@ SOURCE="$(InputPath)"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\build.c
# End Source File
# Begin Source File
SOURCE=.\common\cinematic.c
# End Source File
# Begin Source File

View File

@ -823,7 +823,7 @@ void SV_ClassifyEdict( edict_t *ent, int m_iNewClass )
if( sv_ent->s.ed_type != ED_SPAWNED )
{
// or leave unclassified, wait for next SV_LinkEdict...
// Msg( "AutoClass: %s: <%s>\n", STRING( ent->v.classname ), ed_name[sv_ent->s.ed_type] );
Msg( "AutoClass: %s: <%s>\n", STRING( ent->v.classname ), ed_name[sv_ent->s.ed_type] );
}
}
@ -3721,19 +3721,19 @@ void SV_LoadFromFile( script_t *entities )
continue;
}
}
else if( current_skill == 0 && ent->v.spawnflags & SF_NOT_EASY )
else if( GI->sp_inhibite_ents && current_skill == 0 && ent->v.spawnflags & SF_NOT_EASY )
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
else if( current_skill == 1 && ent->v.spawnflags & SF_NOT_MEDIUM )
else if( GI->sp_inhibite_ents && current_skill == 1 && ent->v.spawnflags & SF_NOT_MEDIUM )
{
SV_FreeEdict( ent );
inhibited++;
continue;
}
else if( current_skill >= 2 && ent->v.spawnflags & SF_NOT_HARD )
else if( GI->sp_inhibite_ents && current_skill >= 2 && ent->v.spawnflags & SF_NOT_HARD )
{
SV_FreeEdict( ent );
inhibited++;

View File

@ -480,6 +480,11 @@ static void PM_CheckMovingGround( edict_t *ent, float frametime )
static void PM_SetupMove( playermove_t *pmove, edict_t *clent, usercmd_t *ucmd, const char *physinfo )
{
edict_t *ent;
float eorg, distSquared;
float flRadius = 12.0f;
int j, e;
pmove->multiplayer = (sv_maxclients->integer > 1) ? true : false;
pmove->serverflags = svgame.globals->serverflags; // shared serverflags
pmove->maxspeed = svgame.movevars.maxspeed;
@ -499,6 +504,39 @@ static void PM_SetupMove( playermove_t *pmove, edict_t *clent, usercmd_t *ucmd,
VectorCopy( clent->v.movedir, pmove->movedir );
VectorCopy( clent->v.velocity, pmove->velocity );
VectorCopy( clent->v.basevelocity, pmove->basevelocity );
flRadius *= flRadius;
pmove->numladders = 0;
// build list of ladders around player
for( e = 1; e < svgame.globals->numEntities; e++ )
{
if( pmove->numladders >= MAX_LADDERS )
{
MsgDev( D_ERROR, "PM_PlayerMove: too many ladders in PVS\n" );
break;
}
ent = EDICT_NUM( e );
if( ent->free ) continue;
distSquared = 0;
for( j = 0; j < 3 && distSquared <= flRadius; j++ )
{
if( pmove->origin[j] < ent->v.absmin[j] )
eorg = pmove->origin[j] - ent->v.absmin[j];
else if( pmove->origin[j] > ent->v.absmax[j] )
eorg = pmove->origin[j] - ent->v.absmax[j];
else eorg = 0;
distSquared += eorg * eorg;
}
if( distSquared > flRadius )
continue;
if( ent->v.skin != CONTENTS_LADDER )
continue;
pmove->ladders[pmove->numladders++] = ent;
}
}
static void PM_FinishMove( playermove_t *pmove, edict_t *clent )

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
#include "ui_local.h"
#include "input.h"
#include "client.h"
#define ART_BANNER "gfx/shell/head_custom"
@ -31,6 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_GOTOSITE 4
#define ID_MODLIST 5
#define ID_TABLEHINT 6
#define ID_MSGBOX 7
#define ID_MSGTEXT 8
#define ID_YES 9
#define ID_NO 10
#define TYPE_LENGTH 10
#define NAME_LENGTH 32+TYPE_LENGTH
@ -52,6 +57,12 @@ typedef struct
menuAction_s go2url;
menuAction_s done;
// prompt dialog
menuAction_s msgBox;
menuAction_s promptMessage;
menuAction_s yes;
menuAction_s no;
menuScrollList_s modList;
menuAction_s hintMessage;
char hintText[MAX_SYSPATH];
@ -59,6 +70,49 @@ typedef struct
static uiCustomGame_t uiCustomGame;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
static void UI_EndGameDialog( void )
{
// toggle main menu between active\inactive
// show\hide delete dialog
uiCustomGame.load.generic.flags ^= QMF_INACTIVE;
uiCustomGame.go2url.generic.flags ^= QMF_INACTIVE;
uiCustomGame.done.generic.flags ^= QMF_INACTIVE;
uiCustomGame.modList.generic.flags ^= QMF_INACTIVE;
uiCustomGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiCustomGame.promptMessage.generic.flags ^= QMF_HIDDEN;
uiCustomGame.no.generic.flags ^= QMF_HIDDEN;
uiCustomGame.yes.generic.flags ^= QMF_HIDDEN;
}
/*
=================
UI_LoadGame_KeyFunc
=================
*/
static const char *UI_CustomGame_KeyFunc( int key, bool down )
{
if( down && key == K_ESCAPE && uiCustomGame.load.generic.flags & QMF_INACTIVE )
{
UI_EndGameDialog();
return uiSoundNull;
}
return UI_DefaultKey( &uiCustomGame.menu, key, down );
}
/*
=================
UI_CustomGame_GetModList
@ -135,11 +189,16 @@ static void UI_CustomGame_Callback( void *self, int event )
Sys_ShellExecute( uiCustomGame.modsWebSites[uiCustomGame.modList.curItem], NULL, false );
break;
case ID_ACTIVATE:
case ID_NO:
if( cls.state == ca_active )
{
UI_EndGameDialog();
break; // don't fuck up the game
}
case ID_YES:
// restart all engine systems with new game
Cbuf_ExecuteText( EXEC_APPEND, va( "game %s\n", uiCustomGame.modsDir[uiCustomGame.modList.curItem] ));
UI_EndGameDialog();
break;
}
}
@ -153,6 +212,8 @@ static void UI_CustomGame_Init( void )
{
Mem_Set( &uiCustomGame, 0, sizeof( uiCustomGame_t ));
uiCustomGame.menu.keyFunc = UI_CustomGame_KeyFunc;
com.strncat( uiCustomGame.hintText, "Type", TYPE_LENGTH );
com.strncat( uiCustomGame.hintText, uiEmptyString, TYPE_LENGTH );
com.strncat( uiCustomGame.hintText, "Name", NAME_LENGTH );
@ -224,6 +285,38 @@ static void UI_CustomGame_Init( void )
uiCustomGame.modList.generic.height = 440;
uiCustomGame.modList.generic.callback = UI_CustomGame_Callback;
uiCustomGame.msgBox.generic.id = ID_MSGBOX;
uiCustomGame.msgBox.generic.type = QMTYPE_ACTION;
uiCustomGame.msgBox.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiCustomGame.msgBox.generic.ownerdraw = UI_MsgBox_Ownerdraw; // just a fill rectangle
uiCustomGame.msgBox.generic.x = 192;
uiCustomGame.msgBox.generic.y = 256;
uiCustomGame.msgBox.generic.width = 640;
uiCustomGame.msgBox.generic.height = 256;
uiCustomGame.promptMessage.generic.id = ID_MSGBOX;
uiCustomGame.promptMessage.generic.type = QMTYPE_ACTION;
uiCustomGame.promptMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.promptMessage.generic.name = "Leave current game?";
uiCustomGame.promptMessage.generic.x = 315;
uiCustomGame.promptMessage.generic.y = 280;
uiCustomGame.yes.generic.id = ID_YES;
uiCustomGame.yes.generic.type = QMTYPE_ACTION;
uiCustomGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.yes.generic.name = "Ok";
uiCustomGame.yes.generic.x = 380;
uiCustomGame.yes.generic.y = 460;
uiCustomGame.yes.generic.callback = UI_CustomGame_Callback;
uiCustomGame.no.generic.id = ID_NO;
uiCustomGame.no.generic.type = QMTYPE_ACTION;
uiCustomGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiCustomGame.no.generic.name = "Cancel";
uiCustomGame.no.generic.x = 530;
uiCustomGame.no.generic.y = 460;
uiCustomGame.no.generic.callback = UI_CustomGame_Callback;
UI_CustomGame_GetModList();
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.background );
@ -233,6 +326,10 @@ static void UI_CustomGame_Init( void )
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.done );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.hintMessage );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.modList );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.msgBox );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.promptMessage );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.no );
UI_AddItem( &uiCustomGame.menu, (void *)&uiCustomGame.yes );
}
/*

View File

@ -1443,6 +1443,7 @@ static bool FS_ParseGameInfo( const char *filename, gameinfo_t *GameInfo )
GameInfo->version = 1.0;
GameInfo->viewheight[0] = 28.0f;
GameInfo->viewheight[1] = 12.0f;
GameInfo->sp_inhibite_ents = false;
com.strncpy( GameInfo->texmode, "Xash3D", MAX_STRING );
com.strncpy( GameInfo->sp_entity, "info_player_start", MAX_STRING );
@ -1539,6 +1540,11 @@ static bool FS_ParseGameInfo( const char *filename, gameinfo_t *GameInfo )
PS_ReadToken( script, 0, &token );
GameInfo->size = com.atoi( token.string );
}
else if( !com.stricmp( token.string, "allow_inhibited_entities" ))
{
MsgDev( D_INFO, "GameInfo: Q1-like inhibite entities mode enabled\n" );
GameInfo->sp_inhibite_ents = true;
}
else if( !com.stricmp( token.string, "max_edicts" ))
{
PS_GetInteger( script, false, &GameInfo->max_edicts );

View File

@ -129,20 +129,23 @@ bool Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
switch( bhdr.bitsPerPixel )
{
case 8:
palIndex = *buf_p++;
red = palette[palIndex][2];
green = palette[palIndex][1];
blue = palette[palIndex][0];
alpha = palette[palIndex][3];
if( image.cmd_flags & IL_KEEP_8BIT )
{
palIndex = *buf_p++;
*pixbuf++ = palIndex;
}
else
{
palIndex = *buf_p++;
*pixbuf++ = palette[palIndex][2];
*pixbuf++ = palette[palIndex][1];
*pixbuf++ = palette[palIndex][0];
*pixbuf++ = palette[palIndex][3];
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
}
if( palIndex == 255 ) image.flags |= IMAGE_HAS_ALPHA;
break;
case 16:
shortPixel = *(word *)buf_p, buf_p += 2;
@ -169,8 +172,7 @@ bool Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
if( alpha != 255 && alpha != 0 )
image.flags |= IMAGE_HAS_ALPHA;
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
break;
default:
MsgDev( D_ERROR, "Image_LoadBMP: illegal pixel_size (%s)\n", name );

View File

@ -236,6 +236,7 @@ typedef struct gameinfo_s
int viewmode;
int gamemode;
int sp_inhibite_ents; // allows spawnflags to inhibite entities like in q1
string sp_entity; // e.g. info_player_start
string dm_entity; // e.g. info_player_deathmatch

View File

@ -411,11 +411,6 @@ extern void UTIL_ScreenFade( const Vector &color, float fadeTime, float fadeHold
extern void UTIL_SetFog ( Vector color, int iFadeTime, int iStartDist, int iEndDist, int playernum = 1 );
extern void UTIL_SetFogAll ( Vector color, int iFadeTime, int iStartDist, int iEndDist );
// hull enumerator
typedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };
typedef enum { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 } IGNORE_MONSTERS;
typedef enum { ignore_glass = 1, dont_ignore_glass = 0 } IGNORE_GLASS;
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceHull (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);

View File

@ -453,9 +453,9 @@ bool R_CreateWindow( int width, int height, bool fullscreen )
int stylebits = WINDOW_STYLE;
int x = 0, y = 0, w, h;
int exstyle = 0;
static char wndname[128];
static string wndname;
com.strcpy( wndname, FS_Title());
com.snprintf( wndname, sizeof( wndname ), "%s %g", GI->title, GI->version );
// register the frame class
wc.style = 0;

View File

@ -576,12 +576,13 @@ brush_t *FinishBrush( void )
VectorSet( movedir, 0.0f, 0.0f, 1.0f ); // z-rotate
else VectorClear( movedir ); // custom movedir
#if 0
if( !VectorIsNull( movedir ))
{
com.snprintf( string, sizeof( string ), "%i %i %i", (int)movedir[0], (int)movedir[1], (int)movedir[2] );
SetKeyValue( &entities[numEntities - 1], "movedir", string );
}
#endif
if(!VectorIsNull( origin ))
{
com.snprintf( string, sizeof( string ), "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2] );