Revert "Added CalculateCamera Hook"

This reverts commit 9f82cdb401.
This commit is contained in:
Zachary McAlpin 2019-12-19 17:21:55 -06:00
parent f5c2341f59
commit 124a0754a6
3 changed files with 14 additions and 64 deletions

View File

@ -52,7 +52,6 @@ enum hook {
hook_PlayerQuit,
hook_IntermissionThinker,
hook_PlayerThink,
hook_CalculateCamera,
hook_MAX // last hook
};
@ -96,6 +95,5 @@ UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_Player
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
boolean LUAh_CalculateCamera(player_t *player, camera_t *camera); // Hook for P_PlayerAfterThink Camera calculations
#endif

View File

@ -63,7 +63,6 @@ const char *const hookNames[hook_MAX+1] = {
"PlayerQuit",
"IntermissionThinker",
"PlayerThink",
"CalculateCamera",
NULL
};
@ -208,7 +207,6 @@ static int lib_addHook(lua_State *L)
case hook_ShieldSpawn:
case hook_ShieldSpecial:
case hook_PlayerThink:
case hook_CalculateCamera:
lastp = &playerhooks;
break;
case hook_LinedefExecute:
@ -1350,43 +1348,4 @@ void LUAh_IntermissionThinker(void)
}
}
boolean LUAh_CalculateCamera(player_t *player, camera_t *camera)
{
hook_p hookp;
boolean hooked;
if (!gL || !(hooksAvailable[hook_CalculateCamera/8] & (1<<(hook_CalculateCamera%8))))
return 0;
lua_settop(gL, 0);
for (hookp = playerhooks; hookp; hookp = hookp->next)
{
if (hookp->type != hook_CalculateCamera)
continue;
if (lua_gettop(gL) == 0)
{
LUA_PushUserdata(gL, player, META_PLAYER);
LUA_PushUserdata(gL, camera, META_CAMERA);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -3);
lua_pushvalue(gL, -3);
if (lua_pcall(gL, 2, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
hookp->error = true;
continue;
}
if (lua_toboolean(gL, -1))
hooked = true;
lua_pop(gL, 1);
}
lua_settop(gL, 0);
return hooked;
}
#endif

View File

@ -12626,29 +12626,22 @@ void P_PlayerAfterThink(player_t *player)
if (thiscam)
{
#ifdef HAVE_BLUA
if (LUAh_CalculateCamera(player, thiscam))
{;}
else
#endif
if (!thiscam->chase) // bob view only if looking through the player's eyes
{
if (!thiscam->chase) // bob view only if looking through the player's eyes
{
P_CalcHeight(player);
P_CalcPostImg(player);
}
P_CalcHeight(player);
P_CalcPostImg(player);
}
else
{
// defaults to make sure 1st person cam doesn't do anything weird on startup
player->deltaviewheight = 0;
player->viewheight = FixedMul(41*player->height/48, player->mo->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = player->mo->z + player->mo->height - player->viewheight;
else
{
// defaults to make sure 1st person cam doesn't do anything weird on startup
player->deltaviewheight = 0;
player->viewheight = FixedMul(41*player->height/48, player->mo->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = player->mo->z + player->mo->height - player->viewheight;
else
player->viewz = player->mo->z + player->viewheight;
if (server || addedtogame)
P_MoveChaseCamera(player, thiscam, false); // calculate the camera movement
}
player->viewz = player->mo->z + player->viewheight;
if (server || addedtogame)
P_MoveChaseCamera(player, thiscam, false); // calculate the camera movement
}
}