Add forceRoll field to first person camera

This commit is contained in:
Agent X 2023-12-02 19:54:40 -05:00
parent 22ac33d3f3
commit 0481de1222
5 changed files with 14 additions and 6 deletions

View File

@ -593,6 +593,7 @@
--- @class FirstPersonCamera
--- @field public crouch number
--- @field public enabled boolean
--- @field public forceRoll boolean
--- @field public fov number
--- @field public pitch integer
--- @field public yaw integer

View File

@ -848,6 +848,7 @@
| ----- | ---- | ------ |
| crouch | `number` | |
| enabled | `boolean` | read-only |
| forceRoll | `boolean` | |
| fov | `number` | |
| pitch | `integer` | |
| yaw | `integer` | |

View File

@ -22,6 +22,7 @@
struct FirstPersonCamera gFirstPersonCamera = {
.enabled = false,
.forceRoll = true,
.pitch = 0,
.yaw = 0,
.crouch = 0,
@ -131,6 +132,9 @@ void first_person_camera_update(void) {
vec3f_copy(gLakituState.goalFocus, gLakituState.focus);
// set other values
if (gFirstPersonCamera.forceRoll) {
gLakituState.roll = 0;
}
gLakituState.posHSpeed = 0;
gLakituState.posVSpeed = 0;
gLakituState.focHSpeed = 0;

View File

@ -7,6 +7,7 @@
struct FirstPersonCamera {
bool enabled;
bool forceRoll;
s16 pitch;
s16 yaw;
f32 crouch;

View File

@ -674,13 +674,14 @@ static struct LuaObjectField sDjuiColorFields[LUA_DJUI_COLOR_FIELD_COUNT] = {
{ "r", LVT_U8, offsetof(struct DjuiColor, r), false, LOT_NONE },
};
#define LUA_FIRST_PERSON_CAMERA_FIELD_COUNT 5
#define LUA_FIRST_PERSON_CAMERA_FIELD_COUNT 6
static struct LuaObjectField sFirstPersonCameraFields[LUA_FIRST_PERSON_CAMERA_FIELD_COUNT] = {
{ "crouch", LVT_F32, offsetof(struct FirstPersonCamera, crouch), false, LOT_NONE },
{ "enabled", LVT_BOOL, offsetof(struct FirstPersonCamera, enabled), true, LOT_NONE },
{ "fov", LVT_F32, offsetof(struct FirstPersonCamera, fov), false, LOT_NONE },
{ "pitch", LVT_S16, offsetof(struct FirstPersonCamera, pitch), false, LOT_NONE },
{ "yaw", LVT_S16, offsetof(struct FirstPersonCamera, yaw), false, LOT_NONE },
{ "crouch", LVT_F32, offsetof(struct FirstPersonCamera, crouch), false, LOT_NONE },
{ "enabled", LVT_BOOL, offsetof(struct FirstPersonCamera, enabled), true, LOT_NONE },
{ "forceRoll", LVT_BOOL, offsetof(struct FirstPersonCamera, forceRoll), false, LOT_NONE },
{ "fov", LVT_F32, offsetof(struct FirstPersonCamera, fov), false, LOT_NONE },
{ "pitch", LVT_S16, offsetof(struct FirstPersonCamera, pitch), false, LOT_NONE },
{ "yaw", LVT_S16, offsetof(struct FirstPersonCamera, yaw), false, LOT_NONE },
};
#define LUA_FLOOR_GEOMETRY_FIELD_COUNT 4