mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-14 13:10:09 +01:00
ref: implement engine ref API
This commit is contained in:
parent
97aba69ed0
commit
199ebfed48
@ -87,6 +87,14 @@ short R_LookupColor( byte r, byte g, byte b )
|
||||
return best;
|
||||
}
|
||||
|
||||
color24 *R_GetTracerColor( uint idx )
|
||||
{
|
||||
if( idx > ARRAYSIZE( gTracerColors ))
|
||||
return NULL;
|
||||
|
||||
return &gTracerColors[idx];
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_GetPackedColor
|
||||
@ -432,7 +440,7 @@ extract entity number from index
|
||||
handle user entities
|
||||
==============
|
||||
*/
|
||||
static cl_entity_t *R_BeamGetEntity( int index )
|
||||
cl_entity_t *R_BeamGetEntity( int index )
|
||||
{
|
||||
if( index < 0 )
|
||||
return clgame.dllFuncs.pfnGetUserEntity( BEAMENT_ENTITY( -index ));
|
||||
|
@ -2083,7 +2083,7 @@ pfnIsNoClipping
|
||||
|
||||
=============
|
||||
*/
|
||||
int pfnIsNoClipping( void )
|
||||
static int pfnIsNoClipping( void )
|
||||
{
|
||||
return ( cl.frames[cl.parsecountmod].playerstate[cl.playernum].movetype == MOVETYPE_NOCLIP );
|
||||
}
|
||||
@ -2094,7 +2094,7 @@ pfnGetViewModel
|
||||
|
||||
=============
|
||||
*/
|
||||
static cl_entity_t* pfnGetViewModel( void )
|
||||
cl_entity_t* CL_GetViewModel( void )
|
||||
{
|
||||
return &clgame.viewent;
|
||||
}
|
||||
@ -2533,7 +2533,7 @@ pfnTraceSurface
|
||||
|
||||
=============
|
||||
*/
|
||||
static struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
|
||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
@ -2550,7 +2550,7 @@ pfnGetMovevars
|
||||
|
||||
=============
|
||||
*/
|
||||
static movevars_t *pfnGetMoveVars( void )
|
||||
movevars_t *pfnGetMoveVars( void )
|
||||
{
|
||||
return &clgame.movevars;
|
||||
}
|
||||
@ -2645,7 +2645,7 @@ pfnGetScreenFade
|
||||
|
||||
=============
|
||||
*/
|
||||
static void pfnGetScreenFade( struct screenfade_s *fade )
|
||||
void pfnGetScreenFade( struct screenfade_s *fade )
|
||||
{
|
||||
if( fade ) *fade = clgame.fade;
|
||||
}
|
||||
@ -3265,7 +3265,7 @@ Demo_IsPlayingback
|
||||
|
||||
=================
|
||||
*/
|
||||
static int Demo_IsPlayingback( void )
|
||||
int Demo_IsPlayingback( void )
|
||||
{
|
||||
return cls.demoplayback;
|
||||
}
|
||||
@ -4020,10 +4020,9 @@ qboolean CL_LoadProgs( const char *name )
|
||||
CL_InitViewBeams ();
|
||||
CL_InitTempEnts ();
|
||||
|
||||
#if 0 // REFTODO:
|
||||
if( !R_InitRenderAPI()) // Xash3D extension
|
||||
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get render API\n" );
|
||||
#endif
|
||||
|
||||
if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface
|
||||
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get mobility API\n" );
|
||||
|
||||
|
@ -19,18 +19,18 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "library.h"
|
||||
|
||||
static int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||
{
|
||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
||||
}
|
||||
|
||||
static lightstyle_t *CL_GetLightStyle( int number )
|
||||
lightstyle_t *CL_GetLightStyle( int number )
|
||||
{
|
||||
Assert( number >= 0 && number < MAX_LIGHTSTYLES );
|
||||
return &cl.lightstyles[number];
|
||||
}
|
||||
|
||||
static const ref_overview_t *GL_GetOverviewParms( void )
|
||||
const ref_overview_t *GL_GetOverviewParms( void )
|
||||
{
|
||||
return &clgame.overView;
|
||||
}
|
||||
|
@ -89,6 +89,10 @@ void CL_DecalRemoveAll( int textureIndex );
|
||||
int CL_DecalIndexFromName( const char *name );
|
||||
int CL_DecalIndex( int id );
|
||||
|
||||
// RefAPI
|
||||
struct particle_s *CL_AllocParticleFast( void );
|
||||
color24 *R_GetTracerColor( uint idx );
|
||||
|
||||
// Beams
|
||||
struct beam_s *R_BeamLightning( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
|
||||
struct beam_s *R_BeamEnts( 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 );
|
||||
|
@ -848,6 +848,12 @@ void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pm
|
||||
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
|
||||
void CL_SetTraceHull( int hull );
|
||||
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
||||
int Demo_IsPlayingback( void );
|
||||
cl_entity_t* CL_GetViewModel( void );
|
||||
void pfnGetScreenFade( struct screenfade_s *fade );
|
||||
physent_t *pfnGetPhysent( int idx );
|
||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||
movevars_t *pfnGetMoveVars( void );
|
||||
|
||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||
{
|
||||
@ -968,7 +974,11 @@ void CL_ClearAllRemaps( void );
|
||||
//
|
||||
// cl_render.c
|
||||
//
|
||||
qboolean R_InitRenderAPI( void );
|
||||
int CL_RenderGetParm( int parm, int arg, const qboolean checkRef );
|
||||
lightstyle_t *CL_GetLightStyle( int number );
|
||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
||||
const ref_overview_t *GL_GetOverviewParms( void );
|
||||
|
||||
//
|
||||
// cl_tent.c
|
||||
@ -996,10 +1006,13 @@ void CL_TempEntUpdate( void );
|
||||
void CL_InitViewBeams( void );
|
||||
void CL_ClearViewBeams( void );
|
||||
void CL_FreeViewBeams( void );
|
||||
cl_entity_t *R_BeamGetEntity( int index );
|
||||
void CL_KillDeadBeams( cl_entity_t *pDeadEntity );
|
||||
void CL_ParseViewBeam( sizebuf_t *msg, int beamType );
|
||||
void CL_LoadClientSprites( void );
|
||||
void CL_ReadPointFile_f( void );
|
||||
void CL_DrawEFX( float time, qboolean fTrans );
|
||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||
void CL_ReadLineFile_f( void );
|
||||
void CL_RunLightStyles( void );
|
||||
|
||||
|
@ -43,8 +43,346 @@ static int pfnRefRenderGetParm( int parm, int arg )
|
||||
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
||||
}
|
||||
|
||||
static int pfnGetPlayerIndex( void )
|
||||
{
|
||||
return cl.playernum + 1;
|
||||
}
|
||||
|
||||
static int pfnGetViewEntIndex( void )
|
||||
{
|
||||
return cl.viewentity;
|
||||
}
|
||||
|
||||
static ref_connstate_t pfnCL_GetConnState( void )
|
||||
{
|
||||
switch( cls.state )
|
||||
{
|
||||
case ca_disconnected: return ref_ca_disconnected;
|
||||
case ca_connecting: return ref_ca_connecting;
|
||||
case ca_connected: return ref_ca_connected;
|
||||
case ca_validate: return ref_ca_validate;
|
||||
case ca_active: return ref_ca_active;
|
||||
case ca_cinematic: return ref_ca_cinematic;
|
||||
default:
|
||||
ASSERT( 0 );
|
||||
}
|
||||
return ref_ca_disconnected;
|
||||
}
|
||||
|
||||
static int pfnGetWaterLevel( void )
|
||||
{
|
||||
return cl.local.waterlevel;
|
||||
}
|
||||
|
||||
static int pfnGetLocalHealth( void )
|
||||
{
|
||||
return cl.local.health;
|
||||
}
|
||||
|
||||
static void pfnCbuf_SetOpenGLConfigHack( qboolean set )
|
||||
{
|
||||
host.apply_opengl_config = set;
|
||||
}
|
||||
|
||||
static world_static_t *pfnGetWorld( void )
|
||||
{
|
||||
return &world;
|
||||
}
|
||||
|
||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||
{
|
||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||
}
|
||||
|
||||
static efrag_t* pfnGetEfragsFreeList( void )
|
||||
{
|
||||
return clgame.free_efrags;
|
||||
}
|
||||
|
||||
static void pfnSetEfragsFreeList( efrag_t *list )
|
||||
{
|
||||
clgame.free_efrags = list;
|
||||
}
|
||||
|
||||
static model_t *pfnGetDefaultSprite( ref_defaultsprite_e spr )
|
||||
{
|
||||
switch( spr )
|
||||
{
|
||||
case REF_DOT_SPRITE: return cl_sprite_dot;
|
||||
case REF_CHROME_SPRITE: return cl_sprite_shell;
|
||||
default: Host_Error( "GetDefaultSprite: unknown sprite %d\n", spr );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *pfnMod_Extradata( int type, model_t *m )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case mod_alias: return Mod_AliasExtradata( m );
|
||||
case mod_studio: return Mod_StudioExtradata( m );
|
||||
case mod_sprite: // fallthrough
|
||||
case mod_brush: return NULL;
|
||||
default: Host_Error( "Mod_Extradata: unknown type %d\n", type );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static model_t *pfnMod_GetCurrentLoadingModel( void )
|
||||
{
|
||||
return loadmodel;
|
||||
}
|
||||
|
||||
static void pfnMod_SetCurrentLoadingModel( model_t *m )
|
||||
{
|
||||
loadmodel = m;
|
||||
}
|
||||
|
||||
static int pfnCL_NumModels( void )
|
||||
{
|
||||
return cl.nummodels;
|
||||
}
|
||||
|
||||
static void pfnGetPredictedOrigin( vec3_t v )
|
||||
{
|
||||
VectorCopy( cl.simorg, v );
|
||||
}
|
||||
|
||||
static byte *pfnCL_GetPaletteColor(int color) // clgame.palette[color]
|
||||
{
|
||||
return clgame.palette[color];
|
||||
}
|
||||
|
||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||
{
|
||||
if( width ) *width = clgame.scrInfo.iWidth;
|
||||
if( height ) *height = clgame.scrInfo.iHeight;
|
||||
}
|
||||
|
||||
static void pfnSetLocalLightLevel( int level )
|
||||
{
|
||||
cl.local.light_level = level;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
pfnPlayerInfo
|
||||
|
||||
===============
|
||||
*/
|
||||
static player_info_t *pfnPlayerInfo( int index )
|
||||
{
|
||||
if( index == -1 ) // special index for menu
|
||||
return &gameui.playerinfo;
|
||||
|
||||
if( index < 0 || index > cl.maxclients )
|
||||
return NULL;
|
||||
|
||||
return &cl.players[index];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
pfnGetPlayerState
|
||||
|
||||
===============
|
||||
*/
|
||||
static entity_state_t *R_StudioGetPlayerState( int index )
|
||||
{
|
||||
if( index < 0 || index >= cl.maxclients )
|
||||
return NULL;
|
||||
|
||||
return &cl.frames[cl.parsecountmod].playerstate[index];
|
||||
}
|
||||
|
||||
static int pfnGetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
|
||||
{
|
||||
return clgame.dllFuncs.pfnGetStudioModelInterface( version, ppinterface, pstudio );
|
||||
}
|
||||
|
||||
static byte *pfnImage_GetPool( void )
|
||||
{
|
||||
return host.imagepool;
|
||||
}
|
||||
|
||||
static struct bpc_desc_s *pfnImage_GetPFDesc( int idx )
|
||||
{
|
||||
return &PFDesc[idx];
|
||||
}
|
||||
|
||||
static void pfnDrawNormalTriangles( void )
|
||||
{
|
||||
clgame.dllFuncs.pfnDrawNormalTriangles();
|
||||
}
|
||||
|
||||
static void pfnDrawTransparentTriangles( void )
|
||||
{
|
||||
clgame.dllFuncs.pfnDrawTransparentTriangles();
|
||||
}
|
||||
|
||||
static ref_api_t gEngfuncs =
|
||||
{
|
||||
CL_IsDevOverviewMode,
|
||||
CL_IsThirdPerson,
|
||||
Host_IsQuakeCompatible,
|
||||
pfnGetPlayerIndex,
|
||||
pfnGetViewEntIndex,
|
||||
pfnCL_GetConnState,
|
||||
Demo_IsPlayingback,
|
||||
pfnGetWaterLevel,
|
||||
pfnRefRenderGetParm,
|
||||
CL_GetMaxClients,
|
||||
pfnGetLocalHealth,
|
||||
Host_IsLocalGame,
|
||||
|
||||
Cvar_Get,
|
||||
Cvar_FindVarExt,
|
||||
Cvar_VariableValue,
|
||||
Cvar_VariableString,
|
||||
Cvar_SetValue,
|
||||
Cvar_Set,
|
||||
Cvar_RegisterVariable,
|
||||
Cvar_FullSet,
|
||||
|
||||
Cmd_AddRefCommand,
|
||||
Cmd_RemoveCommand,
|
||||
Cmd_Argc,
|
||||
Cmd_Argv,
|
||||
Cmd_Args,
|
||||
|
||||
Cbuf_AddText,
|
||||
Cbuf_InsertText,
|
||||
Cbuf_Execute,
|
||||
pfnCbuf_SetOpenGLConfigHack,
|
||||
|
||||
Con_Printf,
|
||||
Con_DPrintf,
|
||||
Con_Reportf,
|
||||
|
||||
Con_NPrintf,
|
||||
Con_NXPrintf,
|
||||
CL_CenterPrint,
|
||||
Con_DrawStringLen,
|
||||
Con_DrawString,
|
||||
CL_DrawCenterPrint,
|
||||
|
||||
CL_GetLocalPlayer,
|
||||
CL_GetViewModel,
|
||||
CL_GetEntityByIndex,
|
||||
pfnNumberOfEntities,
|
||||
R_BeamGetEntity,
|
||||
CL_GetWaterEntity,
|
||||
CL_AddVisibleEntity,
|
||||
|
||||
Mod_SampleSizeForFace,
|
||||
Mod_BoxVisible,
|
||||
pfnGetWorld,
|
||||
Mod_PointInLeaf,
|
||||
Mod_CreatePolygonsForHull,
|
||||
|
||||
R_StudioSlerpBones,
|
||||
R_StudioCalcBoneQuaternion,
|
||||
R_StudioCalcBonePosition,
|
||||
R_StudioGetAnim,
|
||||
pfnStudioEvent,
|
||||
|
||||
CL_DrawEFX,
|
||||
CL_ThinkParticle,
|
||||
R_FreeDeadParticles,
|
||||
CL_AllocParticleFast,
|
||||
pfnGetEfragsFreeList,
|
||||
pfnSetEfragsFreeList,
|
||||
R_GetTracerColor,
|
||||
CL_AllocElight,
|
||||
pfnGetDefaultSprite,
|
||||
|
||||
Mod_ForName,
|
||||
pfnMod_Extradata,
|
||||
CL_ModelHandle,
|
||||
pfnMod_GetCurrentLoadingModel,
|
||||
pfnMod_SetCurrentLoadingModel,
|
||||
pfnCL_NumModels,
|
||||
|
||||
CL_GetRemapInfoForEntity,
|
||||
CL_AllocRemapInfo,
|
||||
CL_FreeRemapInfo,
|
||||
CL_UpdateRemapInfo,
|
||||
|
||||
CL_ExtraUpdate,
|
||||
COM_HashKey,
|
||||
Host_Error,
|
||||
CL_FxBlend,
|
||||
COM_SetRandomSeed,
|
||||
COM_RandomFloat,
|
||||
COM_RandomLong,
|
||||
pfnGetScreenFade,
|
||||
CL_TextMessageGet,
|
||||
pfnGetPredictedOrigin,
|
||||
pfnCL_GetPaletteColor,
|
||||
pfnCL_GetScreenInfo,
|
||||
pfnSetLocalLightLevel,
|
||||
|
||||
pfnPlayerInfo,
|
||||
R_StudioGetPlayerState,
|
||||
Mod_CacheCheck,
|
||||
Mod_LoadCacheFile,
|
||||
Mod_Calloc,
|
||||
pfnGetStudioModelInterface,
|
||||
|
||||
_Mem_AllocPool,
|
||||
_Mem_FreePool,
|
||||
_Mem_Alloc,
|
||||
_Mem_Realloc,
|
||||
_Mem_Free,
|
||||
|
||||
COM_LoadLibrary,
|
||||
COM_FreeLibrary,
|
||||
COM_GetProcAddress,
|
||||
|
||||
FS_LoadFile,
|
||||
COM_ParseFile,
|
||||
FS_FileExists,
|
||||
FS_AllowDirectPaths,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
BuildGammaTable,
|
||||
LightToTexGamma,
|
||||
|
||||
CL_GetLightStyle,
|
||||
CL_GetDynamicLight,
|
||||
CL_GetEntityLight,
|
||||
R_FatPVS,
|
||||
GL_GetOverviewParms,
|
||||
Sys_DoubleTime,
|
||||
|
||||
pfnGetPhysent,
|
||||
pfnTraceSurface,
|
||||
PM_TraceLine,
|
||||
CL_VisTraceLine,
|
||||
CL_TraceLine,
|
||||
pfnGetMoveVars,
|
||||
|
||||
Image_AddCmdFlags,
|
||||
Image_SetForceFlags,
|
||||
Image_ClearForceFlags,
|
||||
Image_CustomPalette,
|
||||
Image_Process,
|
||||
FS_LoadImage,
|
||||
FS_SaveImage,
|
||||
FS_CopyImage,
|
||||
FS_FreeImage,
|
||||
Image_SetMDLPointer,
|
||||
pfnImage_GetPool,
|
||||
pfnImage_GetPFDesc,
|
||||
|
||||
pfnDrawNormalTriangles,
|
||||
pfnDrawTransparentTriangles,
|
||||
&clgame.drawFuncs
|
||||
};
|
||||
|
||||
static void R_UnloadProgs( void )
|
||||
|
@ -711,6 +711,16 @@ int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "gameui command", CMD_GAMEUIDLL );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_AddRefCommand
|
||||
============
|
||||
*/
|
||||
int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description )
|
||||
{
|
||||
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, description, CMD_REFDLL );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_RemoveCommand
|
||||
|
@ -505,6 +505,7 @@ void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const
|
||||
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function );
|
||||
int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description );
|
||||
void Cmd_RemoveCommand( const char *cmd_name );
|
||||
qboolean Cmd_Exists( const char *cmd_name );
|
||||
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
|
||||
|
@ -164,10 +164,11 @@ typedef struct ref_api_s
|
||||
|
||||
// cvar handlers
|
||||
convar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );
|
||||
convar_t *(*pfnGetCvarPointer)( const char *name );
|
||||
convar_t *(*pfnGetCvarPointer)( const char *name, int ignore_flags );
|
||||
float (*pfnGetCvarFloat)( const char *szName );
|
||||
const char *(*pfnGetCvarString)( const char *szName );
|
||||
void (*Cvar_SetValue)( const char *name, float value );
|
||||
void (*Cvar_Set)( const char *name, const char *value );
|
||||
void (*Cvar_RegisterVariable)( convar_t *var );
|
||||
void (*Cvar_FullSet)( const char *var_name, const char *value, int flags );
|
||||
|
||||
@ -176,6 +177,7 @@ typedef struct ref_api_s
|
||||
int (*Cmd_RemoveCommand)( const char *cmd_name );
|
||||
int (*Cmd_Argc)( void );
|
||||
const char *(*Cmd_Argv)( int arg );
|
||||
const char *(*Cmd_Args)( void );
|
||||
|
||||
// cbuf
|
||||
void (*Cbuf_AddText)( const char *commands );
|
||||
@ -184,7 +186,6 @@ typedef struct ref_api_s
|
||||
void (*Cbuf_SetOpenGLConfigHack)( qboolean set ); // host.apply_opengl_config
|
||||
|
||||
// logging
|
||||
void (*Con_VPrintf)( const char *fmt, va_list args );
|
||||
void (*Con_Printf)( const char *fmt, ... ); // typical console allowed messages
|
||||
void (*Con_DPrintf)( const char *fmt, ... ); // -dev 1
|
||||
void (*Con_Reportf)( const char *fmt, ... ); // -dev 2
|
||||
@ -227,7 +228,7 @@ typedef struct ref_api_s
|
||||
particle_t *(*CL_AllocParticleFast)( void ); // unconditionally give new particle pointer from cl_free_particles
|
||||
efrag_t* (*GetEfragsFreeList)( void ); // clgame.free_efrags
|
||||
void (*SetEfragsFreeList)( efrag_t* ); // clgame.free_efrags
|
||||
color24 *(*GetTracerColors)( int num );
|
||||
color24 *(*GetTracerColors)( uint num );
|
||||
struct dlight_s *(*CL_AllocElight)( int key );
|
||||
struct model_s *(*GetDefaultSprite)( enum ref_defaultsprite_e spr );
|
||||
|
||||
@ -237,7 +238,7 @@ typedef struct ref_api_s
|
||||
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
||||
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
|
||||
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
|
||||
int (*CL_NumModels)( void );
|
||||
int (*CL_NumModels)( void ); // cl.nummodels
|
||||
|
||||
// remap
|
||||
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
||||
@ -276,7 +277,7 @@ typedef struct ref_api_s
|
||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||
|
||||
// library management
|
||||
void *(*COM_LoadLibrary)( const char *name );
|
||||
void *(*COM_LoadLibrary)( const char *name, int build_ordinals_table, qboolean directpath );
|
||||
void (*COM_FreeLibrary)( void *handle );
|
||||
void *(*COM_GetProcAddress)( void *handle, const char *name );
|
||||
|
||||
@ -304,26 +305,8 @@ typedef struct ref_api_s
|
||||
dlight_t* (*GetDynamicLight)( int number );
|
||||
dlight_t* (*GetEntityLight)( int number );
|
||||
int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
||||
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
||||
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
|
||||
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
|
||||
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
|
||||
void (*AVI_FreeVideo)( void *Avi );
|
||||
int (*AVI_IsActive)( void *Avi );
|
||||
void (*AVI_StreamSound)( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
|
||||
const struct ref_overview_s *( *GetOverviewParms )( void );
|
||||
const char *( *GetFileByIndex )( int fileindex );
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||
unsigned int (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
||||
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
|
||||
void* ( *pfnGetModel )( int modelindex );
|
||||
float (*pfnTime)( void ); // Sys_DoubleTime
|
||||
void (*Cvar_Set)( const char *name, const char *value );
|
||||
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
||||
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||
double (*pfnTime)( void ); // Sys_DoubleTime
|
||||
|
||||
// event api
|
||||
struct physent_s *(*EV_GetPhysent)( int idx );
|
||||
@ -350,7 +333,7 @@ typedef struct ref_api_s
|
||||
// client exports
|
||||
void (*pfnDrawNormalTriangles)( void );
|
||||
void (*pfnDrawTransparentTriangles)( void );
|
||||
render_interface_t drawFuncs;
|
||||
render_interface_t *drawFuncs;
|
||||
} ref_api_t;
|
||||
|
||||
struct mip_s;
|
||||
|
@ -19,21 +19,6 @@ GNU General Public License for more details.
|
||||
ref_api_t gEngfuncs;
|
||||
ref_globals_t *gpGlobals;
|
||||
|
||||
/*
|
||||
============
|
||||
Con_Printf
|
||||
|
||||
engine callback wrapper
|
||||
============
|
||||
*/
|
||||
void Con_Printf( const char *fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start( args, fmt );
|
||||
gEngfuncs.Con_VPrintf( fmt, args );
|
||||
va_end( args );
|
||||
}
|
||||
|
||||
static void R_ClearScreen( void )
|
||||
{
|
||||
pglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
|
@ -387,7 +387,6 @@ void R_SetupRefParams( const struct ref_viewpass_s *rvp );
|
||||
void R_TranslateForEntity( cl_entity_t *e );
|
||||
void R_RotateForEntity( cl_entity_t *e );
|
||||
void R_SetupGL( qboolean set_gl_state );
|
||||
qboolean R_InitRenderAPI( void );
|
||||
void R_AllowFog( qboolean allowed );
|
||||
void R_SetupFrustum( void );
|
||||
void R_FindViewLeaf( void );
|
||||
@ -470,6 +469,7 @@ player_info_t *pfnPlayerInfo( int index );
|
||||
void R_GatherPlayerLight( void );
|
||||
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc );
|
||||
void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
|
||||
void R_StudioResetPlayerModels( void );
|
||||
void CL_InitStudioAPI( void );
|
||||
void Mod_StudioLoadTextures( model_t *mod, void *data );
|
||||
void Mod_StudioUnloadTextures( void *data );
|
||||
|
@ -769,20 +769,20 @@ void GL_InitCommands( void )
|
||||
r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" );
|
||||
r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
|
||||
r_drawentities = gEngfuncs.Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals" );
|
||||
r_showhull = gEngfuncs.pfnGetCvarPointer( "r_showhull" );
|
||||
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals", 0 );
|
||||
r_showhull = gEngfuncs.pfnGetCvarPointer( "r_showhull", 0 );
|
||||
|
||||
gl_extensions = gEngfuncs.Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
|
||||
gl_texture_nearest = gEngfuncs.Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
|
||||
gl_lightmap_nearest = gEngfuncs.Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" );
|
||||
gl_check_errors = gEngfuncs.Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
|
||||
gl_vsync = gEngfuncs.pfnGetCvarPointer( "gl_vsync" );
|
||||
gl_vsync = gEngfuncs.pfnGetCvarPointer( "gl_vsync", 0 );
|
||||
gl_detailscale = gEngfuncs.Cvar_Get( "gl_detailscale", "4.0", FCVAR_ARCHIVE, "default scale applies while auto-generate list of detail textures" );
|
||||
gl_texture_anisotropy = gEngfuncs.Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" );
|
||||
gl_texture_lodbias = gEngfuncs.Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" );
|
||||
gl_keeptjunctions = gEngfuncs.Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
|
||||
gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
|
||||
gl_showtextures = gEngfuncs.pfnGetCvarPointer( "r_showtextures" );
|
||||
gl_showtextures = gEngfuncs.pfnGetCvarPointer( "r_showtextures", 0 );
|
||||
gl_finish = gEngfuncs.Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
||||
gl_nosort = gEngfuncs.Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );
|
||||
gl_clear = gEngfuncs.Cvar_Get( "gl_clear", "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
||||
@ -798,15 +798,15 @@ void GL_InitCommands( void )
|
||||
// make sure gl_vsync is checked after vid_restart
|
||||
SetBits( gl_vsync->flags, FCVAR_CHANGED );
|
||||
|
||||
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma" );
|
||||
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness" );
|
||||
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma", 0 );
|
||||
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness", 0 );
|
||||
|
||||
tracerred = gEngfuncs.pfnGetCvarPointer( "tracerred" );
|
||||
tracergreen = gEngfuncs.pfnGetCvarPointer( "tracergreen" );
|
||||
tracerblue = gEngfuncs.pfnGetCvarPointer( "tracerblue" );
|
||||
traceralpha = gEngfuncs.pfnGetCvarPointer( "traceralpha" );
|
||||
tracerred = gEngfuncs.pfnGetCvarPointer( "tracerred", 0 );
|
||||
tracergreen = gEngfuncs.pfnGetCvarPointer( "tracergreen", 0 );
|
||||
tracerblue = gEngfuncs.pfnGetCvarPointer( "tracerblue", 0 );
|
||||
traceralpha = gEngfuncs.pfnGetCvarPointer( "traceralpha", 0 );
|
||||
|
||||
cl_lightstyle_lerping = gEngfuncs.pfnGetCvarPointer( "cl_lightstyle_lerping" );
|
||||
cl_lightstyle_lerping = gEngfuncs.pfnGetCvarPointer( "cl_lightstyle_lerping", 0 );
|
||||
|
||||
gEngfuncs.Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
|
||||
gEngfuncs.Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
|
||||
|
@ -110,6 +110,8 @@ void R_NewMap( void )
|
||||
|
||||
R_ClearDecals(); // clear all level decals
|
||||
|
||||
R_StudioResetPlayerModels();
|
||||
|
||||
// upload detailtextures
|
||||
if( CVAR_TO_BOOL( r_detailtextures ))
|
||||
{
|
||||
|
@ -109,6 +109,9 @@ typedef struct
|
||||
vec4_t lightpos[MAXSTUDIOVERTS][MAX_LOCALLIGHTS];
|
||||
vec3_t lightbonepos[MAXSTUDIOBONES][MAX_LOCALLIGHTS];
|
||||
float locallightR2[MAX_LOCALLIGHTS];
|
||||
|
||||
// playermodels
|
||||
player_model_t player_models[MAX_CLIENTS];
|
||||
} studio_draw_state_t;
|
||||
|
||||
// studio-related cvars
|
||||
@ -365,16 +368,10 @@ pfnPlayerInfo
|
||||
*/
|
||||
player_info_t *pfnPlayerInfo( int index )
|
||||
{
|
||||
#if 0
|
||||
if( !RI.drawWorld )
|
||||
return &gameui.playerinfo;
|
||||
index = -1;
|
||||
|
||||
if( index < 0 || index > cl.maxclients )
|
||||
return NULL;
|
||||
return &cl.players[index];
|
||||
#else
|
||||
return gEngfuncs.pfnPlayerInfo( index );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -398,14 +395,8 @@ entity_state_t *R_StudioGetPlayerState( int index )
|
||||
{
|
||||
if( !RI.drawWorld )
|
||||
return &RI.currententity->curstate;
|
||||
#if 0
|
||||
if( index < 0 || index >= cl.maxclients )
|
||||
return NULL;
|
||||
|
||||
return &cl.frames[cl.parsecountmod].playerstate[index];
|
||||
#else
|
||||
return gEngfuncs.pfnGetPlayerState( index );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2398,7 +2389,7 @@ R_StudioSetRemapColors
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_StudioSetRemapColors( int newTop, int newBottom )
|
||||
static void R_StudioSetRemapColors( int newTop, int newBottom )
|
||||
{
|
||||
gEngfuncs.CL_AllocRemapInfo( newTop, newBottom );
|
||||
|
||||
@ -2409,6 +2400,11 @@ void R_StudioSetRemapColors( int newTop, int newBottom )
|
||||
}
|
||||
}
|
||||
|
||||
void R_StudioResetPlayerModels( void )
|
||||
{
|
||||
memset( g_studio.player_models, 0, sizeof( g_studio.player_models ));
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_StudioSetupPlayerModel
|
||||
@ -2420,9 +2416,7 @@ static model_t *R_StudioSetupPlayerModel( int index )
|
||||
player_info_t *info = gEngfuncs.pfnPlayerInfo( index );
|
||||
player_model_t *state;
|
||||
|
||||
#if 0
|
||||
state = &cl.player_models[index];
|
||||
#endif
|
||||
state = &g_studio.player_models[index];
|
||||
|
||||
// g-cont: force for "dev-mode", non-local games and menu preview
|
||||
if(( gpGlobals->developer || !gEngfuncs.Host_IsLocalGame( ) || !RI.drawWorld ) && info->model[0] )
|
||||
@ -3634,7 +3628,7 @@ static void pfnMod_LoadCacheFile( const char *path, struct cache_user_s *cu )
|
||||
|
||||
static cvar_t *pfnGetCvarPointer( const char *name )
|
||||
{
|
||||
return (cvar_t*)gEngfuncs.pfnGetCvarPointer( name );
|
||||
return (cvar_t*)gEngfuncs.pfnGetCvarPointer( name, 0 );
|
||||
}
|
||||
|
||||
static void *pfnMod_Calloc( int number, size_t size )
|
||||
@ -3711,7 +3705,7 @@ void CL_InitStudioAPI( void )
|
||||
pStudioDraw = &gStudioDraw;
|
||||
|
||||
// trying to grab them from client.dll
|
||||
cl_righthand = gEngfuncs.pfnGetCvarPointer( "cl_righthand" );
|
||||
cl_righthand = gEngfuncs.pfnGetCvarPointer( "cl_righthand", 0 );
|
||||
|
||||
if( cl_righthand == NULL )
|
||||
cl_righthand = gEngfuncs.Cvar_Get( "cl_righthand", "0", FCVAR_ARCHIVE, "flip viewmodel (left to right)" );
|
||||
|
Loading…
Reference in New Issue
Block a user