mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Add option to disable first person centering with L
This commit is contained in:
parent
b04dc23aa5
commit
fff0c83866
5 changed files with 8 additions and 2 deletions
|
|
@ -591,6 +591,7 @@
|
||||||
--- @field public r integer
|
--- @field public r integer
|
||||||
|
|
||||||
--- @class FirstPersonCamera
|
--- @class FirstPersonCamera
|
||||||
|
--- @field public centerL boolean
|
||||||
--- @field public crouch number
|
--- @field public crouch number
|
||||||
--- @field public enabled boolean
|
--- @field public enabled boolean
|
||||||
--- @field public forceRoll boolean
|
--- @field public forceRoll boolean
|
||||||
|
|
|
||||||
|
|
@ -846,6 +846,7 @@
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
| ----- | ---- | ------ |
|
| ----- | ---- | ------ |
|
||||||
|
| centerL | `boolean` | |
|
||||||
| crouch | `number` | |
|
| crouch | `number` | |
|
||||||
| enabled | `boolean` | read-only |
|
| enabled | `boolean` | read-only |
|
||||||
| forceRoll | `boolean` | |
|
| forceRoll | `boolean` | |
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
struct FirstPersonCamera gFirstPersonCamera = {
|
struct FirstPersonCamera gFirstPersonCamera = {
|
||||||
.enabled = false,
|
.enabled = false,
|
||||||
.forceRoll = true,
|
.forceRoll = true,
|
||||||
|
.centerL = true,
|
||||||
.pitch = 0,
|
.pitch = 0,
|
||||||
.yaw = 0,
|
.yaw = 0,
|
||||||
.crouch = 0,
|
.crouch = 0,
|
||||||
|
|
@ -71,7 +72,7 @@ void first_person_camera_update(void) {
|
||||||
gFirstPersonCamera.pitch = CLAMP(gFirstPersonCamera.pitch, -0x3F00, 0x3F00);
|
gFirstPersonCamera.pitch = CLAMP(gFirstPersonCamera.pitch, -0x3F00, 0x3F00);
|
||||||
|
|
||||||
// update yaw
|
// update yaw
|
||||||
if (m->controller->buttonPressed & L_TRIG) {
|
if (m->controller->buttonPressed & L_TRIG && gFirstPersonCamera.centerL) {
|
||||||
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
|
||||||
} else {
|
} else {
|
||||||
gFirstPersonCamera.yaw += sensX * (invX * m->controller->extStickX - 1.5f * mouse_x);
|
gFirstPersonCamera.yaw += sensX * (invX * m->controller->extStickX - 1.5f * mouse_x);
|
||||||
|
|
@ -187,6 +188,7 @@ void first_person_update(void) {
|
||||||
|
|
||||||
void first_person_reset(void) {
|
void first_person_reset(void) {
|
||||||
gFirstPersonCamera.forceRoll = false;
|
gFirstPersonCamera.forceRoll = false;
|
||||||
|
gFirstPersonCamera.centerL = true;
|
||||||
gFirstPersonCamera.pitch = 0;
|
gFirstPersonCamera.pitch = 0;
|
||||||
gFirstPersonCamera.yaw = 0;
|
gFirstPersonCamera.yaw = 0;
|
||||||
gFirstPersonCamera.crouch = 0;
|
gFirstPersonCamera.crouch = 0;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
struct FirstPersonCamera {
|
struct FirstPersonCamera {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool forceRoll;
|
bool forceRoll;
|
||||||
|
bool centerL;
|
||||||
s16 pitch;
|
s16 pitch;
|
||||||
s16 yaw;
|
s16 yaw;
|
||||||
f32 crouch;
|
f32 crouch;
|
||||||
|
|
|
||||||
|
|
@ -674,8 +674,9 @@ static struct LuaObjectField sDjuiColorFields[LUA_DJUI_COLOR_FIELD_COUNT] = {
|
||||||
{ "r", LVT_U8, offsetof(struct DjuiColor, r), false, LOT_NONE },
|
{ "r", LVT_U8, offsetof(struct DjuiColor, r), false, LOT_NONE },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LUA_FIRST_PERSON_CAMERA_FIELD_COUNT 7
|
#define LUA_FIRST_PERSON_CAMERA_FIELD_COUNT 8
|
||||||
static struct LuaObjectField sFirstPersonCameraFields[LUA_FIRST_PERSON_CAMERA_FIELD_COUNT] = {
|
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 },
|
{ "crouch", LVT_F32, offsetof(struct FirstPersonCamera, crouch), false, LOT_NONE },
|
||||||
{ "enabled", LVT_BOOL, offsetof(struct FirstPersonCamera, enabled), true, LOT_NONE },
|
{ "enabled", LVT_BOOL, offsetof(struct FirstPersonCamera, enabled), true, LOT_NONE },
|
||||||
{ "forceRoll", LVT_BOOL, offsetof(struct FirstPersonCamera, forceRoll), false, LOT_NONE },
|
{ "forceRoll", LVT_BOOL, offsetof(struct FirstPersonCamera, forceRoll), false, LOT_NONE },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue