mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 20:15:17 +00:00
Mouse lock & freeze cam fixes and warp constants (#103)
This commit is contained in:
parent
0c7ada8d2b
commit
68d46cdefe
8 changed files with 90 additions and 9 deletions
|
@ -12,6 +12,7 @@ in_files = [
|
||||||
"include/types.h",
|
"include/types.h",
|
||||||
"include/sm64.h",
|
"include/sm64.h",
|
||||||
"src/pc/lua/smlua_hooks.h",
|
"src/pc/lua/smlua_hooks.h",
|
||||||
|
"src/game/area.h",
|
||||||
"src/game/camera.h",
|
"src/game/camera.h",
|
||||||
"include/mario_animation_ids.h",
|
"include/mario_animation_ids.h",
|
||||||
"include/sounds.h",
|
"include/sounds.h",
|
||||||
|
|
|
@ -336,6 +336,45 @@ COURSE_COUNT = 25
|
||||||
--- @type integer
|
--- @type integer
|
||||||
COURSE_MIN = 1
|
COURSE_MIN = 1
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
INSTANT_WARP_INDEX_START = 0x00
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
INSTANT_WARP_INDEX_STOP = 0x04
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
MAX_LOADED_GRAPH_NODES = 0x100
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_FROM_BOWSER = 0x12
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_FROM_CIRCLE = 0x0A
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_FROM_COLOR = 0x00
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_FROM_MARIO = 0x10
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_FROM_STAR = 0x08
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_INTO_BOWSER = 0x13
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_INTO_CIRCLE = 0x0B
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_INTO_COLOR = 0x01
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_INTO_MARIO = 0x11
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
WARP_TRANSITION_FADE_INTO_STAR = 0x09
|
||||||
|
|
||||||
--- @class BehaviorId
|
--- @class BehaviorId
|
||||||
|
|
||||||
--- @type BehaviorId
|
--- @type BehaviorId
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
## [:rewind: Lua Reference](lua.md)
|
## [:rewind: Lua Reference](lua.md)
|
||||||
|
|
||||||
# Supported Constants
|
# Supported Constants
|
||||||
|
- [area.h](#areah)
|
||||||
- [behavior_table.h](#behavior_tableh)
|
- [behavior_table.h](#behavior_tableh)
|
||||||
- [enum BehaviorId](#enum-BehaviorId)
|
- [enum BehaviorId](#enum-BehaviorId)
|
||||||
- [camera.h](#camerah)
|
- [camera.h](#camerah)
|
||||||
|
@ -57,6 +58,25 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [area.h](#area.h)
|
||||||
|
- INSTANT_WARP_INDEX_START
|
||||||
|
- INSTANT_WARP_INDEX_STOP
|
||||||
|
- MAX_LOADED_GRAPH_NODES
|
||||||
|
- WARP_TRANSITION_FADE_FROM_BOWSER
|
||||||
|
- WARP_TRANSITION_FADE_FROM_CIRCLE
|
||||||
|
- WARP_TRANSITION_FADE_FROM_COLOR
|
||||||
|
- WARP_TRANSITION_FADE_FROM_MARIO
|
||||||
|
- WARP_TRANSITION_FADE_FROM_STAR
|
||||||
|
- WARP_TRANSITION_FADE_INTO_BOWSER
|
||||||
|
- WARP_TRANSITION_FADE_INTO_CIRCLE
|
||||||
|
- WARP_TRANSITION_FADE_INTO_COLOR
|
||||||
|
- WARP_TRANSITION_FADE_INTO_MARIO
|
||||||
|
- WARP_TRANSITION_FADE_INTO_STAR
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [behavior_table.h](#behavior_table.h)
|
## [behavior_table.h](#behavior_table.h)
|
||||||
|
|
||||||
### [enum BehaviorId](#BehaviorId)
|
### [enum BehaviorId](#BehaviorId)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
#include "pc/network/network.h"
|
#include "pc/network/network.h"
|
||||||
#include "pc/lua/smlua_hooks.h"
|
#include "pc/lua/smlua_hooks.h"
|
||||||
|
#include "pc/djui/djui.h"
|
||||||
|
|
||||||
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
|
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
|
||||||
|
|
||||||
|
@ -3050,7 +3051,7 @@ void update_lakitu(struct Camera *c) {
|
||||||
* Gets controller input, checks for cutscenes, handles mode changes, and moves the camera
|
* Gets controller input, checks for cutscenes, handles mode changes, and moves the camera
|
||||||
*/
|
*/
|
||||||
void update_camera(struct Camera *c) {
|
void update_camera(struct Camera *c) {
|
||||||
if (gOverrideFreezeCamera) {
|
if (gOverrideFreezeCamera && !gDjuiInMainMenu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UNUSED u8 unused[24];
|
UNUSED u8 unused[24];
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "../fs/fs.h"
|
#include "../fs/fs.h"
|
||||||
|
|
||||||
#include "game/level_update.h"
|
#include "game/level_update.h"
|
||||||
|
#include "pc/lua/utils/smlua_misc_utils.h"
|
||||||
|
|
||||||
#include "pc/djui/djui.h"
|
#include "pc/djui/djui.h"
|
||||||
#include "pc/djui/djui_hud_utils.h"
|
#include "pc/djui/djui_hud_utils.h"
|
||||||
|
@ -168,12 +169,14 @@ static void controller_sdl_read(OSContPad *pad) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BETTERCAMERA
|
#ifdef BETTERCAMERA
|
||||||
if (newcam_mouse == 1 && sCurrPlayMode != 2) {
|
if (!gDjuiHudLockMouse) {
|
||||||
|
if (newcam_mouse == 1 && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) {
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
ignore_lock = TRUE;
|
ignore_lock = true;
|
||||||
} else {
|
} else {
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
ignore_lock = FALSE;
|
ignore_lock = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 mouse = SDL_GetRelativeMouseState(&mouse_x, &mouse_y);
|
u32 mouse = SDL_GetRelativeMouseState(&mouse_x, &mouse_y);
|
||||||
|
@ -187,7 +190,7 @@ static void controller_sdl_read(OSContPad *pad) {
|
||||||
last_mouse = (mouse_buttons ^ mouse) & mouse;
|
last_mouse = (mouse_buttons ^ mouse) & mouse;
|
||||||
mouse_buttons = mouse;
|
mouse_buttons = mouse;
|
||||||
#endif
|
#endif
|
||||||
if (!ignore_lock && sCurrPlayMode != 2) {
|
if (!ignore_lock && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) {
|
||||||
SDL_SetRelativeMouseMode(gDjuiHudLockMouse ? SDL_TRUE : SDL_FALSE);
|
SDL_SetRelativeMouseMode(gDjuiHudLockMouse ? SDL_TRUE : SDL_FALSE);
|
||||||
|
|
||||||
#ifndef BETTERCAMERA
|
#ifndef BETTERCAMERA
|
||||||
|
|
|
@ -22,7 +22,7 @@ static enum HudUtilsResolution sResolution = RESOLUTION_DJUI;
|
||||||
static enum DjuiFontType sFont = FONT_NORMAL;
|
static enum DjuiFontType sFont = FONT_NORMAL;
|
||||||
|
|
||||||
f32 gDjuiHudUtilsZ = 0;
|
f32 gDjuiHudUtilsZ = 0;
|
||||||
u8 gDjuiHudLockMouse = FALSE;
|
u8 gDjuiHudLockMouse = false;
|
||||||
|
|
||||||
extern ALIGNED8 const u8 texture_hud_char_camera[];
|
extern ALIGNED8 const u8 texture_hud_char_camera[];
|
||||||
extern ALIGNED8 const u8 texture_hud_char_lakitu[];
|
extern ALIGNED8 const u8 texture_hud_char_lakitu[];
|
||||||
|
|
|
@ -307,6 +307,19 @@ char gSmluaConstants[] = ""
|
||||||
"COURSE_COUNT = 25\n"
|
"COURSE_COUNT = 25\n"
|
||||||
"--- @type integer\n"
|
"--- @type integer\n"
|
||||||
"COURSE_MIN = 1\n"
|
"COURSE_MIN = 1\n"
|
||||||
|
"MAX_LOADED_GRAPH_NODES = 0x100\n"
|
||||||
|
"INSTANT_WARP_INDEX_START = 0x00\n"
|
||||||
|
"INSTANT_WARP_INDEX_STOP = 0x04\n"
|
||||||
|
"WARP_TRANSITION_FADE_FROM_COLOR = 0x00\n"
|
||||||
|
"WARP_TRANSITION_FADE_INTO_COLOR = 0x01\n"
|
||||||
|
"WARP_TRANSITION_FADE_FROM_STAR = 0x08\n"
|
||||||
|
"WARP_TRANSITION_FADE_INTO_STAR = 0x09\n"
|
||||||
|
"WARP_TRANSITION_FADE_FROM_CIRCLE = 0x0A\n"
|
||||||
|
"WARP_TRANSITION_FADE_INTO_CIRCLE = 0x0B\n"
|
||||||
|
"WARP_TRANSITION_FADE_FROM_MARIO = 0x10\n"
|
||||||
|
"WARP_TRANSITION_FADE_INTO_MARIO = 0x11\n"
|
||||||
|
"WARP_TRANSITION_FADE_FROM_BOWSER = 0x12\n"
|
||||||
|
"WARP_TRANSITION_FADE_INTO_BOWSER = 0x13\n"
|
||||||
"id_bhv1Up = 0\n"
|
"id_bhv1Up = 0\n"
|
||||||
"id_bhv1upJumpOnApproach = 1\n"
|
"id_bhv1upJumpOnApproach = 1\n"
|
||||||
"id_bhv1upRunningAway = 2\n"
|
"id_bhv1upRunningAway = 2\n"
|
||||||
|
|
|
@ -11,11 +11,13 @@
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
#include "pc/cheats.h"
|
#include "pc/cheats.h"
|
||||||
#include "pc/djui/djui.h"
|
#include "pc/djui/djui.h"
|
||||||
|
#include "pc/djui/djui_hud_utils.h"
|
||||||
#include "pc/utils/misc.h"
|
#include "pc/utils/misc.h"
|
||||||
#include "pc/lua/smlua.h"
|
#include "pc/lua/smlua.h"
|
||||||
#include "pc/mods/mods.h"
|
#include "pc/mods/mods.h"
|
||||||
#include "pc/crash_handler.h"
|
#include "pc/crash_handler.h"
|
||||||
#include "pc/debuglog.h"
|
#include "pc/debuglog.h"
|
||||||
|
#include "game/camera.h"
|
||||||
|
|
||||||
// Mario 64 specific externs
|
// Mario 64 specific externs
|
||||||
extern s16 sCurrPlayMode;
|
extern s16 sCurrPlayMode;
|
||||||
|
@ -460,6 +462,8 @@ void network_shutdown(bool sendLeaving, bool exiting) {
|
||||||
// reset other stuff
|
// reset other stuff
|
||||||
extern u8* gOverrideEeprom;
|
extern u8* gOverrideEeprom;
|
||||||
gOverrideEeprom = NULL;
|
gOverrideEeprom = NULL;
|
||||||
|
gOverrideFreezeCamera = false;
|
||||||
|
gDjuiHudLockMouse = false;
|
||||||
dynos_mod_shutdown();
|
dynos_mod_shutdown();
|
||||||
mods_clear(&gActiveMods);
|
mods_clear(&gActiveMods);
|
||||||
mods_clear(&gRemoteMods);
|
mods_clear(&gRemoteMods);
|
||||||
|
|
Loading…
Reference in a new issue