Revert "Merge branch 'gamepad-refactor-lua-rumble' into 'next'"

This reverts commit 7d8e8e20b7, reversing
changes made to 7f1cafcd3d.
This commit is contained in:
Eidolon 2023-01-26 19:26:21 -06:00
parent 7ad54af89f
commit 6cc48a6e89
2 changed files with 1 additions and 82 deletions

View file

@ -15,7 +15,6 @@
#include "p_local.h"
#include "p_setup.h" // So we can have P_SetupLevelSky
#include "p_slopes.h" // P_GetSlopeZAt
#include "p_haptic.h"
#include "z_zone.h"
#include "r_main.h"
#include "r_draw.h"
@ -1734,78 +1733,6 @@ static int lib_pPlayerShouldUseSpinHeight(lua_State *L)
return 1;
}
// P_HAPTIC
///////////
#define GET_OPTIONAL_PLAYER(arg) \
player_t *player = NULL; \
if (!lua_isnoneornil(L, arg)) { \
player = *((player_t **)luaL_checkudata(L, arg, META_PLAYER)); \
if (!player) \
return LUA_ErrInvalid(L, "player_t"); \
}
static int lib_pDoRumble(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
fixed_t large_magnitude = luaL_checkfixed(L, 2);
fixed_t small_magnitude = luaL_optfixed(L, 3, large_magnitude);
tic_t duration = luaL_optinteger(L, 4, 0);
#define CHECK_MAGNITUDE(which) \
if (which##_magnitude < 0 || which##_magnitude > FRACUNIT) \
return luaL_error(L, va(#which " motor frequency %f out of range (minimum is 0.0, maximum is 1.0)", \
FixedToFloat(which##_magnitude)))
CHECK_MAGNITUDE(large);
CHECK_MAGNITUDE(small);
#undef CHECK_MAGNITUDE
lua_pushboolean(L, P_DoRumble(player, large_magnitude, small_magnitude, duration));
return 1;
}
static int lib_pPauseRumble(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
P_PauseRumble(player);
return 0;
}
static int lib_pUnpauseRumble(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
P_UnpauseRumble(player);
return 0;
}
static int lib_pIsRumbleEnabled(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
if (player && P_IsLocalPlayer(player))
lua_pushboolean(L, P_IsRumbleEnabled(player));
else
lua_pushnil(L);
return 1;
}
static int lib_pIsRumblePaused(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
if (player && P_IsLocalPlayer(player))
lua_pushboolean(L, P_IsRumblePaused(player));
else
lua_pushnil(L);
return 1;
}
static int lib_pStopRumble(lua_State *L)
{
GET_OPTIONAL_PLAYER(1);
P_StopRumble(player);
return 0;
}
// P_MAP
///////////
@ -3442,6 +3369,7 @@ static int lib_sResumeMusic(lua_State *L)
// G_GAME
////////////
// Copypasted from lib_cvRegisterVar :]
static int lib_gAddGametype(lua_State *L)
{
const char *k;
@ -4163,14 +4091,6 @@ static luaL_Reg lib[] = {
{"P_PlayerCanEnterSpinGaps",lib_pPlayerCanEnterSpinGaps},
{"P_PlayerShouldUseSpinHeight",lib_pPlayerShouldUseSpinHeight},
// p_haptic
{"P_DoRumble",lib_pDoRumble},
{"P_PauseRumble",lib_pPauseRumble},
{"P_UnpauseRumble",lib_pUnpauseRumble},
{"P_IsRumbleEnabled",lib_pIsRumbleEnabled},
{"P_IsRumblePaused",lib_pIsRumblePaused},
{"P_StopRumble",lib_pStopRumble},
// p_map
{"P_CheckPosition",lib_pCheckPosition},
{"P_TryMove",lib_pTryMove},

View file

@ -36,7 +36,6 @@
// angle_t casting
// TODO deal with signedness
#define luaL_checkangle(L, i) ((angle_t)luaL_checkinteger(L, i))
#define luaL_optangle(L, i, o) ((angle_t)luaL_optinteger(L, i, o))
#define lua_pushangle(L, a) lua_pushinteger(L, a)
#ifdef _DEBUG