added keybinds
This commit is contained in:
@@ -41,6 +41,7 @@ DECLARE_BUILD_STAGE(install_game)
|
|||||||
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/materials");
|
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/materials");
|
||||||
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/textures");
|
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/textures");
|
||||||
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/physics");
|
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/physics");
|
||||||
|
filesystem2->CopyFile(CUtlString("%s/core/",szOutputDir.GetString()), "funnyassets/default.cfg");
|
||||||
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "build/funnygame/assets/shaders");
|
filesystem2->CopyDirectory(CUtlString("%s/core/",szOutputDir.GetString()), "build/funnygame/assets/shaders");
|
||||||
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_WINDOWS)
|
if (Target_t::DefaultTarget().kernel == TARGET_KERNEL_WINDOWS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ void IConsole_Exec( int argc, char **argv)
|
|||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
V_printf("exec %s\n", argv[1]);
|
||||||
|
|
||||||
IFileHandle *f = filesystem->Open(argv[1], FILEMODE_READ);
|
IFileHandle *f = filesystem->Open(argv[1], FILEMODE_READ);
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ extern "C" void FunnyMain( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Console()->Execute();
|
||||||
double fPrevious = Plat_GetTime();
|
double fPrevious = Plat_GetTime();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
@@ -108,6 +109,7 @@ extern "C" void FunnyMain( int argc, char **argv )
|
|||||||
double fDelta = fCurrent-fPrevious;
|
double fDelta = fCurrent-fPrevious;
|
||||||
fPrevious = fCurrent;
|
fPrevious = fCurrent;
|
||||||
|
|
||||||
|
|
||||||
g_pHumanDeviceManager->Frame();
|
g_pHumanDeviceManager->Frame();
|
||||||
g_pServerGame->m_pBridge->Frame(fDelta);
|
g_pServerGame->m_pBridge->Frame(fDelta);
|
||||||
|
|
||||||
@@ -118,6 +120,8 @@ extern "C" void FunnyMain( int argc, char **argv )
|
|||||||
g_pRenderContext->Frame(fDelta);
|
g_pRenderContext->Frame(fDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console()->Execute();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ VS
|
|||||||
output.m_vScreenPosition,
|
output.m_vScreenPosition,
|
||||||
g_modelData[uInstance].m_matTranslation
|
g_modelData[uInstance].m_matTranslation
|
||||||
);
|
);
|
||||||
|
|
||||||
output.m_vScreenPosition = mul(
|
output.m_vScreenPosition = mul(
|
||||||
output.m_vScreenPosition,
|
output.m_vScreenPosition,
|
||||||
g_matViewProjection
|
g_matViewProjection
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ DECLARE_BUILD_STAGE(Client)
|
|||||||
"../shared/game.cpp",
|
"../shared/game.cpp",
|
||||||
|
|
||||||
"game.cpp",
|
"game.cpp",
|
||||||
|
"userinput.cpp",
|
||||||
|
|
||||||
"baseentity.cpp",
|
"baseentity.cpp",
|
||||||
"basemodelentity.cpp",
|
"basemodelentity.cpp",
|
||||||
|
|||||||
@@ -6,10 +6,8 @@
|
|||||||
#include "entitysystem.h"
|
#include "entitysystem.h"
|
||||||
#include "baseentity.h"
|
#include "baseentity.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "cglm/mat4.h"
|
|
||||||
#include "cglm/cglm.h"
|
|
||||||
#include "inetworkclient.h"
|
|
||||||
#include "netprotocol.h"
|
#include "netprotocol.h"
|
||||||
|
#include "userinput.h"
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
#include "steam/isteamgameserver.h"
|
#include "steam/isteamgameserver.h"
|
||||||
#include "steam/steam_gameserver.h"
|
#include "steam/steam_gameserver.h"
|
||||||
@@ -29,34 +27,6 @@ class CFunnyGameBridge: public IEngineBridge
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CFunnyInput: public IHumanDeviceInput
|
|
||||||
{
|
|
||||||
|
|
||||||
virtual EInputType GetInputType() override { return k_EInput_Game; };
|
|
||||||
|
|
||||||
virtual void OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override;
|
|
||||||
virtual void OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override;
|
|
||||||
virtual void OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override;
|
|
||||||
|
|
||||||
virtual void OnButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override {};
|
|
||||||
virtual void OnAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override {};
|
|
||||||
virtual void OnAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override {};
|
|
||||||
|
|
||||||
virtual void OnTextWriteUTF8( uint32_t uCode ) override {};
|
|
||||||
};
|
|
||||||
|
|
||||||
void CFunnyInput::OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void CFunnyInput::OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void CFunnyInput::OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
IEngineBridge *EngineBridge()
|
IEngineBridge *EngineBridge()
|
||||||
{
|
{
|
||||||
@@ -66,10 +36,12 @@ IEngineBridge *EngineBridge()
|
|||||||
|
|
||||||
EXPOSE_INTERFACE_FN(EngineBridge, IEngineBridge, ENGINE_BRIDGE_INTERFACE_VERSION)
|
EXPOSE_INTERFACE_FN(EngineBridge, IEngineBridge, ENGINE_BRIDGE_INTERFACE_VERSION)
|
||||||
|
|
||||||
static CFunnyInput s_mainInput;
|
|
||||||
|
|
||||||
void CFunnyGameBridge::Init()
|
void CFunnyGameBridge::Init()
|
||||||
{
|
{
|
||||||
|
Console()->AddCommand("exec game/core/default.cfg\n");
|
||||||
|
Console()->Execute();
|
||||||
|
|
||||||
g_pWorldRenderer->Init();
|
g_pWorldRenderer->Init();
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
if (g_pEngineConstants->m_bIsSteam)
|
if (g_pEngineConstants->m_bIsSteam)
|
||||||
@@ -95,7 +67,7 @@ void CFunnyGameBridge::Init()
|
|||||||
g_pPhysics = (IPhysics*)fnPhysicsFactory(PHYSICS_INTERFACE_VERSION, NULL);
|
g_pPhysics = (IPhysics*)fnPhysicsFactory(PHYSICS_INTERFACE_VERSION, NULL);
|
||||||
g_pPhysicsWorld = g_pPhysics->CreateWorld();
|
g_pPhysicsWorld = g_pPhysics->CreateWorld();
|
||||||
|
|
||||||
g_pHumanDeviceManager->SetDefaultInput(&s_mainInput);
|
g_pHumanDeviceManager->SetDefaultInput(g_pMainInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFunnyGameBridge::Tick( float fDelta )
|
void CFunnyGameBridge::Tick( float fDelta )
|
||||||
|
|||||||
@@ -13,19 +13,21 @@ void C_MOBAPlayer::Spawn()
|
|||||||
{
|
{
|
||||||
BaseClass::Spawn();
|
BaseClass::Spawn();
|
||||||
SetThink(Think);
|
SetThink(Think);
|
||||||
|
SetScale(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
void C_MOBAPlayer::Think( float fDelta )
|
void C_MOBAPlayer::Think( float fDelta )
|
||||||
{
|
{
|
||||||
|
|
||||||
BaseClass::Think(fDelta);
|
|
||||||
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
|
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
|
||||||
if (pEntity == this)
|
if (pEntity == this)
|
||||||
{
|
{
|
||||||
Vector vCameraPos = GetAbsOrigin();
|
Vector vCameraPos = GetAbsOrigin();
|
||||||
vCameraPos.z -= 20;
|
vCameraPos.z += -20;
|
||||||
g_pWorldRenderer->SetCameraPosition(vCameraPos);
|
g_pWorldRenderer->SetCameraPosition(vCameraPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BaseClass::Think(fDelta);
|
||||||
};
|
};
|
||||||
|
|
||||||
LINK_ENTITY_TO_CLASS(player, C_MOBAPlayer)
|
LINK_ENTITY_TO_CLASS(player, C_MOBAPlayer)
|
||||||
@@ -39,16 +41,12 @@ IMPLEMENT_EMPTY_SEND_DT(C_MOBAPlayer)
|
|||||||
|
|
||||||
|
|
||||||
static void IN_ForwardDown( int c, char **v ) {
|
static void IN_ForwardDown( int c, char **v ) {
|
||||||
|
V_printf("+forward\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
static ConCommand startforward("+forward", IN_ForwardDown);
|
static ConCommand startforward("+forward", IN_ForwardDown);
|
||||||
|
|
||||||
static void IN_ForwardUp( int c, char **v ) {
|
static void IN_ForwardUp( int c, char **v ) {
|
||||||
C_MOBAPlayer *pEntity = (C_MOBAPlayer*)UTIL_GetLocalPlayer();
|
V_printf("-forward\n");
|
||||||
if (pEntity)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
static ConCommand endforward("-forward", IN_ForwardUp);
|
static ConCommand endforward("-forward", IN_ForwardUp);
|
||||||
|
|||||||
168
game/client/userinput.cpp
Normal file
168
game/client/userinput.cpp
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
#include "userinput.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
class CFunnyInput: public IHumanDeviceInput
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual EInputType GetInputType() override { return k_EInput_Game; };
|
||||||
|
|
||||||
|
virtual void OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override;
|
||||||
|
virtual void OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override;
|
||||||
|
virtual void OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override;
|
||||||
|
|
||||||
|
virtual void OnButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed ) override {};
|
||||||
|
virtual void OnAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue) override {};
|
||||||
|
virtual void OnAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue ) override {};
|
||||||
|
|
||||||
|
virtual void OnTextWriteUTF8( uint32_t uCode ) override {};
|
||||||
|
|
||||||
|
CUtlString m_aszBindings[k_EInputButton_Count];
|
||||||
|
};
|
||||||
|
|
||||||
|
static CFunnyInput s_mainInput;
|
||||||
|
IHumanDeviceInput *g_pMainInput = &s_mainInput;
|
||||||
|
|
||||||
|
void CFunnyInput::OnGameButton( EInputDeviceType eDevice, EInputButton eScancode, bool bIsPressed )
|
||||||
|
{
|
||||||
|
if (bIsPressed)
|
||||||
|
{
|
||||||
|
Console()->AddCommand(m_aszBindings[eScancode]);
|
||||||
|
Console()->AddCommand("\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto binding = Console()->ParseCommandLine(m_aszBindings[eScancode]);
|
||||||
|
if (binding.GetSize()==0)
|
||||||
|
return;
|
||||||
|
if (binding[0].GetSize() == 0)
|
||||||
|
return;
|
||||||
|
if (binding[0][0].GetString()[0] == '+')
|
||||||
|
{
|
||||||
|
CUtlString &command = binding[0][0];
|
||||||
|
command.GetString()[0] = '-';
|
||||||
|
}
|
||||||
|
Console()->AddCommand(binding[0][0]);
|
||||||
|
Console()->AddCommand("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void CFunnyInput::OnGameAxis( EInputDeviceType eDevice, EInputAxis eAxis, float fValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void CFunnyInput::OnGameAxisDiff( EInputDeviceType eDevice, EInputAxis eAxis, float fValue )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct KeyName_t {
|
||||||
|
const char *szName;
|
||||||
|
EInputButton eKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
static KeyName_t s_keys[] = {
|
||||||
|
|
||||||
|
{"ESCAPE",k_EInputButton_ESCAPE},
|
||||||
|
{"ESC",k_EInputButton_ESCAPE},
|
||||||
|
{"TAB",k_EInputButton_TAB},
|
||||||
|
{"ENTER",k_EInputButton_ENTER},
|
||||||
|
{"CTRL",k_EInputButton_CONTROL},
|
||||||
|
{"CONTROL",k_EInputButton_CONTROL},
|
||||||
|
{"SHIFT",k_EInputButton_SHIFT},
|
||||||
|
{"ALT",k_EInputButton_ALT},
|
||||||
|
{"SPACE",k_EInputButton_SPACE},
|
||||||
|
|
||||||
|
{"BACKSPACE",k_EInputButton_BACKSPACE},
|
||||||
|
{"[",k_EInputButton_LBRACKET},
|
||||||
|
{"]",k_EInputButton_RBRACKET},
|
||||||
|
{"{",k_EInputButton_LBRACKET},
|
||||||
|
{"}",k_EInputButton_RBRACKET},
|
||||||
|
{"\\",k_EInputButton_BACKSLASH},
|
||||||
|
{";",k_EInputButton_SEMICOLON},
|
||||||
|
{":",k_EInputButton_SEMICOLON},
|
||||||
|
{"\'",k_EInputButton_APOSTROPHE},
|
||||||
|
{"\"",k_EInputButton_APOSTROPHE},
|
||||||
|
|
||||||
|
{"F1",k_EInputButton_F1},
|
||||||
|
{"F2",k_EInputButton_F2},
|
||||||
|
{"F3",k_EInputButton_F3},
|
||||||
|
{"F4",k_EInputButton_F4},
|
||||||
|
{"F5",k_EInputButton_F5},
|
||||||
|
{"F6",k_EInputButton_F6},
|
||||||
|
{"F7",k_EInputButton_F7},
|
||||||
|
{"F8",k_EInputButton_F8},
|
||||||
|
{"F9",k_EInputButton_F9},
|
||||||
|
{"F10",k_EInputButton_F10},
|
||||||
|
{"F11",k_EInputButton_F11},
|
||||||
|
{"F12",k_EInputButton_F12},
|
||||||
|
|
||||||
|
{"1",k_EInputButton_1},
|
||||||
|
{"2",k_EInputButton_2},
|
||||||
|
{"3",k_EInputButton_3},
|
||||||
|
{"4",k_EInputButton_4},
|
||||||
|
{"5",k_EInputButton_5},
|
||||||
|
{"6",k_EInputButton_6},
|
||||||
|
{"7",k_EInputButton_7},
|
||||||
|
{"8",k_EInputButton_8},
|
||||||
|
{"9",k_EInputButton_9},
|
||||||
|
{"0",k_EInputButton_0},
|
||||||
|
|
||||||
|
{"A",k_EInputButton_A},
|
||||||
|
{"B",k_EInputButton_B},
|
||||||
|
{"C",k_EInputButton_C},
|
||||||
|
{"D",k_EInputButton_D},
|
||||||
|
{"E",k_EInputButton_E},
|
||||||
|
{"F",k_EInputButton_F},
|
||||||
|
{"G",k_EInputButton_G},
|
||||||
|
{"H",k_EInputButton_H},
|
||||||
|
{"I",k_EInputButton_I},
|
||||||
|
{"J",k_EInputButton_J},
|
||||||
|
{"K",k_EInputButton_K},
|
||||||
|
{"L",k_EInputButton_L},
|
||||||
|
{"M",k_EInputButton_M},
|
||||||
|
{"N",k_EInputButton_N},
|
||||||
|
{"O",k_EInputButton_O},
|
||||||
|
{"P",k_EInputButton_P},
|
||||||
|
{"Q",k_EInputButton_Q},
|
||||||
|
{"R",k_EInputButton_R},
|
||||||
|
{"S",k_EInputButton_S},
|
||||||
|
{"T",k_EInputButton_T},
|
||||||
|
{"U",k_EInputButton_U},
|
||||||
|
{"V",k_EInputButton_V},
|
||||||
|
{"W",k_EInputButton_W},
|
||||||
|
{"X",k_EInputButton_X},
|
||||||
|
{"Y",k_EInputButton_Y},
|
||||||
|
{"Z",k_EInputButton_Z},
|
||||||
|
};
|
||||||
|
|
||||||
|
static EInputButton GetStringAsKey( char *psz )
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i<sizeof(s_keys)/sizeof(KeyName_t); i++)
|
||||||
|
{
|
||||||
|
if (!V_stricmp(s_keys[i].szName, psz))
|
||||||
|
return s_keys[i].eKey;
|
||||||
|
};
|
||||||
|
return k_EInputButton_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
CON_COMMAND(bind, "Allows to run a command when button is pressed")
|
||||||
|
{
|
||||||
|
if (c == 1)
|
||||||
|
return;
|
||||||
|
if (c == 2)
|
||||||
|
return;
|
||||||
|
EInputButton key = GetStringAsKey(v[1]);
|
||||||
|
if (key == k_EInputButton_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
s_mainInput.m_aszBindings[key] = 0;
|
||||||
|
for ( int i = 2; i<c; i++ )
|
||||||
|
{
|
||||||
|
s_mainInput.m_aszBindings[key].AppendTail(v[i]);
|
||||||
|
s_mainInput.m_aszBindings[key].AppendTail(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
8
game/client/userinput.h
Normal file
8
game/client/userinput.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#ifndef USER_INPUT_H
|
||||||
|
#define USER_INPUT_H
|
||||||
|
#include "ihumandevice.h"
|
||||||
|
|
||||||
|
extern IHumanDeviceInput *g_pMainInput;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -103,6 +103,7 @@ void CFunnyMeshInstance::Frame()
|
|||||||
v[2] = m_vScale.z;
|
v[2] = m_vScale.z;
|
||||||
glm_scale_make(m, v);
|
glm_scale_make(m, v);
|
||||||
glm_mat4_mul(m_data.m_matTranslation, m, m_data.m_matTranslation);
|
glm_mat4_mul(m_data.m_matTranslation, m, m_data.m_matTranslation);
|
||||||
|
glm_mat4_inv(m_data.m_matTranslation, m_data.m_matTranslation);
|
||||||
m_data.m_uAlbedo = 1;
|
m_data.m_uAlbedo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,8 +218,12 @@ void CFunnyWorldRenderer::Frame( float fDelta )
|
|||||||
uint32_t uWidth = g_pMainWindow->GetRenderWidth();
|
uint32_t uWidth = g_pMainWindow->GetRenderWidth();
|
||||||
uint32_t uHeight = g_pMainWindow->GetRenderHeight();
|
uint32_t uHeight = g_pMainWindow->GetRenderHeight();
|
||||||
mat4 matCamera;
|
mat4 matCamera;
|
||||||
|
mat4 matCamera2;
|
||||||
|
glm_mat4_identity(matCamera);
|
||||||
|
glm_mat4_identity(matCamera2);
|
||||||
|
glm_translate(matCamera2, m_vPos);
|
||||||
glm_perspective(glm_rad(60), uWidth/(float)uHeight, 0.01, 10000, matCamera);
|
glm_perspective(glm_rad(60), uWidth/(float)uHeight, 0.01, 10000, matCamera);
|
||||||
glm_translate(matCamera, m_vPos);
|
glm_mul(matCamera, matCamera2, matCamera);
|
||||||
/*
|
/*
|
||||||
V_printf("%f %f %f %f\n", matCamera[0][0], matCamera[0][1], matCamera[0][2], matCamera[0][3]);
|
V_printf("%f %f %f %f\n", matCamera[0][0], matCamera[0][1], matCamera[0][2], matCamera[0][3]);
|
||||||
V_printf("%f %f %f %f\n", matCamera[1][0], matCamera[1][1], matCamera[1][2], matCamera[1][3]);
|
V_printf("%f %f %f %f\n", matCamera[1][0], matCamera[1][1], matCamera[1][2], matCamera[1][3]);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
class CBaseModelEntity: public CBaseEntity
|
class CBaseModelEntity: public CBaseEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DECLARE_CLASS(CBaseModelEntity, CBaseEntity);
|
DECLARE_CLASS(CBaseModelEntity, CBaseEntity);
|
||||||
virtual void SetModel( const char *szName );
|
virtual void SetModel( const char *szName );
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -150,11 +150,9 @@ void NET_ProcessPacket( INetworkBase *pBase )
|
|||||||
|
|
||||||
int iIndex = -1;
|
int iIndex = -1;
|
||||||
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
|
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
|
||||||
for ( int i = 0; i < 2; i++ )
|
|
||||||
{
|
|
||||||
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
|
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
|
||||||
pEntity->Spawn();
|
pEntity->Spawn();
|
||||||
}
|
|
||||||
|
|
||||||
SetLocalEntity_t stLocalEntity = {
|
SetLocalEntity_t stLocalEntity = {
|
||||||
k_EMessage_PlayerSetLocalEntity,
|
k_EMessage_PlayerSetLocalEntity,
|
||||||
|
|||||||
@@ -15,8 +15,31 @@ void CPhysicsProp::Spawn()
|
|||||||
|
|
||||||
void CPhysicsProp::Think( float fDelta )
|
void CPhysicsProp::Think( float fDelta )
|
||||||
{
|
{
|
||||||
SetAbsOrigin(m_pBody->GetPosition());
|
BaseClass::SetAbsOrigin(m_pBody->GetPosition());
|
||||||
SetAbsAngles(m_pBody->GetRotation());
|
BaseClass::SetAbsAngles(m_pBody->GetRotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsProp::SetAbsAngles( Quat vQuat )
|
||||||
|
{
|
||||||
|
|
||||||
|
BaseClass::SetAbsAngles( vQuat );
|
||||||
|
if (m_pBody)
|
||||||
|
m_pBody->SetRotation(m_pBody->GetRotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsProp::SetAbsQAngles( float fPitch, float fYaw, float fRoll )
|
||||||
|
{
|
||||||
|
|
||||||
|
BaseClass::SetAbsQAngles( fPitch, fYaw, fRoll);
|
||||||
|
if (m_pBody)
|
||||||
|
m_pBody->SetRotation(m_pBody->GetRotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhysicsProp::SetAbsOrigin( Vector origin )
|
||||||
|
{
|
||||||
|
BaseClass::SetAbsOrigin( origin );
|
||||||
|
if (m_pBody)
|
||||||
|
m_pBody->SetPosition(m_pBody->GetPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhysicsProp::SetModel( const char *szName )
|
void CPhysicsProp::SetModel( const char *szName )
|
||||||
|
|||||||
@@ -5,23 +5,28 @@
|
|||||||
|
|
||||||
class CPhysicsProp: public CBaseModelEntity
|
class CPhysicsProp: public CBaseModelEntity
|
||||||
{
|
{
|
||||||
|
friend CBaseEntity;
|
||||||
friend CBaseModelEntity;
|
friend CBaseModelEntity;
|
||||||
public:
|
public:
|
||||||
DECLARE_CLASS(CPhysicsProp, CBaseModelEntity);
|
DECLARE_CLASS(CPhysicsProp, CBaseModelEntity);
|
||||||
virtual void Spawn() override;
|
virtual void Spawn() override;
|
||||||
virtual void Precache() override;
|
virtual void Precache() override;
|
||||||
|
|
||||||
|
virtual void SetAbsAngles( Quat vQuat ) override;
|
||||||
|
virtual void SetAbsQAngles( float fPitch, float fYaw, float fRoll ) override;
|
||||||
|
virtual void SetAbsOrigin( Vector origin ) override;
|
||||||
|
|
||||||
virtual void SetModel( const char *szName ) override;
|
virtual void SetModel( const char *szName ) override;
|
||||||
virtual void EnableMovement();
|
virtual void EnableMovement();
|
||||||
virtual void DisableMovement();
|
virtual void DisableMovement();
|
||||||
|
|
||||||
void Think( float fDelta );
|
void Think( float fDelta );
|
||||||
private:
|
private:
|
||||||
HFunnyModel m_hModel;
|
HFunnyModel m_hModel = 0;
|
||||||
FunnyModel_t *m_pModel;
|
FunnyModel_t *m_pModel = NULL;
|
||||||
FunnyPhysics_t *m_pPhysics;
|
FunnyPhysics_t *m_pPhysics = NULL;
|
||||||
HCollider m_hCollider;
|
HCollider m_hCollider = 0;
|
||||||
IPhysicsBody *m_pBody;
|
IPhysicsBody *m_pBody = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ pub unsafe extern "C" fn CRapierPhysicsBody_GetRotation( this: *mut RapierPhysic
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn CRapierPhysicsWorld_Frame( this: *mut RapierWorld_t, fDelta: f32 )
|
pub unsafe extern "C" fn CRapierPhysicsWorld_Frame( this: *mut RapierWorld_t, fDelta: f32 )
|
||||||
{
|
{
|
||||||
let vGravity = vec3(0.0, -9.8, 0.0);
|
let vGravity = vec3(0.0, -0.0, 0.0);
|
||||||
let mut integrationParameters = IntegrationParameters::default();
|
let mut integrationParameters = IntegrationParameters::default();
|
||||||
integrationParameters.dt = fDelta;
|
integrationParameters.dt = fDelta;
|
||||||
let mut physicsPipeline = PhysicsPipeline::new();
|
let mut physicsPipeline = PhysicsPipeline::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user