Browse Source

Merge branch 'master' of https://github.com/SDLash3D/hlsdk-xash3d into gravgun

gravgun
mittorn 7 years ago
parent
commit
4a7e928520
  1. 2
      cl_dll/MOTD.cpp
  2. 4
      cl_dll/cl_dll.h
  3. 2
      cl_dll/cl_util.h
  4. 2
      cl_dll/com_weapons.cpp
  5. 4
      cl_dll/com_weapons.h
  6. 29
      cl_dll/hud_redraw.cpp
  7. 24
      cl_dll/scoreboard.cpp
  8. 4
      dlls/extdll.h
  9. 4
      dlls/nodes.h
  10. 2
      dlls/saverestore.h
  11. 41
      dlls/util.cpp
  12. 11
      dlls/util.h
  13. 4
      engine/eiface.h
  14. 2
      engine/studio.h

2
cl_dll/MOTD.cpp

@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime ) @@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime )
// find where to start drawing the line
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 );
ypos += LINE_HEIGHT;

4
cl_dll/cl_dll.h

@ -41,6 +41,10 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); @@ -41,6 +41,10 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
#include "exportdef.h"
#include <string.h>
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT
#endif
extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h"
extern mobile_engfuncs_t *gMobileEngfuncs;

2
cl_dll/cl_util.h

@ -115,6 +115,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height ) @@ -115,6 +115,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height )
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
}
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b );
inline int ConsoleStringLen( const char *string )
{
int _width = 0, _height = 0;

2
cl_dll/com_weapons.cpp

@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s ) @@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s )
return 0;
}
const char *stub_NameForFunction( unsigned long function )
const char *stub_NameForFunction( void *function )
{
return "func";
}

4
cl_dll/com_weapons.h

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); @@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
int stub_PrecacheModel( char* s );
int stub_PrecacheSound( char* s );
unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction( unsigned long function );
const char *stub_NameForFunction( void *function );
void stub_SetModel( struct edict_s *e, const char *m );
extern cvar_t *cl_lw;

29
cl_dll/hud_redraw.cpp

@ -226,6 +226,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g @@ -226,6 +226,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
return xpos;
}
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
{
// xash3d: reset unicode state
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
// draw the string until we hit the null character or a newline character
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
{
int w = gHUD.m_scrinfo.charWidths['M'];
if( xpos + w > iMaxX )
return xpos;
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
{
szIt++;
r = colors[*szIt - '0'][0];
g = colors[*szIt - '0'][1];
b = colors[*szIt - '0'][2];
if( !*(++szIt) )
return xpos;
}
int c = (unsigned int)(unsigned char)*szIt;
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
}
return xpos;
}
int CHud::DrawHudStringLen( char *szIt )
{
int l = 0;

24
cl_dll/scoreboard.cpp

@ -146,18 +146,18 @@ int CHudScoreboard::Draw( float fTime ) @@ -146,18 +146,18 @@ int CHudScoreboard::Draw( float fTime )
FAR_RIGHT += 5;
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
if( !gHUD.m_Teamplay )
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
else
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 );
gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
DrawUtfString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
DrawUtfString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
if( can_show_packetloss )
{
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
}
list_slot += 1.2;
@ -272,7 +272,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -272,7 +272,7 @@ int CHudScoreboard::Draw( float fTime )
}
// draw their name (left to right)
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
// draw kills (right to left)
xpos = KILLS_RANGE_MAX + xpos_rel;
@ -280,7 +280,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -280,7 +280,7 @@ int CHudScoreboard::Draw( float fTime )
// draw divider
xpos = DIVIDER_POS + xpos_rel;
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
// draw deaths
xpos = DEATHS_RANGE_MAX + xpos_rel;
@ -300,7 +300,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -300,7 +300,7 @@ int CHudScoreboard::Draw( float fTime )
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25;
sprintf( buf, " %d", team_info->packetloss );
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
}
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
@ -400,7 +400,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -400,7 +400,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
}
// draw their name (left to right)
gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
// draw kills (right to left)
xpos = KILLS_RANGE_MAX + xpos_rel;
@ -408,7 +408,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -408,7 +408,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
// draw divider
xpos = DIVIDER_POS + xpos_rel;
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
// draw deaths
xpos = DEATHS_RANGE_MAX + xpos_rel;
@ -435,7 +435,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -435,7 +435,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25;
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
}
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again

4
dlls/extdll.h

@ -57,6 +57,10 @@ typedef int BOOL; @@ -57,6 +57,10 @@ typedef int BOOL;
#include "stdlib.h"
#include "math.h"
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT
#endif
// Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t;
typedef unsigned int string_t; // from engine's pr_comp.h;

4
dlls/nodes.h

@ -103,7 +103,11 @@ typedef struct @@ -103,7 +103,11 @@ typedef struct
//=========================================================
// CGraph
//=========================================================
#ifdef XASH_64BIT
#define GRAPH_VERSION (int)16 * 10
#else
#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files.
#endif
class CGraph
{

2
dlls/saverestore.h

@ -59,7 +59,7 @@ public: @@ -59,7 +59,7 @@ public:
void WriteVector( const char *pname, const float *value, int count ); // Save a vector
void WritePositionVector( const char *pname, const Vector &value ); // Offset for landmark if necessary
void WritePositionVector( const char *pname, const float *value, int count ); // array of pos vectors
void WriteFunction( const char *pname, const int *value, int count ); // Save a function pointer
void WriteFunction( const char *pname, void **value, int count ); // Save a function pointer
int WriteEntVars( const char *pname, entvars_t *pev ); // Save entvars_t (entvars_t)
int WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );

41
dlls/util.cpp

@ -1584,6 +1584,33 @@ void UTIL_StripToken( const char *pKey, char *pDest ) @@ -1584,6 +1584,33 @@ void UTIL_StripToken( const char *pKey, char *pDest )
//
// --------------------------------------------------------------
static int gSizes[FIELD_TYPECOUNT] =
{
sizeof(float), // FIELD_FLOAT
sizeof(int), // FIELD_STRING
sizeof(void*), // FIELD_ENTITY
sizeof(void*), // FIELD_CLASSPTR
sizeof(void*), // FIELD_EHANDLE
sizeof(void*), // FIELD_entvars_t
sizeof(void*), // FIELD_EDICT
sizeof(float) * 3, // FIELD_VECTOR
sizeof(float) * 3, // FIELD_POSITION_VECTOR
sizeof(void *), // FIELD_POINTER
sizeof(int), // FIELD_INTEGER
#ifdef GNUC
sizeof(void *) * 2, // FIELD_FUNCTION
#else
sizeof(void *), // FIELD_FUNCTION
#endif
sizeof(int), // FIELD_BOOLEAN
sizeof(short), // FIELD_SHORT
sizeof(char), // FIELD_CHARACTER
sizeof(float), // FIELD_TIME
sizeof(int), // FIELD_MODELNAME
sizeof(int), // FIELD_SOUNDNAME
};
// entities has different store size
static int gInputSizes[FIELD_TYPECOUNT] =
{
sizeof(float), // FIELD_FLOAT
sizeof(int), // FIELD_STRING
@ -1594,12 +1621,12 @@ static int gSizes[FIELD_TYPECOUNT] = @@ -1594,12 +1621,12 @@ static int gSizes[FIELD_TYPECOUNT] =
sizeof(int), // FIELD_EDICT
sizeof(float) * 3, // FIELD_VECTOR
sizeof(float) * 3, // FIELD_POSITION_VECTOR
sizeof(int *), // FIELD_POINTER
sizeof(void *), // FIELD_POINTER
sizeof(int), // FIELD_INTEGER
#ifdef GNUC
sizeof(int *) * 2, // FIELD_FUNCTION
sizeof(void *) * 2, // FIELD_FUNCTION
#else
sizeof(int *), // FIELD_FUNCTION
sizeof(void *), // FIELD_FUNCTION
#endif
sizeof(int), // FIELD_BOOLEAN
sizeof(short), // FIELD_SHORT
@ -1886,7 +1913,7 @@ void CSave::WritePositionVector( const char *pname, const float *value, int coun @@ -1886,7 +1913,7 @@ void CSave::WritePositionVector( const char *pname, const float *value, int coun
}
}
void CSave::WriteFunction( const char *pname, const int *data, int count )
void CSave::WriteFunction( const char *pname, void **data, int count )
{
const char *functionName;
@ -1894,7 +1921,7 @@ void CSave::WriteFunction( const char *pname, const int *data, int count ) @@ -1894,7 +1921,7 @@ void CSave::WriteFunction( const char *pname, const int *data, int count )
if( functionName )
BufferField( pname, strlen( functionName ) + 1, functionName );
else
ALERT( at_error, "Invalid function pointer in entity!" );
ALERT( at_error, "Invalid function pointer in entity!\n" );
}
void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd )
@ -2042,7 +2069,7 @@ int CSave::WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFi @@ -2042,7 +2069,7 @@ int CSave::WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFi
WriteInt( pTest->fieldName, (int *)(char *)pOutputData, pTest->fieldSize );
break;
case FIELD_FUNCTION:
WriteFunction( pTest->fieldName, (int *)pOutputData, pTest->fieldSize );
WriteFunction( pTest->fieldName, (void **)pOutputData, pTest->fieldSize );
break;
default:
ALERT( at_error, "Bad field type\n" );
@ -2137,7 +2164,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou @@ -2137,7 +2164,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
for( j = 0; j < pTest->fieldSize; j++ )
{
void *pOutputData = ( (char *)pBaseData + pTest->fieldOffset + ( j * gSizes[pTest->fieldType] ) );
void *pInputData = (char *)pData + j * gSizes[pTest->fieldType];
void *pInputData = (char *)pData + j * gInputSizes[pTest->fieldType];
switch( pTest->fieldType )
{

11
dlls/util.h

@ -35,10 +35,17 @@ extern globalvars_t *gpGlobals; @@ -35,10 +35,17 @@ extern globalvars_t *gpGlobals;
// Use this instead of ALLOC_STRING on constant strings
#define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset)
#if !defined __amd64__ || defined(CLIENT_DLL)
#if !defined XASH_64BIT || defined(CLIENT_DLL)
#define MAKE_STRING(str) ((int)(size_t)str - (int)(size_t)STRING(0))
#else
#define MAKE_STRING ALLOC_STRING
static inline int MAKE_STRING(const char *szValue)
{
long long ptrdiff = szValue - STRING(0);
if( ptrdiff > INT_MAX || ptrdiff < INT_MIN )
return ALLOC_STRING(szValue);
else
return (int)ptrdiff;
}
#endif
inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName)

4
engine/eiface.h

@ -171,8 +171,8 @@ typedef struct enginefuncs_s @@ -171,8 +171,8 @@ typedef struct enginefuncs_s
int (*pfnRegUserMsg)( const char *pszName, int iSize );
void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime );
void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
unsigned long (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( unsigned long function );
void* (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( void *function );
void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint)( const char *szMsg );
const char *(*pfnCmd_Args)( void ); // these 3 added

2
engine/studio.h

@ -215,7 +215,7 @@ typedef struct @@ -215,7 +215,7 @@ typedef struct
char label[32]; // textual name
char name[64]; // file name
cache_user_t cache; // cache index pointer
#ifndef __amd64
#ifndef XASH_64BIT
int data; // hack for group 0
#endif
} mstudioseqgroup_t;

Loading…
Cancel
Save