Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Jan 19, 2023
1 parent e39cdf5 commit f0d9c8a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
12 changes: 12 additions & 0 deletions fallguys/dllapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions fallguys/fallguys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion fallguys/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fallguys/physics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
11 changes: 10 additions & 1 deletion fallguys/server_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f0d9c8a

Please sign in to comment.