Improvements and optional tweaks (#263)

- Added visibleToEnemies to invisible fields
- Added cur_obj_set_billboard_if_vanilla_cam() which makes trees only billboard if free camera is off
- Added RespawnShellBoxes to gBehaviorValues
- Added pauseExitAnywhere to gLevelValues
- Disabled the power meter chime playing on the main menu whenever disconnecting from a server with low health
This commit is contained in:
Agent X 2023-02-08 10:51:07 -05:00 committed by GitHub
parent 3dcbd5908f
commit 35f7caecc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 94 additions and 42 deletions

View file

@ -72,7 +72,8 @@ override_field_mutable = {
}
override_field_invisible = {
"Mod": [ "files" ]
"Mod": [ "files" ],
"MarioState": [ "visibleToEnemies" ],
}
override_field_immutable = {

View file

@ -6795,6 +6795,11 @@ function cur_obj_set_behavior(behavior)
-- ...
end
--- @return nil
function cur_obj_set_billboard_if_vanilla_cam()
-- ...
end
--- @param a0 Pointer_integer
--- @return integer
function cur_obj_set_direction_table(a0)

View file

@ -188,6 +188,7 @@
--- @field public RacingPenguinBigRadius number
--- @field public RacingPenguinHeight number
--- @field public RacingPenguinRadius number
--- @field public RespawnShellBoxes integer
--- @field public ShowStarMilestones integer
--- @field public ToadStar1Requirement integer
--- @field public ToadStar2Requirement integer
@ -641,6 +642,7 @@
--- @field public floorLowerLimitShadow integer
--- @field public metalCapDuration integer
--- @field public metalCapDurationCotmc integer
--- @field public pauseExitAnywhere boolean
--- @field public metalCapSequence integer
--- @field public pssSlideStarIndex integer
--- @field public pssSlideStarTime integer

View file

@ -3202,16 +3202,12 @@ const BehaviorScript bhvFloorTrapInCastle[] = {
const BehaviorScript bhvTree[] = {
BEGIN(OBJ_LIST_POLELIKE),
ID(id_bhvTree),
#ifdef BETTERCAMERA
CYLBOARD(),
#else
BILLBOARD(),
#endif
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
SET_INT(oInteractType, INTERACT_POLE),
SET_HITBOX(/*Radius*/ 80, /*Height*/ 500),
SET_INT(oIntangibleTimer, 0),
BEGIN_LOOP(),
CALL_NATIVE(cur_obj_set_billboard_if_vanilla_cam),
CALL_NATIVE(bhv_pole_base_loop),
END_LOOP(),
};

View file

@ -3726,6 +3726,24 @@
<br />
## [cur_obj_set_billboard_if_vanilla_cam](#cur_obj_set_billboard_if_vanilla_cam)
### Lua Example
`cur_obj_set_billboard_if_vanilla_cam()`
### Parameters
- None
### Returns
- None
### C Prototype
`void cur_obj_set_billboard_if_vanilla_cam(void);`
[:arrow_up_small:](#)
<br />
## [cur_obj_set_direction_table](#cur_obj_set_direction_table)
### Lua Example

View file

@ -1273,6 +1273,7 @@
- [cur_obj_scale](functions-4.md#cur_obj_scale)
- [cur_obj_scale_over_time](functions-4.md#cur_obj_scale_over_time)
- [cur_obj_set_behavior](functions-4.md#cur_obj_set_behavior)
- [cur_obj_set_billboard_if_vanilla_cam](functions-4.md#cur_obj_set_billboard_if_vanilla_cam)
- [cur_obj_set_direction_table](functions-4.md#cur_obj_set_direction_table)
- [cur_obj_set_face_angle_to_move_angle](functions-4.md#cur_obj_set_face_angle_to_move_angle)
- [cur_obj_set_hitbox_and_die_if_attacked](functions-4.md#cur_obj_set_hitbox_and_die_if_attacked)

View file

@ -310,6 +310,7 @@
| RacingPenguinBigRadius | `number` | |
| RacingPenguinHeight | `number` | |
| RacingPenguinRadius | `number` | |
| RespawnShellBoxes | `integer` | |
| ShowStarMilestones | `integer` | |
| ToadStar1Requirement | `integer` | |
| ToadStar2Requirement | `integer` | |
@ -936,6 +937,7 @@
| floorLowerLimitShadow | `integer` | |
| metalCapDuration | `integer` | |
| metalCapDurationCotmc | `integer` | |
| pauseExitAnywhere | `boolean` | |
| metalCapSequence | `integer` | |
| pssSlideStarIndex | `integer` | |
| pssSlideStarTime | `integer` | |

View file

@ -170,7 +170,8 @@ void exclamation_box_act_4(void) {
spawn_mist_particles_variable(0, 0, 46.0f);
spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState);
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
if (o->oBehParams2ndByte <= 3) {
u8 threshold = gBehaviorValues.RespawnShellBoxes ? 3 : 2;
if (o->oBehParams2ndByte <= threshold) {
o->oAction = 5;
cur_obj_hide();
} else {

View file

@ -97,6 +97,7 @@ struct LevelValues gDefaultLevelValues = {
.floorLowerLimit = FLOOR_LOWER_LIMIT,
.floorLowerLimitMisc = FLOOR_LOWER_LIMIT_MISC,
.floorLowerLimitShadow = FLOOR_LOWER_LIMIT_SHADOW,
.pauseExitAnywhere = 1,
.disableActs = false,
};
@ -130,6 +131,7 @@ struct BehaviorValues gDefaultBehaviorValues = {
.BowlingBallThiSmallSpeed = 10.0f,
.GrateStarRequirement = 120,
.ShowStarMilestones = TRUE,
.RespawnShellBoxes = TRUE,
.starsNeededForDialog = { 1, 3, 8, 30, 50, 70 },
.dialogs = {
.BobombBuddyBob1Dialog = DIALOG_004,

View file

@ -62,6 +62,7 @@ struct LevelValues {
s16 floorLowerLimit;
s16 floorLowerLimitMisc;
s16 floorLowerLimitShadow;
bool pauseExitAnywhere;
bool disableActs;
};
@ -225,6 +226,7 @@ struct BehaviorValues {
f32 BowlingBallThiSmallSpeed;
u16 GrateStarRequirement;
u8 ShowStarMilestones;
u8 RespawnShellBoxes;
struct StarsNeededForDialog starsNeededForDialog;
struct BehaviorDialogs dialogs;
struct BehaviorTrajectories trajectories;

View file

@ -33,6 +33,7 @@
#ifdef BETTERCAMERA
#include "bettercamera.h"
#endif
#include "hardcoded.h"
u16 gDialogColorFadeTimer;
s8 gLastDialogLineNum;
@ -2859,7 +2860,7 @@ s16 render_pause_courses_and_castle(void) {
render_pause_red_coins();
/* Always allow exiting from course */
if (TRUE || (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT)) {
if (gLevelValues.pauseExitAnywhere || (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT)) {
render_pause_course_options(99, 93, &gDialogLineNum, 15);
}

View file

@ -1077,7 +1077,7 @@ void update_hud_values(void) {
gHudDisplay.lives = gMarioState->numLives;
gHudDisplay.keys = gMarioState->numKeys;
if (numHealthWedges > gHudDisplay.wedges) {
if (numHealthWedges > gHudDisplay.wedges && !gDjuiInMainMenu) {
play_sound(SOUND_MENU_POWER_METER, gGlobalSoundSource);
}
gHudDisplay.wedges = numHealthWedges;
@ -1548,13 +1548,10 @@ s32 update_level(void) {
changeLevel = play_mode_normal();
break;
case PLAY_MODE_PAUSED:
#ifdef DEVELOPMENT
if (configDisableDevPause) {
if (!(configSingleplayerPause && network_player_connected_count() == 1)) {
changeLevel = play_mode_normal();
}
#else
changeLevel = play_mode_normal();
#endif
if (sCurrPlayMode == PLAY_MODE_PAUSED) {
changeLevel = play_mode_paused();
}

View file

@ -1840,6 +1840,16 @@ void obj_set_cylboard(struct Object *obj) {
obj->header.gfx.node.flags |= GRAPH_RENDER_CYLBOARD;
}
void cur_obj_set_billboard_if_vanilla_cam(void) {
if (configEnableCamera) {
o->header.gfx.node.flags &= ~GRAPH_RENDER_BILLBOARD;
o->header.gfx.node.flags |= GRAPH_RENDER_CYLBOARD;
} else {
o->header.gfx.node.flags &= ~GRAPH_RENDER_CYLBOARD;
o->header.gfx.node.flags |= GRAPH_RENDER_BILLBOARD;
}
}
void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height) {
if (o == NULL) { return; }

View file

@ -204,6 +204,8 @@ void cur_obj_shake_y(f32 amount);
void cur_obj_start_cam_event(UNUSED struct Object *obj, s32 cameraEvent);
void set_mario_interact_hoot_if_in_range(UNUSED s32 sp0, UNUSED s32 sp4, f32 sp8);
void obj_set_billboard(struct Object *obj);
void obj_set_cylboard(struct Object *obj);
void cur_obj_set_billboard_if_vanilla_cam(void);
void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height);
void obj_set_hurtbox_radius_and_height(struct Object *o, f32 radius, f32 height);
void cur_obj_set_hitbox_radius_and_height(f32 radius, f32 height);

View file

@ -142,9 +142,6 @@ bool configUncappedFramerate = true;
unsigned int configFrameLimit = 60;
unsigned int configDrawDistance = 5;
bool configDisablePopups = 0;
#ifdef DEVELOPMENT
bool configDisableDevPause = 1;
#endif
#ifdef LUA_PROFILER
bool configLuaProfiler = 1;
#endif
@ -152,6 +149,7 @@ bool configDisableDownloadedModels = 0;
unsigned int configInterpolationMode = 1;
unsigned int configGamepadNumber = 0;
bool configBackgroundGamepad = 1;
bool configSingleplayerPause = 0;
static const struct ConfigOption options[] = {
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
@ -245,11 +243,9 @@ static const struct ConfigOption options[] = {
{.name = "coop_custom_palette_skin", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[SKIN]},
{.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]},
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
{.name = "coop_singleplayer_pause", .type = CONFIG_TYPE_BOOL , .boolValue = &configSingleplayerPause},
{.name = "share_lives", .type = CONFIG_TYPE_BOOL , .boolValue = &configShareLives},
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups},
#ifdef DEVELOPMENT
{.name = "disable_devpause", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDevPause},
#endif
#ifdef LUA_PROFILER
{.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler},
#endif

View file

@ -99,14 +99,12 @@ extern bool configUncappedFramerate;
extern unsigned int configFrameLimit;
extern unsigned int configDrawDistance;
extern bool configDisablePopups;
#ifdef DEVELOPMENT
extern bool configDisableDevPause;
#endif
#ifdef LUA_PROFILER
extern bool configLuaProfiler;
#endif
extern bool configDisableDownloadedModels;
extern unsigned int configInterpolationMode;
extern bool configSingleplayerPause;
void configfile_load(const char *filename);
void configfile_save(const char *filename);

View file

@ -5,35 +5,30 @@
#ifdef DEVELOPMENT
void djui_panel_options_debug_create(struct DjuiBase* caller) {
f32 bodyHeight = 32 * 4 + 64 * 1 + 16 * 1;
f32 bodyHeight = 32 * 3 + 64 * 1 + 16 * 1;
struct DjuiBase* defaultBase = NULL;
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\E\\#00b3ff\\B\\#ffef00\\U\\#ff0800\\G");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
{
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Disable Development Pause", &configDisableDevPause);
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Fixed Collisions", (bool*)&gLevelValues.fixCollisionBugs);
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox1->base, 1.0f, 32);
defaultBase = &checkbox1->base;
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Fixed Collisions", (bool*)&gLevelValues.fixCollisionBugs);
#ifdef LUA_PROFILER
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Lua Profiler", &configLuaProfiler);
djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox2->base, 1.0f, 32);
defaultBase = &checkbox2->base;
#ifdef LUA_PROFILER
struct DjuiCheckbox* checkbox3 = djui_checkbox_create(&body->base, "Lua Profiler", &configLuaProfiler);
djui_base_set_size_type(&checkbox3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox3->base, 1.0f, 32);
defaultBase = &checkbox3->base;
#endif
struct DjuiButton* button2 = djui_button_create(&body->base, "Back");
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button2->base, 1.0f, 64);
djui_button_set_style(button2, 1);
djui_interactable_hook_click(&button2->base, djui_panel_menu_back);
struct DjuiButton* button1 = djui_button_create(&body->base, "Back");
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button1->base, 1.0f, 64);
djui_button_set_style(button1, 1);
djui_interactable_hook_click(&button1->base, djui_panel_menu_back);
}
djui_panel_add(caller, &panel->base, defaultBase);
@ -42,9 +37,9 @@ void djui_panel_options_debug_create(struct DjuiBase* caller) {
void djui_panel_misc_create(struct DjuiBase* caller) {
#ifdef DEVELOPMENT
f32 bodyHeight = 64 * 3 + 16 * 2;
f32 bodyHeight = 64 * 4 + 16 * 3;
#else
f32 bodyHeight = 64 * 2 + 16 * 1;
f32 bodyHeight = 64 * 3 + 16 * 2;
#endif
struct DjuiBase* defaultBase = NULL;
@ -52,11 +47,15 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
{
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Pause In Singleplayer", &configSingleplayerPause);
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox1->base, 1.0f, 32);
defaultBase = &checkbox1->base;
struct DjuiButton* button1 = djui_button_create(&body->base, "Menu Options");
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button1->base, 1.0f, 64);
djui_interactable_hook_click(&button1->base, djui_panel_main_menu_create);
defaultBase = &button1->base;
#ifdef DEVELOPMENT
struct DjuiButton* button2 = djui_button_create(&body->base, "Debug");

View file

@ -208,7 +208,7 @@ static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORI
{ "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER },
};
#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 26
#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 27
static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COUNT] = {
{ "BowlingBallBob2Speed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBob2Speed), false, LOT_NONE },
{ "BowlingBallBobSpeed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBobSpeed), false, LOT_NONE },
@ -229,6 +229,7 @@ static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COU
{ "RacingPenguinBigRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigRadius), false, LOT_NONE },
{ "RacingPenguinHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinHeight), false, LOT_NONE },
{ "RacingPenguinRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinRadius), false, LOT_NONE },
{ "RespawnShellBoxes", LVT_U8, offsetof(struct BehaviorValues, RespawnShellBoxes), false, LOT_NONE },
{ "ShowStarMilestones", LVT_U8, offsetof(struct BehaviorValues, ShowStarMilestones), false, LOT_NONE },
{ "ToadStar1Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar1Requirement), false, LOT_NONE },
{ "ToadStar2Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar2Requirement), false, LOT_NONE },
@ -726,7 +727,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] =
{ "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE },
};
#define LUA_LEVEL_VALUES_FIELD_COUNT 25
#define LUA_LEVEL_VALUES_FIELD_COUNT 26
static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = {
{ "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE },
{ "coinsRequiredForCoinStar", LVT_S16, offsetof(struct LevelValues, coinsRequiredForCoinStar), false, LOT_NONE },
@ -742,6 +743,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] =
{ "floorLowerLimitShadow", LVT_S16, offsetof(struct LevelValues, floorLowerLimitShadow), false, LOT_NONE },
{ "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE },
{ "metalCapDurationCotmc", LVT_U16, offsetof(struct LevelValues, metalCapDurationCotmc), false, LOT_NONE },
{ "pauseExitAnywhere", LVT_BOOL, offsetof(struct LevelValues, pauseExitAnywhere), false, LOT_NONE },
{ "metalCapSequence", LVT_U8, offsetof(struct LevelValues, metalCapSequence), false, LOT_NONE },
{ "pssSlideStarIndex", LVT_U8, offsetof(struct LevelValues, pssSlideStarIndex), false, LOT_NONE },
{ "pssSlideStarTime", LVT_U16, offsetof(struct LevelValues, pssSlideStarTime), false, LOT_NONE },

View file

@ -22252,6 +22252,22 @@ int smlua_func_cur_obj_set_behavior(lua_State* L) {
return 1;
}
int smlua_func_cur_obj_set_billboard_if_vanilla_cam(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "cur_obj_set_billboard_if_vanilla_cam", 0, top);
return 0;
}
extern void cur_obj_set_billboard_if_vanilla_cam(void);
cur_obj_set_billboard_if_vanilla_cam();
return 1;
}
int smlua_func_cur_obj_set_direction_table(lua_State* L) {
if (L == NULL) { return 0; }
@ -29874,6 +29890,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "cur_obj_scale", smlua_func_cur_obj_scale);
smlua_bind_function(L, "cur_obj_scale_over_time", smlua_func_cur_obj_scale_over_time);
smlua_bind_function(L, "cur_obj_set_behavior", smlua_func_cur_obj_set_behavior);
smlua_bind_function(L, "cur_obj_set_billboard_if_vanilla_cam", smlua_func_cur_obj_set_billboard_if_vanilla_cam);
smlua_bind_function(L, "cur_obj_set_direction_table", smlua_func_cur_obj_set_direction_table);
smlua_bind_function(L, "cur_obj_set_face_angle_to_move_angle", smlua_func_cur_obj_set_face_angle_to_move_angle);
smlua_bind_function(L, "cur_obj_set_hitbox_and_die_if_attacked", smlua_func_cur_obj_set_hitbox_and_die_if_attacked);