Compare commits

..

27 Commits

Author SHA1 Message Date
nillerusr
2f6aa51749 Upload shitty multiplayer hacks 2021-11-14 17:25:13 +03:00
nillerusr
4243cede59 Merge pull request #29 from nillerusr/misalign-fixes
Misalign fixes
2021-11-14 13:31:02 +03:00
nillerusr
f7cdca7ad2 saverestore fixes 2021-11-14 00:07:58 +03:00
nillerusr
b1edca8c4c utlbuffer: typo fix 2021-11-09 19:02:26 +03:00
nillerusr
2d17c2b52f utlbuffer,bitbuf: misalign fix 2021-11-05 19:51:41 +03:00
nillerusr
cd72eac63d Update server_base.vpc 2021-11-05 11:46:37 +03:00
nillerusr
29c83b7867 vpc_parser: typo fix 2021-11-05 10:54:43 +03:00
nillerusr
1b98e8994e vpc_parser: fix python2 compatibility again 2021-11-05 10:53:29 +03:00
nillerusr
31586ce622 vpc_parser: fix python2 compatibility 2021-11-05 10:49:26 +03:00
nillerusr
889829e5b4 upload vpc parser 2021-11-05 10:29:53 +03:00
nillerusr
7a69af7b00 Android OpenGL support( for tegra gpu's ) 2021-10-26 21:30:11 +03:00
nillerusr
99e02e25c9 CUtlBuffer, Color: misalign fixes 2021-10-25 18:45:21 +03:00
nillerusr
6e5ef80a0e Update README.md, update ivp submodule 2021-10-23 17:09:16 +03:00
nillerusr
18e088f8ff Update wscript 2021-10-23 15:51:37 +03:00
nillerusr
dc2be1dcb4 physics: fix a lot of problems 2021-10-23 14:41:59 +03:00
nillerusr
cb04a1e451 Replace 1e24 with 1e16 to avoid float overflow 2021-10-13 20:01:24 +03:00
nillerusr
977bac3205 touch: replace static arrays with linked list 2021-10-13 18:18:36 +03:00
nillerusr
63e458ef84 add vgui touch panel, touch logic 2021-10-09 15:22:16 +03:00
nillerusr
81b976c384 inputsystem: touch event handling 2021-10-06 21:09:43 +03:00
nillerusr
0d2a493312 materialsystem: fix undefined behaviour(bruh moment) 2021-10-05 00:53:56 +03:00
nillerusr
2f12021cce fix previous commit 2021-10-05 00:51:01 +03:00
Danny Parker
61302b61e7 fix latest gcc builds (#19)
Co-authored-by: Danny Parker <DannyParker0001@users.noreply.github.com>
2021-10-01 20:32:20 +03:00
nillerusr
2c6669f5e3 Initial android support (#17)
* Upload Android armv7 libs

* Fix debug build

* utlvector: fix undefined behavior

* wscript: add --use-ccache option

* wscript: store ccache in a separate directory

* Propertly use gl4es

* fontconfig: fix font detection

* [android]remove fontconfig dependency

* Add build guide for other platforms

Co-authored-by: JusicP <slender87844@gmail.com>
Co-authored-by: nillerusr <nillerusr@users.noreply.github.com>
2021-09-02 20:33:03 +03:00
nillerusr
2a490d398c Revert "Fix code for Android"
This reverts commit 7a91fbebd9.
2021-09-02 20:31:11 +03:00
nillerusr
b62d2f4f1a Revert "Upload Android armv7 libs"
This reverts commit 557c300975.
2021-09-02 20:18:18 +03:00
JusicP
7a91fbebd9 Fix code for Android 2021-08-20 19:56:20 +03:00
JusicP
557c300975 Upload Android armv7 libs 2021-08-20 19:35:07 +03:00
52 changed files with 1493 additions and 1349 deletions

View File

@@ -1,20 +1,27 @@
# source-engine
The main purpose of this repository is to port the engine for other platforms.
# Goals
* fixing bugs
* NEON support
* ~~NEON support~~
* DXVK support
* remove unnecessary dependencies
* Elbrus port
* Arm(android) port
* ~~Arm(android) port~~
* improve performance
* replace current buildsystem with waf
* ~~replace current buildsystem with waf~~
* rewrite achivement system( to work without steam )
# How to Build?
1. Clone repo ( ```git clone https://github.com/nillerusr/source-engine```)
2. Run ```git submodule init && git submodule update```
* 64-bit support
# How to Build?
Clone repo and change directory:
```
git clone https://github.com/nillerusr/source-engine --recursive --depth 1
cd source-engine
```
On Linux:
dependencies:
fontconfig, freetype2, OpenAL, SDL2, libbz2, libcurl, libjpeg, libpng, zlib
```
./waf configure -T debug
./waf build
@@ -25,5 +32,5 @@ export ANDROID_NDK=/path/to/ndk
./waf configure -T debug --android=armeabi-v7a,4.9,21
./waf build
```
On Windows:
**TODO(WAF is not configured for Windows. Use VPC as temporary solution)**
On Windows/MacOS:
**TODO(WAF is not configured for Windows/MacOS. Use VPC as temporary solution)**

View File

@@ -19,6 +19,7 @@
#include "tier1/utllinkedlist.h"
#include "tier1/convar.h"
#include <EGL/egl.h>
// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
#include "tier0/memdbgon.h"
@@ -57,8 +58,14 @@ COpenGLEntryPoints *gGL = NULL;
const int kBogusSwapInterval = INT_MAX;
#ifdef ANDROID
static void *gl4es = NULL;
void *(*_glGetProcAddress)( const char * );
static void *l_gl4es = NULL;
static void *l_egl = NULL;
typedef void *(*t_glGetProcAddress)( const char * );
t_glGetProcAddress _glGetProcAddress;
typedef EGLBoolean (*t_eglBindAPI)(EGLenum api);
t_eglBindAPI _eglBindAPI;
#endif
/*
@@ -238,7 +245,7 @@ public:
virtual void IncWindowRefCount();
virtual void DecWindowRefCount();
// Get the next N events. The function returns the number of events that were filled into your array.
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
#ifdef LINUX
@@ -374,7 +381,7 @@ private:
Uint32 m_MouseButtonDownTimeStamp;
int m_MouseButtonDownX;
int m_MouseButtonDownY;
double m_flPrevGLSwapWindowTime;
};
@@ -544,23 +551,51 @@ InitReturnVal_t CSDLMgr::Init()
m_MouseButtonDownTimeStamp = 0;
m_MouseButtonDownX = 0;
m_MouseButtonDownY = 0;
m_bExpectSyntheticMouseMotion = false;
m_nMouseTargetX = 0;
m_nMouseTargetY = 0;
m_nWarpDelta = 0;
m_bRawInput = false;
m_flPrevGLSwapWindowTime = 0.0f;
memset(m_pixelFormatAttribs, '\0', sizeof (m_pixelFormatAttribs));
int *attCursor = m_pixelFormatAttribs;
#define SET_GL_ATTR(key,value) \
*(attCursor++) = (int) (key); \
*(attCursor++) = (int) (value);
#define SET_GL_ATTR(key,value) \
*(attCursor++) = (int) (key); \
*(attCursor++) = (int) (value);
#ifdef ANDROID
bool m_bOGL = false;
l_egl = dlopen("libEGL.so", RTLD_LAZY);
if( l_egl )
{
_eglBindAPI = (t_eglBindAPI)dlsym(l_egl, "eglBindAPI");
if( _eglBindAPI && _eglBindAPI(EGL_OPENGL_API) )
{
Msg("OpenGL support found!\n");
m_bOGL = true;
}
}
if( m_bOGL )
{
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
}
else
{
l_gl4es = dlopen("libgl4es.so", RTLD_LAZY);
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_gl4es, "gl4es_glGetProcAddress");
}
#endif
SET_GL_ATTR(SDL_GL_RED_SIZE, 8);
SET_GL_ATTR(SDL_GL_GREEN_SIZE, 8);
SET_GL_ATTR(SDL_GL_BLUE_SIZE, 8);
@@ -586,9 +621,9 @@ InitReturnVal_t CSDLMgr::Init()
// to really actually make a window, we just resize the one we built here.
if ( !CreateHiddenGameWindow( "", 640, 480 ) )
Error( "CreateGameWindow failed" );
SDL_HideWindow( m_Window );
return INIT_OK;
}
@@ -724,7 +759,7 @@ bool CSDLMgr::CreateHiddenGameWindow( const char *pTitle, int width, int height
#if defined( DX_TO_GL_ABSTRACTION )
flags |= SDL_WINDOW_OPENGL;
#endif
m_Window = SDL_CreateWindow( pTitle, x, y, width, height, flags );
m_Window = SDL_CreateWindow( pTitle, x, y, width, height, flags );
if (m_Window == NULL)
Error( "Failed to create SDL window: %s", SDL_GetError() );
@@ -760,13 +795,11 @@ bool CSDLMgr::CreateHiddenGameWindow( const char *pTitle, int width, int height
SDL_GL_MakeCurrent(m_Window, m_GLContext);
#ifdef ANDROID
gl4es = dlopen("libgl4es.so", RTLD_LAZY);
if( gl4es )
if( l_gl4es )
{
_glGetProcAddress = dlsym(gl4es, "gl4es_GetProcAddress" );
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_gl4es, "gl4es_GetProcAddress" );
void (*initialize_gl4es)( );
initialize_gl4es = dlsym(gl4es, "initialize_gl4es" );
initialize_gl4es = (void(*)())dlsym(l_gl4es, "initialize_gl4es" );
initialize_gl4es();
}
#endif
@@ -988,10 +1021,10 @@ void CSDLMgr::PostEvent( const CCocoaEvent &theEvent, bool debugEvent )
SDLAPP_FUNC;
m_CocoaEventsMutex.Lock();
CUtlLinkedList<CCocoaEvent,int> &queue = debugEvent ? m_CocoaEvents : m_DebugEvents;
queue.AddToTail( theEvent );
m_CocoaEventsMutex.Unlock();
}
@@ -1837,6 +1870,8 @@ void CSDLMgr::PumpWindowsMessageLoop()
break;
}
// FIXME(nillerusr): SDL posts SDL_QUIT when map loaded on android, idk why.
#ifndef ANDROID
case SDL_QUIT:
{
CCocoaEvent theEvent;
@@ -1844,7 +1879,7 @@ void CSDLMgr::PumpWindowsMessageLoop()
PostEvent( theEvent );
break;
}
#endif
default:
break;
}

View File

@@ -569,7 +569,7 @@ bool CBaseClientState::PrepareSteamConnectResponse( uint64 unGSSteamID, bool bGS
{
return true;
}
/*
#if !defined( NO_STEAM ) && !defined( SWDS )
if ( !Steam3Client().SteamUser() )
{
@@ -577,8 +577,8 @@ bool CBaseClientState::PrepareSteamConnectResponse( uint64 unGSSteamID, bool bGS
Disconnect( "#GameUI_ServerRequireSteam", true );
return false;
}
#endif
#endif*/
netadr_t checkAdr = adr;
if ( adr.GetType() == NA_LOOPBACK || adr.IsLocalhost() )
{
@@ -592,12 +592,14 @@ bool CBaseClientState::PrepareSteamConnectResponse( uint64 unGSSteamID, bool bGS
Steam3Client().GetAuthSessionTicket( steam3Cookie, sizeof(steam3Cookie), &steam3CookieLen, checkAdr.GetIPHostByteOrder(), checkAdr.GetPort(), unGSSteamID, bGSSecure );
/*
if ( steam3CookieLen == 0 )
{
COM_ExplainDisconnection( true, "#GameUI_ServerRequireSteam" );
Disconnect( "#GameUI_ServerRequireSteam", true );
return false;
}
*/
msg.WriteShort( steam3CookieLen );
if ( steam3CookieLen > 0 )
@@ -936,6 +938,7 @@ bool CBaseClientState::ProcessConnectionlessPacket( netpacket_t *packet )
int authprotocol = msg.ReadLong();
uint64 unGSSteamID = 0;
bool bGSSecure = false;
/*
if ( authprotocol == PROTOCOL_STEAM )
{
if ( msg.ReadShort() != 0 )
@@ -962,7 +965,7 @@ bool CBaseClientState::ProcessConnectionlessPacket( netpacket_t *packet )
Disconnect( "#GameUI_ServerInsecure", true );
return false;
}
}
}*/
SendConnectPacket( challenge, authprotocol, unGSSteamID, bGSSecure );
}
break;

View File

@@ -740,7 +740,7 @@ bool CBaseServer::ProcessConnectionlessPacket(netpacket_t * packet)
// RejectConnection( packet->from, "Cannot connect to a secure server while plug-ins are\nloaded on your client\n" );
// break;
// }
/*
if ( authProtocol == PROTOCOL_STEAM )
{
int keyLen = msg.ReadShort();
@@ -753,7 +753,7 @@ bool CBaseServer::ProcessConnectionlessPacket(netpacket_t * packet)
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, keyLen ); // cd key is actually a raw encrypted key
}
else
else*/
{
msg.ReadString( cdkey, sizeof(cdkey) );
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, strlen(cdkey) );
@@ -1466,6 +1466,7 @@ bool CBaseServer::CheckChallengeType( CBaseClient * client, int nNewUserID, neta
// {
// return true;
// }
return true;
client->SetSteamID( CSteamID() ); // set an invalid SteamID

View File

@@ -539,64 +539,62 @@ struct leafnums_t
CCollisionBSPData *pBSPData;
};
int CM_BoxLeafnums( leafnums_t &context, const Vector &center, const Vector &extents, int nodenum )
{
int leafCount = 0;
const int NODELIST_MAX = 1024;
int nodeList[NODELIST_MAX];
int nodeReadIndex = 0;
int nodeWriteIndex = 0;
cplane_t *plane;
cnode_t *node;
int prev_topnode = -1;
int leafCount = 0;
const int NODELIST_MAX = 1024;
int nodeList[NODELIST_MAX];
int nodeReadIndex = 0;
int nodeWriteIndex = 0;
cplane_t *plane;
cnode_t *node;
int prev_topnode = -1;
while (1)
{
if (nodenum < 0)
{
// This handles the case when the box lies completely
// within a single node. In that case, the top node should be
// the parent of the leaf
if (context.leafTopNode == -1)
context.leafTopNode = prev_topnode;
while (1)
{
if (nodenum < 0)
{
// This handles the case when the box lies completely
// within a single node. In that case, the top node should be
// the parent of the leaf
if (context.leafTopNode == -1)
context.leafTopNode = prev_topnode;
if (leafCount < context.leafMaxCount)
{
context.pLeafList[leafCount] = -1 - nodenum;
leafCount++;
}
if ( nodeReadIndex == nodeWriteIndex )
return leafCount;
nodenum = nodeList[nodeReadIndex];
nodeReadIndex = (nodeReadIndex+1) & (NODELIST_MAX-1);
}
else
{
node = &context.pBSPData->map_rootnode[nodenum];
plane = node->plane;
// s = BoxOnPlaneSide (leaf_mins, leaf_maxs, plane);
// s = BOX_ON_PLANE_SIDE(*leaf_mins, *leaf_maxs, plane);
float d0 = DotProduct( plane->normal, center ) - plane->dist;
float d1 = DotProductAbs( plane->normal, extents );
prev_topnode = nodenum;
if (d0 >= d1)
nodenum = node->children[0];
else if (d0 < -d1)
nodenum = node->children[1];
else
{ // go down both
if (context.leafTopNode == -1)
context.leafTopNode = nodenum;
nodeList[nodeWriteIndex] = node->children[0];
nodeWriteIndex = (nodeWriteIndex+1) & (NODELIST_MAX-1);
// check for overflow of the ring buffer
Assert(nodeWriteIndex != nodeReadIndex);
nodenum = node->children[1];
}
}
}
if (leafCount < context.leafMaxCount)
{
context.pLeafList[leafCount] = -1 - nodenum;
leafCount++;
}
if ( nodeReadIndex == nodeWriteIndex )
return leafCount;
nodenum = nodeList[nodeReadIndex];
nodeReadIndex = (nodeReadIndex+1) & (NODELIST_MAX-1);
}
else
{
node = &context.pBSPData->map_rootnode[nodenum];
plane = node->plane;
// s = BoxOnPlaneSide (leaf_mins, leaf_maxs, plane);
// s = BOX_ON_PLANE_SIDE(*leaf_mins, *leaf_maxs, plane);
float d0 = DotProduct( plane->normal, center ) - plane->dist;
float d1 = DotProductAbs( plane->normal, extents );
prev_topnode = nodenum;
if (d0 >= d1)
nodenum = node->children[0];
else if (d0 < -d1)
nodenum = node->children[1];
else
{ // go down both
if (context.leafTopNode == -1)
context.leafTopNode = nodenum;
nodeList[nodeWriteIndex] = node->children[0];
nodeWriteIndex = (nodeWriteIndex+1) & (NODELIST_MAX-1);
// check for overflow of the ring buffer
Assert(nodeWriteIndex != nodeReadIndex);
nodenum = node->children[1];
}
}
}
}
int CM_BoxLeafnums ( const Vector& mins, const Vector& maxs, int *list, int listsize, int *topnode)
@@ -2666,38 +2664,32 @@ bool CM_HeadnodeVisible (int nodenum, const byte *visbits, int vissize )
// *visbits - pvs or pas of some cluster
// Output : true if visible, false if not
//-----------------------------------------------------------------------------
#define MAX_BOX_LEAVES 256
int CM_BoxVisible( const Vector& mins, const Vector& maxs, const byte *visbits, int vissize )
#define MAX_BOX_LEAVES 256
int CM_BoxVisible( const Vector& mins, const Vector& maxs, const byte *visbits, int vissize )
{
int leafList[MAX_BOX_LEAVES];
int topnode;
int leafList[MAX_BOX_LEAVES];
int topnode;
// FIXME: Could save a loop here by traversing the tree in this routine like the code above
int count = CM_BoxLeafnums( mins, maxs, leafList, MAX_BOX_LEAVES, &topnode );
for ( int i = 0; i < count; i++ )
{
int cluster = CM_LeafCluster( leafList[i] );
int offset = cluster>>3;
// FIXME: Could save a loop here by traversing the tree in this routine like the code above
int count = CM_BoxLeafnums( mins, maxs, leafList, MAX_BOX_LEAVES, &topnode );
for ( int i = 0; i < count; i++ )
{
int cluster = CM_LeafCluster( leafList[i] );
int offset = cluster>>3;
if ( offset == -1 )
{
return false;
}
if ( offset > vissize )
{
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );
}
if ( offset > vissize || offset < 0 )
{
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );
}
if (visbits[cluster>>3] & (1<<(cluster&7)))
{
return true;
}
}
return false;
if (visbits[cluster>>3] & (1<<(cluster&7)))
{
return true;
}
}
return false;
}
//-----------------------------------------------------------------------------
// Returns the world-space center of an entity
//-----------------------------------------------------------------------------

View File

@@ -966,23 +966,20 @@ void SaveSurfAtCrossHair()
}
void DebugDrawLightmapAtCrossHair()
void DebugDrawLightmapAtCrossHair() // Lol
{
return;
#if 0
IMaterial *pMaterial;
int lightmapPageSize[2];
if( s_CrossHairSurfID <= 0 )
{
if( !s_CrossHairSurfID )
return;
}
materials->GetLightmapPageSize( materialSortInfoArray[MSurf_MaterialSortID( s_CrossHairSurfID )].lightmapPageID,
&lightmapPageSize[0], &lightmapPageSize[1] );
pMaterial = MSurf_TexInfo( s_CrossHairSurfID )->material;
// pMaterial->GetLowResColorSample( textureS, textureT, baseColor );
DrawLightmapPage( materialSortInfoArray[MSurf_MaterialSortID( s_CrossHairSurfID )].lightmapPageID );
#if 0
int i;
for( i = 0; i < 2; i++ )
{

View File

@@ -1388,6 +1388,7 @@ bool CGameServer::FinishCertificateCheck( netadr_t &adr, int nAuthProtocol, cons
if ( AllowDebugDedicatedServerOutsideSteam() )
return true;
/*
if ( !Host_IsSinglePlayerGame() || sv.IsDedicated()) // PROTOCOL_HASHEDCDKEY isn't allowed for multiplayer servers
{
RejectConnection( adr, clientChallenge, "#GameUI_ServerCDKeyAuthInvalid" );
@@ -1398,7 +1399,7 @@ bool CGameServer::FinishCertificateCheck( netadr_t &adr, int nAuthProtocol, cons
{
RejectConnection( adr, clientChallenge, "#GameUI_ServerInvalidCDKey" );
return false;
}
}*/
int nHashCount = 0;

View File

@@ -364,7 +364,11 @@ void CGame::DispatchInputEvent( const InputEvent_t &event )
case IE_ButtonReleased:
Key_Event( event );
break;
case IE_FingerDown:
case IE_FingerUp:
case IE_FingerMotion:
if( g_ClientDLL )
g_ClientDLL->IN_TouchEvent( event.m_nType, event.m_nData, event.m_nData2, event.m_nData3 );
default:
// Let vgui have the first whack at events
if ( g_pMatSystemSurface && g_pMatSystemSurface->HandleInputEvent( event ) )

View File

@@ -126,6 +126,7 @@
#include "client_virtualreality.h"
#include "mumble.h"
#include "vgui_controls/BuildGroup.h"
#include "touch.h"
// NVNT includes
#include "hud_macros.h"
@@ -729,11 +730,12 @@ public:
// Returns true if the disconnect command has been handled by the client
virtual bool DisconnectAttempt( void );
public:
void PrecacheMaterial( const char *pMaterialName );
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
virtual void IN_TouchEvent( int type, int fingerId, int x, int y );
private:
void UncacheAllMaterials( );
void ResetStringTablePointers();
@@ -1039,6 +1041,8 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
gHUD.Init();
gTouch.Init();
g_pClientMode->Init();
if ( !IGameSystem::InitAllSystems() )
@@ -1202,7 +1206,8 @@ void CHLClient::Shutdown( void )
gHUD.Shutdown();
VGui_Shutdown();
gTouch.Shutdown();
ParticleMgr()->Term();
vgui::BuildGroup::ClearResFileCache();
@@ -1419,8 +1424,23 @@ int CHLClient::IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszC
return input->KeyEvent( eventcode, keynum, pszCurrentBinding );
}
void CHLClient::ExtraMouseSample( float frametime, bool active )
void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y )
{
if( enginevgui->IsGameUIVisible() )
return;
touch_event_t ev;
ev.type = type;
ev.fingerid = fingerId;
ev.x = x;
ev.y = y;
gTouch.ProcessEvent( &ev );
}
void CHLClient::ExtraMouseSample( float frametime, bool active )
{
Assert( C_BaseEntity::IsAbsRecomputationsEnabled() );
Assert( C_BaseEntity::IsAbsQueriesValid() );

View File

@@ -1134,9 +1134,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
bool bValidTeam = false;
if ( (GetLocalTeam() && GetLocalTeam()->GetTeamNumber() == team) )
{
bValidTeam = true;
}
//If we're in the spectator team then we should be getting whatever messages the person I'm spectating gets.
if ( bValidTeam == false )
@@ -1152,15 +1150,11 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
}
}
if ( team == 0 && GetLocalTeam() > 0 )
{
if ( team == 0 && GetLocalTeam() )
bValidTeam = false;
}
if ( team == 255 )
{
bValidTeam = true;
}
if ( bValidTeam == true )
{

View File

@@ -19,12 +19,16 @@
#include "bitbuf.h"
#include "checksum_md5.h"
#include "hltvcamera.h"
#include "touch.h"
#include "ienginevgui.h"
#if defined( REPLAY_ENABLED )
#include "replay/replaycamera.h"
#endif
#include <ctype.h> // isalnum()
#include <voice_status.h>
#include "cam_thirdperson.h"
#include "inputsystem/iinputsystem.h"
#ifdef SIXENSE
#include "sixense/in_sixense.h"
@@ -289,11 +293,11 @@ Add a kbutton_t * to the list of pointers the engine can retrieve via KB_Find
*/
void CInput::AddKeyButton( const char *name, kbutton_t *pkb )
{
CKeyboardKey *p;
CKeyboardKey *p;
kbutton_t *kb;
kb = FindKey( name );
if ( kb )
return;
@@ -307,7 +311,7 @@ void CInput::AddKeyButton( const char *name, kbutton_t *pkb )
}
//-----------------------------------------------------------------------------
// Purpose:
// Purpose:
//-----------------------------------------------------------------------------
CInput::CInput( void )
{
@@ -319,7 +323,7 @@ CInput::CInput( void )
}
//-----------------------------------------------------------------------------
// Purpose:
// Purpose:
//-----------------------------------------------------------------------------
CInput::~CInput( void )
{
@@ -952,6 +956,7 @@ void CInput::ControllerMove( float frametime, CUserCmd *cmd )
SteamControllerMove( frametime, cmd );
JoyStickMove( frametime, cmd );
gTouch.Move( frametime, cmd );
// NVNT if we have a haptic device..
if(haptics && haptics->HasDevice())
@@ -1105,11 +1110,10 @@ void CInput::ExtraMouseSample( float frametime, bool active )
prediction->SetLocalViewAngles( cmd->viewangles );
}
}
}
void CInput::CreateMove ( int sequence_number, float input_sample_frametime, bool active )
{
{
CUserCmd *cmd = &m_pCommands[ sequence_number % MULTIPLAYER_BACKUP ];
CVerifiedUserCmd *pVerified = &m_pVerifiedCommands[ sequence_number % MULTIPLAYER_BACKUP ];
@@ -1196,11 +1200,11 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
cmd->buttons = GetButtonBits( 1 );
#endif
// Using joystick?
// Using joystick or touch?
#ifdef SIXENSE
if ( in_joystick.GetInt() || g_pSixenseInput->IsEnabled() )
if ( in_joystick.GetInt() || g_pSixenseInput->IsEnabled() || touch_enable.GetInt() )
#else
if ( in_joystick.GetInt() )
if ( in_joystick.GetInt() || touch_enable.GetInt() )
#endif
{
if ( cmd->forwardmove > 0 )

View File

@@ -283,7 +283,7 @@ struct CInterpolatedVarEntryBase<Type, false>
{
Assert(maxCount==1);
}
Type *NewEntry( const Type *pValue, int maxCount, float time )
Type *NewEntry( Type *pValue, int maxCount, float time )
{
Assert(maxCount==1);
changetime = time;

371
game/client/touch.cpp Normal file
View File

@@ -0,0 +1,371 @@
#include "convar.h"
#include <dlfcn.h>
#include <string.h>
#include "vgui/IInputInternal.h"
#include "VGuiMatSurface/IMatSystemSurface.h"
#include "vgui/ISurface.h"
#include "touch.h"
#include "cdll_int.h"
#include "ienginevgui.h"
#include "in_buttons.h"
extern ConVar cl_sidespeed;
extern ConVar cl_forwardspeed;
extern ConVar cl_upspeed;
#ifdef ANDROID
#define TOUCH_DEFAULT "1"
#else
#define TOUCH_DEFAULT "0"
#endif
extern ConVar sensitivity;
ConVar touch_enable( "touch_enable", TOUCH_DEFAULT, FCVAR_ARCHIVE );
ConVar touch_forwardzone( "touch_forwardzone", "0.06", FCVAR_ARCHIVE, "forward touch zone" );
ConVar touch_sidezone( "touch_sidezone", "0.06", FCVAR_ARCHIVE, "side touch zone" );
ConVar touch_pitch( "touch_pitch", "90", FCVAR_ARCHIVE, "touch pitch sensitivity" );
ConVar touch_yaw( "touch_yaw", "120", FCVAR_ARCHIVE, "touch yaw sensitivity" );
ConVar touch_config_file( "touch_config_file", "touch.cfg", FCVAR_ARCHIVE, "current touch profile file" );
ConVar touch_grid_count( "touch_grid_count", "50", FCVAR_ARCHIVE, "touch grid count" );
ConVar touch_grid_enable( "touch_grid_enable", "1", FCVAR_ARCHIVE, "enable touch grid" );
ConVar touch_precise_amount( "touch_precise_amount", "0.5", FCVAR_ARCHIVE, "sensitivity multiplier for precise-look" );
#define boundmax( num, high ) ( (num) < (high) ? (num) : (high) )
#define boundmin( num, low ) ( (num) >= (low) ? (num) : (low) )
#define bound( low, num, high ) ( boundmin( boundmax(num, high), low ))
#define S
extern IVEngineClient *engine;
CTouchControls gTouch;
static VTouchPanel g_TouchPanel;
VTouchPanel *touch_panel = &g_TouchPanel;
CTouchPanel::CTouchPanel( vgui::VPANEL parent ) : BaseClass( NULL, "TouchPanel" )
{
SetParent( parent );
int w, h;
engine->GetScreenSize(w, h);
SetBounds( 0, 0, w, h );
SetFgColor( Color( 0, 0, 0, 255 ) );
SetPaintBackgroundEnabled( false );
SetKeyBoardInputEnabled( false );
SetMouseInputEnabled( false );
SetVisible( true );
}
bool CTouchPanel::ShouldDraw( void )
{
return touch_enable.GetBool() && !enginevgui->IsGameUIVisible();
}
void CTouchPanel::Paint()
{
if( ShouldDraw() )
gTouch.Frame();
}
CON_COMMAND( touch_addbutton, "add native touch button" )
{
rgba_t color;
int argc = args.ArgC();
if( argc >= 12 )
{
color = rgba_t(Q_atoi(args[8]), Q_atoi(args[9]), Q_atoi(args[10]), Q_atoi(args[11]));
gTouch.IN_TouchAddButton( args[1], args[2], args[3],
Q_atof( args[4] ), Q_atof( args[5] ),
Q_atof( args[6] ), Q_atof( args[7] ) ,
color );
return;
}
if( argc >= 8 )
{
color = rgba_t(255,255,255);
gTouch.IN_TouchAddButton( args[1], args[2], args[3],
Q_atof( args[4] ), Q_atof( args[5] ),
Q_atof( args[6] ), Q_atof( args[7] ),
color );
return;
}
if( argc >= 4 )
{
color = rgba_t(255,255,255);
gTouch.IN_TouchAddButton( args[1], args[2], args[3], 0.4, 0.4, 0.6, 0.6 );
return;
}
Msg( "Usage: touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" );
}
void CTouchControls::Init()
{
engine->GetScreenSize( screen_w, screen_h );
initialized = true;
btns.EnsureCapacity( 64 );
look_finger = move_finger = resize_finger = -1;
forward = side = 0;
scolor = rgba_t( -1, -1, -1, -1 );
state = state_none;
swidth = 1;
move = edit = selection = NULL;
showbuttons = true;
clientonly = false;
precision = false;
mouse_events = 0;
move_start_x = move_start_y = 0.0f;
showtexture = hidetexture = resettexture = closetexture = joytexture = 0;
configchanged = false;
rgba_t color(255, 255, 255, 255);
IN_TouchAddButton( "use", "vgui/touch/use", "+use", 0.880000, 0.213333, 1.000000, 0.426667, color );
IN_TouchAddButton( "jump", "vgui/touch/jump", "+jump", 0.880000, 0.462222, 1.000000, 0.675556, color );
IN_TouchAddButton( "attack", "vgui/touch/shoot", "+attack", 0.760000, 0.583333, 0.880000, 0.796667, color );
IN_TouchAddButton( "attack2", "vgui/touch/shoot_alt", "+attack2", 0.760000, 0.320000, 0.880000, 0.533333, color );
IN_TouchAddButton( "duck", "vgui/touch/crouch", "+duck", 0.880000, 0.746667, 1.000000, 0.960000, color );
IN_TouchAddButton( "tduck", "vgui/touch/tduck", ";+duck", 0.560000, 0.817778, 0.620000, 0.924444, color );
IN_TouchAddButton( "_look", "", "", 0.5, 0, 1, 1, color );
IN_TouchAddButton( "_move", "", "", 0, 0, 0.5, 1, color );
IN_TouchAddButton( "zoom", "vgui/touch/zoom", "+zoom", 0.680000, 0.00000, 0.760000, 0.142222, color );
IN_TouchAddButton( "speed", "vgui/touch/speed", "+speed", 0.180000, 0.568889, 0.280000, 0.746667, color );
IN_TouchAddButton( "loadquick", "vgui/touch/load", "load quick", 0.760000, 0.000000, 0.840000, 0.142222, color );
IN_TouchAddButton( "savequick", "vgui/touch/save", "save quick", 0.840000, 0.000000, 0.920000, 0.142222, color );
IN_TouchAddButton( "reload", "vgui/touch/reload", "+reload", 0.000000, 0.320000, 0.120000, 0.533333, color );
IN_TouchAddButton( "flashlight", "vgui/touch/flash_light_filled", "impulse 100", 0.920000, 0.000000, 1.000000, 0.142222, color );
IN_TouchAddButton( "invnext", "vgui/touch/next_weap", "invnext", 0.000000, 0.533333, 0.120000, 0.746667, color );
IN_TouchAddButton( "invprev", "vgui/touch/prev_weap", "invprev", 0.000000, 0.071111, 0.120000, 0.284444, color );
//IN_TouchAddButton( "edit", "vgui/touch/settings", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color );
IN_TouchAddButton( "menu", "vgui/touch/menu", "gameui_activate", 0.000000, 0.00000, 0.080000, 0.142222, color );
}
void CTouchControls::Shutdown( )
{
btns.PurgeAndDeleteElements();
}
void CTouchControls::IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 )
{
/// TODO: grid check here
if( *x2 - *x1 < GRID_X * 2 )
*x2 = *x1 + GRID_X * 2;
if( *y2 - *y1 < GRID_Y * 2)
*y2 = *y1 + GRID_Y * 2;
if( *x1 < 0 )
*x2 -= *x1, *x1 = 0;
if( *y1 < 0 )
*y2 -= *y1, *y1 = 0;
if( *y2 > 1 )
*y1 -= *y2 - 1, *y2 = 1;
if( *x2 > 1 )
*x1 -= *x2 - 1, *x2 = 1;
if ( touch_grid_enable.GetBool() )
{
*x1 = GRID_ROUND_X( *x1 );
*x2 = GRID_ROUND_X( *x2 );
*y1 = GRID_ROUND_Y( *y1 );
*y2 = GRID_ROUND_Y( *y2 );
}
}
void CTouchControls::Move( float /*frametime*/, CUserCmd *cmd )
{
cmd->sidemove -= cl_sidespeed.GetFloat() * side;
cmd->forwardmove += cl_forwardspeed.GetFloat() * forward;
}
void CTouchControls::IN_Look()
{
if( !pitch && !yaw )
return;
QAngle ang;
engine->GetViewAngles( ang );
ang.x += pitch;
ang.y += yaw;
engine->SetViewAngles( ang );
pitch = yaw = 0;
}
void CTouchControls::Frame()
{
if (!initialized)
return;
IN_Look();
Paint();
}
void CTouchControls::Paint( )
{
if (!initialized)
return;
CUtlLinkedList<CTouchButton*>::iterator it;
for( it = btns.begin(); it != btns.end(); it++ )
{
CTouchButton *btn = *it;
if( btn->type == touch_move || btn->type == touch_look )
continue;
g_pMatSystemSurface->DrawSetColor(255, 255, 255, 155);
g_pMatSystemSurface->DrawSetTexture( btn->textureID );
g_pMatSystemSurface->DrawTexturedRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h );
}
}
void CTouchControls::IN_TouchAddButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, rgba_t color )
{
CTouchButton *btn = new CTouchButton;
ETouchButtonType type = touch_command;
Q_strncpy( btn->name, name, sizeof(btn->name) );
Q_strncpy( btn->texturefile, texturefile, sizeof(btn->texturefile) );
Q_strncpy( btn->command, command, sizeof(btn->command) );
IN_TouchCheckCoords(&x1, &y1, &x2, &y2);
btn->x1 = x1;
btn->y1 = y1;
btn->x2 = x2;
btn->y2 = y1 + ( x2 - x1 ) * (((float)screen_w)/screen_h);
IN_TouchCheckCoords(&btn->x1, &btn->y1, &btn->x2, &btn->y2);
if( Q_strcmp(name, "_look") == 0 )
type = touch_look;
else if( Q_strcmp(name, "_move") == 0 )
type = touch_move;
btn->color = color;
btn->type = type;
btn->finger = -1;
btn->textureID = g_pMatSystemSurface->CreateNewTextureID();
g_pMatSystemSurface->DrawSetTextureFile( btn->textureID, btn->texturefile, true, false);
btns.AddToTail(btn);
}
void CTouchControls::ProcessEvent(touch_event_t *ev)
{
if( !touch_enable.GetBool() )
return;
if( ev->type == IE_FingerMotion )
FingerMotion( ev );
else
FingerPress( ev );
}
void CTouchControls::FingerMotion(touch_event_t *ev)
{
float x = ev->x / (float)screen_w;
float y = ev->y / (float)screen_h;
float f, s;
CUtlLinkedList<CTouchButton*>::iterator it;
for( it = btns.begin(); it != btns.end(); it++ )
{
CTouchButton *btn = *it;
if( btn->finger == ev->fingerid )
{
if( btn->type == touch_move )
{
f = ( move_start_y - y ) / touch_forwardzone.GetFloat();
s = ( move_start_x - x ) / touch_sidezone.GetFloat();
forward = bound( -1, f, 1 );
side = bound( -1, s, 1 );
}
else if( btn->type == touch_look )
{
yaw += touch_yaw.GetFloat() * ( dx - x ) * sensitivity.GetFloat();
pitch -= touch_pitch.GetFloat() * ( dy - y ) * sensitivity.GetFloat();
dx = x;
dy = y;
}
}
}
}
void CTouchControls::FingerPress(touch_event_t *ev)
{
float x = ev->x / (float)screen_w;
float y = ev->y / (float)screen_h;
CUtlLinkedList<CTouchButton*>::iterator it;
if( ev->type == IE_FingerDown )
{
for( it = btns.begin(); it != btns.end(); it++ )
{
CTouchButton *btn = *it;
if( x > btn->x1 && x < btn->x2 && y > btn->y1 && y < btn->y2 )
{
btn->finger = ev->fingerid;
if( btn->type == touch_move )
{
if( move_finger == -1 )
{
move_start_x = x;
move_start_y = y;
move_finger = ev->fingerid;
}
else
btn->finger = move_finger;
}
else if( btn->type == touch_look )
{
if( look_finger == -1 )
{
dx = x;
dy = y;
look_finger = ev->fingerid;
}
else
btn->finger = look_finger;
}
else
engine->ClientCmd( btn->command );
}
}
}
else if( ev->type == IE_FingerUp )
{
for( it = btns.begin(); it != btns.end(); it++ )
{
CTouchButton *btn = *it;
if( btn->finger == ev->fingerid )
{
btn->finger = -1;
if( btn->type == touch_move )
{
forward = side = 0;
move_finger = -1;
}
else if( btn->type == touch_look )
look_finger = -1;
else if( btn->command[0] == '+' )
{
char cmd[256];
snprintf( cmd, sizeof cmd, "%s", btn->command );
cmd[0] = '-';
engine->ClientCmd( cmd );
}
}
}
}
}

198
game/client/touch.h Normal file
View File

@@ -0,0 +1,198 @@
#include "utllinkedlist.h"
#include "vgui/VGUI.h"
#include <vgui_controls/Panel.h>
#include "cbase.h"
#include "kbutton.h"
#include "usercmd.h"
extern ConVar touch_enable;
#define GRID_COUNT touch_grid_count.GetInt()
#define GRID_COUNT_X (GRID_COUNT)
#define GRID_COUNT_Y (GRID_COUNT * screen_h / screen_w)
#define GRID_X (1.0/GRID_COUNT_X)
#define GRID_Y (screen_w/screen_h/GRID_COUNT_X)
#define GRID_ROUND_X(x) ((float)round( x * GRID_COUNT_X ) / GRID_COUNT_X)
#define GRID_ROUND_Y(x) ((float)round( x * GRID_COUNT_Y ) / GRID_COUNT_Y)
#define CMD_SIZE 64
enum ETouchButtonType
{
touch_command = 0, // Tap button
touch_move, // Like a joystick stick.
touch_joy, // Like a joystick stick, centered.
touch_dpad, // Only two directions.
touch_look, // Like a touchpad.
touch_key
};
enum ETouchState
{
state_none = 0,
state_edit,
state_edit_move
};
enum ETouchRound
{
round_none = 0,
round_grid,
round_aspect
};
struct rgba_t
{
rgba_t( unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255 ) : r( r ), g( g ), b( b ), a( a ) { }
rgba_t() : r( 0 ), g( 0 ), b( 0 ), a( 0 ) { }
rgba_t( unsigned char *x ) : r( x[0] ), g( x[1] ), b( x[2] ), a( x[3] ) { }
operator unsigned char*() { return &r; }
unsigned char r, g, b, a;
};
struct event_clientcmd_t
{
char buf[CMD_SIZE];
};
struct event_s
{
int type;
int x;
int y;
int fingerid;
} typedef touch_event_t;
class CTouchButton
{
public:
// Touch button type: tap, stick or slider
ETouchButtonType type;
// Field of button in pixels
float x1, y1, x2, y2;
// Button texture
int texture;
rgba_t color;
char texturefile[256];
char command[256];
char name[32];
int finger;
int flags;
float fade;
float fadespeed;
float fadeend;
float aspect;
int textureID;
};
class CTouchPanel : public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CTouchPanel, vgui::Panel );
public:
CTouchPanel( vgui::VPANEL parent );
virtual ~CTouchPanel( void ) {};
virtual void Paint();
virtual bool ShouldDraw( void );
};
abstract_class ITouchPanel
{
public:
virtual void Create( vgui::VPANEL parent ) = 0;
virtual void Destroy( void ) = 0;
};
class VTouchPanel : public ITouchPanel
{
private:
CTouchPanel *touchPanel;
public:
VTouchPanel( void )
{
touchPanel = NULL;
}
void Create( vgui::VPANEL parent )
{
touchPanel = new CTouchPanel( parent );
}
void Destroy( void )
{
if ( touchPanel )
{
touchPanel->SetParent( (vgui::Panel *)NULL );
touchPanel->MarkForDeletion();
touchPanel = NULL;
}
}
};
class CTouchControls
{
public:
void Init( );
void Shutdown( );
void Paint( );
void Frame( );
void IN_TouchAddButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, rgba_t color = rgba_t(255, 255, 255, 255) );
void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
void Move( float frametime, CUserCmd *cmd );
void IN_Look( );
void ProcessEvent( touch_event_t *ev );
void FingerPress( touch_event_t *ev );
void FingerMotion( touch_event_t *ev );
CTouchPanel *touchPanel;
private:
bool initialized;
ETouchState state;
CUtlLinkedList<CTouchButton*> btns;
int look_finger;
int move_finger;
float forward, side, movecount;
float yaw, pitch;
CTouchButton *move;
float move_start_x, move_start_y;
float dx, dy;
// editing
CTouchButton *edit;
CTouchButton *selection;
int resize_finger;
bool showbuttons;
bool clientonly;
rgba_t scolor;
int swidth;
bool precision;
// textures
int showtexture;
int hidetexture;
int resettexture;
int closetexture;
int joytexture; // touch indicator
bool configchanged;
vgui::HFont textfont;
int mouse_events;
int screen_h, screen_w;
};
extern CTouchControls gTouch;
extern VTouchPanel *touch_panel;

View File

@@ -22,6 +22,7 @@
#include <vgui_controls/Panel.h>
#include <KeyValues.h>
#include "filesystem.h"
#include "touch.h"
#include "matsys_controls/matsyscontrols.h"
#ifdef SIXENSE
@@ -129,6 +130,7 @@ static void VGui_VideoMode_AdjustForModeChange( void )
fps->Destroy();
messagechars->Destroy();
loadingdisc->Destroy();
touch_panel->Destroy();
// Recreate our panels.
VPANEL gameToolParent = enginevgui->GetPanel( PANEL_CLIENTDLL_TOOLS );
@@ -142,6 +144,7 @@ static void VGui_VideoMode_AdjustForModeChange( void )
// Debugging or related tool
fps->Create( toolParent );
touch_panel->Create( toolParent );
#if defined( TRACK_BLOCKING_IO )
iopanel->Create( gameDLLPanel );
#endif
@@ -207,6 +210,8 @@ void VGui_CreateGlobalPanels( void )
// Debugging or related tool
fps->Create( toolParent );
touch_panel->Create( toolParent );
#if defined( TRACK_BLOCKING_IO )
iopanel->Create( gameDLLPanel );
#endif
@@ -236,6 +241,7 @@ void VGui_Shutdown()
iopanel->Destroy();
#endif
fps->Destroy();
touch_panel->Destroy();
messagechars->Destroy();
loadingdisc->Destroy();

View File

@@ -3,533 +3,37 @@
from waflib import Utils
import os
import vpc_parser
top = '.'
PROJECT_NAME = 'client'
def options(opt):
# stub
return
games = {
'hl2': ['client_base.vpc', 'client_hl2.vpc'],
'hl2mp': ['client_base.vpc', 'client_hl2mp.vpc'],
'hl1': ['client_base.vpc', 'client_hl1.vpc'],
'portal': ['client_base.vpc', 'client_portal.vpc'],
'hl1mp': ['client_base.vpc', 'client_hl1.vpc'],
'css': ['client_base.vpc', 'client_cstrike.vpc'],
'dod': ['client_base.vpc', 'client_dod.vpc']
}
def configure(conf):
conf.env.append_unique('DEFINES',[
'NO_STRING_T',
'CLIENT_DLL',
'VECTOR',
'VERSION_SAFE_STEAM_API_INTERFACES',
'strncpy=use_Q_strncpy_instead',
'strncpy=use_Q_strncpy_instead',
'USE_WEBM_FOR_REPLAY', # LINUXALL
'HL2_CLIENT_DLL'
])
game = conf.options.GAMES
conf.env.GAMES = game
if game not in games.keys():
conf.fatal("Couldn't find game: ", game)
def build(bld):
source = [
#'replay/replayyoutubeapi_key_sdk.cpp', [$SOURCESDK]
'game_controls/slideshowpanel.cpp',
'../../common/movieobjects/timeutils.cpp',
'hl2/C_Func_Monitor.cpp',
'geiger.cpp',
'history_resource.cpp',
'hud_weapon.cpp',
'train.cpp',
'../shared/weapon_parse_default.cpp',
'../shared/achievement_saverestore.cpp',
'../shared/achievementmgr.cpp',
'../shared/achievements_hlx.cpp',
'achievement_notification_panel.cpp',
'../shared/activitylist.cpp',
'alphamaterialproxy.cpp',
'../shared/ammodef.cpp',
'animatedentitytextureproxy.cpp',
'animatedoffsettextureproxy.cpp',
'animatedtextureproxy.cpp',
'AnimateSpecificTextureProxy.cpp',
'../shared/animation.cpp',
'../shared/base_playeranimstate.cpp',
'../shared/baseachievement.cpp',
'baseanimatedtextureproxy.cpp',
'baseclientrendertargets.cpp',
'../shared/basecombatcharacter_shared.cpp',
'../shared/basecombatweapon_shared.cpp',
'../shared/baseentity_shared.cpp',
'../shared/basegrenade_shared.cpp',
'../shared/baseparticleentity.cpp',
'../shared/baseplayer_shared.cpp',
'../shared/baseprojectile.cpp',
'../shared/baseviewmodel_shared.cpp',
'beamdraw.cpp',
'../shared/beam_shared.cpp',
'../../public/bone_accessor.cpp',
'bone_merge_cache.cpp',
'c_ai_basehumanoid.cpp',
'c_ai_basenpc.cpp',
'c_baseanimating.cpp',
'c_baseanimatingoverlay.cpp',
'c_basecombatcharacter.cpp',
'c_basecombatweapon.cpp',
'c_basedoor.cpp',
'c_baseentity.cpp',
'c_baseflex.cpp',
'c_baseplayer.cpp',
'c_baseviewmodel.cpp',
'c_breakableprop.cpp',
'c_colorcorrection.cpp',
'c_colorcorrectionvolume.cpp',
'c_dynamiclight.cpp',
'c_entitydissolve.cpp',
'c_entityparticletrail.cpp',
'c_env_fog_controller.cpp',
'c_env_particlescript.cpp',
'c_env_projectedtexture.cpp',
'c_env_screenoverlay.cpp',
'c_env_tonemap_controller.cpp',
'c_fire_smoke.cpp',
'c_fish.cpp',
'c_func_areaportalwindow.cpp',
'c_func_breakablesurf.cpp',
'c_func_conveyor.cpp',
'c_func_dust.cpp',
'c_func_lod.cpp',
'c_func_occluder.cpp',
'c_func_reflective_glass.cpp',
'c_func_rotating.cpp',
'c_func_smokevolume.cpp',
'c_func_tracktrain.cpp',
'c_gib.cpp',
'c_hairball.cpp',
'c_info_overlay_accessor.cpp',
'c_lightglow.cpp',
'C_MaterialModifyControl.cpp',
'c_particle_system.cpp',
'c_physbox.cpp',
'c_physicsprop.cpp',
'c_physmagnet.cpp',
'c_pixel_visibility.cpp',
'c_plasma.cpp',
'c_playerresource.cpp',
'c_point_camera.cpp',
'c_point_commentary_node.cpp',
'c_props.cpp',
'c_ragdoll_manager.cpp',
'c_rope.cpp',
'c_rumble.cpp',
'c_sceneentity.cpp',
'c_shadowcontrol.cpp',
'c_slideshow_display.cpp',
'c_soundscape.cpp',
'c_spotlight_end.cpp',
'c_sprite.cpp',
'c_sprite_perfmonitor.cpp',
'c_sun.cpp',
'c_team.cpp',
'c_tesla.cpp',
'c_test_proxytoggle.cpp',
'c_user_message_register.cpp',
'c_vehicle_choreo_generic.cpp',
'c_vehicle_jeep.cpp',
'c_vguiscreen.cpp',
'hl2/c_waterbullet.cpp',
'hl2/hud_autoaim.cpp',
'C_WaterLODControl.cpp',
'c_world.cpp',
'../shared/cam_thirdperson.cpp',
'camomaterialproxy.cpp',
'cdll_client_int.cpp',
'cdll_bounded_cvars.cpp',
'cdll_util.cpp',
'cl_mat_stub.cpp',
'classmap.cpp',
'client_factorylist.cpp',
'client_thinklist.cpp',
'client_virtualreality.cpp',
'clienteffectprecachesystem.cpp',
'cliententitylist.cpp',
'clientleafsystem.cpp',
'clientmode_shared.cpp',
'clientshadowmgr.cpp',
'clientsideeffects.cpp',
'clientsideeffects_test.cpp',
'clientsteamcontext.cpp',
'colorcorrectionmgr.cpp',
'commentary_modelviewer.cpp',
'../shared/collisionproperty.cpp',
'../shared/death_pose.cpp',
'../shared/debugoverlay_shared.cpp',
'../shared/decals.cpp',
'detailobjectsystem.cpp',
'dummyproxy.cpp',
'../shared/effect_dispatch_data.cpp',
'EffectsClient.cpp',
'../shared/ehandle.cpp',
'../shared/entitylist_base.cpp',
'entityoriginmaterialproxy.cpp',
'../shared/EntityParticleTrail_Shared.cpp',
'../shared/env_detail_controller.cpp',
'../shared/env_wind_shared.cpp',
'../shared/eventlist.cpp',
'flashlighteffect.cpp',
'../shared/func_ladder.cpp',
'functionproxy.cpp',
'fx_blood.cpp',
'fx_cube.cpp',
'fx_explosion.cpp',
'fx_fleck.cpp',
'fx_impact.cpp',
'fx_interpvalue.cpp',
'fx_quad.cpp',
'fx_shelleject.cpp',
'fx_staticline.cpp',
'fx_tracer.cpp',
'fx_trail.cpp',
'fx_water.cpp',
'../shared/gamemovement.cpp',
'../shared/gamerules.cpp',
'../shared/gamerules_register.cpp',
'../shared/GameStats.cpp',
'../shared/gamestringpool.cpp',
'gametrace_client.cpp',
'../shared/gamevars_shared.cpp',
'glow_outline_effect.cpp',
'glow_overlay.cpp',
'../shared/hintmessage.cpp',
'../shared/hintsystem.cpp',
'hltvcamera.cpp',
'hud.cpp',
'hud_animationinfo.cpp',
'hud_basechat.cpp',
'hud_basetimer.cpp',
'hud_bitmapnumericdisplay.cpp',
'hud_closecaption.cpp',
'hud_crosshair.cpp',
'hud_element_helper.cpp',
'hl2/hud_filmdemo.cpp',
'hl2/hud_hdrdemo.cpp',
'hud_hintdisplay.cpp',
'hud_msg.cpp',
'hud_numericdisplay.cpp',
'hud_pdump.cpp',
'hud_redraw.cpp',
'hud_vehicle.cpp',
'../shared/igamesystem.cpp',
'in_camera.cpp',
'in_joystick.cpp',
'in_main.cpp',
'in_steamcontroller.cpp',
'initializer.cpp',
'interpolatedvar.cpp',
'IsNPCProxy.cpp',
'lampbeamproxy.cpp',
'lamphaloproxy.cpp',
'../shared/mapentities_shared.cpp',
'mathproxy.cpp',
'matrixproxy.cpp',
'menu.cpp',
'message.cpp',
'movehelper_client.cpp',
'../shared/movevars_shared.cpp',
'../shared/multiplay_gamerules.cpp',
'../shared/obstacle_pushaway.cpp',
'panelmetaclassmgr.cpp',
'particle_collision.cpp',
'particle_litsmokeemitter.cpp',
'../shared/particle_parse.cpp',
'../shared/particle_property.cpp',
'particle_proxies.cpp',
'particle_simple3d.cpp',
'particlemgr.cpp',
'particles_attractor.cpp',
'particles_ez.cpp',
'particles_localspace.cpp',
'particles_new.cpp',
'particles_simple.cpp',
'../shared/particlesystemquery.cpp',
'perfvisualbenchmark.cpp',
'physics.cpp',
'physics_main_client.cpp',
'../shared/physics_main_shared.cpp',
'../shared/physics_saverestore.cpp',
'../shared/physics_shared.cpp',
'physpropclientside.cpp',
'playerandobjectenumerator.cpp',
'playerspawncache.cpp',
'../shared/point_bonusmaps_accessor.cpp',
'../shared/point_posecontroller.cpp',
'../shared/precache_register.cpp',
'../shared/predictableid.cpp',
'prediction.cpp',
'../shared/predictioncopy.cpp',
'../shared/props_shared.cpp',
'proxyentity.cpp',
'ProxyHealth.cpp',
'proxyplayer.cpp',
'proxypupil.cpp',
'ragdoll.cpp',
'../shared/ragdoll_shared.cpp',
'recvproxy.cpp',
'basepresence.cpp', #[$WIN32||$POSIX]
#'basepresence_xbox.cpp', [$X360]
'../shared/rope_helpers.cpp',
'../shared/saverestore.cpp',
'../shared/sceneentity_shared.cpp',
'ScreenSpaceEffects.cpp',
'../shared/sequence_Transitioner.cpp',
'simple_keys.cpp',
'../shared/simtimer.cpp',
'../shared/singleplay_gamerules.cpp',
'../shared/SoundEmitterSystem.cpp',
'../shared/soundenvelope.cpp',
'../../public/SoundParametersInternal.cpp',
'splinepatch.cpp',
'../shared/Sprite.cpp',
'spritemodel.cpp',
'../shared/SpriteTrail.cpp',
'../shared/studio_shared.cpp',
'studio_stats.cpp',
'../shared/takedamageinfo.cpp',
'../shared/teamplay_gamerules.cpp',
'../shared/teamplayroundbased_gamerules.cpp',
'../shared/test_ehandle.cpp',
'text_message.cpp',
'texturescrollmaterialproxy.cpp',
'timematerialproxy.cpp',
'toggletextureproxy.cpp',
'../shared/usercmd.cpp',
'../shared/usermessages.cpp',
'../shared/util_shared.cpp',
'../shared/vehicle_viewblend_shared.cpp',
'vgui_avatarimage.cpp',
'vgui_basepanel.cpp',
'vgui_bitmapbutton.cpp',
'vgui_bitmapimage.cpp',
'vgui_bitmappanel.cpp',
'vgui_schemevisualizer.cpp',
'vgui_centerstringpanel.cpp',
'vgui_consolepanel.cpp',
'vgui_debugoverlaypanel.cpp',
'vgui_fpspanel.cpp',
'vgui_game_viewport.cpp',
'vgui_grid.cpp',
'vgui_int.cpp',
'vgui_loadingdiscpanel.cpp',
'vgui_messagechars.cpp',
'vgui_netgraphpanel.cpp',
'vgui_slideshow_display_screen.cpp',
'view.cpp',
'view_beams.cpp',
'view_effects.cpp',
'view_scene.cpp',
'viewangleanim.cpp',
'ViewConeImage.cpp',
'viewdebug.cpp',
'viewpostprocess.cpp',
'viewrender.cpp',
'../shared/voice_banmgr.cpp',
'../shared/voice_status.cpp',
'warp_overlay.cpp',
'WaterLODMaterialProxy.cpp',
'../shared/weapon_parse.cpp',
'weapon_selection.cpp',
'weapons_resource.cpp',
'WorldDimsProxy.cpp',
'vgui_video.cpp',
'vgui_video_player.cpp',
'../shared/mp_shareddefs.cpp',
'../client/c_vote_controller.cpp',
'../../public/haptics/haptic_msgs.cpp', #[!$X360]
#'../../public/haptics/haptic_utils.cpp', [$WIN32&&!$X360]
'sixense/in_sixense.cpp',
'sixense/in_sixense_gesture_bindings.cpp',
'../shared/sixense/sixense_convars.cpp',
'../../public/bone_setup.cpp',
'../../public/posedebugger.cpp',
'../../public/client_class.cpp',
'../../common/compiledcaptionswap.cpp',
'../../public/collisionutils.cpp',
'../../public/crtmemdebug.cpp',
'../../public/dt_recv.cpp',
'../../public/dt_utlvector_common.cpp',
'../../public/dt_utlvector_recv.cpp',
'../../public/filesystem_helpers.cpp',
'../../public/interpolatortypes.cpp',
'../shared/interval.cpp',
'../../common/language.cpp',
'../../public/networkvar.cpp',
'../../common/randoverride.cpp',
'../../common/steamid.cpp',
'../../public/rope_physics.cpp',
'../../public/scratchpad3d.cpp',
'../../public/ScratchPadUtils.cpp',
'../../public/sentence.cpp',
'../shared/sheetsimulator.cpp',
'../../public/simple_physics.cpp',
'../../public/stringregistry.cpp',
'../../public/studio.cpp',
'../../public/vallocator.cpp',
'../../public/vgui_controls/vgui_controls.cpp',
'../../public/jigglebones.cpp',
'hud_lcd.cpp',
'in_mouse.cpp',
'mumble.cpp',
'../../public/renamed_recvtable_compat.cpp',
'rendertexture.cpp',
'c_basetempentity.cpp',
'c_effects.cpp',
'c_impact_effects.cpp',
'c_movie_explosion.cpp',
'c_particle_fire.cpp',
'c_particle_smokegrenade.cpp',
'c_prop_vehicle.cpp',
'c_recipientfilter.cpp',
'c_smoke_trail.cpp',
'c_smokestack.cpp',
'c_steamjet.cpp',
'c_stickybolt.cpp',
'c_te.cpp',
'c_te_armorricochet.cpp',
'c_te_basebeam.cpp',
'c_te_beamentpoint.cpp',
'c_te_beaments.cpp',
'c_te_beamfollow.cpp',
'c_te_beamlaser.cpp',
'c_te_beampoints.cpp',
'c_te_beamring.cpp',
'c_te_beamringpoint.cpp',
'c_te_beamspline.cpp',
'c_te_bloodsprite.cpp',
'c_te_bloodstream.cpp',
'c_te_breakmodel.cpp',
'c_te_bspdecal.cpp',
'c_te_bubbles.cpp',
'c_te_bubbletrail.cpp',
'c_te_clientprojectile.cpp',
'c_te_decal.cpp',
'c_te_dynamiclight.cpp',
'c_te_effect_dispatch.cpp',
'c_te_energysplash.cpp',
'c_te_explosion.cpp',
'c_te_fizz.cpp',
'c_te_footprint.cpp',
'c_te_glassshatter.cpp',
'c_te_glowsprite.cpp',
'c_te_impact.cpp',
'c_te_killplayerattachments.cpp',
'c_te_largefunnel.cpp',
'c_te_legacytempents.cpp',
'c_te_muzzleflash.cpp',
'c_te_particlesystem.cpp',
'c_te_physicsprop.cpp',
'c_te_playerdecal.cpp',
'c_te_projecteddecal.cpp',
'c_te_showline.cpp',
'c_te_smoke.cpp',
'c_te_sparks.cpp',
'c_te_sprite.cpp',
'c_te_spritespray.cpp',
'c_te_worlddecal.cpp',
'c_testtraceline.cpp',
'c_tracer.cpp',
'fx.cpp',
'fx_discreetline.cpp',
'fx_envelope.cpp',
'fx_line.cpp',
'fx_sparks.cpp',
'particlesphererenderer.cpp',
'smoke_fog_overlay.cpp',
'game_controls/baseviewport.cpp',
'game_controls/basemodelpanel.cpp',
'game_controls/basemodel_panel.cpp',
'game_controls/ClientScoreBoardDialog.cpp',
'game_controls/commandmenu.cpp',
'game_controls/intromenu.cpp',
'game_controls/MapOverview.cpp',
'game_controls/NavProgress.cpp',
'game_controls/SpectatorGUI.cpp',
'game_controls/teammenu.cpp',
'game_controls/vguitextwindow.cpp',
'game_controls/IconPanel.cpp',
'mp3player.cpp',
'../../public/tools/bonelist.cpp',
'entity_client_tools.cpp',
'toolframework_client.cpp',
'hud_chat.cpp',
'c_team_objectiveresource.cpp',
'../shared/hl2/basehlcombatweapon_shared.cpp',
'../shared/hl2/achievements_hl2.cpp',
'hl2/c_antlion_dust.cpp',
'hl2/c_ar2_explosion.cpp',
'hl2/c_barnacle.cpp',
'hl2/c_barney.cpp',
'hl2/c_basehelicopter.cpp',
'hl2/c_basehlcombatweapon.cpp',
'hl2/c_basehlplayer.cpp',
'hl2/c_citadel_effects.cpp',
'hl2/c_corpse.cpp',
'hl2/c_env_alyxtemp.cpp',
'hl2/c_env_headcrabcanister.cpp',
'hl2/c_env_starfield.cpp',
'hl2/c_func_tankmortar.cpp',
'hl2/c_hl2_playerlocaldata.cpp',
'hl2/c_info_teleporter_countdown.cpp',
'hl2/c_npc_antlionguard.cpp',
'hl2/c_npc_combinegunship.cpp',
'hl2/c_npc_manhack.cpp',
'hl2/c_npc_rollermine.cpp',
'hl2/c_plasma_beam_node.cpp',
'hl2/c_prop_combine_ball.cpp',
'hl2/c_rotorwash.cpp',
'hl2/c_script_intro.cpp',
'../shared/script_intro_shared.cpp',
'hl2/c_strider.cpp',
'hl2/c_te_concussiveexplosion.cpp',
'hl2/c_te_flare.cpp',
'hl2/c_thumper_dust.cpp',
'hl2/c_vehicle_airboat.cpp',
'hl2/c_vehicle_cannon.cpp',
'hl2/c_vehicle_crane.cpp',
'hl2/c_vehicle_prisoner_pod.cpp',
'hl2/c_weapon__stubs_hl2.cpp',
'hl2/c_weapon_crossbow.cpp',
'hl2/c_weapon_physcannon.cpp',
'hl2/c_weapon_stunstick.cpp',
'hl2/clientmode_hlnormal.cpp',
'death.cpp',
'../shared/hl2/env_headcrabcanister_shared.cpp',
'hl2/fx_antlion.cpp',
'hl2/fx_bugbait.cpp',
'hl2/fx_hl2_impacts.cpp',
'hl2/fx_hl2_tracers.cpp',
'hl2/hl2_clientmode.cpp',
'../shared/hl2/hl2_gamerules.cpp',
'../shared/hl2/hl2_usermessages.cpp',
'../shared/hl2/hl_gamemovement.cpp',
'hl2/hl_in_main.cpp',
'hl2/hl_prediction.cpp',
'hl2/hud_ammo.cpp',
'hl2/hud_battery.cpp',
'hl2/hud_blood.cpp',
'hl2/hud_credits.cpp',
'hl2/hud_damageindicator.cpp',
'hl2/hud_flashlight.cpp',
'hl2/hud_health.cpp',
'hl2/hud_poisondamageindicator.cpp',
'hud_posture.cpp',
'hl2/hud_quickinfo.cpp',
'hud_squadstatus.cpp',
'hl2/hud_suitpower.cpp',
'hl2/hud_weaponselection.cpp',
'hl2/hud_zoom.cpp',
'hl2/shieldproxy.cpp',
'hl2/vgui_rootpanel_hl2.cpp',
'episodic/c_vort_charge_token.cpp'
]
game = vpc_parser.parse_vpcs( bld.env, games[bld.env.GAMES], '../..' )
includes = [
'.',
'game_controls',
'hl2',
'hl2/elements',
'../shared/hl2',
'../../common',
'../../public',
'../../public/tier0',
@@ -539,8 +43,6 @@ def build(bld):
'../shared'
]
defines = []
libs = [
'tier0',
'particles',
@@ -556,13 +58,20 @@ def build(bld):
'steam_api',
'bitmap',
'vtf',
'RT'
'RT',
'ZLIB'
]
install_path = bld.env.PREFIX
if bld.env.DEST_OS != 'android':
install_path += '/hl2/bin'
source = game["sources"]
includes += game["includes"]
defines = game["defines"]
defines.remove('PROTECTED_THINGS_ENABLE')
bld.shlib(
source = source,
target = PROJECT_NAME,

View File

@@ -74,7 +74,7 @@ static float g_PhysAverageSimTime;
CCallQueue g_PostSimulationQueue;
// local routines
// local roeutines
static IPhysicsObject *PhysCreateWorld( CBaseEntity *pWorld );
static void PhysFrame( float deltaTime );
static bool IsDebris( int collisionGroup );
@@ -1689,6 +1689,7 @@ void PhysFrame( float deltaTime )
float simRealTime = 0;
deltaTime *= phys_timescale.GetFloat();
// !!!HACKHACK -- hard limit scaled time to avoid spending too much time in here
// Limit to 100 ms
if ( deltaTime > 0.100f )
@@ -1709,10 +1710,9 @@ void PhysFrame( float deltaTime )
g_Collisions.BufferTouchEvents( true );
#endif
physenv->Simulate( deltaTime );
int activeCount = physenv->GetActiveObjectCount();
IPhysicsObject **pActiveList = NULL;
#if 0
if ( activeCount )
{
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
@@ -1721,6 +1721,26 @@ void PhysFrame( float deltaTime )
for ( int i = 0; i < activeCount; i++ )
{
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
OutputVPhysicsDebugInfo(pEntity);
}
stackfree( pActiveList );
}
#endif
physenv->Simulate( deltaTime );
activeCount = physenv->GetActiveObjectCount();
pActiveList = NULL;
if ( activeCount )
{
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
physenv->GetActiveObjects( pActiveList );
for ( int i = 0; i < activeCount; i++ )
{
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
// OutputVPhysicsDebugInfo(pEntity);
if ( pEntity )
{
if ( pEntity->CollisionProp()->DoesVPhysicsInvalidateSurroundingBox() )
@@ -1948,7 +1968,7 @@ void CCollisionEvent::Friction( IPhysicsObject *pObject, float energy, int surfa
if ( pEntity )
{
friction_t *pFriction = g_Collisions.FindFriction( pEntity );
if ( pFriction && pFriction->pObject)
{
// in MP mode play sound and effects once every 500 msecs,

View File

@@ -3380,12 +3380,14 @@ void CBasePlayer::PhysicsSimulate( void )
pi->m_nNumCmds = commandsToRun;
}
}
#if 0
else if ( GetTimeSinceLastUserCommand() > sv_player_usercommand_timeout.GetFloat() )
{
// no usercommand from player after some threshold
// server should start RunNullCommand as if client sends an empty command so that Think and gamestate related things run properly
RunNullCommand();
}
#endif
// Restore the true server clock
// FIXME: Should this occur after simulation of children so

View File

@@ -54,7 +54,7 @@ $Configuration
$Compiler
{
$AdditionalIncludeDirectories "$BASE;.\;$SRCDIR\game\shared;$SRCDIR\utils\common;$SRCDIR\game\shared\econ;$SRCDIR\game\server\NextBot"
$PreprocessorDefinitions "$BASE;GAME_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;sprintf=use_Q_snprintf_instead_of_sprintf;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
$PreprocessorDefinitions "$BASE;GAME_DLL;VECTOR;VERSION_SAFE_STEAM_API_INTERFACES;PROTECTED_THINGS_ENABLE;strncpy=use_Q_strncpy_instead;_snprintf=use_Q_snprintf_instead"
$PreprocessorDefinitions "$BASE;SWDS" [$POSIX]
$PreprocessorDefinitions "$BASE;fopen=dont_use_fopen" [$WINDOWS||$X360]
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"

View File

@@ -3,585 +3,41 @@
from waflib import Utils
import os
import vpc_parser
top = '.'
PROJECT_NAME = 'server'
games = {
'hl2': ['server_base.vpc', 'server_hl2.vpc'],
'episodic':['server_base.vpc', 'server_episodic.vpc'],
'hl2mp': ['server_base.vpc', 'server_hl2mp.vpc'],
'portal': ['server_base.vpc', 'server_portal.vpc'],
'hl1': ['server_base.vpc', 'server_hl1.vpc'],
'hl1mp': ['server_base.vpc', 'server_hl1.vpc'],
'css': ['server_base.vpc', 'server_cstrike.vpc', 'nav_mesh.vpc'],
'dod': ['server_base.vpc', 'server_dod.vpc'],
'tf': [
'server_base.vpc',
'server_econ_base.vpc',
'tf/tf_gcmessages_include.vpc',
'nav_mesh.vpc',
'server_tf.vpc'
]
}
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES', [
'GAME_DLL',
'VECTOR',
'VERSION_SAFE_STEAM_API_INTERFACES',
'PROTECTED_THINGS_ENABLE'
'sprintf=use_Q_snprintf_instead_of_sprintf',
'strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead',
'HL2_DLL',
'USES_SAVERESTORE'
])
game = conf.options.GAMES
conf.env.GAMES = game
if game not in games.keys():
conf.fatal("Couldn't find game: ", game)
def build(bld):
print(bld)
source = [
'../shared/achievement_saverestore.cpp',
'../shared/achievementmgr.cpp',
'../shared/achievements_hlx.cpp',
'../shared/activitylist.cpp',
'ai_activity.cpp',
'ai_baseactor.cpp',
'ai_basehumanoid.cpp',
'ai_basenpc.cpp',
'ai_basenpc_flyer.cpp',
'ai_basenpc_flyer_new.cpp',
'ai_basenpc_movement.cpp',
'ai_basenpc_physicsflyer.cpp',
'ai_basenpc_schedule.cpp',
'ai_basenpc_squad.cpp',
'ai_behavior.cpp',
'ai_behavior_assault.cpp',
'ai_behavior_fear.cpp',
'ai_behavior_follow.cpp',
'ai_behavior_lead.cpp',
'ai_behavior_rappel.cpp',
'ai_behavior_standoff.cpp',
'ai_blended_movement.cpp',
'ai_concommands.cpp',
'ai_condition.cpp',
'AI_Criteria.cpp',
'ai_default.cpp',
'ai_dynamiclink.cpp',
'ai_event.cpp',
'ai_goalentity.cpp',
'ai_hint.cpp',
'ai_hull.cpp',
'ai_initutils.cpp',
'AI_Interest_Target.cpp',
'ai_link.cpp',
'ai_localnavigator.cpp',
'ai_looktarget.cpp',
'ai_memory.cpp',
'ai_motor.cpp',
'ai_moveprobe.cpp',
'ai_moveshoot.cpp',
'ai_movesolver.cpp',
'ai_namespaces.cpp',
'ai_navigator.cpp',
'ai_network.cpp',
'ai_networkmanager.cpp',
'ai_node.cpp',
'ai_pathfinder.cpp',
'ai_planesolver.cpp',
'ai_playerally.cpp',
'AI_ResponseSystem.cpp',
'ai_route.cpp',
'ai_saverestore.cpp',
'ai_schedule.cpp',
'ai_scriptconditions.cpp',
'ai_senses.cpp',
'ai_sentence.cpp',
'ai_speech.cpp',
'ai_speechfilter.cpp',
'ai_squad.cpp',
'ai_squadslot.cpp',
'ai_tacticalservices.cpp',
'ai_task.cpp',
'ai_trackpather.cpp',
'ai_utils.cpp',
'ai_waypoint.cpp',
'../shared/ammodef.cpp',
'../shared/animation.cpp',
'../shared/base_playeranimstate.cpp',
'base_transmit_proxy.cpp',
'../shared/baseachievement.cpp',
'baseanimating.cpp',
'BaseAnimatingOverlay.cpp',
'basecombatcharacter.cpp',
'../shared/basecombatcharacter_shared.cpp',
'basecombatweapon.cpp',
'../shared/basecombatweapon_shared.cpp',
'baseentity.cpp',
'../shared/baseentity_shared.cpp',
'baseflex.cpp',
'../shared/basegrenade_shared.cpp',
'basemultiplayerplayer.cpp',
'../shared/baseparticleentity.cpp',
'../shared/baseplayer_shared.cpp',
'../shared/baseprojectile.cpp',
'baseviewmodel.cpp',
'../shared/baseviewmodel_shared.cpp',
'../shared/beam_shared.cpp',
'bitstring.cpp',
'bmodels.cpp',
'buttons.cpp',
'cbase.cpp',
'client.cpp',
'../shared/collisionproperty.cpp',
'colorcorrection.cpp',
'colorcorrectionvolume.cpp',
'CommentarySystem.cpp',
'controlentities.cpp',
'cplane.cpp',
'CRagdollMagnet.cpp',
'damagemodifier.cpp',
'../shared/death_pose.cpp',
'../shared/debugoverlay_shared.cpp',
'../shared/decals.cpp',
'doors.cpp',
'dynamiclight.cpp',
'../shared/effect_dispatch_data.cpp',
'effects.cpp',
'EffectsServer.cpp',
'../shared/ehandle.cpp',
'entityblocker.cpp',
'EntityDissolve.cpp',
'EntityFlame.cpp',
'entitylist.cpp',
'../shared/entitylist_base.cpp',
'EntityParticleTrail.cpp',
'../shared/EntityParticleTrail_Shared.cpp',
'env_debughistory.cpp',
'../shared/env_detail_controller.cpp',
'env_effectsscript.cpp',
'env_entity_maker.cpp',
'env_particlescript.cpp',
'env_player_surface_trigger.cpp',
'env_projectedtexture.cpp',
'env_screenoverlay.cpp',
'env_texturetoggle.cpp',
'env_tonemap_controller.cpp',
'../shared/env_wind_shared.cpp',
'env_zoom.cpp',
'EnvBeam.cpp',
'EnvFade.cpp',
'EnvHudHint.cpp',
'EnvLaser.cpp',
'EnvMessage.cpp',
'envmicrophone.cpp',
'EnvShake.cpp',
'EnvSpark.cpp',
'../shared/eventlist.cpp',
'EventLog.cpp',
'explode.cpp',
'filters.cpp',
'fire.cpp',
'fire_smoke.cpp',
'fish.cpp',
'fogcontroller.cpp',
'fourwheelvehiclephysics.cpp',
'func_areaportal.cpp',
'func_areaportalbase.cpp',
'func_areaportalwindow.cpp',
'func_break.cpp',
'func_breakablesurf.cpp',
'func_dust.cpp',
'../shared/func_ladder.cpp',
'func_ladder_endpoint.cpp',
'func_lod.cpp',
'func_movelinear.cpp',
'func_occluder.cpp',
'func_reflective_glass.cpp',
'func_smokevolume.cpp',
'game.cpp',
'game_ui.cpp',
'gameinterface.cpp',
'../shared/gamemovement.cpp',
'../shared/gamerules.cpp',
'../shared/gamerules_register.cpp',
'../shared/GameStats.cpp',
'../shared/gamestringpool.cpp',
'gametrace_dll.cpp',
'../shared/gamevars_shared.cpp',
'gameweaponmanager.cpp',
'genericactor.cpp',
'genericmonster.cpp',
'gib.cpp',
'globals.cpp',
'globalstate.cpp',
'guntarget.cpp',
'h_ai.cpp',
'hierarchy.cpp',
'hltvdirector.cpp',
'../shared/hintmessage.cpp',
'../shared/hintsystem.cpp',
'../shared/igamesystem.cpp',
'info_camera_link.cpp',
'info_overlay_accessor.cpp',
'intermission.cpp',
'item_world.cpp',
'lightglow.cpp',
'lights.cpp',
'logic_measure_movement.cpp',
'logic_navigation.cpp',
'logicauto.cpp',
'logicentities.cpp',
'logicrelay.cpp',
'mapentities.cpp',
'../shared/mapentities_shared.cpp',
'maprules.cpp',
'MaterialModifyControl.cpp',
'message_entity.cpp',
'modelentities.cpp',
'../shared/ModelSoundsCache.cpp',
'movehelper_server.cpp',
'movement.cpp',
'../shared/movevars_shared.cpp',
'../shared/multiplay_gamerules.cpp',
'ndebugoverlay.cpp',
'npc_vehicledriver.cpp',
'../shared/obstacle_pushaway.cpp',
'particle_light.cpp',
'../shared/particle_parse.cpp',
'particle_system.cpp',
'../shared/particlesystemquery.cpp',
'pathcorner.cpp',
'pathtrack.cpp',
'phys_controller.cpp',
'physconstraint.cpp',
'physics.cpp',
'physics_bone_follower.cpp',
'physics_cannister.cpp',
'physics_fx.cpp',
'physics_impact_damage.cpp',
'physics_main.cpp',
'../shared/physics_main_shared.cpp',
'physics_npc_solver.cpp',
'physics_prop_ragdoll.cpp',
'../shared/physics_saverestore.cpp',
'../shared/physics_shared.cpp',
'physobj.cpp',
'player.cpp',
'player_command.cpp',
'player_lagcompensation.cpp',
'player_pickup.cpp',
'player_resource.cpp',
'playerinfomanager.cpp',
'playerlocaldata.cpp',
'plugin_check.cpp',
'../shared/point_bonusmaps_accessor.cpp',
'point_camera.cpp',
'point_devshot_camera.cpp',
'point_playermoveconstraint.cpp',
'../shared/point_posecontroller.cpp',
'point_spotlight.cpp',
'point_template.cpp',
'pointanglesensor.cpp',
'PointAngularVelocitySensor.cpp',
'pointhurt.cpp',
'pointteleport.cpp',
'../shared/precache_register.cpp',
'../shared/predictableid.cpp',
'props.cpp',
'../shared/props_shared.cpp',
'../shared/querycache.cpp',
'ragdoll_manager.cpp',
'../shared/ragdoll_shared.cpp',
'RagdollBoogie.cpp',
'recipientfilter.cpp',
'rope.cpp',
'../shared/rope_helpers.cpp',
'../shared/saverestore.cpp',
'saverestore_gamedll.cpp',
'../shared/SceneCache.cpp',
'sceneentity.cpp',
'../shared/sceneentity_shared.cpp',
'scratchpad_gamedll_helpers.cpp',
'scripted.cpp',
'scriptedtarget.cpp',
'sendproxy.cpp',
'../shared/sequence_Transitioner.cpp',
'../server/serverbenchmark_base.cpp',
'ServerNetworkProperty.cpp',
'shadowcontrol.cpp',
'../shared/simtimer.cpp',
'../shared/singleplay_gamerules.cpp',
'SkyCamera.cpp',
'slideshow_display.cpp',
'sound.cpp',
'../shared/SoundEmitterSystem.cpp',
'soundent.cpp',
'../shared/soundenvelope.cpp',
'../../public/SoundParametersInternal.cpp',
'soundscape.cpp',
'soundscape_system.cpp',
'spotlightend.cpp',
'../shared/Sprite.cpp',
'sprite_perfmonitor.cpp',
'../shared/studio_shared.cpp',
'subs.cpp',
'sun.cpp',
'tactical_mission.cpp',
'../shared/takedamageinfo.cpp',
'tanktrain.cpp',
'team.cpp',
'../shared/teamplay_gamerules.cpp',
'TemplateEntities.cpp',
'tempmonster.cpp',
'tesla.cpp',
'../shared/test_ehandle.cpp',
'test_proxytoggle.cpp',
'test_stressentities.cpp',
'testfunctions.cpp',
'testtraceline.cpp',
'textstatsmgr.cpp',
'timedeventmgr.cpp',
'trains.cpp',
'triggers.cpp',
'../shared/usercmd.cpp',
'util.cpp',
'../shared/util_shared.cpp',
'variant_t.cpp',
'vehicle_base.cpp',
'vehicle_baseserver.cpp',
'../shared/vehicle_viewblend_shared.cpp',
'vguiscreen.cpp',
'../shared/voice_gamemgr.cpp',
'waterbullet.cpp',
'WaterLODControl.cpp',
'wcedit.cpp',
'../shared/weapon_parse.cpp',
'../shared/weapon_proficiency.cpp',
'weight_button.cpp',
'world.cpp',
'../shared/mp_shareddefs.cpp',
'../server/vote_controller.cpp',
'../../public/haptics/haptic_msgs.cpp',
# '../../public/haptics/haptic_utils.cpp', [$WIN32]
'../../public/bone_setup.cpp',
'../../public/collisionutils.cpp',
'../../public/dt_send.cpp',
'../../public/dt_utlvector_common.cpp',
'../../public/dt_utlvector_send.cpp',
'../../public/editor_sendcommand.cpp',
'../../public/filesystem_helpers.cpp',
'gamehandle.cpp',
'h_export.cpp',
'init_factory.cpp',
'../../public/interpolatortypes.cpp',
'../../game/shared/interval.cpp',
'../../public/keyframe/keyframe.cpp',
'../../common/language.cpp',
'../../common/steamid.cpp',
'../../public/map_utils.cpp',
'../../public/networkvar.cpp',
'../../common/randoverride.cpp',
'../../public/registry.cpp',
'../../public/rope_physics.cpp',
'../../public/scratchpad3d.cpp',
'../../public/ScratchPadUtils.cpp',
'../../public/server_class.cpp',
'../../game/shared/sheetsimulator.cpp',
'../../public/simple_physics.cpp',
'../../public/stringregistry.cpp',
'../../public/studio.cpp',
'GameStats_BasicStatsFunctions.cpp',
'basetempentity.cpp',
'event_tempentity_tester.cpp',
'movie_explosion.cpp',
'particle_fire.cpp',
'particle_smokegrenade.cpp',
'plasma.cpp',
'smokestack.cpp',
'smoke_trail.cpp',
'../shared/SpriteTrail.cpp',
'steamjet.cpp',
'te.cpp',
'te_armorricochet.cpp',
'te_basebeam.cpp',
'te_beamentpoint.cpp',
'te_beaments.cpp',
'te_beamfollow.cpp',
'te_beamlaser.cpp',
'te_beampoints.cpp',
'te_beamring.cpp',
'te_beamringpoint.cpp',
'te_beamspline.cpp',
'te_bloodsprite.cpp',
'te_bloodstream.cpp',
'te_breakmodel.cpp',
'te_bspdecal.cpp',
'te_bubbles.cpp',
'te_bubbletrail.cpp',
'te_clientprojectile.cpp',
'te_decal.cpp',
'te_dynamiclight.cpp',
'te_effect_dispatch.cpp',
'te_energysplash.cpp',
'te_explosion.cpp',
'te_fizz.cpp',
'te_footprintdecal.cpp',
'hl2/te_gaussexplosion.cpp',
'te_glassshatter.cpp',
'te_glowsprite.cpp',
'te_impact.cpp',
'te_killplayerattachments.cpp',
'te_largefunnel.cpp',
'te_muzzleflash.cpp',
'te_particlesystem.cpp',
'te_physicsprop.cpp',
'te_playerdecal.cpp',
'te_projecteddecal.cpp',
'te_showline.cpp',
'te_smoke.cpp',
'te_sparks.cpp',
'te_sprite.cpp',
'te_spritespray.cpp',
'te_worlddecal.cpp',
'../shared/usermessages.cpp',
'entity_tools_server.cpp',
'toolframework_server.cpp'
] + [
'ai_eventresponse.cpp',
'ai_relationship.cpp',
'base_gameinterface.cpp',
'basegrenade_concussion.cpp',
'basegrenade_contact.cpp',
'basegrenade_timed.cpp',
'hl2/Func_Monitor.cpp',
'grenadethrown.cpp',
'h_cycler.cpp',
'logic_achievement.cpp',
'monstermaker.cpp',
'../shared/hl2/survival_gamerules.cpp',
'team_spawnpoint.cpp',
'vehicle_choreo_generic.cpp',
'../shared/weapon_parse_default.cpp',
'../shared/hl2/achievements_hl2.cpp',
'hl2/ai_allymanager.cpp',
'hl2/ai_behavior_actbusy.cpp',
'hl2/ai_behavior_functank.cpp',
'hl2/ai_behavior_holster.cpp',
'hl2/ai_behavior_operator.cpp',
'hl2/ai_behavior_police.cpp',
'hl2/ai_goal_police.cpp',
'hl2/ai_spotlight.cpp',
'hl2/antlion_dust.cpp',
'hl2/antlion_maker.cpp',
'hl2/ar2_explosion.cpp',
'basebludgeonweapon.cpp',
'hl2/basehlcombatweapon.cpp',
'../shared/hl2/basehlcombatweapon_shared.cpp',
'hl2/cbasehelicopter.cpp',
'hl2/cbasespriteprojectile.cpp',
'hl2/citadel_effects.cpp',
'hl2/combine_mine.cpp',
'hl2/env_alyxemp.cpp',
'hl2/env_headcrabcanister.cpp',
'../shared/hl2/env_headcrabcanister_shared.cpp',
'hl2/env_speaker.cpp',
'hl2/env_starfield.cpp',
'hl2/func_recharge.cpp',
'hl2/func_tank.cpp',
'hl2/grenade_ar2.cpp',
'hl2/grenade_bugbait.cpp',
'hl2/grenade_frag.cpp',
'hl2/hl2_ai_network.cpp',
'hl2/hl2_client.cpp',
'hl2/hl2_eventlog.cpp',
'../shared/hl2/hl2_gamerules.cpp',
'hl2/hl2_gamestats.cpp',
'hl2/hl2_player.cpp',
'hl2/hl2_playerlocaldata.cpp',
'hl2/hl2_triggers.cpp',
'../shared/hl2/hl2_usermessages.cpp',
'../shared/hl2/hl_gamemovement.cpp',
'hl2/hl_playermove.cpp',
'hl2/info_darknessmode_lightsource.cpp',
'hl2/info_teleporter_countdown.cpp',
'hl2/item_ammo.cpp',
'hl2/item_battery.cpp',
'hl2/item_dynamic_resupply.cpp',
'hl2/item_healthkit.cpp',
'hl2/item_itemcrate.cpp',
'hl2/item_suit.cpp',
'hl2/look_door.cpp',
'hl2/monster_dummy.cpp',
'hl2/npc_alyx.cpp',
'hl2/npc_antlion.cpp',
'hl2/npc_antlionguard.cpp',
'hl2/npc_apcdriver.cpp',
'hl2/npc_attackchopper.cpp',
'hl2/npc_barnacle.cpp',
'hl2/npc_barney.cpp',
'hl2/npc_basescanner.cpp',
'hl2/npc_BaseZombie.cpp',
'hl2/npc_blob.cpp',
'hl2/npc_breen.cpp',
'hl2/npc_bullseye.cpp',
'hl2/npc_citizen17.cpp',
'hl2/npc_combine.cpp',
'hl2/npc_combinecamera.cpp',
'hl2/npc_combinedropship.cpp',
'hl2/npc_combinegunship.cpp',
'hl2/npc_combines.cpp',
'hl2/npc_cranedriver.cpp',
'hl2/npc_crow.cpp',
'hl2/npc_dog.cpp',
'hl2/npc_eli.cpp',
'hl2/npc_enemyfinder.cpp',
'hl2/npc_fastzombie.cpp',
'hl2/npc_fisherman.cpp',
'hl2/npc_gman.cpp',
'hl2/npc_headcrab.cpp',
'hl2/npc_ichthyosaur.cpp',
'hl2/npc_kleiner.cpp',
'hl2/npc_launcher.cpp',
'hl2/npc_manhack.cpp',
'hl2/npc_metropolice.cpp',
'hl2/npc_monk.cpp',
'hl2/npc_mossman.cpp',
'hl2/npc_playercompanion.cpp',
'hl2/npc_PoisonZombie.cpp',
'hl2/npc_rollermine.cpp',
'hl2/npc_scanner.cpp',
'hl2/npc_stalker.cpp',
'hl2/npc_strider.cpp',
'npc_talker.cpp',
'hl2/npc_turret_ceiling.cpp',
'hl2/npc_turret_floor.cpp',
'hl2/npc_turret_ground.cpp',
'hl2/npc_vortigaunt_episodic.cpp',
'hl2/npc_zombie.cpp',
'hl2/point_apc_controller.cpp',
'hl2/prop_combine_ball.cpp',
'hl2/prop_thumper.cpp',
'hl2/proto_sniper.cpp',
'hl2/rotorwash.cpp',
'hl2/script_intro.cpp',
'../shared/script_intro_shared.cpp',
'hl2/vehicle_airboat.cpp',
'hl2/vehicle_cannon.cpp',
'hl2/vehicle_crane.cpp',
'hl2/vehicle_jeep.cpp',
'hl2/vehicle_prisoner_pod.cpp',
'hl2/vehicle_viewcontroller.cpp',
'hl2/weapon_357.cpp',
'hl2/weapon_alyxgun.cpp',
'hl2/weapon_annabelle.cpp',
'hl2/weapon_ar2.cpp',
'hl2/weapon_bugbait.cpp',
'hl2/weapon_citizenpackage.cpp',
'hl2/weapon_crossbow.cpp',
'hl2/weapon_crowbar.cpp',
'weapon_cubemap.cpp',
'hl2/weapon_frag.cpp',
'hl2/weapon_physcannon.cpp',
'hl2/weapon_pistol.cpp',
'hl2/weapon_rpg.cpp',
'hl2/weapon_shotgun.cpp',
'hl2/weapon_smg1.cpp',
'hl2/weapon_stunstick.cpp',
'hl2/grenade_beam.cpp',
'hl2/grenade_homer.cpp',
'hl2/grenade_pathfollower.cpp',
'hl2/npc_missiledefense.cpp',
'hl2/vehicle_apc.cpp',
'hl2/weapon_cguard.cpp',
'hl2/weapon_flaregun.cpp'
]
game = vpc_parser.parse_vpcs( bld.env, games[bld.env.GAMES], '../..' )
includes = [
'.',
@@ -593,9 +49,6 @@ def build(bld):
'../../public/tier0',
'../../public/tier1',
'../../public'
] + [
'../shared/hl2',
'hl2'
]
defines = []
@@ -606,6 +59,12 @@ def build(bld):
if bld.env.DEST_OS != 'android':
install_path += '/hl2/bin'
source = game["sources"]
includes += game["includes"]
defines = game["defines"]
defines.remove('PROTECTED_THINGS_ENABLE')
bld.shlib(
source = source,
target = PROJECT_NAME,

View File

@@ -31,7 +31,6 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CInputSystem, IInputSystem,
INPUTSYSTEM_INTERFACE_VERSION, g_InputSystem );
#if defined( WIN32 ) && !defined( _X360 )
typedef BOOL (WINAPI *RegisterRawInputDevices_t)
(
@@ -70,6 +69,7 @@ CInputSystem::CInputSystem()
m_JoysticksEnabled.ClearAllFlags();
m_nJoystickCount = 0;
m_bJoystickInitialized = false;
m_bTouchInitialized = false;
m_nPollCount = 0;
m_PrimaryUserId = INVALID_USER_ID;
m_uiMouseWheel = 0;
@@ -166,6 +166,10 @@ InitReturnVal_t CInputSystem::Init()
ButtonCode_UpdateScanCodeLayout();
joy_xcontroller_found.SetValue( 0 );
if( !m_bConsoleTextMode )
InitializeTouch();
if ( IsPC() && !m_bConsoleTextMode )
{
InitializeJoysticks();
@@ -1526,6 +1530,16 @@ bool CInputSystem::GetRawMouseAccumulators( int& accumX, int& accumY )
#endif
}
bool CInputSystem::GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY )
{
event = m_touchAccumEvent;
fingerId = m_touchAccumFingerId;
accumX = m_touchAccumX;
accumY = m_touchAccumY;
return m_bJoystickInitialized;
}
void CInputSystem::SetConsoleTextMode( bool bConsoleTextMode )
{
/* If someone calls this after init, shut it down. */
@@ -1548,3 +1562,10 @@ ISteamController* CInputSystem::SteamControllerInterface()
return m_SteamAPIContext.SteamController();
}
}
void CInputSystem::StartTextInput()
{
#ifdef USE_SDL
SDL_StartTextInput();
#endif
}

View File

@@ -101,6 +101,8 @@ public:
virtual void *GetHapticsInterfaceAddress() const { return NULL;}
#endif
bool GetRawMouseAccumulators( int& accumX, int& accumY );
bool GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY );
virtual void SetConsoleTextMode( bool bConsoleTextMode );
// Windows proc
@@ -240,6 +242,13 @@ public:
// Record button state and post the event
void JoystickButtonEvent( ButtonCode_t button, int sample );
// Init touch
void InitializeTouch( void );
// Shut down touch
void ShutdownTouch( void );
#if defined( WIN32 ) && !defined ( _X360 )
// NVNT attaches window to novint devices
@@ -324,6 +333,11 @@ public:
void JoystickButtonRelease( int joystickId, int button ); // same as above.
void JoystickAxisMotion( int joystickId, int axis, int value );
void FingerDown( int fingerId, int x, int y );
void FingerUp( int fingerId, int x, int y );
void FingerMotion( int fingerId, int x, int y );
// Steam Controller
void ReadSteamController( int iIndex );
void PostKeyEvent( int iIndex, sKey_t sKey, int nSample );
@@ -360,6 +374,8 @@ public:
m_bSkipControllerInitialization = bSkip;
}
virtual void StartTextInput();
#if defined( USE_SDL )
void PollInputState_Platform();
@@ -390,6 +406,7 @@ public:
CUtlFlags<unsigned short> m_JoysticksEnabled;
int m_nJoystickCount;
bool m_bJoystickInitialized;
bool m_bTouchInitialized;
bool m_bXController;
JoystickInfo_t m_pJoystickInfo[ MAX_JOYSTICKS ];
@@ -444,6 +461,9 @@ public:
bool m_bRawInputSupported;
int m_mouseRawAccumX, m_mouseRawAccumY;
InputEventType_t m_touchAccumEvent;
int m_touchAccumFingerId, m_touchAccumX, m_touchAccumY;
// For the 'SleepUntilInput' feature
HANDLE m_hEvent;

98
inputsystem/touch_sdl.cpp Normal file
View File

@@ -0,0 +1,98 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Linux/Android touch implementation for inputsystem
//
//===========================================================================//
/* For force feedback testing. */
#include "inputsystem.h"
#include "tier1/convar.h"
#include "tier0/icommandline.h"
#include "SDL.h"
#include "SDL_touch.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Handle the events coming from the Touch SDL subsystem.
//-----------------------------------------------------------------------------
int TouchSDLWatcher( void *userInfo, SDL_Event *event )
{
CInputSystem *pInputSystem = (CInputSystem *)userInfo;
SDL_Window *window = SDL_GetWindowFromID(event->tfinger.windowID);
if( !window )
return 0;
int width, height;
width = height = 0;
SDL_GetWindowSize(window, &width, &height);
switch ( event->type ) {
case SDL_FINGERDOWN:
pInputSystem->FingerDown( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height );
break;
case SDL_FINGERUP:
pInputSystem->FingerUp( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height );
break;
case SDL_FINGERMOTION:
pInputSystem->FingerMotion( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height );
break;
}
return 1;
}
//-----------------------------------------------------------------------------
// Initialize all joysticks
//-----------------------------------------------------------------------------
void CInputSystem::InitializeTouch( void )
{
if ( m_bTouchInitialized )
ShutdownTouch();
// abort startup if user requests no touch
if ( CommandLine()->FindParm("-notouch") ) return;
m_bJoystickInitialized = true;
SDL_AddEventWatch(TouchSDLWatcher, this);
}
void CInputSystem::ShutdownTouch()
{
if ( !m_bTouchInitialized )
return;
SDL_DelEventWatch( TouchSDLWatcher, this );
m_bTouchInitialized = false;
}
void CInputSystem::FingerDown(int fingerId, int x, int y)
{
m_touchAccumEvent = IE_FingerDown;
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerDown, m_nLastSampleTick, fingerId, x, y);
}
void CInputSystem::FingerUp(int fingerId, int x, int y)
{
m_touchAccumEvent = IE_FingerUp;
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerUp, m_nLastSampleTick, fingerId, x, y);
}
void CInputSystem::FingerMotion(int fingerId, int x, int y)
{
m_touchAccumEvent = IE_FingerMotion;
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerMotion, m_nLastSampleTick, fingerId, x, y);
}

View File

@@ -18,6 +18,7 @@ def build(bld):
source = [
'inputsystem.cpp',
'joystick_sdl.cpp',
'touch_sdl.cpp',
#'novint.cpp', # [$WIN32]
'key_translation.cpp',
'steamcontroller.cpp'

2
ivp

Submodule ivp updated: 64e06cde5f...82849306f7

View File

@@ -7,7 +7,7 @@
#include <unistd.h>
#include <stdio.h>
#include <dlfcn.h>
#include <SDL_hints.h>
#include "tier0/threadtools.h"
@@ -92,9 +92,9 @@ t_eglGetProcAddress eglGetProcAddress;
void *GetProcAddress( const char *procname )
{
void *result = dlsym(lgles, procname);
if(result)
if( result )
return result;
else
else if( eglGetProcAddress )
return eglGetProcAddress(procname);
}
@@ -127,7 +127,7 @@ DLLEXPORT int LauncherMainAndroid( int argc, char **argv )
gl4es_set_getprocaddress = (t_set_getprocaddress)dlsym(lgl4es, "set_getprocaddress");
eglGetProcAddress = (t_eglGetProcAddress)dlsym(lEGL, "eglGetProcAddress");
if( gl4es_set_getprocaddress && eglGetProcAddress )
if( gl4es_set_getprocaddress )
{
gl4es_set_getprocaddress( &GetProcAddress );
}
@@ -137,6 +137,7 @@ DLLEXPORT int LauncherMainAndroid( int argc, char **argv )
return 1;
}
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
DeclareCurrentThreadIsMainThread(); // Init thread propertly on Android
return LauncherMain(iLastArgs, LauncherArgv);

View File

@@ -2378,15 +2378,12 @@ void CMaterial::ReloadTextures( void )
IMaterialVar **ppVars = GetShaderParams();
for( i = 0; i < nParams; i++ )
{
if( ppVars[i] )
if( ppVars[i] )
{
if( ppVars[i]->IsTexture() )
{
ITextureInternal *pTexture = ( ITextureInternal * )ppVars[i]->GetTextureValue();
if( !IsTextureInternalEnvCubemap( pTexture ) )
{
pTexture->Download();
}
pTexture->Download();
}
}
}

View File

@@ -426,7 +426,7 @@ void CMaterialVar::CleanUpData()
case MATERIAL_VAR_TYPE_TEXTURE:
// garymcthack
if( m_pTexture && !IsTextureInternalEnvCubemap( m_pTexture ) )
if( m_pTexture )
{
m_pTexture->DecrementReferenceCount();
if ( g_bDeleteUnreferencedTexturesEnabled )
@@ -731,16 +731,8 @@ const char *CMaterialVar::GetStringValue( void ) const
}
case MATERIAL_VAR_TYPE_TEXTURE:
// check for env_cubemap
if( IsTextureInternalEnvCubemap( m_pTexture ) )
{
return "env_cubemap";
}
else
{
Q_snprintf( s_CharBuf, sizeof( s_CharBuf ), "%s", m_pTexture->GetName() );
return s_CharBuf;
}
Q_snprintf( s_CharBuf, sizeof( s_CharBuf ), "%s", m_pTexture->GetName() );
return s_CharBuf;
case MATERIAL_VAR_TYPE_MATERIAL:
Q_snprintf( s_CharBuf, sizeof( s_CharBuf ), "%s", ( m_pMaterialValue ? m_pMaterialValue->GetName() : "" ) );
return s_CharBuf;
@@ -878,14 +870,11 @@ ITexture *CMaterialVar::GetTextureValue( void )
if( m_Type == MATERIAL_VAR_TYPE_TEXTURE )
{
if ( !IsTextureInternalEnvCubemap( m_pTexture ) )
{
retVal = static_cast<ITexture *>( m_pTexture );
}
else
{
if ( strcmp(m_pTexture->GetName(), "bitch_cubemap") == 0 )
retVal = MaterialSystem()->GetLocalCubemap();
}
else
retVal = static_cast<ITexture *>( m_pTexture );
if( !retVal )
{
static int bitchCount = 0;
@@ -945,7 +934,7 @@ void CMaterialVar::SetTextureValue( ITexture *texture )
// Avoid the garymcthack in CShaderSystem::LoadCubeMap by ensuring we're not using
// the internal env cubemap.
if ( ThreadInMainThread() && !IsTextureInternalEnvCubemap( static_cast<ITextureInternal*>( texture ) ) )
if ( ThreadInMainThread() )
{
ITextureInternal* pTexInternal = assert_cast<ITextureInternal *>( texture );
TextureManager()->RequestAllMipmaps( pTexInternal );
@@ -994,10 +983,8 @@ void CMaterialVar::SetTextureValue( ITexture *texture )
if ( !m_bFakeMaterialVar && m_pMaterial && (m_pMaterial == MaterialSystem()->GetCurrentMaterial()))
g_pShaderAPI->FlushBufferedPrimitives();
if( pTexImp && !IsTextureInternalEnvCubemap( pTexImp ) )
{
if( pTexImp )
pTexImp->IncrementReferenceCount();
}
CleanUpData();
m_pTexture = pTexImp;

View File

@@ -1,11 +1,157 @@
#ifndef MAT_STUB_H
#define MAT_STUB_H
#include "tier1/convar.h"
#include "materialsystem/itexture.h"
#include "itextureinternal.h"
// ---------------------------------------------------------------------------------------- //
// ITexture dummy implementation.
// ---------------------------------------------------------------------------------------- //
class CDummyTextureInternal : public ITextureInternal
{
public:
CDummyTextureInternal( const char *texture_name = "dummy_texture" )
{
Q_strncpy( m_szTextureName, texture_name, sizeof(m_szTextureName) );
}
virtual void Bind( Sampler_t sampler ) {};
virtual void Bind( Sampler_t sampler1, int nFrame, Sampler_t sampler2 = (Sampler_t) -1 ) { };
// Methods associated with reference counting
virtual int GetReferenceCount() { return 0; };
virtual void GetReflectivity( Vector& reflectivity ) {};
// Set this as the render target, return false for failure
virtual bool SetRenderTarget( int nRenderTargetID ) { return false; };
// Releases the texture's hw memory
virtual void ReleaseMemory() {};
// Called before Download() on restore. Gives render targets a change to change whether or
// not they force themselves to have a separate depth buffer due to AA.
virtual void OnRestore() {};
// Resets the texture's filtering and clamping mode
virtual void SetFilteringAndClampingMode( bool bOnlyLodValues = false ) {};
// Used by tools.... loads up the non-fallback information about the texture
virtual void Precache() {};
// Stretch blit the framebuffer into this texture.
virtual void CopyFrameBufferToMe( int nRenderTargetID = 0, Rect_t *pSrcRect = NULL, Rect_t *pDstRect = NULL ) {};
virtual void CopyMeToFrameBuffer( int nRenderTargetID = 0, Rect_t *pSrcRect = NULL, Rect_t *pDstRect = NULL ) {};
// Get the shaderapi texture handle associated w/ a particular frame
virtual ShaderAPITextureHandle_t GetTextureHandle( int nFrame, int nTextureChannel =0 ) { return 0; };
static void Destroy( ITextureInternal *pTexture, bool bSkipTexMgrCheck = false ) { };
// Set this as the render target, return false for failure
virtual bool SetRenderTarget( int nRenderTargetID, ITexture* pDepthTexture ) { return true; };
// Bind this to a vertex texture sampler
virtual void BindVertexTexture( VertexTextureSampler_t sampler, int frameNum = 0 ) {};
virtual void MarkAsPreloaded( bool bSet ) {};
virtual bool IsPreloaded() const { return true; };
virtual void MarkAsExcluded( bool bSet, int nDimensionsLimit ) {};
virtual bool UpdateExcludedState( void ) { return false; };
virtual bool IsTempRenderTarget( void ) const { return false; };
// Reload any files the texture is responsible for.
virtual void ReloadFilesInList( IFileList *pFilesToReload ) { };
virtual bool AsyncReadTextureFromFile( IVTFTexture* pVTFTexture, unsigned int nAdditionalCreationFlags ) { return false; };
virtual void AsyncCancelReadTexture() {};
// Map and unmap. These can fail. And can cause a very significant perf penalty. Be very careful with them.
virtual void Map( void** pOutDst, int* pOutPitch ) {};
virtual void Unmap() {};
// Texture streaming!
virtual ResidencyType_t GetCurrentResidence() const { return RESIDENT_NONE; };
virtual ResidencyType_t GetTargetResidence() const { return RESIDENT_NONE; };
virtual bool MakeResident( ResidencyType_t newResidence ) {};
virtual void UpdateLodBias() {};
// Various texture polling methods
virtual const char *GetName( void ) const { return m_szTextureName; }
virtual int GetMappingWidth() const { return 512; }
virtual int GetMappingHeight() const { return 512; }
virtual int GetActualWidth() const { return 512; }
virtual int GetActualHeight() const { return 512; }
virtual int GetNumAnimationFrames() const { return 0; }
virtual bool IsTranslucent() const { return false; }
virtual bool IsMipmapped() const { return false; }
virtual void GetLowResColorSample( float s, float t, float *color ) const {}
virtual void *GetResourceData( uint32 eDataType, size_t *pNumBytes ) const
{
return NULL;
}
// Methods associated with reference count
virtual void IncrementReferenceCount( void ) {}
virtual void DecrementReferenceCount( void ) {}
// Used to modify the texture bits (procedural textures only)
virtual void SetTextureRegenerator( ITextureRegenerator *pTextureRegen ) {}
// Reconstruct the texture bits in HW memory
// If rect is not specified, reconstruct all bits, otherwise just
// reconstruct a subrect.
virtual void Download( Rect_t *pRect = 0, int nAdditionalCreationFlags = 0 ) {}
// Uses for stats. . .get the approximate size of the texture in it's current format.
virtual int GetApproximateVidMemBytes( void ) const { return 64; }
virtual bool IsError() const { return false; }
virtual ITexture *GetEmbeddedTexture( int nIndex ) { return NULL; }
// For volume textures
virtual bool IsVolumeTexture() const { return false; }
virtual int GetMappingDepth() const { return 1; }
virtual int GetActualDepth() const { return 1; }
virtual ImageFormat GetImageFormat() const { return IMAGE_FORMAT_RGBA8888; }
virtual NormalDecodeMode_t GetNormalDecodeMode() const { return NORMAL_DECODE_NONE; }
// Various information about the texture
virtual bool IsRenderTarget() const { return false; }
virtual bool IsCubeMap() const { return false; }
virtual bool IsNormalMap() const { return false; }
virtual bool IsProcedural() const { return false; }
virtual void DeleteIfUnreferenced() {}
virtual void SwapContents( ITexture *pOther ) {}
virtual unsigned int GetFlags( void ) const { return 0; }
virtual void ForceLODOverride( int iNumLodsOverrideUpOrDown ) { NULL; }
#if defined( _X360 )
virtual bool ClearTexture( int r, int g, int b, int a ) { return true; }
virtual bool CreateRenderTargetSurface( int width, int height, ImageFormat format, bool bSameAsTexture ) { return true; }
#endif
// Save texture to a file.
virtual bool SaveToFile( const char *fileName ) { return false; }
void CopyToStagingTexture( ITexture* pDstTex ) {}
virtual void SetErrorTexture( bool bIsErrorTexture ) { }
private:
char m_szTextureName[128];
};
class CDummyTexture : public ITexture
{
public:

View File

@@ -619,10 +619,8 @@ bool CShaderDeviceMgrDx8::ComputeCapsFromD3D( HardwareCaps_t *pCaps, int nAdapte
if ( pVendorID )
{
int nVendorID = V_atoi( pVendorID ); // use V_atoi for hex support
if ( pVendorID > 0 )
{
if ( pVendorID )
ident.VendorId = nVendorID;
}
}
}

View File

@@ -32,6 +32,8 @@
//#define DEBUG_DEPTH 1
CDummyTextureInternal g_BitchCubemapTexture("bitch_cubemap");
//-----------------------------------------------------------------------------
// Lovely convars
//-----------------------------------------------------------------------------
@@ -1953,8 +1955,7 @@ void CShaderSystem::LoadTexture( IMaterialVar *pTextureVar, const char *pTexture
// Force local cubemaps when using the editor
if ( MaterialSystem()->CanUseEditorMaterials() && ( stricmp( pName, "env_cubemap" ) == 0 ) )
{
// TODO(nillerusr): should work with g_DummyTexture, but now it doesn't work
pTexture = (ITextureInternal*)-1;
pTexture = &g_BitchCubemapTexture;
}
else
{
@@ -2027,7 +2028,7 @@ void CShaderSystem::LoadCubeMap( IMaterialVar **ppParams, IMaterialVar *pTexture
{
// don't have to load anything here. . just set the texture value to DummyTexture
// special that says to use the cubemap entity.
pTextureVar->SetTextureValue( (ITexture*)-1 );
pTextureVar->SetTextureValue( &g_BitchCubemapTexture );
SetFlags2( ppParams, MATERIAL_VAR2_USES_ENV_CUBEMAP );
}
else

View File

@@ -12,6 +12,8 @@
#pragma once
#endif
#include "tier1/strtools.h"
//-----------------------------------------------------------------------------
// Purpose: Basic handler for an rgb set of colors
// This class is fully inline
@@ -22,7 +24,7 @@ public:
// constructors
Color()
{
*((int *)this) = 0;
Q_memset( _color, 0, sizeof _color );
}
Color(int _r,int _g,int _b)
{
@@ -32,7 +34,7 @@ public:
{
SetColor(_r, _g, _b, _a);
}
// set the color
// r - red component (0-255)
// g - green component (0-255)
@@ -56,19 +58,21 @@ public:
void SetRawColor( int color32 )
{
*((int *)this) = color32;
Q_memcpy( _color, &color32, sizeof _color );
}
int GetRawColor() const
{
return *((int *)this);
int color;
Q_memcpy( &color, _color, sizeof _color );
return color;
}
inline int r() const { return _color[0]; }
inline int g() const { return _color[1]; }
inline int b() const { return _color[2]; }
inline int a() const { return _color[3]; }
unsigned char &operator[](int index)
{
return _color[index];
@@ -79,12 +83,12 @@ public:
return _color[index];
}
bool operator == (const Color &rhs) const
bool operator == (const Color &rhs)
{
return ( *((int *)this) == *((int *)&rhs) );
return Q_memcmp( this, &rhs, sizeof(Color) ) == 0;
}
bool operator != (const Color &rhs) const
bool operator != (const Color &rhs)
{
return !(operator==(rhs));
}

View File

@@ -794,7 +794,10 @@ struct dfaceid_t
#if defined( _X360 )
#pragma bitfield_order( push, lsb_to_msb )
#endif
#ifdef WIN32
#pragma warning( disable:4201 ) // C4201: nonstandard extension used: nameless struct/union
#endif
struct dleaf_version_0_t
{
DECLARE_BYTESWAP_DATADESC();

View File

@@ -789,6 +789,8 @@ public:
virtual bool DisconnectAttempt( void ) = 0;
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0;
virtual void IN_TouchEvent( int type, int fingerId, int x, int y ) = 0;
};
#define CLIENT_DLL_INTERFACE_VERSION "VClient017"

View File

@@ -128,11 +128,9 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
#define ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0]))
#define SIZE_OF_ARRAY(p) _ARRAYSIZE(p)
// Normal offset of is invalid on non-array-types, this is dubious as hell. The rest of the codebase converted to the
// legit offsetof from the C headers, so we'll use the old impl here to avoid exposing temptation to others
#define _hacky_datamap_offsetof(s,m) ((size_t)&(((s *)0)->m))
#define _offsetof(s,m) ((size_t)&(((s *)0)->m))
#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance }
#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, { _offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance }
#define DEFINE_FIELD_NULL { FIELD_VOID,0, {0,0},0,0,0,0,0,0}
#define DEFINE_FIELD(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_SAVE, NULL, 0 )
#define DEFINE_KEYFIELD(name,fieldtype, mapname) _FIELD(name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0 )
@@ -144,35 +142,35 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(edict_t, name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE | FTYPEDESC_GLOBAL, #name, 0 )
#define DEFINE_GLOBAL_FIELD(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_GLOBAL | FTYPEDESC_SAVE, NULL, 0 )
#define DEFINE_GLOBAL_KEYFIELD(name,fieldtype, mapname) _FIELD(name, fieldtype, 1, FTYPEDESC_GLOBAL | FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0 )
#define DEFINE_CUSTOM_FIELD(name,datafuncs) { FIELD_CUSTOM, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, datafuncs, NULL }
#define DEFINE_CUSTOM_KEYFIELD(name,datafuncs,mapname) { FIELD_CUSTOM, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_KEY, mapname, datafuncs, NULL }
#define DEFINE_CUSTOM_FIELD(name,datafuncs) { FIELD_CUSTOM, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, datafuncs, NULL }
#define DEFINE_CUSTOM_KEYFIELD(name,datafuncs,mapname) { FIELD_CUSTOM, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_KEY, mapname, datafuncs, NULL }
#define DEFINE_AUTO_ARRAY2D(name,fieldtype) _FIELD(name, fieldtype, ARRAYSIZE2D(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, NULL, 0 )
// Used by byteswap datadescs
#define DEFINE_BITFIELD(name,fieldtype,bitcount) DEFINE_ARRAY(name,fieldtype,((bitcount+FIELD_BITS(fieldtype)-1)&~(FIELD_BITS(fieldtype)-1)) / FIELD_BITS(fieldtype) )
#define DEFINE_INDEX(name,fieldtype) _FIELD(name, fieldtype, 1, FTYPEDESC_INDEX, NULL, 0 )
#define DEFINE_EMBEDDED( name ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name.m_DataMap), sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name.m_DataMap), sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f }
#define DEFINE_EMBEDDED_OVERRIDE( name, overridetype ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &((overridetype *)0)->m_DataMap, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &((overridetype *)0)->m_DataMap, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, 0.0f }
#define DEFINE_EMBEDDEDBYREF( name ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( *(((classNameTypedef *)0)->name) ), NULL, 0, 0.0f }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( *(((classNameTypedef *)0)->name) ), NULL, 0, 0.0f }
#define DEFINE_EMBEDDED_ARRAY( name, count ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, count, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, count, FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f }
#define DEFINE_EMBEDDED_AUTO_ARRAY( name ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, SIZE_OF_ARRAY( ((classNameTypedef *)0)->name ), FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, SIZE_OF_ARRAY( ((classNameTypedef *)0)->name ), FTYPEDESC_SAVE, NULL, NULL, NULL, &(((classNameTypedef *)0)->name->m_DataMap), sizeof( ((classNameTypedef *)0)->name[0] ), NULL, 0, 0.0f }
#ifndef NO_ENTITY_PREDICTION
#define DEFINE_PRED_TYPEDESCRIPTION( name, fieldtype ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &fieldtype::m_PredMap }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &fieldtype::m_PredMap }
#define DEFINE_PRED_TYPEDESCRIPTION_PTR( name, fieldtype ) \
{ FIELD_EMBEDDED, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &fieldtype::m_PredMap }
{ FIELD_EMBEDDED, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE | FTYPEDESC_PTR, NULL, NULL, NULL, &fieldtype::m_PredMap }
#else
@@ -193,7 +191,7 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
//#define DEFINE_DATA( name, fieldextname, flags ) _FIELD(name, fieldtype, 1, flags, extname )
// INPUTS
#define DEFINE_INPUT( name, fieldtype, inputname ) { fieldtype, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_INPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, inputname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ) }
#define DEFINE_INPUT( name, fieldtype, inputname ) { fieldtype, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_INPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, inputname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ) }
#define DEFINE_INPUTFUNC( fieldtype, inputname, inputfunc ) { fieldtype, #inputfunc, { NULL, NULL }, 1, FTYPEDESC_INPUT, inputname, NULL, static_cast <inputfunc_t> (&classNameTypedef::inputfunc) }
// OUTPUTS
@@ -201,7 +199,7 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
// we know the output type from the variable itself, so it doesn't need to be specified here
class ISaveRestoreOps;
extern ISaveRestoreOps *eventFuncs;
#define DEFINE_OUTPUT( name, outputname ) { FIELD_CUSTOM, #name, { (int)_hacky_datamap_offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_OUTPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, outputname, eventFuncs }
#define DEFINE_OUTPUT( name, outputname ) { FIELD_CUSTOM, #name, { _offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_OUTPUT | FTYPEDESC_SAVE | FTYPEDESC_KEY, outputname, eventFuncs }
// replaces EXPORT table for portability and non-DLL based systems (xbox)
#define DEFINE_FUNCTION_RAW( function, func_type ) { FIELD_VOID, nameHolder.GenerateName(#function), { NULL, NULL }, 1, FTYPEDESC_FUNCTIONTABLE, NULL, NULL, (inputfunc_t)((func_type)(&classNameTypedef::function)) }

View File

@@ -76,7 +76,10 @@ enum InputEventType_t
IE_ButtonReleased, // m_nData contains a ButtonCode_t
IE_ButtonDoubleClicked, // m_nData contains a ButtonCode_t
IE_AnalogValueChanged, // m_nData contains an AnalogCode_t, m_nData2 contains the value
IE_FingerDown,
IE_FingerUp,
IE_FingerMotion,
IE_FirstSystemEvent = 100,
IE_Quit = IE_FirstSystemEvent,
IE_ControllerInserted, // m_nData contains the controller ID

View File

@@ -156,6 +156,8 @@ public:
void ActivateSteamControllerActionSet( GameActionSet_t eActionSet ) {
ActivateSteamControllerActionSetForSlot( 0xffffffffffffffff, eActionSet );
}
virtual void StartTextInput() = 0;
};

View File

@@ -20,7 +20,7 @@
#include "mathlib/vector.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include "strtools.h"
#if _DEBUG
#define BITBUF_INLINE inline
@@ -465,12 +465,12 @@ BITBUF_INLINE void bf_write::WriteUBitVar( unsigned int data )
// write raw IEEE float bits in little endian form
BITBUF_INLINE void bf_write::WriteBitFloat(float val)
{
long intVal;
int32 intVal;
Assert(sizeof(long) == sizeof(float));
Assert(sizeof(float) == 4);
intVal = *((long*)&val);
Q_memcpy( &intVal, &val, sizeof(intVal));
WriteUBitLong( intVal, 32 );
}

View File

@@ -598,7 +598,7 @@ inline void CUtlBuffer::GetObject( T *dest )
{
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
{
*dest = *(T *)PeekGet();
Q_memcpy( dest, PeekGet(), sizeof( T ) );
}
else
{
@@ -630,18 +630,18 @@ inline void CUtlBuffer::GetTypeBin( T &dest )
{
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
{
dest = *(T *)PeekGet();
Q_memcpy(&dest, PeekGet(), sizeof(T) );
}
else
{
m_Byteswap.SwapBufferToTargetEndian<T>( &dest, (T*)PeekGet() );
}
m_Get += sizeof(T);
}
m_Get += sizeof(T);
}
else
{
dest = 0;
}
}
}
template <>
@@ -661,18 +661,18 @@ inline void CUtlBuffer::GetTypeBin< float >( float &dest )
else
{
// aligned read
dest = *(float *)pData;
Q_memcpy( &dest, (void*)pData, sizeof(float) );
}
if ( m_Byteswap.IsSwappingBytes() )
{
m_Byteswap.SwapBufferToTargetEndian< float >( &dest, &dest );
}
m_Get += sizeof( float );
}
m_Get += sizeof( float );
}
else
{
dest = 0;
}
}
}
template <typename T>
@@ -816,7 +816,7 @@ inline void CUtlBuffer::PutObject( T *src )
{
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
{
*(T *)PeekPut() = *src;
Q_memcpy( PeekPut(), src, sizeof( T ) );
}
else
{
@@ -845,7 +845,7 @@ inline void CUtlBuffer::PutTypeBin( T src )
{
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
{
*(T *)PeekPut() = src;
Q_memcpy( PeekPut(), &src, sizeof( T ) );
}
else
{

View File

@@ -0,0 +1,181 @@
# It looks like shit, but I'm not particularly worried about such scripts.
import os
import re
token_list = [
re.compile(r'&&'),
re.compile(r'\|\|'),
re.compile(r'\!'),
re.compile(r'[a-zA-Z0-9_.]*')
]
match_statement = re.compile(r'\[.*\]')
def compute_statement( defines, statement ):
vars = {}
for define in defines:
d=define.split('=')[0]
vars.update({d:True})
def t( op ):
if op == '1': return True
elif op == '0': return False
elif op not in vars: return False
return vars[op]
pos = 0
statement = re.sub(r'\[|\]| |\$', '', statement)
l = []
final = True
final_init = False
while pos < len(statement):
for token in token_list:
r = token.search(statement, pos)
if r and r.start() == pos:
l += [r.group(0)]
pos = r.end()
k = 0
for i in range(len(l)):
j = i-k
if l[j] == '!' and j+1 < len(l):
df = l[j+1]
if df in vars:
vars[df] = not vars[df]
else: vars.update({df:True})
del l[j]
k += 1
k = 0
for i in range(len(l)):
j = i-k
if l[j] == '&&' and j+1 < len(l) and j-1 >= 0:
val = 0
if t(l[j-1]) and t(l[j+1]):
val = 1
del l[j+1], l[j], l[j-1]
l.insert(j, str(val))
k += 2
k = 0
for i in range(len(l)):
j = i-k
if l[j] == '||' and j+1 < len(l) and j-1 >= 0:
val = 0
if t(l[j-1]) or t(l[j+1]):
val = 1
del l[j+1], l[j], l[j-1]
l.insert(j, str(val))
k += 2
return t(l[0])
def project_key(l):
for k in l.keys():
if '$Project' in k:
return k
def fix_dos_path( path ):
path = path.replace('\\', '/')
p = path.split('/')
filename = p[-1]
find_path = '/'.join(p[0:len(p)-1])
if find_path == '': find_path = './'
else: find_path += '/'
dirlist = os.listdir(find_path)
for file in dirlist:
if file == filename:
return find_path+file
elif file.lower() == filename.lower():
return find_path+file
return find_path+filename
def parse_vpcs( env ,vpcs, basedir ):
back_path = os.path.abspath('.')
os.chdir(env.SUBPROJECT_PATH[0])
sources = []
defines = []
includes = []
for vpc in vpcs:
f=open(vpc, 'r').read().replace('\\\n', ';')
l = f.split('\n')
iBrackets = 0
next_br = False
ret = {}
cur_key = ''
for i in l:
if i == '': continue
s = match_statement.search(i)
if s and not compute_statement(env.DEFINES+defines, s.group(0)):
continue
if i.startswith('$') and iBrackets == 0:
ret.update({i:[]})
cur_key = i
next_br = True
elif i == '{':
iBrackets += 1
next_br = False
elif i == '}':
iBrackets -= 1
elif iBrackets > 0:
ret[cur_key].append(i)
if next_br:
next_br = False
key = project_key(ret)
l=ret[key]
for i in l:
if '-$File' in i and '.h"' not in i:
for k in i.split(';'):
k = k.replace('$SRCDIR', basedir)
s = fix_dos_path(k.split('"')[1])
for j in range(len(sources)):
if sources[j] == s:
del sources[j]
break
elif '$File' in i and '.h"' not in i:
for j in i.split(';'):
j = j.replace('$SRCDIR', basedir)
s = fix_dos_path(j.split('"')[1])
sources.append(s)
for i in ret['$Configuration']:
if '$PreprocessorDefinitions' in i:
i = i.replace('$BASE', '')
s = i.split('"')[1]
s = re.split(';|,', s)
for j in s:
if j != '' and j not in defines:
defines.append(j)
if '$AdditionalIncludeDirectories' in i:
i = i.replace('$BASE', '').replace('$SRCDIR', basedir)
s = i.split('"')[1]
s = re.split(';|,', s)
for j in s:
j = j.replace('\\','/')
if j != '' and j not in includes:
includes.append(j)
os.chdir(back_path)
return {'defines':defines, 'includes':includes, 'sources': sources}

View File

@@ -211,7 +211,7 @@ bool CCustomGames::CheckTagFilter( gameserveritem_t &server )
V_SplitString( m_szTagFilter, ",", TagList );
for ( int i = 0; i < TagList.Count(); i++ )
{
if ( ( Q_strnistr( server.m_szGameTags, TagList[i], MAX_TAG_CHARACTERS ) > 0 ) == TagsExclude() )
if ( ( Q_strnistr( server.m_szGameTags, TagList[i], MAX_TAG_CHARACTERS ) ) == TagsExclude() )
{
bRetVal = false;
break;

View File

@@ -1236,12 +1236,13 @@ public:
#if !defined( _X360 )
Assert( dstVertex.m_vecUserData.w == -1.0f || dstVertex.m_vecUserData.w == 1.0f );
// TODO(nillerusr): uncomment when i remove -mfpmath=387 from compiler options
//if ( nHasSIMD )
//{
// meshBuilder.FastVertexSSE( dstVertex );
//}
//else
#if 0 // FIXME(nillerusr): causing a crash, reason: misalign?
if ( nHasSIMD )
{
meshBuilder.FastVertexSSE( dstVertex );
}
else
#endif
{
meshBuilder.FastVertex( dstVertex );
}
@@ -1251,11 +1252,13 @@ public:
}
else
{
#if 0 // FIXME(nillerusr): causing a crash, reason: misalign?
if ( nHasSIMD )
{
meshBuilder.FastVertexSSE( *(ModelVertexDX7_t*)&dstVertex );
}
else
#endif
{
meshBuilder.FastVertex( *(ModelVertexDX7_t*)&dstVertex );
}

View File

@@ -28,6 +28,7 @@
#include <vgui_controls/MenuItem.h>
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
#include <inputsystem/iinputsystem.h>
enum
{
@@ -1482,7 +1483,10 @@ void TextEntry::OnMousePressed(MouseCode code)
BaseClass::OnMousePressed( code );
return;
}
if( IsEnabled() )
g_pInputSystem->StartTextInput();
// move the cursor to where the mouse was pressed
int x, y;
input()->GetCursorPos(x, y);

View File

@@ -652,6 +652,9 @@ void CConsolePanel::OnTextChanged(Panel *panel)
// see if they've hit the tilde key (which opens & closes the console)
int len = Q_strlen(m_szPartialText);
if( !len )
return;
bool hitTilde = ( m_szPartialText[len - 1] == '~' || m_szPartialText[len - 1] == '`' ) ? true : false;
bool altKeyDown = ( vgui::input()->IsKeyDown( KEY_LALT ) || vgui::input()->IsKeyDown( KEY_RALT ) ) ? true : false;
@@ -1253,4 +1256,4 @@ void CConsoleDialog::OnKeyCodePressed( vgui::KeyCode code )
{
BaseClass::OnKeyCodePressed(code);
}
}
}

View File

@@ -423,7 +423,27 @@ bool InputHandleInputEvent( const InputEvent_t &event )
}
}
break;
case IE_FingerDown:
{
//g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 );
g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED );
g_pIInput->InternalMousePressed( MOUSE_LEFT );
}
return true;
case IE_FingerUp:
{
g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED );
g_pIInput->InternalMouseReleased( MOUSE_LEFT );
}
return true;
case IE_FingerMotion:
{
//g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 );
g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 );
}
return true;
case IE_ButtonDoubleClicked:
{
// NOTE: data2 is the virtual key code (data1 contains the scan-code one)

View File

@@ -65,7 +65,7 @@ static void BuildVertMap( vertmap_t &out, const Vector *pVerts, int vertexCount,
int index = -1;
Vector tmp;
ConvertPositionToHL( &pVertList[ivpIndex], tmp);
float minDist = 1e24;
float minDist = 1e16;
for ( int k = 0; k < vertexCount; k++ )
{
float dist = (tmp-pVerts[k]).Length();

View File

@@ -592,7 +592,8 @@ void CPhysicsObject::SetMass( float mass )
}
Assert( mass > 0 );
mass = clamp( mass, 0, VPHYSICS_MAX_MASS ); // NOTE: Allow zero procedurally, but not by initialization
mass = clamp( mass, 1.f, VPHYSICS_MAX_MASS );
m_pObject->change_mass( mass );
SetVolume( m_volume );
RecomputeDragBases();
@@ -633,13 +634,17 @@ Vector CPhysicsObject::GetInvInertia( void ) const
}
void CPhysicsObject::SetInertia( const Vector &inertia )
{
IVP_U_Float_Point ri;
ConvertDirectionToIVP( inertia, ri );
IVP_U_Float_Point ri; ConvertDirectionToIVP( inertia, ri );
ri.k[0] = IVP_Inline_Math::fabsd(ri.k[0]);
ri.k[1] = IVP_Inline_Math::fabsd(ri.k[1]);
ri.k[2] = IVP_Inline_Math::fabsd(ri.k[2]);
if( ri.k[0] > 1e14f ) ri.k[0] = 1e14f; if( ri.k[1] > 1e14f ) ri.k[1] = 1e14f; if( ri.k[2] > 1e14f ) ri.k[2] = 1e14f;
if( ri.k[0] <= 0 ) ri.k[0] = 1.f; if( ri.k[1] <= 0 ) ri.k[1] = 1.f; if( ri.k[2] <= 0 ) ri.k[2] = 1.f;
m_pObject->get_core()->set_rotation_inertia( &ri );
}
@@ -1358,6 +1363,7 @@ bool CPhysicsObject::IsFluid() const
// sets the object to be hinged. Fixed it place, but able to rotate around one axis.
void CPhysicsObject::BecomeHinged( int localAxis )
{
if ( IsMoveable() )
{
float savedMass = GetMass();
@@ -1370,6 +1376,7 @@ void CPhysicsObject::BecomeHinged( int localAxis )
SetMass( VPHYSICS_MAX_MASS );
IVP_U_Float_Hesse tmp = *iri;
#if 0
for ( i = 0; i < 3; i++ )
tmp.k[i] = savedRI[i];
@@ -1394,10 +1401,10 @@ void CPhysicsObject::RemoveHinged()
void CPhysicsObject::OutputDebugInfo() const
{
Msg("-----------------\nObject: %s\n", m_pObject->get_name());
Msg("Mass: %.1f (inv %.3f)\n", GetMass(), GetInvMass() );
Msg("Mass: %.3e (inv %.3e)\n", GetMass(), GetInvMass() );
Vector inertia = GetInertia();
Vector invInertia = GetInvInertia();
Msg("Inertia: %.2f, %.2f, %.2f (inv %.3f, %.3f, %.3f)\n", inertia.x, inertia.y, inertia.z, invInertia.x, invInertia.y, invInertia.z );
Msg("Inertia: %.3e, %.3e, %.3e (inv %.3e, %.3e, %.3e)\n", inertia.x, inertia.y, inertia.z, invInertia.x, invInertia.y, invInertia.z );
Vector speed, angSpeed;
GetVelocity( &speed, &angSpeed );
@@ -1406,7 +1413,7 @@ void CPhysicsObject::OutputDebugInfo() const
float damp, angDamp;
GetDamping( &damp, &angDamp );
Msg("Damping %.2f linear, %.2f angular\n", damp, angDamp );
Msg("Damping %.3e linear, %.3e angular\n", damp, angDamp );
Msg("Linear Drag: %.2f, %.2f, %.2f (factor %.2f)\n", m_dragBasis.x, m_dragBasis.y, m_dragBasis.z, m_dragCoefficient );
Msg("Angular Drag: %.2f, %.2f, %.2f (factor %.2f)\n", m_angDragBasis.x, m_angDragBasis.y, m_angDragBasis.z, m_angDragCoefficient );
@@ -1462,8 +1469,7 @@ bool CPhysicsObject::IsAttachedToConstraint( bool bExternalOnly ) const
static void InitObjectTemplate( IVP_Template_Real_Object &objectTemplate, int materialIndex, objectparams_t *pParams, bool isStatic )
{
objectTemplate.mass = pParams->mass;
objectTemplate.mass = clamp( objectTemplate.mass, VPHYSICS_MIN_MASS, VPHYSICS_MAX_MASS );
objectTemplate.mass = clamp( pParams->mass, VPHYSICS_MIN_MASS, VPHYSICS_MAX_MASS );
if ( materialIndex >= 0 )
{
@@ -1495,8 +1501,8 @@ static void InitObjectTemplate( IVP_Template_Real_Object &objectTemplate, int ma
if ( inertia <= 0 )
inertia = 1.0;
if ( inertia > 1e18f )
inertia = 1e18f;
if ( inertia > 1e14f )
inertia = 1e14f;
objectTemplate.rot_inertia.set(inertia, inertia, inertia);
objectTemplate.rot_speed_damp_factor.set(pParams->rotdamping, pParams->rotdamping, pParams->rotdamping);

View File

@@ -1052,7 +1052,7 @@ void CShadowController::AttachObject( void )
if ( !m_allowsRotation )
{
IVP_U_Float_Point ri( 1e15f, 1e15f, 1e15f );
IVP_U_Float_Point ri( 1e14f, 1e14f, 1e14f );
pCore->set_rotation_inertia( &ri );
}
if ( !m_allowsTranslation )

View File

@@ -1231,7 +1231,7 @@ loop_without_store:
const IVP_Compact_Ledgetree_Node *node0 = node->left_son();
center.set(node0->center.k);
// if we don't insert, this is larger than any quad distance
float lastDist = 1e24f;
float lastDist = 1e16f;
if ( SweepHitsSphereOS( &center, node0->radius ) )
{
lastDist = m_rayStartOS.quad_distance_to(&center);
@@ -2073,7 +2073,7 @@ inline float Clip( const Vector &dir, const Vector &pos, const Vector &normal )
return dist / cosTheta;
// parallel or not facing the plane
return 1e24f;
return 1e16f;
}
// This is the first iteration of solving time of intersection.
@@ -2258,7 +2258,7 @@ float simplex_t::ClipRayToTriangle( const Vector &dir, float epsilon )
}
float dot = DotProduct( dir, *normals[best] );
if ( dot <= 0 )
return 1e24f;
return 1e16f;
dmin += epsilon/dot;
return dmin;

View File

@@ -174,7 +174,13 @@ void CVPhysicsParse::ParseSolid( solid_t *pSolid, IVPhysicsKeyHandler *unknownKe
}
else if ( !Q_stricmp( key, "inertia" ) )
{
pSolid->params.inertia = atof(value);
float inertia = atof(value);
if( inertia > 1e14f )
pSolid->params.inertia = 1e14f;
else if( inertia <= 0 )
pSolid->params.inertia = 1.f;
else
pSolid->params.inertia = inertia;
}
else if ( !Q_stricmp( key, "damping" ) )
{
@@ -468,7 +474,13 @@ void CVPhysicsParse::ParseVehicleWheel( vehicle_wheelparams_t &wheel )
}
else if ( !Q_stricmp( key, "inertia" ) )
{
wheel.inertia = atof( value );
float inertia = atof(value);
if( inertia > 1e14f )
wheel.inertia = 1e14f;
else if( inertia <= 0 )
wheel.inertia = 1.f;
else
wheel.inertia = inertia;
}
else if ( !Q_stricmp( key, "damping" ) )
{

View File

@@ -29,7 +29,7 @@
typedef uint16 PackFileIndex_t;
#define PACKFILEINDEX_END 0xffff
const uint16 packedfileindex_end = 0xffff;
#pragma pack(1)
struct CFilePartDescr
@@ -120,9 +120,12 @@ static int SkipFile( char const * &pData ) // returns highest file index
int nHighestChunkIndex = -1;
pData += 1 + V_strlen( pData );
pData += sizeof( uint32 );
int nMetaDataSize = *(reinterpret_cast<uint16 const *>( pData ) );
uint16 nMetaDataSize;
Q_memcpy( &nMetaDataSize, pData, sizeof( uint16 ) );
pData += sizeof( uint16 );
while ( *( ( PackFileIndex_t const *) pData ) != PACKFILEINDEX_END )
while ( Q_memcmp( pData, &packedfileindex_end, sizeof( packedfileindex_end ) ) != 0 )
{
int nIdx = reinterpret_cast<CFilePartDescr const *>(pData)->m_nFileNumber;

17
wscript
View File

@@ -112,8 +112,6 @@ projects={
]
}
@Configure.conf
def check_pkg(conf, package, uselib_store, fragment, *k, **kw):
errormsg = '{0} not available! Install {0} development package. Also you may need to set PKG_CONFIG_PATH environment variable'.format(package)
@@ -201,6 +199,9 @@ def options(opt):
grp.add_option('--use-togl', action = 'store', dest = 'GL', type = 'int', default = True,
help = 'build engine with ToGL [default: %default]')
grp.add_option('--build-games', action = 'store', dest = 'GAMES', type = 'string', default = 'hl2',
help = 'build games [default: %default]')
grp.add_option('--use-ccache', action = 'store_true', dest = 'CCACHE', default = False,
help = 'build using ccache [default: %default]')
@@ -214,7 +215,6 @@ def options(opt):
opt.load('reconfigure')
def configure(conf):
conf.load('fwgslib reconfigure')
# Force XP compability, all build targets should add
@@ -245,6 +245,7 @@ def configure(conf):
'-Winit-self',
'-Wstrict-aliasing',
'-faligned-new'
# '-Werror=strict-aliasing'
]
c_compiler_optional_flags = [
@@ -267,9 +268,15 @@ def configure(conf):
]
if conf.env.DEST_CPU == 'arm':
flags += ['-mfpu=neon', '-fsigned-char']
flags += ['-fsigned-char', '-mfpu=neon']
if conf.env.DEST_OS == 'android':
flags += ['-mcpu=cortex-a15', '-mtune=cortex-a15']
else:
flags += ['-march=native', '-mtune=native']
else:
flags += ['-march=pentium4','-mtune=core2','-mfpmath=387']
flags += ['-march=native','-mtune=native','-mfpmath=sse', '-msse', '-msse2']
cflags += flags
linkflags += flags