04 Nov 2010

This commit is contained in:
g-cont 2010-11-04 00:00:00 +03:00 committed by Alibek Omarov
parent bdaacfbc84
commit 737646d6bd
29 changed files with 1150 additions and 151 deletions

View File

@ -5,7 +5,7 @@
#include "extdll.h"
#include "utils.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "hud.h"
#include "aurora.h"
#include "pm_defs.h"

View File

@ -5,7 +5,7 @@
#include "extdll.h"
#include "utils.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "r_efx.h"
#include "ref_params.h"
#include "ev_hldm.h"
@ -1493,6 +1493,10 @@ void CViewRenderBeams::DrawBeam( Beam_t *pbeam )
color[2] = srcColor[2];
}
// HACKHACK: for Salute mod
if( pbeam->type == TE_BEAMFOLLOW && pbeam->entity[0] )
pbeam->brightness = pbeam->entity[0]->curstate.renderamt;
color[0] *= ((float)pbeam->brightness / 255.0);
color[1] *= ((float)pbeam->brightness / 255.0);
color[2] *= ((float)pbeam->brightness / 255.0);

View File

@ -5,7 +5,7 @@
#include "extdll.h"
#include "utils.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "r_efx.h"
#include "pm_movevars.h"
#include "ev_hldm.h"

View File

@ -12,21 +12,6 @@
#define SIMSHIFT 10
#define SPARK_COLORCOUNT 9
typedef enum
{
pt_static,
pt_grav,
pt_slowgrav,
pt_fire,
pt_explode,
pt_explode2,
pt_blob,
pt_blob2,
pt_vox_slowgrav,
pt_vox_grav,
pt_clientcustom // Must have callback function specified
} ptype_t;
class CBaseParticle
{
public:

View File

@ -6,7 +6,7 @@
#include "extdll.h"
#include "utils.h"
#include "studio_event.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "entity_types.h"
#include "pm_movevars.h"
#include "r_tempents.h"

View File

@ -5,7 +5,7 @@
#include "extdll.h"
#include "utils.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "r_efx.h"
#include "pm_movevars.h"
#include "ev_hldm.h"

View File

@ -7,7 +7,7 @@
#include "extdll.h"
#include "utils.h"
#include "r_efx.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "hud.h"
#include "r_weather.h"
#include "pm_defs.h"

View File

@ -6,7 +6,7 @@
#include "extdll.h"
#include "utils.h"
#include "ref_params.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "pm_movevars.h"
#include "r_beams.h"
#include "studio.h"

View File

@ -5,7 +5,7 @@
#include "extdll.h"
#include "utils.h"
#include "hud.h"
#include "triangle_api.h"
#include "triangleapi.h"
#define MAX_LOGO_FRAMES 56

60
common/beamdef.h Normal file
View File

@ -0,0 +1,60 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef BEAMDEF_H
#define BEAMDEF_H
#define FBEAM_STARTENTITY 0x00000001
#define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000
typedef struct beam_s BEAM;
struct beam_s
{
BEAM *next;
int type;
int flags;
vec3_t source;
vec3_t target;
vec3_t delta;
float t; // 0 .. 1 over lifetime of beam
float freq;
float die;
float width;
float amplitude;
float r, g, b;
float brightness;
float speed;
float frameRate;
float frame;
int segments;
int startEntity;
int endEntity;
int modelIndex;
int frameCount;
struct model_s *pFollowModel;
struct particle_s *particles;
};
#endif//BEAMDEF_H

View File

@ -254,51 +254,6 @@ typedef struct cl_enginefuncs_s
#define CLDLL_INTERFACE_VERSION 7
extern void ClientDLL_Init( void ); // from cdll_int.c
extern void ClientDLL_Shutdown( void );
extern void ClientDLL_HudInit( void );
extern void ClientDLL_HudVidInit( void );
extern void ClientDLL_UpdateClientData( void );
extern void ClientDLL_Frame( double time );
extern void ClientDLL_HudRedraw( int intermission );
extern void ClientDLL_MoveClient( struct playermove_s *ppmove );
extern void ClientDLL_ClientMoveInit( struct playermove_s *ppmove );
extern char ClientDLL_ClientTextureType( char *name );
extern void ClientDLL_CreateMove( float frametime, struct usercmd_s *cmd, int active );
extern void ClientDLL_ActivateMouse( void );
extern void ClientDLL_DeactivateMouse( void );
extern void ClientDLL_MouseEvent( int mstate );
extern void ClientDLL_ClearStates( void );
extern int ClientDLL_IsThirdPerson( void );
extern void ClientDLL_GetCameraOffsets( float *ofs );
extern int ClientDLL_GraphKeyDown( void );
extern struct kbutton_s *ClientDLL_FindKey( const char *name );
extern void ClientDLL_CAM_Think( void );
extern void ClientDLL_IN_Accumulate( void );
extern void ClientDLL_CalcRefdef( struct ref_params_s *pparams );
extern int ClientDLL_AddEntity( int type, struct cl_entity_s *ent );
extern void ClientDLL_CreateEntities( void );
extern void ClientDLL_DrawNormalTriangles( void );
extern void ClientDLL_DrawTransparentTriangles( void );
extern void ClientDLL_StudioEvent( const struct mstudioevent_s *event, const struct cl_entity_s *entity );
extern void ClientDLL_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );
extern void ClientDLL_TxferLocalOverrides( struct entity_state_s *state, const struct clientdata_s *client );
extern void ClientDLL_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src );
extern void ClientDLL_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd );
extern void ClientDLL_ReadDemoBuffer( int size, unsigned char *buffer );
extern int ClientDLL_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
extern int ClientDLL_GetHullBounds( int hullnumber, float *mins, float *maxs );
extern void ClientDLL_VGui_ConsolePrint(const char* text);
extern int ClientDLL_Key_Event( int down, int keynum, const char *pszCurrentBinding );
extern void ClientDLL_TempEntUpdate( double ft, double ct, double grav, struct tempent_s **ppFreeTE, struct tempent_s **ppActiveTE, int ( *addTEntity )( struct cl_entity_s *pEntity ), void ( *playTESound )( struct tempent_s *pTemp, float damp ) );
extern struct cl_entity_s *ClientDLL_GetUserEntity( int index );
extern void ClientDLL_VoiceStatus(int entindex, qboolean bTalking);
extern void ClientDLL_DirectorMessage( int iSize, void *pbuf );
typedef struct
{
int (*pfnVidInit)( void );

53
common/particledef.h Normal file
View File

@ -0,0 +1,53 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef PARTICLEDEF_H
#define PARTICLEDEF_H
typedef enum
{
pt_static,
pt_grav,
pt_slowgrav,
pt_fire,
pt_explode,
pt_explode2,
pt_blob,
pt_blob2,
pt_vox_slowgrav,
pt_vox_grav,
pt_clientcustom // Must have callback function specified
} ptype_t;
typedef struct particle_s
{
vec3_t org;
short color;
short packedColor;
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
void (*deathfunc)( struct particle_s *particle );
// for pt_clientcusttom, we'll call this function each frame
void (*callback)( struct particle_s *particle, float frametime );
// For deathfunc, etc.
unsigned char context;
} particle_t;
#endif//PARTICLEDEF_H

View File

@ -5,7 +5,10 @@
#ifndef R_EFX_H
#define R_EFX_H
#include "particledef.h"
#include "beamdef.h"
#include "dlight.h"
#include "cl_entity.h"
typedef struct efx_api_s
{

View File

@ -1,56 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// triangle_api.h - custom triangles rendering
//=======================================================================
#ifndef TRIANGLE_API_H
#define TRIANGLE_API_H
#define TRI_API_VERSION 2
typedef enum
{
TRI_FRONT = 0,
TRI_NONE,
} TRI_CULL;
#define TRI_TRIANGLES 0
#define TRI_TRIANGLE_FAN 1
#define TRI_QUADS 2
#define TRI_POLYGON 3
#define TRI_LINES 4
#define TRI_TRIANGLE_STRIP 5
#define TRI_QUAD_STRIP 6 // UNDONE: not implemented
typedef enum
{
TRI_SHADER = 1,
TRI_MAXCAPS
} TRI_CAPS;
typedef struct triangleapi_s
{
int version;
int (*LoadShader)( const char *szShaderName, int fShaderNoMip );
int (*GetSpriteTexture)( int spriteIndex, int spriteFrame );
void (*RenderMode)( int mode );
void (*Begin)( int primitiveCode );
void (*End)( void );
void (*Enable)( int cap );
void (*Disable)( int cap );
void (*Vertex3f)( float x, float y, float z );
void (*Vertex3fv)( const float *v );
void (*Normal3f)( float x, float y, float z );
void (*Normal3fv)( const float *v );
void (*Color4f)( float r, float g, float b, float a );
void (*Color4ub)( byte r, byte g, byte b, byte a );
void (*TexCoord2f)( float u, float v );
void (*Bind)( int shader, int frame ); // use handle that return pfnLoadShader
void (*CullFace)( TRI_CULL mode );
void (*ScreenToWorld)( float *screen, float *world );
int (*WorldToScreen)( float *world, float *screen ); // returns 1 if it's z clipped
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn );
} triangleapi_t;
#endif//TRIANGLE_API_H

70
common/triangleapi.h Normal file
View File

@ -0,0 +1,70 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef TRIANGLEAPI_H
#define TRIANGLEAPI_H
typedef enum
{
TRI_FRONT = 0,
TRI_NONE = 1,
} TRICULLSTYLE;
#define TRI_API_VERSION 1
#define TRI_TRIANGLES 0
#define TRI_TRIANGLE_FAN 1
#define TRI_QUADS 2
#define TRI_POLYGON 3
#define TRI_LINES 4
#define TRI_TRIANGLE_STRIP 5
#define TRI_QUAD_STRIP 6
typedef enum
{
TRI_SHADER = 1,
TRI_MAXCAPS
} TRI_CAPS;
typedef struct triangleapi_s
{
int version;
void (*RenderMode)( int mode );
void (*Begin)( int primitiveCode );
void (*End)( void );
void (*Color4f)( float r, float g, float b, float a );
void (*Color4ub)( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
void (*TexCoord2f)( float u, float v );
void (*Vertex3fv)( float *worldPnt );
void (*Vertex3f)( float x, float y, float z );
void (*Brightness)( float brightness );
void (*CullFace)( TRICULLSTYLE style );
int (*GetSpriteTexture)( int spriteIndex, int spriteFrame );
int (*WorldToScreen)( float *world, float *screen ); // Returns 1 if it's z clipped
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
void (*ScreenToWorld)( float *screen, float *world );
// Xash3D interface starts here
int (*LoadShader)( const char *szShaderName, int fShaderNoMip );
void (*Enable)( int cap );
void (*Disable)( int cap );
void (*Normal3f)( float x, float y, float z );
void (*Normal3fv)( const float *v );
void (*Bind)( int shader, int frame ); // use handle that return LoadShader
} triangleapi_t;
#endif//TRIANGLEAPI_H

View File

@ -8,12 +8,60 @@
#include "byteorder.h"
#include "matrix_lib.h"
#include "const.h"
#include "triangle_api.h"
#include "triangleapi.h"
#include "r_efx.h"
#include "net_api.h"
#include "demo_api.h"
#include "event_flags.h"
#include "ivoicetweak.h"
#include "pm_local.h"
#include "input.h"
#include "shake.h"
static dllfunc_t cdll_exports[] =
{
{ "Initialize", (void **)&clgame.cdllFuncs.pfnInitialize },
{ "HUD_VidInit", (void **)&clgame.cdllFuncs.pfnVidInit },
{ "HUD_Init", (void **)&clgame.cdllFuncs.pfnInit },
{ "HUD_Shutdown", (void **)&clgame.cdllFuncs.pfnShutdown },
{ "HUD_Redraw", (void **)&clgame.cdllFuncs.pfnRedraw },
{ "HUD_UpdateClientData", (void **)&clgame.cdllFuncs.pfnUpdateClientData },
{ "HUD_Reset", (void **)&clgame.cdllFuncs.pfnReset },
{ "HUD_PlayerMove", (void **)&clgame.cdllFuncs.pfnPlayerMove },
{ "HUD_PlayerMoveInit", (void **)&clgame.cdllFuncs.pfnPlayerMoveInit },
{ "HUD_PlayerMoveTexture", (void **)&clgame.cdllFuncs.pfnPlayerMoveTexture },
{ "HUD_ConnectionlessPacket", (void **)&clgame.cdllFuncs.pfnConnectionlessPacket },
{ "HUD_GetHullBounds", (void **)&clgame.cdllFuncs.pfnGetHullBounds },
{ "HUD_Frame", (void **)&clgame.cdllFuncs.pfnFrame },
{ "HUD_VoiceStatus", (void **)&clgame.cdllFuncs.pfnVoiceStatus },
{ "HUD_DirectorMessage", (void **)&clgame.cdllFuncs.pfnDirectorMessage },
{ "HUD_PostRunCmd", (void **)&clgame.cdllFuncs.pfnPostRunCmd },
{ "HUD_Key_Event", (void **)&clgame.cdllFuncs.pfnKey_Event },
{ "HUD_AddEntity", (void **)&clgame.cdllFuncs.pfnAddEntity },
{ "HUD_CreateEntities", (void **)&clgame.cdllFuncs.pfnCreateEntities },
{ "HUD_StudioEvent", (void **)&clgame.cdllFuncs.pfnStudioEvent },
{ "HUD_TxferLocalOverrides", (void **)&clgame.cdllFuncs.pfnTxferLocalOverrides },
{ "HUD_ProcessPlayerState", (void **)&clgame.cdllFuncs.pfnProcessPlayerState },
{ "HUD_TxferPredictionData", (void **)&clgame.cdllFuncs.pfnTxferPredictionData },
{ "HUD_TempEntUpdate", (void **)&clgame.cdllFuncs.pfnTempEntUpdate },
{ "HUD_DrawNormalTriangles", (void **)&clgame.cdllFuncs.pfnDrawNormalTriangles },
{ "HUD_DrawTransparentTriangles", (void **)&clgame.cdllFuncs.pfnDrawTransparentTriangles },
{ "HUD_GetUserEntity", (void **)&clgame.cdllFuncs.pfnGetUserEntity },
{ "Demo_ReadBuffer", (void **)&clgame.cdllFuncs.pfnDemo_ReadBuffer },
{ "CAM_Think", (void **)&clgame.cdllFuncs.CAM_Think },
{ "CL_IsThirdPerson", (void **)&clgame.cdllFuncs.CL_IsThirdPerson },
{ "CL_CameraOffset", (void **)&clgame.cdllFuncs.CL_CameraOffset },
{ "CL_CreateMove", (void **)&clgame.cdllFuncs.CL_CreateMove },
{ "IN_ActivateMouse", (void **)&clgame.cdllFuncs.IN_ActivateMouse },
{ "IN_DeactivateMouse", (void **)&clgame.cdllFuncs.IN_DeactivateMouse },
{ "IN_MouseEvent", (void **)&clgame.cdllFuncs.IN_MouseEvent },
{ "IN_Accumulate", (void **)&clgame.cdllFuncs.IN_Accumulate },
{ "IN_ClearStates", (void **)&clgame.cdllFuncs.IN_ClearStates },
{ "V_CalcRefdef", (void **)&clgame.cdllFuncs.V_CalcRefdef },
{ "KB_Find", (void **)&clgame.cdllFuncs.KB_Find },
{ NULL, NULL }
};
/*
====================
CL_GetEntityByIndex
@ -2120,13 +2168,146 @@ void VGui_ViewportPaintBackground( int extents[4] )
/*
=============
pfnIsInGame
pfnLoadMapSprite
=============
*/
int pfnIsInGame( void )
model_t *pfnLoadMapSprite( const char *filename )
{
return ( cls.key_dest == key_game ) ? true : false;
// FIXME: implement
return NULL;
}
/*
=============
PlayerInfo_ValueForKey
=============
*/
const char *PlayerInfo_ValueForKey( int playerNum, const char *key )
{
// find the player
if(( playerNum > cl.maxclients ) || ( playerNum < 1 ))
return NULL;
if(( cl.players[playerNum-1].name == NULL ) || (*(cl.players[playerNum-1].name) == 0 ))
return NULL;
return Info_ValueForKey( cl.players[playerNum-1].userinfo, key );
}
/*
=============
PlayerInfo_SetValueForKey
=============
*/
void PlayerInfo_SetValueForKey( const char *key, const char *value )
{
// FIXME: implement
}
/*
=============
pfnGetPlayerUniqueID
=============
*/
qboolean pfnGetPlayerUniqueID( int iPlayer, char playerID[16] )
{
// FIXME: implement
return false;
}
/*
=============
pfnGetTrackerIDForPlayer
=============
*/
int pfnGetTrackerIDForPlayer( int playerSlot )
{
playerSlot -= 1; // make into a client index
if( !cl.players[playerSlot].userinfo[0] || !cl.players[playerSlot].name[0] )
return 0;
return com.atoi( Info_ValueForKey( cl.players[playerSlot].userinfo, "*tracker" ));
}
/*
=============
pfnGetPlayerForTrackerID
=============
*/
int pfnGetPlayerForTrackerID( int trackerID )
{
int i;
for( i = 0; i < MAX_CLIENTS; i++ )
{
if( !cl.players[i].userinfo[0] || !cl.players[i].name[0] )
continue;
if( com.atoi( Info_ValueForKey( cl.players[i].userinfo, "*tracker" )) == trackerID )
{
// make into a player slot
return (i+1);
}
}
return 0;
}
/*
=============
pfnServerCmdUnreliable
=============
*/
int pfnServerCmdUnreliable( char *szCmdString )
{
if( !szCmdString || !*szCmdString )
return 0;
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
BF_WriteString( &cls.netchan.message, szCmdString );
return 1;
}
/*
=============
pfnGetMousePos
=============
*/
void pfnGetMousePos( struct tagPOINT *ppt )
{
GetCursorPos( ppt );
}
/*
=============
pfnSetMousePos
=============
*/
void pfnSetMousePos( int mx, int my )
{
if( !mx && !my ) return;
Sys_QueEvent( SE_MOUSE, mx, my, 0, NULL );
}
/*
=============
pfnSetMouseEnable
=============
*/
void pfnSetMouseEnable( qboolean fEnable )
{
if( fEnable ) IN_ActivateMouse();
else IN_DeactivateMouse();
}
/*
@ -2253,6 +2434,11 @@ callback from renderer
*/
void Tri_DrawTriangles( int fTrans )
{
if( fTrans )
{
CL_DrawParticles ();
}
clgame.dllFuncs.pfnDrawTriangles( fTrans );
}
@ -2444,13 +2630,24 @@ void TriTexCoord2f( float u, float v )
re->TexCoord2f( u, v );
}
/*
=============
TriBrightness
=============
*/
void TriBrightness( float brightness )
{
// FIXME: implement
}
/*
=============
TriCullFace
=============
*/
void TriCullFace( TRI_CULL mode )
void TriCullFace( TRICULLSTYLE mode )
{
if( !re ) return;
re->CullFace( mode );
@ -2505,28 +2702,262 @@ void TriFog( float flFogColor[3], float flStart, float flEnd, int bOn )
if( re ) re->Fog( flFogColor, flStart, flEnd, bOn );
}
/*
=================
DemoApi implementation
=================
*/
/*
=================
Demo_IsRecording
=================
*/
static int Demo_IsRecording( void )
{
return cls.demorecording;
}
/*
=================
Demo_IsPlayingback
=================
*/
static int Demo_IsPlayingback( void )
{
return cls.demoplayback;
}
/*
=================
Demo_IsTimeDemo
=================
*/
static int Demo_IsTimeDemo( void )
{
return cls.timedemo;
}
/*
=================
Demo_WriteBuffer
=================
*/
static void Demo_WriteBuffer( int size, byte *buffer )
{
// FIXME: implement
}
/*
=================
NetworkApi implementation
=================
*/
/*
=================
NetAPI_InitNetworking
=================
*/
void NetAPI_InitNetworking( void )
{
// FIXME: implement
}
/*
=================
NetAPI_InitNetworking
=================
*/
void NetAPI_Status( net_status_t *status )
{
// FIXME: implement
}
/*
=================
NetAPI_SendRequest
=================
*/
void NetAPI_SendRequest( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response )
{
// FIXME: implement
}
/*
=================
NetAPI_CancelRequest
=================
*/
void NetAPI_CancelRequest( int context )
{
// FIXME: implement
}
/*
=================
NetAPI_CancelAllRequests
=================
*/
void NetAPI_CancelAllRequests( void )
{
// FIXME: implement
}
/*
=================
NetAPI_AdrToString
=================
*/
char *NetAPI_AdrToString( netadr_t *a )
{
return NET_AdrToString( *a );
}
/*
=================
NetAPI_CompareAdr
=================
*/
int NetAPI_CompareAdr( netadr_t *a, netadr_t *b )
{
return NET_CompareAdr( *a, *b );
}
/*
=================
NetAPI_StringToAdr
=================
*/
int NetAPI_StringToAdr( char *s, netadr_t *a )
{
return NET_StringToAdr( s, a );
}
/*
=================
NetAPI_ValueForKey
=================
*/
const char *NetAPI_ValueForKey( const char *s, const char *key )
{
return Info_ValueForKey( s, key );
}
/*
=================
NetAPI_RemoveKey
=================
*/
void NetAPI_RemoveKey( char *s, const char *key )
{
Info_RemoveKey( s, key );
}
/*
=================
NetAPI_SetValueForKey
=================
*/
void NetAPI_SetValueForKey( char *s, const char *key, const char *value, int maxsize )
{
if( maxsize > MAX_INFO_STRING ) return;
Info_SetValueForKey( s, key, value );
}
/*
=================
IVoiceTweak implementation
=================
*/
/*
=================
Voice_StartVoiceTweakMode
=================
*/
int Voice_StartVoiceTweakMode( void )
{
// UNDONE: wait for voice implementation in snd_dx.dll
// g-cont. may be move snd_dx.dll back into the engine ?
return 0;
}
/*
=================
Voice_EndVoiceTweakMode
=================
*/
void Voice_EndVoiceTweakMode( void )
{
// FIXME: implement
}
/*
=================
Voice_SetControlFloat
=================
*/
void Voice_SetControlFloat( VoiceTweakControl iControl, float value )
{
// FIXME: implement
}
/*
=================
Voice_GetControlFloat
=================
*/
float Voice_GetControlFloat( VoiceTweakControl iControl )
{
// FIXME: implement
return 1.0f;
}
static triangleapi_t gTriApi =
{
TRI_API_VERSION,
TriLoadShader,
TriGetSpriteFrame,
TriRenderMode,
TriBegin,
TriEnd,
TriEnable,
TriDisable,
TriVertex3f,
TriVertex3fv,
TriNormal3f,
TriNormal3fv,
TriColor4f,
TriColor4ub,
TriTexCoord2f,
TriBind,
TriVertex3fv,
TriVertex3f,
TriBrightness,
TriCullFace,
TriScreenToWorld,
TriGetSpriteFrame,
TriWorldToScreen,
TriFog
TriFog,
TriScreenToWorld,
TriLoadShader,
TriEnable,
TriDisable,
TriNormal3f,
TriNormal3fv,
TriBind,
};
static efx_api_t gEfxApi =
@ -2569,6 +3000,37 @@ static event_api_t gEventApi =
pfnKillEvents,
};
static demo_api_t gDemoApi =
{
Demo_IsRecording,
Demo_IsPlayingback,
Demo_IsTimeDemo,
Demo_WriteBuffer,
};
static net_api_t gNetApi =
{
NetAPI_InitNetworking,
NetAPI_Status,
NetAPI_SendRequest,
NetAPI_CancelRequest,
NetAPI_CancelAllRequests,
NetAPI_AdrToString,
NetAPI_CompareAdr,
NetAPI_StringToAdr,
NetAPI_ValueForKey,
NetAPI_RemoveKey,
NetAPI_SetValueForKey,
};
static IVoiceTweak gVoiceApi =
{
Voice_StartVoiceTweakMode,
Voice_EndVoiceTweakMode,
Voice_SetControlFloat,
Voice_GetControlFloat,
};
// engine callbacks
static cl_enginefunc_t gEngfuncs =
{
@ -2657,11 +3119,22 @@ static cl_enginefunc_t gEngfuncs =
&gTriApi,
&gEfxApi,
&gEventApi,
NULL,
NULL,
NULL,
&gDemoApi,
&gNetApi,
&gVoiceApi,
pfnIsSpectateOnly,
// FIXME: add missed builtins
pfnLoadMapSprite,
COM_AddAppDirectoryToSearchPath,
COM_ExpandFilename,
PlayerInfo_ValueForKey,
PlayerInfo_SetValueForKey,
pfnGetPlayerUniqueID,
pfnGetTrackerIDForPlayer,
pfnGetPlayerForTrackerID,
pfnServerCmdUnreliable,
pfnGetMousePos,
pfnSetMousePos,
pfnSetMouseEnable,
};
void CL_UnloadProgs( void )
@ -2669,6 +3142,7 @@ void CL_UnloadProgs( void )
if( !clgame.hInstance ) return;
CL_FreeEdicts();
CL_FreeParticles();
// deinitialize game
clgame.dllFuncs.pfnShutdown();
@ -2683,6 +3157,7 @@ qboolean CL_LoadProgs( const char *name )
{
static CLIENTAPI GetClientAPI;
static playermove_t gpMove;
const dllfunc_t *func;
if( clgame.hInstance ) CL_UnloadProgs();
@ -2699,6 +3174,23 @@ qboolean CL_LoadProgs( const char *name )
clgame.hInstance = FS_LoadLibrary( name, false );
if( !clgame.hInstance ) return false;
// clear exports
for( func = cdll_exports; func && func->name; func++ )
*func->func = NULL;
#if 0
// UNDONE: waiting for finalize client.dll interface
for( func = cdll_exports; func && func->name != NULL; func++ )
{
// functions are cleared before all the extensions are evaluated
if(!( *func->func = (void *)FS_GetProcAddress( clgame.hInstance, func->name )))
{
MsgDev( D_NOTE, "CL_LoadProgs: failed to get address of %s proc\n", func->name );
FS_FreeLibrary( clgame.hInstance );
clgame.hInstance = NULL;
return false;
}
}
#endif
GetClientAPI = (CLIENTAPI)FS_GetProcAddress( clgame.hInstance, "CreateAPI" );
if( !GetClientAPI )
@ -2719,6 +3211,7 @@ qboolean CL_LoadProgs( const char *name )
clgame.maxEntities = GI->max_edicts; // merge during loading
CL_InitTitles( "titles.txt" );
CL_InitParticles ();
// initialize game
clgame.dllFuncs.pfnInit();

View File

@ -24,6 +24,7 @@ convar_t *cl_showfps;
convar_t *cl_nodelta;
convar_t *cl_crosshair;
convar_t *cl_cmdbackup;
convar_t *cl_draw_particles;
convar_t *cl_idealpitchscale;
convar_t *cl_solid_players;
convar_t *cl_showmiss;
@ -1459,6 +1460,8 @@ void CL_InitLocal( void )
cl_smooth = Cvar_Get ("cl_smooth", "1", 0, "smooth up stair climbing and interpolate position in multiplayer" );
cl_cmdbackup = Cvar_Get( "cl_cmdbackup", "2", CVAR_ARCHIVE, "how many additional history commands are sent" );
cl_cmdrate = Cvar_Get( "cl_cmdrate", "30", CVAR_ARCHIVE, "Max number of command packets sent to server per second" );
cl_draw_particles = Cvar_Get( "cl_draw_particles", "1", CVAR_ARCHIVE, "Disable any particle effects" );
Cvar_Get( "hud_scale", "0", CVAR_ARCHIVE|CVAR_LATCH, "scale hud at current resolution" );
Cvar_Get( "skin", "", CVAR_USERINFO, "player skin" ); // XDM 3.3 want this cvar

View File

@ -335,6 +335,7 @@ void SCR_RegisterShaders( void )
if( re )
{
cls.fillShader = re->RegisterShader( "*white", SHADER_NOMIP ); // used for FillRGBA
cls.particleShader = re->RegisterShader( "*particle", SHADER_NOMIP );
// register gfx.wad images
cls.pauseIcon = re->RegisterShader( "gfx/paused", SHADER_NOMIP ); // FIXME: MAKE INTRESOURCE

View File

@ -8,11 +8,324 @@
#include "r_efx.h"
#include "event_flags.h"
#include "entity_types.h"
#include "triangleapi.h"
#include "studio.h"
/*
==============================================================
PARTICLES MANAGEMENT
==============================================================
*/
#define NUMVERTEXNORMALS 162
#define SPARK_COLORCOUNT 9
// particle velocities
static const float cl_avertexnormals[NUMVERTEXNORMALS][3] =
{
#include "anorms.h"
};
// particle ramps
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
static int ramp3[6] = { 0x6d, 0x6b, 6, 5, 4, 3 };
static int gTracerColors[][3] =
{
{ 255, 255, 255 }, // White
{ 255, 0, 0 }, // Red
{ 0, 255, 0 }, // Green
{ 0, 0, 255 }, // Blue
{ 0, 0, 0 }, // Tracer default, filled in from cvars, etc.
{ 255, 167, 17 }, // Yellow-orange sparks
{ 255, 130, 90 }, // Yellowish streaks (garg)
{ 55, 60, 144 }, // Blue egon streak
{ 255, 130, 90 }, // More Yellowish streaks (garg)
{ 255, 140, 90 }, // More Yellowish streaks (garg)
{ 200, 130, 90 }, // More red streaks (garg)
{ 255, 120, 70 }, // Darker red streaks (garg)
};
static int gSparkRamp[SPARK_COLORCOUNT][3] =
{
{ 255, 255, 255 },
{ 255, 247, 199 },
{ 255, 243, 147 },
{ 255, 243, 27 },
{ 239, 203, 31 },
{ 223, 171, 39 },
{ 207, 143, 43 },
{ 127, 59, 43 },
{ 35, 19, 7 }
};
particle_t *cl_active_particles;
particle_t *cl_free_particles;
particle_t *cl_particles = NULL; // particle pool
static vec3_t cl_avelocities[NUMVERTEXNORMALS];
/*
================
CL_InitParticles
================
*/
void CL_InitParticles( void )
{
int i;
cl_particles = Mem_Alloc( cls.mempool, sizeof( particle_t ) * GI->max_particles );
CL_ClearParticles ();
// this is used for EF_BRIGHTFIELD
for( i = 0; i < NUMVERTEXNORMALS; i++ )
{
cl_avelocities[i][0] = Com_RandomLong( 0, 255 ) * 0.01f;
cl_avelocities[i][1] = Com_RandomLong( 0, 255 ) * 0.01f;
cl_avelocities[i][2] = Com_RandomLong( 0, 255 ) * 0.01f;
}
}
/*
================
CL_ClearParticles
================
*/
void CL_ClearParticles( void )
{
int i;
cl_free_particles = cl_particles;
cl_active_particles = NULL;
for( i = 0; i < GI->max_particles; i++ )
cl_particles[i].next = &cl_particles[i+1];
cl_particles[GI->max_particles-1].next = NULL;
}
/*
================
CL_FreeParticles
================
*/
void CL_FreeParticles( void )
{
if( cl_particles ) Mem_Free( cl_particles );
}
/*
================
CL_FreeParticle
move particle to freelist
================
*/
void CL_FreeParticle( particle_t *p )
{
if( p->type == pt_clientcustom && p->deathfunc )
{
// call right the deathfunc func before die
p->deathfunc( p );
}
p->next = cl_free_particles;
cl_free_particles = p;
}
/*
================
CL_AllocParticle
can return NULL if particles is out
================
*/
particle_t *CL_AllocParticle( void (*callback)( particle_t*, float ))
{
particle_t *p;
// never alloc particles when we not in game
if( !CL_IsInGame( )) return NULL;
if( !cl_free_particles )
{
MsgDev( D_INFO, "Overflow %d particles\n", GI->max_particles );
return NULL;
}
p = cl_free_particles;
cl_free_particles = p->next;
p->next = cl_active_particles;
cl_active_particles = p;
// clear old particle
p->type = pt_static;
VectorClear( p->vel );
VectorClear( p->org );
p->ramp = 0;
if( callback )
{
p->type = pt_clientcustom;
p->callback = callback;
}
return p;
}
void CL_UpdateParticle( particle_t *p, float ft )
{
float time3 = 15.0 * ft;
float time2 = 10.0 * ft;
float time1 = 5.0 * ft;
float dvel = 4 * ft;
float grav = ft * clgame.movevars.gravity * 0.05f;
float size = 1.5f;
vec3_t right, up;
rgb_t color;
int i;
switch( p->type )
{
case pt_static:
break;
case pt_clientcustom:
if( p->callback )
p->callback( p, ft );
return;
case pt_fire:
p->ramp += time1;
if( p->ramp >= 6 ) p->die = -1;
else p->color = ramp3[(int)p->ramp];
p->vel[2] += grav;
break;
case pt_explode:
p->ramp += time2;
if( p->ramp >= 8 ) p->die = -1;
else p->color = ramp1[(int)p->ramp];
for( i = 0; i < 3; i++ )
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_explode2:
p->ramp += time3;
if( p->ramp >= 8 ) p->die = -1;
else p->color = ramp2[(int)p->ramp];
for( i = 0; i < 3; i++ )
p->vel[i] -= p->vel[i] * ft;
p->vel[2] -= grav;
break;
case pt_blob:
for( i = 0; i < 3; i++ )
p->vel[i] += p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_blob2:
for( i = 0; i < 2; i++ )
p->vel[i] -= p->vel[i] * dvel;
p->vel[2] -= grav;
break;
case pt_grav:
p->vel[2] -= grav * 20;
break;
case pt_slowgrav:
p->vel[2] = grav;
break;
case pt_vox_grav:
p->vel[2] -= grav * 8;
break;
case pt_vox_slowgrav:
p->vel[2] -= grav * 4;
break;
}
// HACKHACK a scale up to keep particles from disappearing
size += (p->org[0] - cl.refdef.vieworg[0]) * cl.refdef.forward[0];
size += (p->org[1] - cl.refdef.vieworg[1]) * cl.refdef.forward[1];
size += (p->org[2] - cl.refdef.vieworg[2]) * cl.refdef.forward[2];
if( size < 20.0f ) size = 1.0f;
else size = 1.0f + size * 0.004f;
// scale the axes by radius
VectorScale( cl.refdef.right, size, right );
VectorScale( cl.refdef.up, size, up );
p->color = bound( 0, p->color, 255 );
VectorSet( color, clgame.palette[p->color][0], clgame.palette[p->color][1], clgame.palette[p->color][2] );
re->Enable( TRI_SHADER );
re->RenderMode( kRenderTransTexture );
re->Color4ub( color[0], color[1], color[2], 0xFF );
re->Bind( cls.particleShader, 0 );
// add the 4 corner vertices.
re->Begin( TRI_QUADS );
re->TexCoord2f( 0.0f, 1.0f );
re->Vertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
re->TexCoord2f( 0.0f, 0.0f );
re->Vertex3f( p->org[0] + right[0] + up[0], p->org[1] + right[1] + up[1], p->org[2] + right[2] + up[2] );
re->TexCoord2f( 1.0f, 0.0f );
re->Vertex3f( p->org[0] + right[0] - up[0], p->org[1] + right[1] - up[1], p->org[2] + right[2] - up[2] );
re->TexCoord2f( 1.0f, 1.0f );
re->Vertex3f( p->org[0] - right[0] - up[0], p->org[1] - right[1] - up[1], p->org[2] - right[2] - up[2] );
re->End();
re->Disable( TRI_SHADER );
// update position.
VectorMA( p->org, ft, p->vel, p->org );
}
void CL_DrawParticles( void )
{
particle_t *p, *kill;
float frametime;
frametime = cl.time - cl.oldtime;
if( !cl_draw_particles->integer )
return;
while( 1 )
{
// free time-expired particles
kill = cl_active_particles;
if( kill && kill->die < cl.time )
{
cl_active_particles = kill->next;
CL_FreeParticle( kill );
continue;
}
break;
}
for( p = cl_active_particles; p; p = p->next )
{
while( 1 )
{
kill = p->next;
if( kill && kill->die < cl.time )
{
p->next = kill->next;
CL_FreeParticle( kill );
continue;
}
break;
}
CL_UpdateParticle( p, frametime );
}
}
/*
==============================================================
TEMPENTS MANAGEMENT
==============================================================
@ -575,5 +888,6 @@ CL_ClearEffects
void CL_ClearEffects( void )
{
CL_ClearDlights ();
CL_ClearParticles ();
CL_ClearLightStyles ();
}

View File

@ -246,10 +246,54 @@ typedef struct
float applied_angle;
} screen_shake_t;
typedef struct
{
int (*pfnInitialize)( cl_enginefunc_t *pEnginefuncs, int iVersion );
int (*pfnVidInit)( void );
void (*pfnInit)( void );
void (*pfnShutdown)( void );
int (*pfnRedraw)( float flTime, int intermission );
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime );
void (*pfnReset)( void );
void (*pfnPlayerMove)( struct playermove_s *ppmove, int server );
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove );
char (*pfnPlayerMoveTexture)( char *name );
int (*pfnConnectionlessPacket)( const netadr_t *net_from, const char *args, char *buffer, int *size );
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
void (*pfnFrame)( double time );
void (*pfnVoiceStatus)( int entindex, qboolean bTalking );
void (*pfnDirectorMessage)( int iSize, void *pbuf );
void (*pfnPostRunCmd)( local_state_t *from, local_state_t *to, usercmd_t *cmd, int runfuncs, double time, uint random_seed );
int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding );
void (*pfnDemo_ReadBuffer)( int size, byte *buffer );
int (*pfnAddEntity)( int type, cl_entity_t *ent, const char *modelname );
void (*pfnCreateEntities)( void );
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity );
void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client );
void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src );
void (*pfnTxferPredictionData)( entity_state_t *ps, const entity_state_t *pps, clientdata_t *pcd, const clientdata_t *ppcd, weapon_data_t *wd, const weapon_data_t *pwd );
void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
void (*pfnDrawNormalTriangles)( void );
void (*pfnDrawTransparentTriangles)( void );
cl_entity_t (*pfnGetUserEntity)( int index );
void *(*KB_Find)( const char *name ); // returns kbutton_t. Probably Xash3D doesn't need for it
void (*CAM_Think)( void ); // camera stuff (QW issues)
int (*CL_IsThirdPerson)( void );
void (*CL_CameraOffset)( float *ofs );
void (*CL_CreateMove)( float frametime, usercmd_t *cmd, int active );
void (*IN_ActivateMouse)( void );
void (*IN_DeactivateMouse)( void );
void (*IN_MouseEvent)( int mstate );
void (*IN_Accumulate)( void );
void (*IN_ClearStates)( void );
void (*V_CalcRefdef)( ref_params_t *pparams );
} CDLL_FUNCTIONS;
typedef struct
{
void *hInstance; // pointer to client.dll
HUD_FUNCTIONS dllFuncs; // dll exported funcs
CDLL_FUNCTIONS cdllFuncs; // dll exported funcs (under construction)
byte *mempool; // client edicts pool
string mapname; // map name
string maptitle; // display map title
@ -335,6 +379,7 @@ typedef struct
// internal shaders
shader_t fillShader; // used for emulate FillRGBA to avoid wrong draw-sort
shader_t particleShader; // built-in particle and sparks shader
shader_t pauseIcon; // draw 'paused' when game in-pause
shader_t loadingBar; // 'loading' progress bar
cl_font_t creditsFont; // shared creditsfont
@ -368,6 +413,7 @@ typedef struct
qboolean demorecording;
qboolean demoplayback;
qboolean demowaiting; // don't record until a non-delta message is received
qboolean timedemo;
string demoname; // for demo looping
file_t *demofile;
@ -393,6 +439,7 @@ extern convar_t *cl_testlights;
extern convar_t *cl_solid_players;
extern convar_t *cl_idealpitchscale;
extern convar_t *cl_allow_levelshots;
extern convar_t *cl_draw_particles;
extern convar_t *cl_levelshot_name;
extern convar_t *scr_centertime;
extern convar_t *scr_download;
@ -549,6 +596,10 @@ void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, floa
word CL_EventIndex( const char *name );
void CL_ResetEvent( event_info_t *ei );
void CL_FireEvents( void );
void CL_InitParticles( void );
void CL_ClearParticles( void );
void CL_FreeParticles( void );
void CL_DrawParticles( void );
//
// console.c

View File

@ -285,6 +285,8 @@ void CL_StudioFxTransform( struct cl_entity_s *ent, float transform[4][4] );
qboolean CL_GetEntitySpatialization( int entnum, vec3_t origin, vec3_t velocity );
void CL_StudioEvent( struct mstudioevent_s *event, struct cl_entity_s *ent );
qboolean CL_GetComment( const char *demoname, char *comment );
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
struct cl_entity_s *CL_GetEntityByIndex( int index );

View File

@ -107,6 +107,61 @@ skipwhite:
return data;
}
/*
=============
COM_AddAppDirectoryToSearchPath
=============
*/
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
{
string dir;
if( !pszBaseDir || !appName )
{
MsgDev( D_ERROR, "COM_AddDirectorySearchPath: bad directory or appname\n" );
return;
}
com.snprintf( dir, sizeof( dir ), "%s/%s", pszBaseDir, appName );
FS_AddGameDirectory( dir, FS_GAMEDIR_PATH );
}
/*
===========
COM_ExpandFilename
Finds the file in the search path, copies over the name with the full path name.
This doesn't search in the pak file.
===========
*/
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
{
const char *path;
char rootdir[MAX_SYSPATH];
char result[MAX_SYSPATH];
if( !fileName || !*fileName || !nameOutBuffer || nameOutBufferSize <= 0 )
return 0;
// filename examples:
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
if(( path = FS_GetDiskPath( fileName )) != NULL )
{
GetCurrentDirectory( MAX_SYSPATH, rootdir );
com.sprintf( result, "%s/%s", rootdir, path );
// check for enough room
if( com.strlen( result ) > nameOutBufferSize )
return 0;
com.strncpy( nameOutBuffer, result, nameOutBufferSize );
return 1;
}
return 0;
}
/*
=============
pfnMemFgets

View File

@ -23,6 +23,8 @@ void IN_Init( void );
void Host_InputFrame( void );
void IN_Shutdown( void );
void IN_MouseEvent( int mstate );
void IN_ActivateMouse( void );
void IN_DeactivateMouse( void );
long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam );
#endif//INPUT_H

View File

@ -307,6 +307,7 @@ void FS_InitEditor( void );
void FS_InitRootDir( char *path );
void FS_ClearSearchPath( void );
void FS_AllowDirectPaths( qboolean enable );
void FS_AddGameDirectory( const char *dir, int flags );
void FS_AddGameHierarchy( const char *dir, int flags );
int FS_CheckParm( const char *parm );
void FS_LoadGameInfo( const char *rootfolder );

View File

@ -91,6 +91,7 @@ void Sys_GetStdAPI( void )
com.Com_InitRootDir = FS_InitRootDir; // init custom rootdir
com.Com_LoadGameInfo = FS_LoadGameInfo; // gate game info from script file
com.Com_AddGameHierarchy = FS_AddGameHierarchy; // add base directory in search list
com.Com_AddGameDirectory = FS_AddGameDirectory; // add game directory in search list
com.Com_AllowDirectPaths = FS_AllowDirectPaths; // allow direct paths e.g. C:\windows
com.Com_CheckParm = FS_CheckParm; // get parm from cmdline
com.Com_GetParm = FS_GetParmFromCmdLine; // get filename without path & ext

View File

@ -522,6 +522,7 @@ typedef struct stdilib_api_s
void (*Com_InitRootDir)( char *path ); // init custom rootdir
void (*Com_LoadGameInfo)( const char *rootfolder ); // initialize gamedir
void (*Com_AddGameHierarchy)( const char *dir, int flags ); // add base directory in search list
void (*Com_AddGameDirectory)( const char *dir, int flags ); // add game directory in search list
void (*Com_AllowDirectPaths)( qboolean enable ); // allow direct paths e.g. C:\windows
int (*Com_CheckParm)( const char *parm ); // check parm in cmdline
qboolean (*Com_GetParm)( char *parm, char *out, size_t size ); // get parm from cmdline
@ -813,6 +814,7 @@ filesystem manager
===========================================
*/
#define FS_AddGameHierarchy com.Com_AddGameHierarchy
#define FS_AddGameDirectory com.Com_AddGameDirectory
#define FS_LoadGameInfo com.Com_LoadGameInfo
#define FS_InitRootDir com.Com_InitRootDir
#define FS_AllowDirectPaths com.Com_AllowDirectPaths

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_LIGHTMAPS 128
#define MAX_SUPER_STYLES 1024 // unique lightstyle combiantions
#define MAX_TEXTURES 4096
#define MAX_ARRAY_VERTS 6144
#define MAX_ARRAY_VERTS 12288
#define MAX_ARRAY_ELEMENTS MAX_ARRAY_VERTS * 6
#define MAX_ARRAY_TRIANGLES MAX_ARRAY_ELEMENTS / 3
#define MAX_ARRAY_NEIGHBORS MAX_ARRAY_TRIANGLES * 3
@ -296,7 +296,7 @@ static _inline qboolean R_MeshOverflow2( const mesh_t *mesh1, const mesh_t *mesh
static _inline qboolean R_InvalidMesh( const mesh_t *mesh )
{
return ( !mesh->numVerts || !mesh->numElems ||mesh->numVerts > MAX_ARRAY_VERTS || mesh->numElems > MAX_ARRAY_ELEMENTS );
return ( !mesh->numVerts || !mesh->numElems || mesh->numVerts > MAX_ARRAY_VERTS || mesh->numElems > MAX_ARRAY_ELEMENTS );
}
void R_RenderMeshBuffer( const meshbuffer_t *mb );

View File

@ -6,7 +6,7 @@
#include "r_local.h"
#include "mathlib.h"
#include "matrix_lib.h"
#include "triangle_api.h"
#include "triangleapi.h"
static vec4_t pic_xyz[4] = { {0,0,0,1}, {0,0,0,1}, {0,0,0,1}, {0,0,0,1} };
static vec2_t pic_st[4];

View File

@ -909,7 +909,7 @@ Mod_ConvertSurface
*/
static void Mod_ConvertSurface( msurface_t *surf )
{
byte *buffer;
byte *buffer, *mem;
mesh_t *poly, *next;
uint totalIndexes;
uint totalVerts;
@ -936,7 +936,7 @@ static void Mod_ConvertSurface( msurface_t *surf )
if( surf->flags & (SURF_DRAWSKY|SURF_DRAWTURB))
{
buffer = Mod_Malloc( loadmodel, sizeof( mesh_t )
mem = buffer = Mod_Malloc( loadmodel, sizeof( mesh_t )
+ (totalVerts * sizeof( vec4_t ) * 2 )
+ (totalIndexes * sizeof( elem_t ))
+ (totalVerts * sizeof( vec2_t ))
@ -944,7 +944,7 @@ static void Mod_ConvertSurface( msurface_t *surf )
}
else
{
buffer = Mod_Malloc( loadmodel, sizeof( mesh_t )
mem = buffer = Mod_Malloc( loadmodel, sizeof( mesh_t )
+ (totalVerts * sizeof( vec4_t ) * 2 )
+ (totalIndexes * sizeof( elem_t ))
+ (totalVerts * sizeof( vec2_t ) * 2 )
@ -993,7 +993,7 @@ static void Mod_ConvertSurface( msurface_t *surf )
if( R_InvalidMesh( outMesh ))
{
MsgDev( D_ERROR, "Mod_ConvertSurface: surface mesh is invalid!\n" );
Mem_Free( buffer );
Mem_Free( mem );
return;
}