mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 11:18:30 +00:00
Add first person mario head Y constants
This commit is contained in:
parent
c32cf2054a
commit
ba4ad874f4
5 changed files with 18 additions and 8 deletions
|
@ -3432,6 +3432,12 @@ DS_NONE = 0xff
|
||||||
--- @type integer
|
--- @type integer
|
||||||
FIRST_PERSON_DEFAULT_FOV = 70
|
FIRST_PERSON_DEFAULT_FOV = 70
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
FIRST_PERSON_MARIO_HEAD_POS = 120
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
FIRST_PERSON_MARIO_HEAD_POS_SHORT = 60
|
||||||
|
|
||||||
--- @type integer
|
--- @type integer
|
||||||
BACKGROUND_ABOVE_CLOUDS = 8
|
BACKGROUND_ABOVE_CLOUDS = 8
|
||||||
|
|
||||||
|
|
|
@ -1183,6 +1183,8 @@
|
||||||
|
|
||||||
## [first_person_cam.h](#first_person_cam.h)
|
## [first_person_cam.h](#first_person_cam.h)
|
||||||
- FIRST_PERSON_DEFAULT_FOV
|
- FIRST_PERSON_DEFAULT_FOV
|
||||||
|
- FIRST_PERSON_MARIO_HEAD_POS
|
||||||
|
- FIRST_PERSON_MARIO_HEAD_POS_SHORT
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
#include "pc/lua/utils/smlua_misc_utils.h"
|
#include "pc/lua/utils/smlua_misc_utils.h"
|
||||||
#include "pc/lua/smlua_hooks.h"
|
#include "pc/lua/smlua_hooks.h"
|
||||||
|
|
||||||
#define MARIO_HEAD_POS 120
|
|
||||||
#define MARIO_HEAD_POS_SHORT MARIO_HEAD_POS / 2
|
|
||||||
|
|
||||||
#define CLAMP(_val, _min, _max) MAX(MIN((_val), _max), _min)
|
#define CLAMP(_val, _min, _max) MAX(MIN((_val), _max), _min)
|
||||||
|
|
||||||
struct FirstPersonCamera gFirstPersonCamera = {
|
struct FirstPersonCamera gFirstPersonCamera = {
|
||||||
|
@ -107,18 +104,18 @@ void first_person_camera_update(void) {
|
||||||
// update crouch
|
// update crouch
|
||||||
if (mario_is_crouching(m) || m->action == ACT_LEDGE_GRAB) {
|
if (mario_is_crouching(m) || m->action == ACT_LEDGE_GRAB) {
|
||||||
f32 inc = 10 * (m->controller->buttonDown & Z_TRIG) != 0 || m->action == ACT_CROUCH_SLIDE || m->action == ACT_LEDGE_GRAB ? 1 : -1;
|
f32 inc = 10 * (m->controller->buttonDown & Z_TRIG) != 0 || m->action == ACT_CROUCH_SLIDE || m->action == ACT_LEDGE_GRAB ? 1 : -1;
|
||||||
gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch + inc, 0, MARIO_HEAD_POS - MARIO_HEAD_POS_SHORT);
|
gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch + inc, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT);
|
||||||
} else {
|
} else {
|
||||||
gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch - 10, 0, MARIO_HEAD_POS - MARIO_HEAD_POS_SHORT);
|
gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch - 10, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->action == ACT_LEDGE_GRAB) {
|
if (m->action == ACT_LEDGE_GRAB) {
|
||||||
gFirstPersonCamera.crouch = MARIO_HEAD_POS - MARIO_HEAD_POS_SHORT;
|
gFirstPersonCamera.crouch = FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update pos
|
// update pos
|
||||||
gLakituState.pos[0] = m->pos[0] + coss(gFirstPersonCamera.pitch) * sins(gFirstPersonCamera.yaw);
|
gLakituState.pos[0] = m->pos[0] + coss(gFirstPersonCamera.pitch) * sins(gFirstPersonCamera.yaw);
|
||||||
gLakituState.pos[1] = m->pos[1] + sins(gFirstPersonCamera.pitch) + (MARIO_HEAD_POS - gFirstPersonCamera.crouch);
|
gLakituState.pos[1] = m->pos[1] + sins(gFirstPersonCamera.pitch) + (FIRST_PERSON_MARIO_HEAD_POS - gFirstPersonCamera.crouch);
|
||||||
gLakituState.pos[2] = m->pos[2] + coss(gFirstPersonCamera.pitch) * coss(gFirstPersonCamera.yaw);
|
gLakituState.pos[2] = m->pos[2] + coss(gFirstPersonCamera.pitch) * coss(gFirstPersonCamera.yaw);
|
||||||
vec3f_copy(m->area->camera->pos, gLakituState.pos);
|
vec3f_copy(m->area->camera->pos, gLakituState.pos);
|
||||||
vec3f_copy(gLakituState.curPos, gLakituState.pos);
|
vec3f_copy(gLakituState.curPos, gLakituState.pos);
|
||||||
|
@ -126,7 +123,7 @@ void first_person_camera_update(void) {
|
||||||
|
|
||||||
// update focus
|
// update focus
|
||||||
gLakituState.focus[0] = m->pos[0] - 100 * coss(gFirstPersonCamera.pitch) * sins(gFirstPersonCamera.yaw);
|
gLakituState.focus[0] = m->pos[0] - 100 * coss(gFirstPersonCamera.pitch) * sins(gFirstPersonCamera.yaw);
|
||||||
gLakituState.focus[1] = m->pos[1] - 100 * sins(gFirstPersonCamera.pitch) + (MARIO_HEAD_POS - gFirstPersonCamera.crouch);
|
gLakituState.focus[1] = m->pos[1] - 100 * sins(gFirstPersonCamera.pitch) + (FIRST_PERSON_MARIO_HEAD_POS - gFirstPersonCamera.crouch);
|
||||||
gLakituState.focus[2] = m->pos[2] - 100 * coss(gFirstPersonCamera.pitch) * coss(gFirstPersonCamera.yaw);
|
gLakituState.focus[2] = m->pos[2] - 100 * coss(gFirstPersonCamera.pitch) * coss(gFirstPersonCamera.yaw);
|
||||||
vec3f_copy(m->area->camera->focus, gLakituState.focus);
|
vec3f_copy(m->area->camera->focus, gLakituState.focus);
|
||||||
vec3f_copy(gLakituState.curFocus, gLakituState.focus);
|
vec3f_copy(gLakituState.curFocus, gLakituState.focus);
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
#define FIRST_PERSON_DEFAULT_FOV 70
|
#define FIRST_PERSON_DEFAULT_FOV 70
|
||||||
|
|
||||||
|
#define FIRST_PERSON_MARIO_HEAD_POS 120
|
||||||
|
#define FIRST_PERSON_MARIO_HEAD_POS_SHORT 60
|
||||||
|
|
||||||
struct FirstPersonCamera {
|
struct FirstPersonCamera {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool forceRoll;
|
bool forceRoll;
|
||||||
|
|
|
@ -1354,6 +1354,8 @@ char gSmluaConstants[] = ""
|
||||||
"DS_NONE = 0xff\n"
|
"DS_NONE = 0xff\n"
|
||||||
"DS_DIFF = DS_TUXIE\n"
|
"DS_DIFF = DS_TUXIE\n"
|
||||||
"FIRST_PERSON_DEFAULT_FOV = 70\n"
|
"FIRST_PERSON_DEFAULT_FOV = 70\n"
|
||||||
|
"FIRST_PERSON_MARIO_HEAD_POS = 120\n"
|
||||||
|
"FIRST_PERSON_MARIO_HEAD_POS_SHORT = 60\n"
|
||||||
"BACKGROUND_OCEAN_SKY = 0\n"
|
"BACKGROUND_OCEAN_SKY = 0\n"
|
||||||
"BACKGROUND_FLAMING_SKY = 1\n"
|
"BACKGROUND_FLAMING_SKY = 1\n"
|
||||||
"BACKGROUND_UNDERWATER_CITY = 2\n"
|
"BACKGROUND_UNDERWATER_CITY = 2\n"
|
||||||
|
|
Loading…
Reference in a new issue