Browse Source

client: fix build

master
Alibek Omarov 3 months ago
parent
commit
fbd76d6d68
43 changed files with 2260 additions and 99 deletions
  1. +1
    -1
      cl_dll/cdll_int.cpp
  2. +1
    -3
      cl_dll/entity.cpp
  3. +2
    -2
      cl_dll/getfont.h
  4. +1
    -1
      cl_dll/health.cpp
  5. +3
    -3
      cl_dll/hud.cpp
  6. +4
    -3
      cl_dll/hud_redraw.cpp
  7. +7
    -3
      cl_dll/hud_servers.cpp
  8. +1628
    -0
      cl_dll/input_goldsource.cpp
  9. +93
    -0
      cl_dll/input_mouse.cpp
  10. +79
    -0
      cl_dll/input_mouse.h
  11. +293
    -0
      cl_dll/input_xash3d.cpp
  12. +0
    -0
      cl_dll/inputw32.old
  13. +6
    -3
      cl_dll/render/gl_aurora.cpp
  14. +2
    -1
      cl_dll/render/gl_backend.cpp
  15. +3
    -3
      cl_dll/render/gl_cubemaps.cpp
  16. +3
    -3
      cl_dll/render/gl_deferred.cpp
  17. +3
    -2
      cl_dll/render/gl_dlight.cpp
  18. +7
    -8
      cl_dll/render/gl_export.cpp
  19. +3
    -2
      cl_dll/render/gl_grass.cpp
  20. +2
    -2
      cl_dll/render/gl_shadows.cpp
  21. +1
    -1
      cl_dll/render/gl_sprite.cpp
  22. +1
    -1
      cl_dll/render/gl_studiodecal.h
  23. +2
    -2
      cl_dll/render/gl_studiodecal_new.cpp
  24. +11
    -11
      cl_dll/render/gl_world_new.cpp
  25. +1
    -3
      cl_dll/render/tri.cpp
  26. +3
    -2
      cl_dll/saytext.cpp
  27. +3
    -2
      cl_dll/status_icons.cpp
  28. +6
    -5
      cl_dll/util.cpp
  29. +1
    -1
      cl_dll/vgui_CustomObjects.cpp
  30. +10
    -5
      cl_dll/vgui_ScorePanel.cpp
  31. +6
    -5
      cl_dll/vgui_TeamFortressViewport.cpp
  32. +6
    -6
      cl_dll/vgui_TeamFortressViewport.h
  33. +1
    -1
      cl_dll/vgui_radio.cpp
  34. +2
    -4
      cl_dll/vgui_screenmsg.h
  35. +0
    -3
      cl_dll/vgui_tips.cpp
  36. +9
    -0
      common/port.h
  37. +16
    -1
      game_shared/mathlib.h
  38. +1
    -1
      game_shared/matrix.h
  39. +3
    -2
      game_shared/utlblockmemory.h
  40. +1
    -1
      game_shared/vgui_slider2.cpp
  41. +33
    -0
      game_shared/virtualfs.cpp
  42. +1
    -1
      utils/vgui
  43. +1
    -1
      wscript

+ 1
- 1
cl_dll/cdll_int.cpp View File

@@ -341,4 +341,4 @@ void DLLEXPORT HUD_ClipMoveToEntity( physent_t *pe, const float *start, float *m
if( trace.ent != NULL && PM_GetPlayerMove( ))
tr->ent = pe - PM_GetPlayerMove()->physents;
else tr->ent = -1;
}
}

+ 1
- 3
cl_dll/entity.cpp View File

@@ -22,8 +22,6 @@
#include "gl_local.h"
#include "gl_studio.h"

#define DLLEXPORT __declspec( dllexport )

void Game_AddObjects( void );

extern vec3_t v_origin;
@@ -934,4 +932,4 @@ Indices must start at 1, not zero.
cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
{
return NULL;
}
}

+ 2
- 2
cl_dll/getfont.h View File

@@ -6,6 +6,6 @@
#ifndef _GETFONT_H
#define _GETFONT_H

Font* FontFromMessage(const char* &ptext);
Font* FontFromMessage(const char* ptext);

#endif // _GETFONT_H
#endif // _GETFONT_H

+ 1
- 1
cl_dll/health.cpp View File

@@ -427,7 +427,7 @@ int CHudHealth::DrawDamage(float flTime)


// check for bits that should be expired
for ( i = 0; i < NUM_DMG_TYPES; i++ )
for (int i = 0; i < NUM_DMG_TYPES; i++ )
{
DAMAGE_IMAGE *pdmg = &m_dmg[i];



+ 3
- 3
cl_dll/hud.cpp View File

@@ -36,7 +36,7 @@
#include "studio.h"
#include "demo.h"
#include "demo_api.h"
#include "vgui_scorepanel.h"
#include "vgui_ScorePanel.h"
#include "gl_local.h" // buz
#include "r_studioint.h"

@@ -708,7 +708,7 @@ void CHud :: VidInit( void )

p = m_pSpriteList;
int index = 0;
for ( j = 0; j < m_iSpriteCountAllRes; j++ )
for ( int j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
{
@@ -886,4 +886,4 @@ void CHud::AddHudElem(CHudBase *phudelem)
float CHud::GetSensitivity( void )
{
return m_flMouseSensitivity;
}
}

+ 4
- 3
cl_dll/hud_redraw.cpp View File

@@ -158,7 +158,7 @@ int CHud :: Redraw( float flTime, int intermission )
m_fOldTime = m_flTime; // save time of previous redraw
m_flTime = flTime;
m_flTimeDelta = (double)m_flTime - m_fOldTime;
static m_flShotTime = 0;
static int m_flShotTime = 0;

#if 0
// g-cont. disabled for users request
@@ -359,7 +359,8 @@ int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int
int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
{
// find the end of the string
for ( char *szIt = szString; *szIt != 0; szIt++ )
char *szIt;
for ( szIt = szString; *szIt != 0; szIt++ )
{ // we should count the length?
}

@@ -518,4 +519,4 @@ void DrawBlurTest( float frametime )
{
blurstate = false;
}
}
}

+ 7
- 3
cl_dll/hud_servers.cpp View File

@@ -12,7 +12,11 @@
#include "hud_servers.h"
#include "net_api.h"
#include <string.h>
#if XASH_WIN32
#include <winsock.h>
#else
#include <arpa/inet.h>
#endif

static int context_id;

@@ -599,7 +603,7 @@ int CompareField( CHudServers::server_t *p1, CHudServers::server_t *p2, const ch
return stricmp( sz1, sz2 );
}

int CALLBACK ServerListCompareFunc( CHudServers::server_t *p1, CHudServers::server_t *p2, const char *fieldname )
int ServerListCompareFunc( CHudServers::server_t *p1, CHudServers::server_t *p2, const char *fieldname )
{
if (!p1 || !p2) // No meaningful comparison
return 0;
@@ -750,7 +754,7 @@ int CHudServers::LoadMasterAddresses( int maxservers, int *count, netadr_t *padr
char szMaster[ 256 ];
char szMasterFile[256];
char *pbuffer = NULL;
char *pstart = NULL ;
const char *pstart = NULL ;
netadr_t adr;
char szAdr[64];
int nPort;
@@ -1227,4 +1231,4 @@ void ServerPlayers( int server )
{
g_pServers->ServerPlayers( server );
}
}
}

+ 1628
- 0
cl_dll/input_goldsource.cpp
File diff suppressed because it is too large
View File


+ 93
- 0
cl_dll/input_mouse.cpp View File

@@ -0,0 +1,93 @@
#include "input_mouse.h"
#include "exportdef.h"
#include "hud.h"
#include "cl_util.h"

// shared between backends
Vector dead_viewangles(0, 0, 0);
cvar_t *sensitivity;
cvar_t *in_joystick;

FWGSInput fwgsInput;

#ifdef SUPPORT_GOLDSOURCE_INPUT
GoldSourceInput goldSourceInput;
AbstractInput* currentInput = &goldSourceInput;
#else
AbstractInput* currentInput = &fwgsInput;
#endif
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove )
{
currentInput->IN_ClientMoveEvent(forwardmove, sidemove);
}

extern "C" void DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch )
{
currentInput->IN_ClientLookEvent(relyaw, relpitch);
}

void IN_Move( float frametime, usercmd_t *cmd )
{
currentInput->IN_Move(frametime, cmd);
}

extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
{
currentInput->IN_MouseEvent(mstate);
}

extern "C" void DLLEXPORT IN_ClearStates( void )
{
currentInput->IN_ClearStates();
}

extern "C" void DLLEXPORT IN_ActivateMouse( void )
{
currentInput->IN_ActivateMouse();
}

extern "C" void DLLEXPORT IN_DeactivateMouse( void )
{
currentInput->IN_DeactivateMouse();
}

extern "C" void DLLEXPORT IN_Accumulate( void )
{
currentInput->IN_Accumulate();
}

/*
===========
IN_ResetMouse
===========
*/
void IN_ResetMouse( void )
{
gEngfuncs.pfnSetMousePos( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
}

void IN_Commands( void )
{
currentInput->IN_Commands();
}

void IN_Shutdown( void )
{
currentInput->IN_Shutdown();
}

void IN_Init( void )
{
#ifdef SUPPORT_GOLDSOURCE_INPUT
if (IsXashFWGS()) {
gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" );
currentInput = &fwgsInput;
} else {
gEngfuncs.Con_Printf( "GoldSource input is in use\n" );
currentInput = &goldSourceInput;
}
#else
currentInput = &fwgsInput;
#endif
currentInput->IN_Init();
}

+ 79
- 0
cl_dll/input_mouse.h View File

@@ -0,0 +1,79 @@
#pragma once
#ifndef INPUT_MOUSE_H
#define INPUT_MOUSE_H
#include "cl_dll.h"
#include "usercmd.h"
#include "in_defs.h"

class AbstractInput
{
public:
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove ) = 0;
virtual void IN_ClientLookEvent( float relyaw, float relpitch ) = 0;
virtual void IN_Move( float frametime, usercmd_t *cmd ) = 0;
virtual void IN_MouseEvent( int mstate ) = 0;
virtual void IN_ClearStates( void ) = 0;
virtual void IN_ActivateMouse( void ) = 0;
virtual void IN_DeactivateMouse( void ) = 0;
virtual void IN_Accumulate( void ) = 0;
virtual void IN_Commands( void ) = 0;
virtual void IN_Shutdown( void ) = 0;
virtual void IN_Init( void ) = 0;
};

class FWGSInput : public AbstractInput
{
public:
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove );
virtual void IN_ClientLookEvent( float relyaw, float relpitch );
virtual void IN_Move( float frametime, usercmd_t *cmd );
virtual void IN_MouseEvent( int mstate );
virtual void IN_ClearStates( void );
virtual void IN_ActivateMouse( void );
virtual void IN_DeactivateMouse( void );
virtual void IN_Accumulate( void );
virtual void IN_Commands( void );
virtual void IN_Shutdown( void );
virtual void IN_Init( void );

protected:
float ac_forwardmove;
float ac_sidemove;
int ac_movecount;
float rel_yaw;
float rel_pitch;
};

// No need for goldsource input support on the platforms that are not supported by GoldSource.
#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86))
#define SUPPORT_GOLDSOURCE_INPUT
class GoldSourceInput : public AbstractInput
{
public:
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove ) {}
virtual void IN_ClientLookEvent( float relyaw, float relpitch ) {}
virtual void IN_Move( float frametime, usercmd_t *cmd );
virtual void IN_MouseEvent( int mstate );
virtual void IN_ClearStates( void );
virtual void IN_ActivateMouse( void );
virtual void IN_DeactivateMouse( void );
virtual void IN_Accumulate( void );
virtual void IN_Commands( void );
virtual void IN_Shutdown( void );
virtual void IN_Init( void );

protected:
void IN_GetMouseDelta( int *pOutX, int *pOutY);
void IN_MouseMove ( float frametime, usercmd_t *cmd);
void IN_StartupMouse (void);

int mouse_buttons;
int mouse_oldbuttonstate;
POINT current_pos;
int old_mouse_x, old_mouse_y, mx_accum, my_accum;
int mouseinitialized;
void* sdl2Lib;
};
#endif

#endif

+ 293
- 0
cl_dll/input_xash3d.cpp View File

@@ -0,0 +1,293 @@
#include "hud.h"
#include "usercmd.h"
#include "cvardef.h"
#include "kbutton.h"
#include "keydefs.h"
#include "input_mouse.h"
extern cvar_t *sensitivity;
extern cvar_t *in_joystick;

extern kbutton_t in_strafe;
extern kbutton_t in_mlook;
extern kbutton_t in_speed;
extern kbutton_t in_jlook;
extern kbutton_t in_forward;
extern kbutton_t in_back;
extern kbutton_t in_moveleft;
extern kbutton_t in_moveright;

extern cvar_t *m_pitch;
extern cvar_t *m_yaw;
extern cvar_t *m_forward;
extern cvar_t *m_side;
extern cvar_t *lookstrafe;
extern cvar_t *lookspring;
extern cvar_t *cl_pitchdown;
extern cvar_t *cl_pitchup;
extern cvar_t *cl_yawspeed;
extern cvar_t *cl_sidespeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_movespeedkey;
cvar_t *cl_laddermode;


#define F 1U<<0 // Forward
#define B 1U<<1 // Back
#define L 1U<<2 // Left
#define R 1U<<3 // Right
#define T 1U<<4 // Forward stop
#define S 1U<<5 // Side stop

#define BUTTON_DOWN 1
#define IMPULSE_DOWN 2
#define IMPULSE_UP 4

int CL_IsDead( void );
int g_iVisibleMouse = 0;
extern int iMouseInUse;
extern Vector dead_viewangles;

void IN_ToggleButtons( float forwardmove, float sidemove )
{
static unsigned int moveflags = T | S;

if( forwardmove )
moveflags &= ~T;
else
{
//if( in_forward.state || in_back.state ) gEngfuncs.Con_Printf("Buttons pressed f%d b%d\n", in_forward.state, in_back.state);
if( !( moveflags & T ) )
{
//IN_ForwardUp();
//IN_BackUp();
//gEngfuncs.Con_Printf("Reset forwardmove state f%d b%d\n", in_forward.state, in_back.state);
in_forward.state &= ~BUTTON_DOWN;
in_back.state &= ~BUTTON_DOWN;
moveflags |= T;
}
}
if( sidemove )
moveflags &= ~S;
else
{
//gEngfuncs.Con_Printf("l%d r%d\n", in_moveleft.state, in_moveright.state);
//if( in_moveleft.state || in_moveright.state ) gEngfuncs.Con_Printf("Buttons pressed l%d r%d\n", in_moveleft.state, in_moveright.state);
if( !( moveflags & S ) )
{
//IN_MoverightUp();
//IN_MoveleftUp();
//gEngfuncs.Con_Printf("Reset sidemove state f%d b%d\n", in_moveleft.state, in_moveright.state);
in_moveleft.state &= ~BUTTON_DOWN;
in_moveright.state &= ~BUTTON_DOWN;
moveflags |= S;
}
}

if( forwardmove > 0.7f && !( moveflags & F ) )
{
moveflags |= F;
in_forward.state |= BUTTON_DOWN;
}
if( forwardmove < 0.7f && ( moveflags & F ) )
{
moveflags &= ~F;
in_forward.state &= ~BUTTON_DOWN;
}
if( forwardmove < -0.7f && !( moveflags & B ) )
{
moveflags |= B;
in_back.state |= BUTTON_DOWN;
}
if( forwardmove > -0.7f && ( moveflags & B ) )
{
moveflags &= ~B;
in_back.state &= ~BUTTON_DOWN;
}
if( sidemove > 0.9f && !( moveflags & R ) )
{
moveflags |= R;
in_moveright.state |= BUTTON_DOWN;
}
if( sidemove < 0.9f && ( moveflags & R ) )
{
moveflags &= ~R;
in_moveright.state &= ~BUTTON_DOWN;
}
if( sidemove < -0.9f && !( moveflags & L ) )
{
moveflags |= L;
in_moveleft.state |= BUTTON_DOWN;
}
if( sidemove > -0.9f && ( moveflags & L ) )
{
moveflags &= ~L;
in_moveleft.state &= ~BUTTON_DOWN;
}
}

void FWGSInput::IN_ClientMoveEvent( float forwardmove, float sidemove )
{
//gEngfuncs.Con_Printf("IN_MoveEvent\n");

ac_forwardmove += forwardmove;
ac_sidemove += sidemove;
ac_movecount++;
}

void FWGSInput::IN_ClientLookEvent( float relyaw, float relpitch )
{
rel_yaw += relyaw;
rel_pitch += relpitch;
}

// Rotate camera and add move values to usercmd
void FWGSInput::IN_Move( float frametime, usercmd_t *cmd )
{
Vector viewangles;
bool fLadder = false;

if( gHUD.m_iIntermission )
return; // we can't move during intermission

if( cl_laddermode->value != 2 )
{
cl_entity_t *pplayer = gEngfuncs.GetLocalPlayer();
if( pplayer )
fLadder = pplayer->curstate.movetype == MOVETYPE_FLY;
}
//if(ac_forwardmove || ac_sidemove)
//gEngfuncs.Con_Printf("Move: %f %f %f %f\n", ac_forwardmove, ac_sidemove, rel_pitch, rel_yaw);
#if 0
if( in_mlook.state & 1 )
{
V_StopPitchDrift();
}
#endif
if( CL_IsDead() )
{
viewangles = dead_viewangles; // HACKHACK: see below
}
else
{
gEngfuncs.GetViewAngles( viewangles );
}
if( gHUD.GetSensitivity() != 0 )
{
rel_yaw *= gHUD.GetSensitivity();
rel_pitch *= gHUD.GetSensitivity();
}
else
{
rel_yaw *= sensitivity->value;
rel_pitch *= sensitivity->value;
}
viewangles[YAW] += rel_yaw;
if( fLadder )
{
if( cl_laddermode->value == 1 )
viewangles[YAW] -= ac_sidemove * 5;
ac_sidemove = 0;
}
#if 0
if( gHUD.m_MOTD.m_bShow )
gHUD.m_MOTD.scroll += rel_pitch;
else
#endif
viewangles[PITCH] += rel_pitch;

if( viewangles[PITCH] > cl_pitchdown->value )
viewangles[PITCH] = cl_pitchdown->value;
if( viewangles[PITCH] < -cl_pitchup->value )
viewangles[PITCH] = -cl_pitchup->value;
// HACKHACK: change viewangles directly in viewcode,
// so viewangles when player is dead will not be changed on server
if( !CL_IsDead() )
{
gEngfuncs.SetViewAngles( viewangles );
}

dead_viewangles = viewangles; // keep them actual
if( ac_movecount )
{
IN_ToggleButtons( ac_forwardmove / ac_movecount, ac_sidemove / ac_movecount );

if( ac_forwardmove )
cmd->forwardmove = ac_forwardmove * cl_forwardspeed->value / ac_movecount;
if( ac_sidemove )
cmd->sidemove = ac_sidemove * cl_sidespeed->value / ac_movecount;
if( ( in_speed.state & 1 ) && ( ac_sidemove || ac_forwardmove ) )
{
cmd->forwardmove *= cl_movespeedkey->value;
cmd->sidemove *= cl_movespeedkey->value;
}
}

ac_sidemove = ac_forwardmove = rel_pitch = rel_yaw = 0;
ac_movecount = 0;
}

void FWGSInput::IN_MouseEvent( int mstate )
{
static int mouse_oldbuttonstate;
if ( iMouseInUse || g_iVisibleMouse )
return;
// perform button actions
for( int i = 0; i < 5; i++ )
{
if( ( mstate & ( 1 << i ) ) && !( mouse_oldbuttonstate & ( 1 << i ) ) )
{
gEngfuncs.Key_Event( K_MOUSE1 + i, 1 );
}

if( !( mstate & ( 1 << i ) ) && ( mouse_oldbuttonstate & ( 1 << i ) ) )
{
gEngfuncs.Key_Event( K_MOUSE1 + i, 0 );
}
}

mouse_oldbuttonstate = mstate;
}

// Stubs

void FWGSInput::IN_ClearStates( void )
{
//gEngfuncs.Con_Printf( "IN_ClearStates\n" );
}

void FWGSInput::IN_ActivateMouse( void )
{
//gEngfuncs.Con_Printf( "IN_ActivateMouse\n" );
}

void FWGSInput::IN_DeactivateMouse( void )
{
//gEngfuncs.Con_Printf( "IN_DeactivateMouse\n" );
}

void FWGSInput::IN_Accumulate( void )
{
//gEngfuncs.Con_Printf( "IN_Accumulate\n" );
}

void FWGSInput::IN_Commands( void )
{
//gEngfuncs.Con_Printf( "IN_Commands\n" );
}

void FWGSInput::IN_Shutdown( void )
{
}

// Register cvars and reset data
void FWGSInput::IN_Init( void )
{
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );
cl_laddermode = gEngfuncs.pfnRegisterVariable( "cl_laddermode", "2", FCVAR_ARCHIVE );
ac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;
}

cl_dll/inputw32.cpp → cl_dll/inputw32.old View File


+ 6
- 3
cl_dll/render/gl_aurora.cpp View File

@@ -929,7 +929,9 @@ void CParticleSystem :: DrawSystem( void )
{
if( pParticle->m_fSize <= 0 || !ParticleIsVisible( pParticle ))
continue;
DrawParticle( pParticle, GetVLeft(), GetVUp( ));
Vector vLeft = GetVLeft();
Vector vUp = GetVUp();
DrawParticle( pParticle, vLeft, vUp);
}
}

@@ -1068,7 +1070,8 @@ void CParticleSystem :: DrawParticle( CParticle *part, const vec3_t &right, cons
point[3] = origin + up * -fSinSize + right * fCosSize;

ClearBounds( absmin, absmax );
for( int i = 0; i < 4; i++ )
int i;
for( i = 0; i < 4; i++ )
AddPointToBounds( point[i], absmin, absmax );

int iContents = CONTENTS_NONE;
@@ -1168,4 +1171,4 @@ void CParticleSystem :: DrawParticle( CParticle *part, const vec3_t &right, cons
RI->frame.trans_list.AddToTail( entry );
#endif
}
}
}

+ 2
- 1
cl_dll/render/gl_backend.cpp View File

@@ -13,6 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/

#include <stdarg.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@@ -1052,4 +1053,4 @@ void CompressNormalizedVector( char outVec[3], const Vector &inVec )
outVec[0] = FloatToChar( vNorm.x );
outVec[1] = FloatToChar( vNorm.y );
outVec[2] = FloatToChar( vNorm.z );
}
}

+ 3
- 3
cl_dll/render/gl_cubemaps.cpp View File

@@ -211,13 +211,13 @@ void CL_BuildCubemaps_f( void )
{
mcubemap_t *m = &world->defaultCubemap;
FREE_TEXTURE( m->texture );
m->valid = m->texture = false;
m->valid = ( m->texture = false );

for( int i = 0; i < world->num_cubemaps; i++ )
{
mcubemap_t *m = &world->cubemaps[i];
FREE_TEXTURE( m->texture );
m->valid = m->texture = false;
m->valid = ( m->texture = false );
}

if( FBitSet( world->features, WORLD_HAS_SKYBOX ))
@@ -225,4 +225,4 @@ void CL_BuildCubemaps_f( void )

world->rebuilding_cubemaps = CMREBUILD_CHECKING;
world->loading_cubemaps = true;
}
}

+ 3
- 3
cl_dll/render/gl_deferred.cpp View File

@@ -422,7 +422,7 @@ static void GL_DrawBilateralFilter( word hProgram, int pass )
case UT_COLORMAP:
if( pass == BILATERAL_PASS0 )
u->SetValue( tr.fbo_light.GetTexture() );
else if( pass = BILATERAL_PASS1 )
else if( pass == BILATERAL_PASS1 )
u->SetValue( tr.fbo_filter.GetTexture() );
else u->SetValue( tr.defscene_fbo->colortarget[0] );
break;
@@ -435,7 +435,7 @@ static void GL_DrawBilateralFilter( word hProgram, int pass )
case UT_SCREENSIZEINV:
if( pass == BILATERAL_PASS0 )
u->SetValue( 1.0f / (float)glState.width, 0.0f );
else if( pass = BILATERAL_PASS1 )
else if( pass == BILATERAL_PASS1 )
u->SetValue( 0.0f, 1.0f / (float)glState.height );
else u->SetValue( 1.0f / (float)glState.width, 1.0f / (float)glState.height );
break;
@@ -551,4 +551,4 @@ void GL_DrawDeferredPass( void )
GL_CleanupDrawState();
GL_BindFBO( FBO_MAIN );
GL_Setup3D();
}
}

+ 3
- 2
cl_dll/render/gl_dlight.cpp View File

@@ -751,7 +751,7 @@ get_next_light:
int ignored = -1;
int light = 255;

for( i = 0; i < count; i++ )
for( int i = 0; i < count; i++ )
{
if( indexes[i][0] == -1.0f )
continue;
@@ -768,6 +768,7 @@ get_next_light:
if( ignored == -1 )
return;

int i;
for( i = 0; i < (int)cv_deferred_maxlights->value && lights[i] != 255; i++ );
if( i < (int)cv_deferred_maxlights->value )
lights[i] = light; // nearest light for surf
@@ -776,4 +777,4 @@ get_next_light:
// if( count > (int)cv_deferred_maxlights->value && i == (int)cv_deferred_maxlights->value )
// Msg( "skipped light %i intensity %g, type %d\n", light, maxIllum, world->worldlights[light].emittype );
goto get_next_light;
}
}

+ 7
- 8
cl_dll/render/gl_export.cpp View File

@@ -13,8 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/

#define EXTERN

#define APIENTRY_LINKAGE
#include "hud.h"
#include "cl_util.h"
#include "gl_local.h"
@@ -355,7 +354,7 @@ DebugCallback
For ARB_debug_output
========================
*/
static void CALLBACK GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLuint severity, GLint length, const GLcharARB *message, GLvoid *userParam )
static void APIENTRY GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLuint severity, GLint length, const GLcharARB *message, GLvoid *userParam )
{
static char string[8192];
char *msg;
@@ -502,10 +501,10 @@ static void GL_InitExtensions( void )
}

// get our various GL strings
glConfig.vendor_string = pglGetString( GL_VENDOR );
glConfig.renderer_string = pglGetString( GL_RENDERER );
glConfig.version_string = pglGetString( GL_VERSION );
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
glConfig.vendor_string = (const char*)pglGetString( GL_VENDOR );
glConfig.renderer_string = (const char*)pglGetString( GL_RENDERER );
glConfig.version_string = (const char*)pglGetString( GL_VERSION );
glConfig.extensions_string = (const char*)pglGetString( GL_EXTENSIONS );

if( Q_stristr( glConfig.renderer_string, "geforce" ))
glConfig.hardware_type = GLHW_NVIDIA;
@@ -1026,4 +1025,4 @@ void GL_Shutdown( void )

// now all extensions are disabled
memset( glConfig.extension, 0, sizeof( glConfig.extension[0] ) * R_EXTCOUNT );
}
}

+ 3
- 2
cl_dll/render/gl_grass.cpp View File

@@ -1117,7 +1117,8 @@ find or add unique texture for grass
*/
byte R_GrassTextureForName( const char *name )
{
for( byte i = 0; i < GRASS_TEXTURES && grasstexs[i].name[0]; i++ )
byte i;
for( i = 0; i < GRASS_TEXTURES && grasstexs[i].name[0]; i++ )
{
if( !Q_stricmp( grasstexs[i].name, name ))
return i; // found
@@ -1772,4 +1773,4 @@ void R_GrassShutdown( void )

FREE_TEXTURE( grasstexs[i].gl_texturenum );
}
}
}

+ 2
- 2
cl_dll/render/gl_shadows.cpp View File

@@ -196,7 +196,7 @@ static int R_ComputeCropBounds( const matrix4x4 &lightViewProjection, Vector bou
}

// add studio models too
for( i = 0; i < prevRI->frame.solid_meshes.Count(); i++ )
for( int i = 0; i < prevRI->frame.solid_meshes.Count(); i++ )
{
if( !R_StudioGetBounds( &prevRI->frame.solid_meshes[i], worldBounds ))
continue;
@@ -657,4 +657,4 @@ void R_RenderShadowmaps( void )
GL_BindFBO( oldFBO );
GL_BindShader( NULL );
RI->currentlight = NULL;
}
}

+ 1
- 1
cl_dll/render/gl_sprite.cpp View File

@@ -593,4 +593,4 @@ mspriteframe_t *CSpriteModelRenderer :: GetSpriteFrame( const model_t *m_pSprite

m_pCurrentEntity = NULL;
return GetSpriteFrame( frame, 0.0f );
}
}

+ 1
- 1
cl_dll/render/gl_studiodecal.h View File

@@ -56,4 +56,4 @@ typedef struct studiodecal_s
shader_t forwardLightProj;
} studiodecal_t;
#endif//GL_STUDIODECAL_H
#endif//GL_STUDIODECAL_H

+ 2
- 2
cl_dll/render/gl_studiodecal_new.cpp View File

@@ -1137,7 +1137,7 @@ void CStudioModelRenderer :: AddDecalToModel( DecalBuildInfo_t& buildInfo )
float s = 1.0f / (float)ptexture->width;
float t = 1.0f / (float)ptexture->height;

while( numVerts = *( ptricmds++ ))
while(( numVerts = *( ptricmds++ )))
{
bool strip = ( numVerts < 0 ) ? false : true;
int vertexState = 0;
@@ -1778,4 +1778,4 @@ void CStudioModelRenderer :: DrawDecal( CSolidEntry *entry, GLenum cull_mode )
GL_DepthMask( GL_TRUE );
GL_Blend( GL_FALSE );
GL_Cull( GL_FRONT );
}
}

+ 11
- 11
cl_dll/render/gl_world_new.cpp View File

@@ -146,7 +146,7 @@ check cubemap sides for valid
*/
static bool Mod_CheckCubemap( const char *name )
{
char *suf[6] = { "px", "nx", "py", "ny", "pz", "nz" };
const char *suf[6] = { "px", "nx", "py", "ny", "pz", "nz" };
int valid_sides = 0;
char sidename[64];
int iCompare;
@@ -175,7 +175,7 @@ remove cubemap images from HDD
*/
static void Mod_DeleteCubemap( const char *name )
{
char *suf[6] = { "px", "nx", "py", "ny", "pz", "nz" };
const char *suf[6] = { "px", "nx", "py", "ny", "pz", "nz" };
char sidename[64];

for( int i = 0; i < 6; i++ )
@@ -328,7 +328,7 @@ void GL_LoadAndRebuildCubemaps( int refParams )

// bind cubemaps onto world surfaces
// so we don't need to search them again
for( i = 0; i < worldmodel->numsurfaces; i++ )
for( int i = 0; i < worldmodel->numsurfaces; i++ )
{
msurface_t *surf = &worldmodel->surfaces[i];
mextrasurf_t *es = surf->info;
@@ -405,7 +405,7 @@ static void Mod_LoadCubemaps( const byte *base, const dlump_t *l )
cm->size = 4;
}

for( i = 0; i < count; i++, in++, out++ )
for( int i = 0; i < count; i++, in++, out++ )
{
// build a cubemap name like enum
Q_snprintf( out->name, sizeof( out->name ), "maps/env/%s/cube#%i", world->name, i );
@@ -965,12 +965,12 @@ Mod_SurfaceCompareBuild
sort faces before lightmap building
=================
*/
static int Mod_SurfaceCompareBuild( const unsigned short **a, const unsigned short **b )
static int Mod_SurfaceCompareBuild( const unsigned short *a, const unsigned short *b )
{
msurface_t *surf1, *surf2;

surf1 = &worldmodel->surfaces[(unsigned short)*a];
surf2 = &worldmodel->surfaces[(unsigned short)*b];
surf1 = &worldmodel->surfaces[*a];
surf2 = &worldmodel->surfaces[*b];

if( FBitSet( surf1->flags, SURF_DRAWSKY ) && !FBitSet( surf2->flags, SURF_DRAWSKY ))
return -1;
@@ -1002,13 +1002,13 @@ Mod_SurfaceCompareInGame
sort faces to reduce shader switches
=================
*/
static int Mod_SurfaceCompareInGame( const unsigned short **a, const unsigned short **b )
static int Mod_SurfaceCompareInGame( const unsigned short *a, const unsigned short *b )
{
msurface_t *surf1, *surf2;
mextrasurf_t *esrf1, *esrf2;

surf1 = &worldmodel->surfaces[(unsigned short)*a];
surf2 = &worldmodel->surfaces[(unsigned short)*b];
surf1 = &worldmodel->surfaces[*a];
surf2 = &worldmodel->surfaces[*b];

esrf1 = surf1->info;
esrf2 = surf2->info;
@@ -4022,4 +4022,4 @@ void R_RenderShadowBrushList( void )

R_RenderShadowGrassOnList();
GL_CleanupDrawState();
}
}

+ 1
- 3
cl_dll/render/tri.cpp View File

@@ -21,8 +21,6 @@
#include "com_model.h"
#include "gl_local.h"// buz

#define DLLEXPORT __declspec( dllexport )

extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );
@@ -204,4 +202,4 @@ Render any triangles with transparent rendermode needs here
*/
void DLLEXPORT HUD_DrawTransparentTriangles( void )
{
}
}

+ 3
- 2
cl_dll/saytext.cpp View File

@@ -174,7 +174,8 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
}

// find an empty string slot
for ( int i = 0; i < MAX_LINES; i++ )
int i;
for ( i = 0; i < MAX_LINES; i++ )
{
if ( ! *g_szLineBuffer[i] )
break;
@@ -318,4 +319,4 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
}
}
}
}
}

+ 3
- 2
cl_dll/status_icons.cpp View File

@@ -107,7 +107,8 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p
void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
{
// check to see if the sprite is in the current list
for ( int i = 0; i < MAX_ICONSPRITES; i++ )
int i;
for ( i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
break;
@@ -155,7 +156,7 @@ void CHudStatusIcons::DisableIcon( char *pszIconName )
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
{
// clear the item from the list
memset( &m_IconList[i], 0, sizeof icon_sprite_t );
memset( &m_IconList[i], 0, sizeof( icon_sprite_t ));
return;
}
}


+ 6
- 5
cl_dll/util.cpp View File

@@ -18,9 +18,10 @@
// implementation of class-less helper functions
//

#include "STDIO.H"
#include "STDLIB.H"
#include "MATH.H"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdarg.h>

#include "hud.h"
#include "cl_util.h"
@@ -43,7 +44,7 @@ pfnAlertMessage

=============
*/
void ALERT( ALERT_TYPE level, char *szFmt, ... )
void ALERT( ALERT_TYPE level, const char *szFmt, ... )
{
char buffer[2048]; // must support > 1k messages
va_list args;
@@ -1418,4 +1419,4 @@ color24 UnpackColor( float pack )
color.z = color.z - floor( color.z );

return color24( color.x * 256, color.y * 256, color.z * 256 );
}
}

+ 1
- 1
cl_dll/vgui_CustomObjects.cpp View File

@@ -32,7 +32,7 @@
#include "vgui_int.h"
#include "vgui_TeamFortressViewport.h"
#include "vgui_ServerBrowser.h"
#include "../game_shared/vgui_LoadTGA.h"
#include "../game_shared/vgui_loadtga.h"

// Arrow filenames
char *sArrowFilenames[] =


+ 10
- 5
cl_dll/vgui_ScorePanel.cpp View File

@@ -303,7 +303,8 @@ void ScorePanel::Update()
void ScorePanel::SortTeams()
{
// clear out team scores
for ( int i = 1; i <= m_iNumTeams; i++ )
int i;
for ( i = 1; i <= m_iNumTeams; i++ )
{
if ( !g_TeamInfo[i].scores_overriden )
g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0;
@@ -320,7 +321,8 @@ void ScorePanel::SortTeams()
continue; // skip over players who are not in a team

// find what team this player is in
for ( int j = 1; j <= m_iNumTeams; j++ )
int j;
for ( j = 1; j <= m_iNumTeams; j++ )
{
if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) )
break;
@@ -462,7 +464,8 @@ void ScorePanel::SortPlayers( int iTeam, char *team )
void ScorePanel::RebuildTeams()
{
// clear out player counts from teams
for ( int i = 1; i <= m_iNumTeams; i++ )
int i;
for ( i = 1; i <= m_iNumTeams; i++ )
{
g_TeamInfo[i].players = 0;
}
@@ -479,7 +482,8 @@ void ScorePanel::RebuildTeams()
continue; // skip over players who are not in a team

// is this player in an existing team?
for ( int j = 1; j <= m_iNumTeams; j++ )
int j;
for ( j = 1; j <= m_iNumTeams; j++ )
{
if ( g_TeamInfo[j].name[0] == '\0' )
break;
@@ -541,7 +545,8 @@ void ScorePanel::FillGrid()

bool bNextRowIsGap = false;

for(int row=0; row < NUM_ROWS; row++)
int row;
for(row=0; row < NUM_ROWS; row++)
{
CGrid *pGridRow = &m_PlayerGrids[row];
pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);


+ 6
- 5
cl_dll/vgui_TeamFortressViewport.cpp View File

@@ -1070,11 +1070,11 @@ try
pfile = gEngfuncs.COM_ParseFile(pfile, token);
}
}
catch( CException *e )
catch( ... /* CException *e */ )
{
e;
/*e;
//e->Delete();
e = NULL;
e = NULL;*/
m_iInitialized = false;
return newIndex;
}
@@ -2366,7 +2366,8 @@ int TeamFortressViewport::MsgFunc_TeamScore( const char *pszName, int iSize, voi
char *TeamName = READ_STRING();

// find the team matching the name
for ( int i = 1; i <= m_pScoreBoard->m_iNumTeams; i++ )
int i;
for ( i = 1; i <= m_pScoreBoard->m_iNumTeams; i++ )
{
if ( !stricmp( TeamName, g_TeamInfo[i].name ) )
break;
@@ -2545,4 +2546,4 @@ void VGuiAddPickupMessage( client_textmessage_t *msg )
gViewPort->AddPickupMessage( msg );
else
gEngfuncs.Con_Printf("Pickup message error: Viewport is not constructed!\n");
}
}

+ 6
- 6
cl_dll/vgui_TeamFortressViewport.h View File

@@ -684,14 +684,14 @@ protected:
char m_pszCommand[MAX_COMMAND_SIZE];
int m_iCloseVGUIMenu;
public:
CMenuHandler_StringCommand( char *pszCommand )
CMenuHandler_StringCommand( const char *pszCommand )
{
strncpy( m_pszCommand, pszCommand, MAX_COMMAND_SIZE);
m_pszCommand[MAX_COMMAND_SIZE-1] = '\0';
m_iCloseVGUIMenu = false;
}

CMenuHandler_StringCommand( char *pszCommand, int iClose )
CMenuHandler_StringCommand( const char *pszCommand, int iClose )
{
strncpy( m_pszCommand, pszCommand, MAX_COMMAND_SIZE);
m_pszCommand[MAX_COMMAND_SIZE-1] = '\0';
@@ -715,11 +715,11 @@ class CMenuHandler_StringCommandWatch : public CMenuHandler_StringCommand
{
private:
public:
CMenuHandler_StringCommandWatch( char *pszCommand ) : CMenuHandler_StringCommand( pszCommand )
CMenuHandler_StringCommandWatch( const char *pszCommand ) : CMenuHandler_StringCommand( pszCommand )
{
}

CMenuHandler_StringCommandWatch( char *pszCommand, int iClose ) : CMenuHandler_StringCommand( pszCommand, iClose )
CMenuHandler_StringCommandWatch( const char *pszCommand, int iClose ) : CMenuHandler_StringCommand( pszCommand, iClose )
{
}

@@ -745,11 +745,11 @@ class CMenuHandler_StringCommandClassSelect : public CMenuHandler_StringCommand
{
private:
public:
CMenuHandler_StringCommandClassSelect( char *pszCommand ) : CMenuHandler_StringCommand( pszCommand )
CMenuHandler_StringCommandClassSelect( const char *pszCommand ) : CMenuHandler_StringCommand( pszCommand )
{
}

CMenuHandler_StringCommandClassSelect( char *pszCommand, int iClose ) : CMenuHandler_StringCommand( pszCommand, iClose )
CMenuHandler_StringCommandClassSelect( const char *pszCommand, int iClose ) : CMenuHandler_StringCommand( pszCommand, iClose )
{
}



+ 1
- 1
cl_dll/vgui_radio.cpp View File

@@ -50,7 +50,7 @@ void CRadioIcon::Initialize()

CRadioIcon::CRadioIcon() : Panel(0, 0, 10, 10)
{
if( m_pSpeakerBitmap = vgui_LoadTGANoInvertAlpha("gfx/vgui/speaker4.tga" ) )
if(( m_pSpeakerBitmap = vgui_LoadTGANoInvertAlpha("gfx/vgui/speaker4.tga" ) ))
m_pSpeakerBitmap->setColor( Color(255,255,255,1) );
else
gEngfuncs.Con_Printf("Cannot load gfx/vgui/speaker4.tga!\n");


+ 2
- 4
cl_dll/vgui_screenmsg.h View File

@@ -7,9 +7,7 @@
using namespace vgui;

#include "vgui_shadowtext.h"

Font* FontFromMessage(const char* &ptext);

#include "getfont.h"

class CScreenMessage : public ShadowTextPanel
{
@@ -170,4 +168,4 @@ protected:
float m_delay;
};

#endif // _VGUIMSG_H
#endif // _VGUIMSG_H

+ 0
- 3
cl_dll/vgui_tips.cpp View File

@@ -30,9 +30,6 @@ void ShowTip( client_textmessage_t *tempMessage )
gEngfuncs.Con_Printf("Tips error: m_pTips or ViewPort is not constructed!\n");
}


Font* FontFromMessage(const char* &ptext);

void CTips::Initialize()
{
setVisible(false);


+ 9
- 0
common/port.h View File

@@ -66,6 +66,7 @@ GNU General Public License for more details.
#define FreeLibrary( x ) dlclose( x )
#define tell( a ) lseek(a, 0, SEEK_CUR)
#define HAVE_DUP
#define _aligned_malloc( x, y ) aligned_alloc( y, x ) // man 3 posix_memalign
#endif

#if XASH_DOS4GW
@@ -152,6 +153,14 @@ GNU General Public License for more details.
#include <string.h>
#include <limits.h>

#if !defined MAX_PATH
#define MAX_PATH 4096 // 4k ought to be enough for anybody
#endif

#if __cplusplus >= 2011L
#define COMPILE_TIME_ASSERT static_assert
#endif

#if defined XASH_SDL && !defined REF_DLL
#include <SDL.h>
#endif


+ 16
- 1
game_shared/mathlib.h View File

@@ -96,6 +96,21 @@ void VectorAngles( const Vector &forward, Vector &angles );
void VectorAngles2( const Vector &forward, Vector &angles );
void MakeAxial( float normal[3] );

// return the smallest power of two >= x.
// returns 0 if x == 0 or x > 0x80000000 (ie numbers that would be negative if x was signed)
// NOTE: the old code took an int, and if you pass in an int of 0x80000000 casted to a uint,
// you'll get 0x80000000, which is correct for uints, instead of 0, which was correct for ints
_forceinline uint SmallestPowerOfTwoGreaterOrEqual( uint x )
{
x -= 1;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
return x + 1;
}

// Remap a value in the range [A,B] to [C,D].
inline float RemapVal( float val, float A, float B, float C, float D)
{
@@ -263,4 +278,4 @@ float PackNormal( const Vector &normal );
extern float g_hullcolor[8][3];
extern int g_boxpnt[6][4];

#endif//MATHLIB_H
#endif//MATHLIB_H

+ 1
- 1
game_shared/matrix.h View File

@@ -1114,4 +1114,4 @@ public:
Vector4D mat[4];
};

#endif//MATRIX_H
#endif//MATRIX_H

+ 3
- 2
game_shared/utlblockmemory.h View File

@@ -244,7 +244,8 @@ void CUtlBlockMemory<T,I>::ChangeSize( int nBlocks )

if ( !m_pMemory )
{
Error( "CUtlBlockMemory overflow!\n" );
printf( "CUtlBlockMemory overflow!\n" );
abort();
}

// allocate new blocks if growing
@@ -316,4 +317,4 @@ void CUtlBlockMemory<T,I>::Purge( int numElements )
ChangeSize( nBlocks );
}

#endif // UTLBLOCKMEMORY_H
#endif // UTLBLOCKMEMORY_H

+ 1
- 1
game_shared/vgui_slider2.cpp View File

@@ -433,4 +433,4 @@ void Slider2::setRangeWindowEnabled(bool state)
void Slider2::setButtonOffset(int buttonOffset)
{
_buttonOffset=buttonOffset;
}
}

+ 33
- 0
game_shared/virtualfs.cpp View File

@@ -0,0 +1,33 @@
//=======================================================================
// Copyright (C) XashXT Group 2014
// virtualfs.h - Virtual FileSystem that writes into memory
//=======================================================================
#include "port.h"
#include <stdarg.h>
#include "mathlib.h"
#include "stringlib.h"
#include "virtualfs.h"

size_t CVirtualFS :: Printf( const char *fmt, ... )
{
size_t result;
va_list args;

va_start( args, fmt );
result = VPrintf( fmt, args );
va_end( args );

return result;
}

size_t CVirtualFS :: IPrintf( const char *fmt, ... )
{
size_t result;
va_list args;

va_start( args, fmt );
result = IVPrintf( fmt, args );
va_end( args );

return result;
}

+ 1
- 1
utils/vgui

@@ -1 +1 @@
Subproject commit f5566261bda70bc5e0f2d277bfbadd2316c18bfb
Subproject commit 93573075afe885618ea15831e72d44bdacd65bfb

+ 1
- 1
wscript View File

@@ -255,7 +255,7 @@ def configure(conf):
pass
else:
conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti'])

# strip lib from pattern
if conf.env.DEST_OS in ['linux', 'darwin']:


Loading…
Cancel
Save