diff --git a/fallguys/dllapi.cpp b/fallguys/dllapi.cpp index 55ffe9a..5e97178 100644 --- a/fallguys/dllapi.cpp +++ b/fallguys/dllapi.cpp @@ -118,6 +118,18 @@ edict_t* GetClientViewEntity(edict_t*pClient) return GetClientViewEntity(g_engfuncs.pfnIndexOfEdict(pClient)); } +bool SetClientViewEntity(edict_t* pClient, edict_t*pViewEnt) +{ + int clientindex = g_engfuncs.pfnIndexOfEdict(pClient); + if (clientindex > 0 && clientindex < gpGlobals->maxClients) + { + g_engfuncs.pfnSetView(pClient, pViewEnt); + return true; + } + + return false; +} + int NewAddToFullPack_Post(struct entity_state_s *state, int entindex, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet) { if (META_RESULT_ORIG_RET(int) == 1) diff --git a/fallguys/fallguys.h b/fallguys/fallguys.h index ddd97b5..abd56ef 100644 --- a/fallguys/fallguys.h +++ b/fallguys/fallguys.h @@ -40,6 +40,7 @@ int GetRunPlayerMovePlayerIndex(); edict_t* GetCurrentSuperPusher(Vector* out); edict_t* GetClientViewEntity(int clientindex); edict_t* GetClientViewEntity(edict_t* pClient); +bool SetClientViewEntity(edict_t* pClient, edict_t*pViewEnt); void EnableCustomStepSound(bool bEnabled); diff --git a/fallguys/physics.cpp b/fallguys/physics.cpp index 497b849..0aa803a 100644 --- a/fallguys/physics.cpp +++ b/fallguys/physics.cpp @@ -2572,7 +2572,7 @@ void CPhysicsManager::StepSimulation(double frametime) void CPhysicsManager::SetSimRate(float rate) { - m_simrate = max(min(rate, 1.0f / 32.0f), 1.0f / 128.0f); + m_simrate = rate; } void CPhysicsManager::SetGravity(float velocity) diff --git a/fallguys/physics.h b/fallguys/physics.h index c2914c3..dca09cf 100644 --- a/fallguys/physics.h +++ b/fallguys/physics.h @@ -915,7 +915,7 @@ CGameObject { auto constraint = world->getConstraint(i); - for (int j = 0; j < m_physics.size(); ++j) + for (size_t j = 0; j < m_physics.size(); ++j) { auto physObj = m_physics[j]; diff --git a/fallguys/server_hook.cpp b/fallguys/server_hook.cpp index a1a6899..5d0dc72 100644 --- a/fallguys/server_hook.cpp +++ b/fallguys/server_hook.cpp @@ -34,6 +34,11 @@ edict_t* SC_SERVER_DECL CASEngineFuncs__GetViewEntity(void* pthis, SC_SERVER_DUM return GetClientViewEntity(pClient); } +bool SC_SERVER_DECL CASEngineFuncs__SetViewEntity(void* pthis, SC_SERVER_DUMMYARG edict_t* pClient, edict_t* pViewEnt) +{ + return SetClientViewEntity(pClient, pViewEnt); +} + int SC_SERVER_DECL CASEngineFuncs__GetRunPlayerMovePlayerIndex(void* pthis SC_SERVER_DUMMYARG_NOCOMMA) { return GetRunPlayerMovePlayerIndex(); @@ -447,9 +452,13 @@ void RegisterAngelScriptMethods(void) (void *)CASEngineFuncs__GetRunPlayerMovePlayerIndex, 3); ASEXT_RegisterObjectMethod(pASDoc, - "Get view entity of specified client", "CEngineFuncs", "edict_t@ GetViewEntity(edict_t@ pClient)", + "Get client's view entity", "CEngineFuncs", "edict_t@ GetViewEntity(edict_t@ pClient)", (void *)CASEngineFuncs__GetViewEntity, 3); + ASEXT_RegisterObjectMethod(pASDoc, + "Set client's view entity", "CEngineFuncs", "bool SetViewEntity(edict_t@ pClient, edict_t@ pViewEnt)", + (void *)CASEngineFuncs__SetViewEntity, 3); + ASEXT_RegisterObjectMethod(pASDoc, "Create physic box for entity", "CEntityFuncs", "bool CreateSolidOptimizer(edict_t@ ent, int boneindex, const Vector& in halfextent, const Vector& in halfextent2)", (void *)CASEntityFuncs__CreateSolidOptimizer, 3);