diff --git a/build.cpp b/build.cpp index 46a3a59..8ec7822 100755 --- a/build.cpp +++ b/build.cpp @@ -33,7 +33,7 @@ DECLARE_BUILD_STAGE(install_game) filesystem2->CopyFile(szOutputDir, GET_PROJECT_OBJECT(rapier, "physics")); } if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { - filesystem2->CopyFile(szOutputDir, EXTERNAL"steamworks/redistributable_bin/linux64/libsteam_api.so"); + filesystem2->CopyFile(szOutputDir, GET_PROJECT_OBJECT(config, "steam_lib")); } filesystem2->CopyFile(szOutputDir, GET_PROJECT_OBJECT(launcher, "launcher")); filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/models"); diff --git a/buildcfg.cpp b/buildcfg.cpp index ed87c78..19f2808 100644 --- a/buildcfg.cpp +++ b/buildcfg.cpp @@ -1,6 +1,7 @@ #include "helper.h" #include "tier0/commandline.h" +#define EXTERNAL "external/" DECLARE_BUILD_STAGE(config) { if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_IOS) @@ -10,8 +11,20 @@ DECLARE_BUILD_STAGE(config) } else { + if (Target_t::DefaultTarget().GetTriplet() == "x86_64-unknown-linux") + { + ADD_OUTPUT_VALUE("steam", "true"); + ADD_OUTPUT_OBJECT("steam_lib", EXTERNAL"steamworks/redistributable_bin/linux64/libsteam_api.so"); + } + else if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_WINDOWS) + { + ADD_OUTPUT_VALUE("steam", "true"); + ADD_OUTPUT_OBJECT("steam_lib", EXTERNAL"steamworks/redistributable_bin/win64/steam_api64.dll"); + } + else { + ADD_OUTPUT_VALUE("steam", "false"); + } ADD_OUTPUT_VALUE("static", "false"); - ADD_OUTPUT_VALUE("steam", "true"); } ADD_OUTPUT_VALUE("static", "true"); return 0; diff --git a/engine/build.cpp b/engine/build.cpp index 8bcb34a..2d0b037 100644 --- a/engine/build.cpp +++ b/engine/build.cpp @@ -47,14 +47,13 @@ DECLARE_BUILD_STAGE(engine) } else { - if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { - ldProject.libraryDirectories.AppendTail(EXTERNAL"steamworks/redistributable_bin/linux64"); - ldProject.libraries.AppendTail("steam_api"); - } ldProject.linkType = ELINK_DYNAMIC_LIBRARY; ldProject.libraryObjects = { GET_PROJECT_LIBRARY(tier0, "tier0"), }; + if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { + ldProject.libraryObjects.AppendTail(GET_PROJECT_OBJECT(config, "steam_lib")); + } ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier1, "tier1")}); ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier2, "tier2")}); } @@ -72,7 +71,6 @@ DECLARE_BUILD_STAGE(engine) ldProject.libraries.AppendTail("version"); ldProject.libraries.AppendTail("shell32"); ldProject.libraries.AppendTail("uuid"); - }; CUtlString outputProject = linker->Link(&ldProject); diff --git a/engine/cl_dll.cpp b/engine/cl_dll.cpp index cee6158..7072e6e 100644 --- a/engine/cl_dll.cpp +++ b/engine/cl_dll.cpp @@ -9,14 +9,8 @@ void CClientGameDLL::Init() { void *pLib; -#ifdef __linux - pLib = Plat_LoadLibrary("libclient.so"); -#endif - if (!pLib) - Plat_FatalErrorFunc("Failed to load server library\n"); - m_pLibrary = pLib; - CreateInterfaceFn pfnServerFactory = Sys_GetFactory(pLib); + CreateInterfaceFn pfnServerFactory = Sys_GetFactory("client"); IEngineBridge *pEngineBridge = (IEngineBridge*)pfnServerFactory(ENGINE_BRIDGE_INTERFACE_VERSION, NULL); pEngineBridge->ConnectInterface(FILESYSTEM_INTERFACE_VERSION, filesystem); diff --git a/engine/engine.cpp b/engine/engine.cpp index 1439ccf..8581aa2 100644 --- a/engine/engine.cpp +++ b/engine/engine.cpp @@ -38,10 +38,20 @@ extern "C" void __cdecl SteamAPIDebug( ESteamNetworkingSocketsDebugOutputType nT extern "C" void FunnyMain( int argc, char **argv ) { +#ifdef __WIN32__ + CUtlString szPath = Plat_GetExecutablePath(); + szPath = szPath.GetDirectory(); + CUtlString szEnv = Plat_GetEnv("PATH"); + szEnv.AppendTail(":"); + szEnv.AppendTail(szPath); + Plat_SetEnv("PATH", szEnv); +#endif CommandLine()->CreateCommandLine(argc, argv); EngineConsts_t stConstants = {}; + V_printf("------------ 1\n"); #ifdef STEAM + V_printf("Steam :)\n"); if(SteamAPI_RestartAppIfNecessary(480)) { V_printf("Mshallah we are doing reboot\n"); @@ -51,6 +61,7 @@ extern "C" void FunnyMain( int argc, char **argv ) stConstants.m_bIsSteam = true; if (!SteamAPI_Init()) { + V_printf("Steam :()\n"); stConstants.m_bIsSteam = false; } stConstants.LaunchServer = LaunchServerAtSteamRelay; diff --git a/game/client/baseanimating.cpp b/game/client/baseanimating.cpp new file mode 100644 index 0000000..e69de29 diff --git a/game/client/baseanimating.h b/game/client/baseanimating.h new file mode 100644 index 0000000..e69de29 diff --git a/game/client/build.cpp b/game/client/build.cpp index a6bb246..3e59fc2 100644 --- a/game/client/build.cpp +++ b/game/client/build.cpp @@ -16,6 +16,7 @@ DECLARE_BUILD_STAGE(Client) compileProject.m_szName = "client"; compileProject.files = { "../shared/game.cpp", + "../shared/boneanimation.cpp", "game.cpp", "userinput.cpp", @@ -50,16 +51,23 @@ DECLARE_BUILD_STAGE(Client) } else { - if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { - ldProject.libraryDirectories.AppendTail(EXTERNAL"steamworks/redistributable_bin/linux64"); - ldProject.libraries.AppendTail("steam_api"); - } ldProject.linkType = ELINK_DYNAMIC_LIBRARY; ldProject.libraryObjects = { GET_PROJECT_LIBRARY(tier0, "tier0"), }; ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier1, "tier1")}); ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier2, "tier2")}); + + if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { + ldProject.libraryObjects.AppendTail(GET_PROJECT_OBJECT(config, "steam_lib")); + } + + if (ldProject.m_target.kernel & TARGET_KERNEL_WINDOWS_DEVICES) + { + ldProject.libraryDirectories.AppendTail(EXTERNAL"windows"); + ldProject.libraries.AppendTail("winpthread-1"); + ldProject.libraries.AppendTail("ws2_32"); + } } diff --git a/game/client/entitysystem.cpp b/game/client/entitysystem.cpp index b354ee6..859fde8 100644 --- a/game/client/entitysystem.cpp +++ b/game/client/entitysystem.cpp @@ -185,9 +185,6 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket ) { case MESSAGE_ENTITY_CLASS_SYNC: - V_printf("MESSAGE_ENTITY_CLASS_SYNC: %u = %s\n", - (uint32_t)pPlayerPacket->m_entityClass.m_uIndex, - pPlayerPacket->m_entityClass.m_szEntityName); pEntity = CreateByClassnameWithIndex( (char*)pPlayerPacket->m_entityClass.m_szEntityName, pPlayerPacket->m_entityClass.m_uIndex @@ -226,7 +223,6 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket ) } break; case k_EMessage_PlayerSetLocalEntity: - V_printf("k_EMessage_PlayerSetLocalEntity: %u\n",(uint32_t)pPlayerPacket->m_setLocalEntity.m_uIndex); if (pPlayerPacket->m_setLocalEntity.m_uIndex > MAX_EDICTS) break; s_pLocalEntity = m_pEntities[pPlayerPacket->m_setLocalEntity.m_uIndex]; @@ -235,9 +231,74 @@ void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket ) } } -void CEntitySystem::NetSendThink() +void CEntitySystem::NetSendThink( INetworkBase *pBase ) { + C_BaseEntity *pEntity; + int i; + uint32_t u; + uint32_t x; + uint32_t uSize; + netmap_t *pNetMap; + void *pData; + union { + void *pCurrentData; + char *pcCurrentData; + EntityDataSync_t *pSync; + EntityDataSyncValue_t *pValue; + }; + pEntity = UTIL_GetLocalPlayer(); + if ( pEntity == NULL ) + return; + + pNetMap = pEntity->GetSendMap(); + uSize = sizeof(EntityDataSyncValue_t); + x = 0; + while ( pNetMap ) + { + for ( u = 0; u < pNetMap->m_uFieldCount; u++ ) + { + x++; + uSize += (pNetMap->m_pFields[u].m_uSize+7) & ~7; + uSize += sizeof(EntityDataSyncValue_t); + } + pNetMap = pNetMap->m_pBase; + } + pData = V_malloc(uSize); + V_memset(pData, 0, uSize); + pCurrentData = pData; + pSync->m_eType = MESSAGE_ENTITY_DATA_SYNC; + for ( i = 0; i < MAX_EDICTS; i++ ) + { + if ( m_pEntities[i] != pEntity ) + continue; + pSync->m_uIndex = i; + break; + } + pSync->m_uCount = x; + + pcCurrentData += sizeof(EntityDataSync_t); + pNetMap = pEntity->GetSendMap(); + x = 0; + while ( pNetMap ) + { + for ( u = 0; u < pNetMap->m_uFieldCount; u++ ) + { + pValue->m_uVariableSize = pNetMap->m_pFields[u].m_uSize; + pValue->m_uVariableIndex = x; + uint32_t uVariableSize; + pcCurrentData += sizeof(EntityDataSyncValue_t); + V_memcpy(pcCurrentData, + pNetMap->m_pFields[u].m_uOffset+(char*)pEntity, + pNetMap->m_pFields[u].m_uSize); + pcCurrentData += (pNetMap->m_pFields[u].m_uSize+7) & ~7; + x++; + } + pNetMap = pNetMap->m_pBase; + } + if (pBase) + pBase->SendPacket({pData, uSize}); + V_free(pData); } diff --git a/game/client/entitysystem.h b/game/client/entitysystem.h index be26587..a6da98b 100644 --- a/game/client/entitysystem.h +++ b/game/client/entitysystem.h @@ -32,7 +32,7 @@ public: virtual void Think(); virtual void NetRecvPacket( NetPacket_t *pPacket ); - virtual void NetSendThink(); + virtual void NetSendThink( INetworkBase *pBase ); virtual C_BaseEntity **GetEntities(); private: diff --git a/game/client/game.cpp b/game/client/game.cpp index a5fd226..b875e60 100644 --- a/game/client/game.cpp +++ b/game/client/game.cpp @@ -25,6 +25,7 @@ class CFunnyGameBridge: public IEngineBridge bool m_bIsConnectedToSteamRelay; bool m_bIsConnectedToServer; + float m_fNetUpdateTimer; }; @@ -151,6 +152,15 @@ void CFunnyGameBridge::Frame( float fDelta ) } EntitySystem()->Think(); + + float fTickRate = 1.0/60.0; + m_fNetUpdateTimer += fDelta; + while (m_fNetUpdateTimer >= fTickRate) + { + m_fNetUpdateTimer-=fTickRate; + if (pCurrentServer) + EntitySystem()->NetSendThink(pCurrentServer); + } g_pWorldRenderer->Frame(fDelta); } diff --git a/game/client/milmoba/player.cpp b/game/client/milmoba/player.cpp index d628a68..60de039 100644 --- a/game/client/milmoba/player.cpp +++ b/game/client/milmoba/player.cpp @@ -14,18 +14,20 @@ void C_MOBAPlayer::Spawn() BaseClass::Spawn(); SetThink(Think); SetScale(1); + vCameraPos = {0,0,-20}; }; void C_MOBAPlayer::Think( float fDelta ) { C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer(); + + + m_vMovementVector.x = m_bIsForward - m_bIsBack; + if (pEntity == this) { - Vector vCameraPos = GetAbsOrigin(); - vCameraPos.z += -20; g_pWorldRenderer->SetCameraPosition(vCameraPos); - } BaseClass::Think(fDelta); }; @@ -37,16 +39,48 @@ END_DATADESC() IMPLEMENT_RECV_DT(C_MOBAPlayer) END_RECV_DT() -IMPLEMENT_EMPTY_SEND_DT(C_MOBAPlayer) + +IMPLEMENT_SEND_DT(C_MOBAPlayer) + NetPropFloat3(m_vMovementVector), +END_SEND_DT() static void IN_ForwardDown( int c, char **v ) { - V_printf("+forward\n"); - + C_BaseEntity *pPlayer = UTIL_GetLocalPlayer(); + if (!pPlayer) + return; + if (!dynamic_cast(pPlayer)) + return; + ((C_MOBAPlayer*)pPlayer)->m_bIsForward = true; } static ConCommand startforward("+forward", IN_ForwardDown); static void IN_ForwardUp( int c, char **v ) { - V_printf("-forward\n"); + C_BaseEntity *pPlayer = UTIL_GetLocalPlayer(); + if (!pPlayer) + return; + if (!dynamic_cast(pPlayer)) + return; + ((C_MOBAPlayer*)pPlayer)->m_bIsForward = false; } static ConCommand endforward("-forward", IN_ForwardUp); + +static void IN_BackDown( int c, char **v ) { + C_BaseEntity *pPlayer = UTIL_GetLocalPlayer(); + if (!pPlayer) + return; + if (!dynamic_cast(pPlayer)) + return; + ((C_MOBAPlayer*)pPlayer)->m_bIsBack = true; +} +static ConCommand startback("+back", IN_BackDown); + +static void IN_BackUp( int c, char **v ) { + C_BaseEntity *pPlayer = UTIL_GetLocalPlayer(); + if (!pPlayer) + return; + if (!dynamic_cast(pPlayer)) + return; + ((C_MOBAPlayer*)pPlayer)->m_bIsBack = false; +} +static ConCommand endback("-back", IN_BackUp); diff --git a/game/client/milmoba/player.h b/game/client/milmoba/player.h index 8a65412..4842574 100644 --- a/game/client/milmoba/player.h +++ b/game/client/milmoba/player.h @@ -15,9 +15,18 @@ public: virtual void Spawn( void ) override; void Think( float fDelta ); + bool m_bIsForward = 0; + bool m_bIsBack = 0; + bool m_bIsLeft = 0; + bool m_bIsRight = 0; + int m_bIsShooting; float m_fFBWalkingDirection; float m_fLRWalkingDirection; + + Vector m_vMovementVector; + Vector m_vLocalMovementVector; + Vector vCameraPos; }; #endif diff --git a/game/server/baseentity.h b/game/server/baseentity.h index cafa532..a554f81 100644 --- a/game/server/baseentity.h +++ b/game/server/baseentity.h @@ -52,10 +52,12 @@ public: DECLARE_DATADESC_NOBASE() DECLARE_SERVERCLASS_NOBASE() + typedescription_t *FindDataByName( const char *szName ); typedescription_t *FindDataByMapName( const char *szName ); const char *GetClassName(); + void SetNetworkOwner( uint64_t ullPlayer ); virtual ~CBaseEntity(); virtual void Precache(); @@ -77,6 +79,7 @@ public: fnThink m_pfnThink = NULL; const char *m_szClassName; + uint64_t m_ullOwner; private: Vector m_vPosition; Quat m_vRotation; diff --git a/game/server/build.cpp b/game/server/build.cpp index 7f0362c..0ff55ff 100644 --- a/game/server/build.cpp +++ b/game/server/build.cpp @@ -17,6 +17,7 @@ DECLARE_BUILD_STAGE(Server) compileProject.m_szName = "server"; compileProject.files = { "../shared/game.cpp", + "../shared/boneanimation.cpp", "game.cpp", "assetmgr.cpp", @@ -46,16 +47,32 @@ DECLARE_BUILD_STAGE(Server) } else { - if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { - ldProject.libraryDirectories.AppendTail(EXTERNAL"steamworks/redistributable_bin/linux64"); - ldProject.libraries.AppendTail("steam_api"); - } ldProject.linkType = ELINK_DYNAMIC_LIBRARY; ldProject.libraryObjects = { GET_PROJECT_LIBRARY(tier0, "tier0"), }; ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier1, "tier1")}); ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier2, "tier2")}); + + if ( GET_PROJECT_VALUE(config, "steam") == "true" ) { + ldProject.libraryObjects.AppendTail(GET_PROJECT_OBJECT(config, "steam_lib")); + } + + if (ldProject.m_target.kernel & TARGET_KERNEL_WINDOWS_DEVICES) + { + ldProject.libraryDirectories.AppendTail(EXTERNAL"windows"); + ldProject.libraries.AppendTail("winpthread-1"); + ldProject.libraries.AppendTail("ws2_32"); + ldProject.libraries.AppendTail("winmm"); + ldProject.libraries.AppendTail("ole32"); + ldProject.libraries.AppendTail("gdi32"); + ldProject.libraries.AppendTail("oleaut32"); + ldProject.libraries.AppendTail("setupapi"); + ldProject.libraries.AppendTail("imm32"); + ldProject.libraries.AppendTail("version"); + ldProject.libraries.AppendTail("shell32"); + ldProject.libraries.AppendTail("uuid"); + }; } if (ldProject.m_target.kernel & TARGET_KERNEL_WINDOWS_DEVICES) diff --git a/game/server/entitysystem.cpp b/game/server/entitysystem.cpp index 78f3a30..d146ebd 100644 --- a/game/server/entitysystem.cpp +++ b/game/server/entitysystem.cpp @@ -132,12 +132,78 @@ void CEntitySystem::Think() } } +static void *UTIL_GetNetMapData(CBaseEntity *pEntity, netmap_t *pMap, uint32_t uIndex ) +{ + netmap_t *pCurrentMap = pMap; + uint32_t uCurrentIndex = uIndex; +searchIndex: + if ( uCurrentIndex < pCurrentMap->m_uFieldCount ) + { + return (char*)pEntity+pCurrentMap->m_pFields[uCurrentIndex].m_uOffset; + } + uCurrentIndex -= pCurrentMap->m_uFieldCount; + pCurrentMap = pCurrentMap->m_pBase; + if (!pCurrentMap) + return NULL; + goto searchIndex; + +} + +void CEntitySystem::NetRecvPacket( NetPacket_t *pPacket ) +{ + PlayerPacket_t *pPlayerPacket = (PlayerPacket_t*)pPacket->pData; + CBaseEntity *pEntity; + switch (pPlayerPacket->m_eType) + { + case MESSAGE_ENTITY_DATA_SYNC: + if ( pPlayerPacket->m_entityData.m_uIndex >= MAX_EDICTS ) + break; + + pEntity = m_pEntities[pPlayerPacket->m_entityData.m_uIndex]; + + // check for owner being moron + if ( pEntity == NULL ) + break; + if ( pEntity->m_ullOwner != pPacket->m_uOwner) + break; + + union { + void *pData; + char *pcCurrentData; + EntityDataSyncValue_t *pcSyncValue; + }; + + pData = pPlayerPacket; + pcCurrentData += sizeof(EntityDataSync_t); + + // too bad + // this shall be reworked + for ( uint32_t u = 0; u < pPlayerPacket->m_entityData.m_uCount; u++ ) + { + + uint32_t uVariableSize = pcSyncValue->m_uVariableSize; + void *pValueData = (float*)UTIL_GetNetMapData( + pEntity, + pEntity->GetRecvMap(), + pcSyncValue->m_uVariableIndex); + + pcCurrentData += sizeof(EntityDataSyncValue_t); + if (pValueData) + V_memcpy(pValueData, pcCurrentData, uVariableSize); + pcCurrentData += (uVariableSize+7) & ~7; + } + break; + default: + break; + } +} + //------------------------------------------------------------------------------- // Purpose: Sends packets to clients. // Since we are running this on server we can't really accept any packet. // We only allow packets from the entities sent by a client //------------------------------------------------------------------------------- -void CEntitySystem::NetThink( INetworkBase *pBase ) +void CEntitySystem::NetSendThink( INetworkBase *pBase ) { CBaseEntity *pEntity; @@ -159,9 +225,6 @@ void CEntitySystem::NetThink( INetworkBase *pBase ) pEntity = m_pEntities[i]; if ( pEntity == NULL ) continue; - - if ( !pEntity->m_pfnThink ) - continue; pNetMap = pEntity->GetSendMap(); uSize = sizeof(EntityDataSyncValue_t); @@ -202,10 +265,9 @@ void CEntitySystem::NetThink( INetworkBase *pBase ) } pNetMap = pNetMap->m_pBase; } - if (g_pCurrentConnection) - g_pCurrentConnection->SendPacket({pData, uSize}); + if (pBase) + pBase->SendPacket({pData, uSize}); V_free(pData); - } } @@ -213,3 +275,16 @@ CBaseEntity **CEntitySystem::GetEntities() { return m_pEntities; } + +void CEntitySystem::SetAllowedEntityForPlayer( uint64_t ullPlayer, CBaseEntity *pEntity ) +{ + if (pEntity) + { + + + } + else + { + + } +} diff --git a/game/server/entitysystem.h b/game/server/entitysystem.h index 99f89bf..160df08 100644 --- a/game/server/entitysystem.h +++ b/game/server/entitysystem.h @@ -25,8 +25,11 @@ public: virtual IEntityFactory *GetFactoryByClassname( const char *szName ); virtual void Think(); - virtual void NetThink( INetworkBase *pBase ); virtual CBaseEntity **GetEntities(); + + virtual void NetRecvPacket( NetPacket_t *pPacket ); + virtual void NetSendThink( INetworkBase *pBase ); + virtual void SetAllowedEntityForPlayer( uint64_t ullPlayer, CBaseEntity *pEntity ); private: CBaseEntity *m_pEntities[MAX_EDICTS]; int m_nEntityCount; diff --git a/game/server/game.cpp b/game/server/game.cpp index 788ff83..167b7c5 100644 --- a/game/server/game.cpp +++ b/game/server/game.cpp @@ -68,6 +68,7 @@ uint32_t NET_ServerCallback( NetCallback_t *pCallback ) CBaseEntity *pEntity; pEntity = EntitySystem()->CreateByClassname("player", &iIndex); pEntity->Spawn(); + pEntity->m_ullOwner = pCallback->m_ullUserConnection; SetLocalEntity_t stLocalEntity = { k_EMessage_PlayerSetLocalEntity, @@ -150,9 +151,9 @@ void NET_ProcessPacket( INetworkBase *pBase ) int iIndex = -1; V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName); - pEntity = EntitySystem()->CreateByClassname("player", &iIndex); pEntity->Spawn(); + pEntity->m_ullOwner = 0; SetLocalEntity_t stLocalEntity = { k_EMessage_PlayerSetLocalEntity, @@ -162,7 +163,11 @@ void NET_ProcessPacket( INetworkBase *pBase ) g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), 0, PACKET_MUST_ARRIVE}); } return; + case MESSAGE_ENTITY_DATA_SYNC: + EntitySystem()->NetRecvPacket(&packet); + pBase->RecievePacket(); default: + pBase->RecievePacket(); break; } pBase->RecievePacket(); @@ -204,7 +209,7 @@ void CFunnyGameBridge::Frame( float fDelta ) { g_pPhysicsWorld->Frame(fTickRate); EntitySystem()->Think(); - EntitySystem()->NetThink(g_pCurrentConnection); + EntitySystem()->NetSendThink(g_pCurrentConnection); } } diff --git a/game/server/milmoba/player.cpp b/game/server/milmoba/player.cpp index f0392f5..3c018ca 100644 --- a/game/server/milmoba/player.cpp +++ b/game/server/milmoba/player.cpp @@ -14,6 +14,7 @@ void CMOBAPlayer::Spawn() void CMOBAPlayer::Think( float fDelta ) { + V_printf("%f %f %f\n", m_vMovementVector.x, m_vMovementVector.y, m_vMovementVector.z); CPhysicsProp::Think(fDelta); }; @@ -25,4 +26,6 @@ END_DATADESC() IMPLEMENT_SEND_DT(CMOBAPlayer) END_SEND_DT() -IMPLEMENT_EMPTY_RECV_DT(CMOBAPlayer) +IMPLEMENT_RECV_DT(CMOBAPlayer) + NetPropFloat3(m_vMovementVector) +END_RECV_DT() diff --git a/game/server/milmoba/player.h b/game/server/milmoba/player.h index dc288bd..f578bc9 100644 --- a/game/server/milmoba/player.h +++ b/game/server/milmoba/player.h @@ -12,6 +12,8 @@ public: virtual void Spawn( void ) override; void Think( float fDelta ); +private: + Vector m_vMovementVector = {}; }; #endif diff --git a/game/shared/boneanimation.cpp b/game/shared/boneanimation.cpp new file mode 100644 index 0000000..e69de29 diff --git a/game/shared/boneanimation.h b/game/shared/boneanimation.h new file mode 100644 index 0000000..01341c0 --- /dev/null +++ b/game/shared/boneanimation.h @@ -0,0 +1,15 @@ +#ifndef BONE_ANIMATION_H +#define BONE_ANIMATION_H + +class CBones +{ + +}; + +class CBoneAnimator +{ +public: + virtual CBones *CreateBones(); +}; + +#endif diff --git a/game/shared/netprotocol.h b/game/shared/netprotocol.h index ea92465..42fac93 100644 --- a/game/shared/netprotocol.h +++ b/game/shared/netprotocol.h @@ -3,7 +3,7 @@ #include "stdint.h" -#include +#include "tier0/network.h" class CNetworkUInt32 { diff --git a/launcher/build.cpp b/launcher/build.cpp index 435bff3..6950975 100644 --- a/launcher/build.cpp +++ b/launcher/build.cpp @@ -17,10 +17,10 @@ DECLARE_BUILD_STAGE(launcher) { CProject_t compileProject = {}; LinkProject_t ldProject = {}; - compileProject.m_szName = "launcher"; compileProject.files = {"launcher.cpp"}; compileProject.includeDirectories = {"../external/SDL/include"}; + compileProject.m_target = Target_t::DefaultTarget(); ldProject = ccompiler->Compile(&compileProject); ldProject.linkType = ELINK_EXECUTABLE; if (compileProject.m_target.kernel == TARGET_KERNEL_IOS) diff --git a/launcher/launcher.cpp b/launcher/launcher.cpp index 486fcae..23778cb 100644 --- a/launcher/launcher.cpp +++ b/launcher/launcher.cpp @@ -95,6 +95,8 @@ int main( int argc, char **argv ) { printf("Symbol not found: FunnyMain\n"); } dirname(szLauncherPath); + + SetCurrentDirectoryA(szLauncherPath); pEngineMain(argc, argv); #endif diff --git a/materialsystem/vulkan/commands/draw.cpp b/materialsystem/vulkan/commands/draw.cpp index d80fefa..b96ec93 100644 --- a/materialsystem/vulkan/commands/draw.cpp +++ b/materialsystem/vulkan/commands/draw.cpp @@ -114,9 +114,9 @@ DECLARE_VULKAN_COMMAND(SetViewport) { VkViewport v = { fX, - fY+fHeight, + fY, fWidth, - -fHeight, + fHeight, fDepthMin, fDepthMax }; diff --git a/rapier/.cargo/config.toml b/rapier/.cargo/config.toml new file mode 100644 index 0000000..bef9fdf --- /dev/null +++ b/rapier/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.x86_64-pc-windows-gnu] +rustflags = ["-C", "target-feature=+crt-static"] + +[target.aarch64-apple-ios] +rustflags = ["-C", "link-arg=-mios-version-min=13.0"] diff --git a/rapier/Cargo.toml b/rapier/Cargo.toml index 338fa2b..8d53fdc 100644 --- a/rapier/Cargo.toml +++ b/rapier/Cargo.toml @@ -3,8 +3,6 @@ name = "rapier_rtt" version = "0.1.0" edition = "2021" -[target.aarch64-apple-ios] -rustflags = ["-C", "link-arg=-mios-version-min=13.0"] [lib] crate-type = ["staticlib"] diff --git a/rapier/build.cpp b/rapier/build.cpp index 5cd5530..62769a7 100644 --- a/rapier/build.cpp +++ b/rapier/build.cpp @@ -53,6 +53,25 @@ DECLARE_BUILD_STAGE(rapier) linkProject.linkType = ELINK_DYNAMIC_LIBRARY; linkProject.objects.AppendTail({rapier_lib}); linkProject.objects.AppendTail({GET_PROJECT_OBJECT(tier1, "tier1")}); + linkProject.libraryObjects.AppendTail(GET_PROJECT_OBJECT(tier0, "tier0")); + + if (linkProject.m_target.kernel & TARGET_KERNEL_WINDOWS_DEVICES) + { + linkProject.libraryDirectories.AppendTail(EXTERNAL"windows"); + linkProject.libraries.AppendTail("winpthread-1"); + linkProject.libraries.AppendTail("ws2_32"); + linkProject.libraries.AppendTail("ntdll"); + linkProject.libraries.AppendTail("userenv"); + linkProject.libraries.AppendTail("winmm"); + linkProject.libraries.AppendTail("ole32"); + linkProject.libraries.AppendTail("gdi32"); + linkProject.libraries.AppendTail("oleaut32"); + linkProject.libraries.AppendTail("setupapi"); + linkProject.libraries.AppendTail("imm32"); + linkProject.libraries.AppendTail("version"); + linkProject.libraries.AppendTail("shell32"); + linkProject.libraries.AppendTail("uuid"); + }; CUtlString sz_libRapierPhysics = linker->Link(&linkProject); ADD_OUTPUT_OBJECT("physics", sz_libRapierPhysics); diff --git a/rapier/physics.rs b/rapier/physics.rs index 3d6aaed..ae13914 100644 --- a/rapier/physics.rs +++ b/rapier/physics.rs @@ -146,7 +146,7 @@ pub unsafe extern "C" fn CRapierPhysicsBody_GetRotation( this: *mut RapierPhysic #[no_mangle] pub unsafe extern "C" fn CRapierPhysicsWorld_Frame( this: *mut RapierWorld_t, fDelta: f32 ) { - let vGravity = vec3(0.0, -0.0, 0.0); + let vGravity = vec3(0.0, -9.8, 0.0); let mut integrationParameters = IntegrationParameters::default(); integrationParameters.dt = fDelta; let mut physicsPipeline = PhysicsPipeline::new();