Expose camera->reset to Lua

This commit is contained in:
SMS Alfredo 2023-06-03 00:40:12 -05:00
parent 610effb8ea
commit a0c7c08bb7

View file

@ -167,6 +167,7 @@ enum cameraf {
camera_x, camera_x,
camera_y, camera_y,
camera_z, camera_z,
camera_reset,
camera_angle, camera_angle,
camera_subsector, camera_subsector,
camera_floorz, camera_floorz,
@ -185,6 +186,7 @@ static const char *const camera_opt[] = {
"x", "x",
"y", "y",
"z", "z",
"reset",
"angle", "angle",
"subsector", "subsector",
"floorz", "floorz",
@ -338,6 +340,9 @@ static int camera_get(lua_State *L)
case camera_z: case camera_z:
lua_pushinteger(L, cam->z); lua_pushinteger(L, cam->z);
break; break;
case camera_reset:
lua_pushboolean(L, cam->reset);
break;
case camera_angle: case camera_angle:
lua_pushinteger(L, cam->angle); lua_pushinteger(L, cam->angle);
break; break;
@ -384,6 +389,9 @@ static int camera_set(lua_State *L)
case camera_x: case camera_x:
case camera_y: case camera_y:
return luaL_error(L, LUA_QL("camera_t") " field " LUA_QS " should not be set directly. Use " LUA_QL("P_TryCameraMove") " or " LUA_QL("P_TeleportCameraMove") " instead.", camera_opt[field]); return luaL_error(L, LUA_QL("camera_t") " field " LUA_QS " should not be set directly. Use " LUA_QL("P_TryCameraMove") " or " LUA_QL("P_TeleportCameraMove") " instead.", camera_opt[field]);
case camera_reset:
cam->reset = luaL_checkboolean(L, 3);
break;
case camera_chase: { case camera_chase: {
INT32 chase = luaL_checkboolean(L, 3); INT32 chase = luaL_checkboolean(L, 3);
if (cam == &camera) if (cam == &camera)