Added gFirstPersonCamera.forceYaw
This commit is contained in:
parent
73ffdf6e98
commit
2b6a173f8b
|
@ -595,6 +595,7 @@
|
|||
--- @field public enabled boolean
|
||||
--- @field public forcePitch boolean
|
||||
--- @field public forceRoll boolean
|
||||
--- @field public forceYaw boolean
|
||||
--- @field public fov number
|
||||
--- @field public offset Vec3f
|
||||
--- @field public pitch integer
|
||||
|
|
|
@ -852,6 +852,7 @@
|
|||
| enabled | `boolean` | read-only |
|
||||
| forcePitch | `boolean` | |
|
||||
| forceRoll | `boolean` | |
|
||||
| forceYaw | `boolean` | |
|
||||
| fov | `number` | |
|
||||
| offset | [Vec3f](structs.md#Vec3f) | read-only |
|
||||
| pitch | `integer` | |
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
|
||||
struct FirstPersonCamera gFirstPersonCamera = {
|
||||
.enabled = false,
|
||||
.forceRoll = true,
|
||||
.forcePitch = false,
|
||||
.forceYaw = false,
|
||||
.forceRoll = true,
|
||||
.centerL = true,
|
||||
.pitch = 0,
|
||||
.yaw = 0,
|
||||
|
@ -75,10 +76,12 @@ static void first_person_camera_update(void) {
|
|||
}
|
||||
|
||||
// update yaw
|
||||
if (m->controller->buttonPressed & L_TRIG && gFirstPersonCamera.centerL) {
|
||||
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
||||
} else {
|
||||
gFirstPersonCamera.yaw += sensX * (invX * m->controller->extStickX - 1.5f * mouse_x);
|
||||
if (!gFirstPersonCamera.forceYaw) {
|
||||
if (m->controller->buttonPressed & L_TRIG && gFirstPersonCamera.centerL) {
|
||||
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
||||
} else {
|
||||
gFirstPersonCamera.yaw += sensX * (invX * m->controller->extStickX - 1.5f * mouse_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -676,13 +676,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 9
|
||||
#define LUA_FIRST_PERSON_CAMERA_FIELD_COUNT 10
|
||||
static struct LuaObjectField sFirstPersonCameraFields[LUA_FIRST_PERSON_CAMERA_FIELD_COUNT] = {
|
||||
{ "centerL", LVT_BOOL, offsetof(struct FirstPersonCamera, centerL), false, LOT_NONE },
|
||||
{ "crouch", LVT_F32, offsetof(struct FirstPersonCamera, crouch), false, LOT_NONE },
|
||||
{ "enabled", LVT_BOOL, offsetof(struct FirstPersonCamera, enabled), true, LOT_NONE },
|
||||
{ "forcePitch", LVT_BOOL, offsetof(struct FirstPersonCamera, forcePitch), false, LOT_NONE },
|
||||
{ "forceRoll", LVT_BOOL, offsetof(struct FirstPersonCamera, forceRoll), false, LOT_NONE },
|
||||
{ "forceYaw", LVT_BOOL, offsetof(struct FirstPersonCamera, forceYaw), false, LOT_NONE },
|
||||
{ "fov", LVT_F32, offsetof(struct FirstPersonCamera, fov), false, LOT_NONE },
|
||||
{ "offset", LVT_COBJECT, offsetof(struct FirstPersonCamera, offset), true, LOT_VEC3F },
|
||||
{ "pitch", LVT_S16, offsetof(struct FirstPersonCamera, pitch), false, LOT_NONE },
|
||||
|
|
|
@ -722,8 +722,9 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
cnt->extStickY = 0;
|
||||
|
||||
gFirstPersonCamera.enabled = false;
|
||||
gFirstPersonCamera.forceRoll = false;
|
||||
gFirstPersonCamera.forcePitch = false;
|
||||
gFirstPersonCamera.forceYaw = false;
|
||||
gFirstPersonCamera.forceRoll = true;
|
||||
gFirstPersonCamera.centerL = true;
|
||||
gFirstPersonCamera.fov = FIRST_PERSON_DEFAULT_FOV;
|
||||
vec3f_set(gFirstPersonCamera.offset, 0, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue