mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'expos-camreset' into 'next'
Expose P_ResetCamera / camera->reset to Lua See merge request STJr/SRB2!2009
This commit is contained in:
commit
3de4547f74
2 changed files with 22 additions and 0 deletions
|
@ -1696,6 +1696,19 @@ static int lib_pHomingAttack(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pResetCamera(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
camera_t *cam = *((camera_t **)luaL_checkudata(L, 2, META_CAMERA));
|
||||
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!cam)
|
||||
return LUA_ErrInvalid(L, "camera_t");
|
||||
P_ResetCamera(player, cam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pSuperReady(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -4316,6 +4329,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_NukeEnemies",lib_pNukeEnemies},
|
||||
{"P_Earthquake",lib_pEarthquake},
|
||||
{"P_HomingAttack",lib_pHomingAttack},
|
||||
{"P_ResetCamera",lib_pResetCamera},
|
||||
{"P_SuperReady",lib_pSuperReady},
|
||||
{"P_DoJump",lib_pDoJump},
|
||||
{"P_DoSpinDashDust",lib_pDoSpinDashDust},
|
||||
|
|
|
@ -169,6 +169,7 @@ enum cameraf {
|
|||
camera_x,
|
||||
camera_y,
|
||||
camera_z,
|
||||
camera_reset,
|
||||
camera_angle,
|
||||
camera_subsector,
|
||||
camera_floorz,
|
||||
|
@ -187,6 +188,7 @@ static const char *const camera_opt[] = {
|
|||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"reset",
|
||||
"angle",
|
||||
"subsector",
|
||||
"floorz",
|
||||
|
@ -341,6 +343,9 @@ static int camera_get(lua_State *L)
|
|||
case camera_z:
|
||||
lua_pushinteger(L, cam->z);
|
||||
break;
|
||||
case camera_reset:
|
||||
lua_pushboolean(L, cam->reset);
|
||||
break;
|
||||
case camera_angle:
|
||||
lua_pushinteger(L, cam->angle);
|
||||
break;
|
||||
|
@ -387,6 +392,9 @@ static int camera_set(lua_State *L)
|
|||
case camera_x:
|
||||
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]);
|
||||
case camera_reset:
|
||||
cam->reset = luaL_checkboolean(L, 3);
|
||||
break;
|
||||
case camera_chase: {
|
||||
INT32 chase = luaL_checkboolean(L, 3);
|
||||
if (cam == &camera)
|
||||
|
|
Loading…
Reference in a new issue