Merge branch 'coop-deluxe:main' into main

This commit is contained in:
FluffaMario 2023-11-19 19:15:01 -06:00 committed by GitHub
commit b758a391d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 162 additions and 65 deletions

View file

@ -305,7 +305,7 @@ TARGET := sm64.$(VERSION)
# f3d_new - default for EU and Shindou versions
# f3dex -
# f3dex2 -
# f3dex2e -
# f3dex2e - default for PC Port
# f3dzex - newer, experimental microcode used in Animal Crossing
$(eval $(call validate-option,GRUCODE,f3d_old f3dex f3dex2 f3dex2e f3d_new f3dzex))
@ -381,29 +381,14 @@ endif
ifeq ($(NON_MATCHING),1)
DEFINES += NON_MATCHING=1 AVOID_UB=1
COMPARE := 0
endif
# COMPARE - whether to verify the SHA-1 hash of the ROM after building
# 1 - verifies the SHA-1 hash of the selected version of the game
# 0 - does not verify the hash
COMPARE ?= 1
$(eval $(call validate-option,COMPARE,0 1))
ifeq ($(OSX_BUILD),0)
USE_APP := 0
else ifeq ($(shell uname -m),arm64)
DISCORD_SDK := 0
endif
TARGET_STRING := sm64.$(VERSION).$(GRUCODE)
# If non-default settings were chosen, disable COMPARE
ifeq ($(filter $(TARGET_STRING), sm64.jp.f3d_old sm64.us.f3d_old sm64.eu.f3d_new sm64.sh.f3d_new),)
COMPARE := 0
endif
# Whether to hide commands or not
VERBOSE ?= 0
ifeq ($(VERBOSE),0)
@ -418,12 +403,6 @@ ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
$(info ==== Build Options ====)
$(info Version: $(VERSION))
$(info Microcode: $(GRUCODE))
$(info Target: $(TARGET))
ifeq ($(COMPARE),1)
$(info Compare ROM: yes)
else
$(info Compare ROM: no)
endif
ifeq ($(NON_MATCHING),1)
$(info Build Matching: no)
else
@ -499,12 +478,12 @@ BUILD_DIR_BASE := build
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc
ifeq ($(WINDOWS_BUILD),1)
EXE := $(BUILD_DIR)/$(TARGET_STRING).exe
EXE := $(BUILD_DIR)/sm64coopdx.exe
else # Linux builds/binary namer
ifeq ($(TARGET_RPI),1)
EXE := $(BUILD_DIR)/$(TARGET_STRING).arm
EXE := $(BUILD_DIR)/sm64coopdx.arm
else
EXE := $(BUILD_DIR)/$(TARGET_STRING)
EXE := $(BUILD_DIR)/sm64coopdx
endif
endif
@ -1157,11 +1136,6 @@ exemap: $(EXE)
all: exemap
endif
ifeq ($(COMPARE),1)
@$(PRINT) "$(GREEN)Checking if ROM matches.. $(NO_COL)\n"
@$(SHA1SUM) --quiet -c $(TARGET).sha1 && $(PRINT) "$(TARGET): $(GREEN)OK$(NO_COL)\n" || ($(PRINT) "$(YELLOW)Building the ROM file has succeeded, but does not match the original ROM.\nThis is expected, and not an error, if you are making modifications.\nTo silence this message, use 'make COMPARE=0.' $(NO_COL)\n" && false)
endif
clean:
$(RM) -r $(BUILD_DIR_BASE)

View file

@ -1,3 +1,4 @@
#include "geo_header.h"
// Normal Mario Geo
const GeoLayout luigi_geo_face_and_wings[] = {

View file

@ -1,3 +1,4 @@
#include "geo_header.h"
// 0x16000CA4
const GeoLayout luigis_cap_geo[] = {
GEO_NODE_START(),

View file

@ -1,3 +1,4 @@
#include "geo_header.h"
// Normal Mario Geo
// 0x170002E0

View file

@ -1,3 +1,4 @@
#include "geo_header.h"
// 0x16000CA4
const GeoLayout marios_cap_geo[] = {
GEO_NODE_START(),

View file

@ -4,4 +4,3 @@ extern ALIGNED8 const Texture mario_cap_seg3_texture_0301E750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_0301F750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_03020750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_03021750[];
extern ALIGNED8 const Texture mario_cap_texture_cap_inside[];

View file

@ -203,7 +203,7 @@ const Gfx mario_cap_seg3_dl_03022D10[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (8 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, mario_cap_texture_cap_inside),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, mario_texture_cap_inside),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_16b_BYTES)),
gsSPCopyLightsPlayerPart(CAP), //gsSPLight(&mario_cap_seg3_lights_0301CF08.a, 2),

View file

@ -75,7 +75,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],
"src/pc/utils/misc.h": [ "update_all_mario_stars" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level" ],
"src/game/area.h": [ "area_get_warp_node" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color" ]

View file

@ -4040,6 +4040,30 @@ TIMER_CONTROL_START = 1
--- @type integer
TIMER_CONTROL_STOP = 2
--- @type integer
WARP_NODE_CREDITS_END = 0xFA
--- @type integer
WARP_NODE_CREDITS_MIN = 0xF8
--- @type integer
WARP_NODE_CREDITS_NEXT = 0xF9
--- @type integer
WARP_NODE_CREDITS_START = 0xF8
--- @type integer
WARP_NODE_DEATH = 0xF1
--- @type integer
WARP_NODE_F0 = 0xF0
--- @type integer
WARP_NODE_F2 = 0xF2
--- @type integer
WARP_NODE_WARP_FLOOR = 0xF3
--- @type integer
WARP_OP_CREDITS_END = 0x15
@ -5500,6 +5524,17 @@ PACKET_LENGTH = 3000
--- @type integer
SYNC_DISTANCE_INFINITE = 0
--- @class BouncyLevelBounds
--- @type BouncyLevelBounds
BOUNCY_LEVEL_BOUNDS_OFF = 0
--- @type BouncyLevelBounds
BOUNCY_LEVEL_BOUNDS_ON = 1
--- @type BouncyLevelBounds
BOUNCY_LEVEL_BOUNDS_ON_CAP = 2
--- @class NetworkSystemType
--- @type NetworkSystemType

View file

@ -4244,6 +4244,13 @@ function level_trigger_warp(m, warpOp)
-- ...
end
--- @param arg0 integer
--- @param levelNum integer
--- @return integer
function lvl_set_current_level(arg0, levelNum)
-- ...
end
--- @param arg integer
--- @return nil
function warp_special(arg)

View file

@ -41,6 +41,7 @@
- [enum MarioHandGSCId](#enum-MarioHandGSCId)
- [mod_storage.h](#mod_storageh)
- [network.h](#networkh)
- [enum BouncyLevelBounds](#enum-BouncyLevelBounds)
- [enum NetworkSystemType](#enum-NetworkSystemType)
- [enum PlayerInteractions](#enum-PlayerInteractions)
- [network_player.h](#network_playerh)
@ -1427,6 +1428,14 @@
- TIMER_CONTROL_SHOW
- TIMER_CONTROL_START
- TIMER_CONTROL_STOP
- WARP_NODE_CREDITS_END
- WARP_NODE_CREDITS_MIN
- WARP_NODE_CREDITS_NEXT
- WARP_NODE_CREDITS_START
- WARP_NODE_DEATH
- WARP_NODE_F0
- WARP_NODE_F2
- WARP_NODE_WARP_FLOOR
- WARP_OP_CREDITS_END
- WARP_OP_CREDITS_NEXT
- WARP_OP_CREDITS_START
@ -1962,6 +1971,13 @@
- PACKET_LENGTH
- SYNC_DISTANCE_INFINITE
### [enum BouncyLevelBounds](#BouncyLevelBounds)
| Identifier | Value |
| :--------- | :---- |
| BOUNCY_LEVEL_BOUNDS_OFF | 0 |
| BOUNCY_LEVEL_BOUNDS_ON | 1 |
| BOUNCY_LEVEL_BOUNDS_ON_CAP | 2 |
### [enum NetworkSystemType](#NetworkSystemType)
| Identifier | Value |
| :--------- | :---- |

View file

@ -4030,6 +4030,27 @@
<br />
## [lvl_set_current_level](#lvl_set_current_level)
### Lua Example
`local integerValue = lvl_set_current_level(arg0, levelNum)`
### Parameters
| Field | Type |
| ----- | ---- |
| arg0 | `integer` |
| levelNum | `integer` |
### Returns
- `integer`
### C Prototype
`s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);`
[:arrow_up_small:](#)
<br />
## [warp_special](#warp_special)
### Lua Example

View file

@ -859,6 +859,7 @@
- [get_painting_warp_node](functions-3.md#get_painting_warp_node)
- [initiate_painting_warp](functions-3.md#initiate_painting_warp)
- [level_trigger_warp](functions-3.md#level_trigger_warp)
- [lvl_set_current_level](functions-3.md#lvl_set_current_level)
- [warp_special](functions-3.md#warp_special)
<br />

View file

@ -3193,7 +3193,7 @@ void update_camera(struct Camera *c) {
gCamera = c;
update_camera_hud_status(c);
if ((gOverrideFreezeCamera || first_person_update()) && !gDjuiInMainMenu) {
if ((gOverrideFreezeCamera || get_first_person_enabled()) && !gDjuiInMainMenu) {
return;
}
@ -7199,15 +7199,13 @@ void find_mario_floor_and_ceil(struct PlayerGeometry *pg) {
s16 tempCheckingSurfaceCollisionsForCamera = gCheckingSurfaceCollisionsForCamera;
gCheckingSurfaceCollisionsForCamera = TRUE;
if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f,
sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit) {
if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit && surf != NULL) {
pg->currFloorType = surf->type;
} else {
pg->currFloorType = 0;
}
if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f,
sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit) {
if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit && surf != NULL) {
pg->currCeilType = surf->type;
} else {
pg->currCeilType = 0;

View file

@ -35,6 +35,9 @@ bool first_person_check_cancels(void) {
if (m->action == ACT_FIRST_PERSON || m->action == ACT_IN_CANNON || m->action == ACT_READING_NPC_DIALOG || m->action == ACT_DISAPPEARED) {
return true;
}
if (gLuaLoadingMod != NULL) { return false; }
struct Object *bowser = find_object_with_behavior(bhvBowser);
if (bowser != NULL && (bowser->oAction == 5 || bowser->oAction == 6)) {
return true;
@ -138,13 +141,13 @@ void first_person_camera_update(void) {
gFOVState.fov = gFirstPersonCamera.fov;
}
bool first_person_update(void) {
void first_person_update(void) {
if (gFirstPersonCamera.enabled && !gDjuiInMainMenu) {
struct MarioState *m = &gMarioStates[0];
// check cancels
bool cancel = first_person_check_cancels();
if (cancel) { return false; }
if (cancel) { return; }
struct MarioState *m = &gMarioStates[0];
if (m->action == ACT_SHOT_FROM_CANNON && m->area->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
@ -166,13 +169,9 @@ bool first_person_update(void) {
}
first_person_camera_update();
return true;
} else if (!camera_config_is_mouse_look_enabled()) {
gDjuiHudLockMouse = false;
}
return false;
}
void first_person_reset(void) {

View file

@ -19,7 +19,7 @@ extern struct FirstPersonCamera gFirstPersonCamera;
bool get_first_person_enabled(void);
void set_first_person_enabled(bool enable);
bool first_person_update(void);
void first_person_update(void);
void first_person_reset(void);
#endif

View file

@ -48,17 +48,6 @@
#include "engine/level_script.h"
#include "mario_actions_cutscene.h"
#define WARP_NODE_F0 0xF0
#define WARP_NODE_DEATH 0xF1
#define WARP_NODE_F2 0xF2
#define WARP_NODE_WARP_FLOOR 0xF3
#define WARP_NODE_CREDITS_START 0xF8
#define WARP_NODE_CREDITS_NEXT 0xF9
#define WARP_NODE_CREDITS_END 0xFA
#define WARP_NODE_CREDITS_MIN 0xF8
#define MENU_LEVEL_MIN 0
#define MENU_LEVEL_MAX 17

View file

@ -58,6 +58,15 @@
#define MARIO_SPAWN_LAUNCH_DEATH 0x25
#define MARIO_SPAWN_UNKNOWN_27 0x27
#define WARP_NODE_F0 0xF0
#define WARP_NODE_DEATH 0xF1
#define WARP_NODE_F2 0xF2
#define WARP_NODE_WARP_FLOOR 0xF3
#define WARP_NODE_CREDITS_START 0xF8
#define WARP_NODE_CREDITS_NEXT 0xF9
#define WARP_NODE_CREDITS_END 0xFA
#define WARP_NODE_CREDITS_MIN 0xF8
#define WARP_TYPE_NOT_WARPING 0
#define WARP_TYPE_CHANGE_LEVEL 1
#define WARP_TYPE_CHANGE_AREA 2
@ -162,6 +171,7 @@ void initiate_painting_warp(s16 paintingIndex);
s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
void level_set_transition(s16 length, void (*updateFunction)(s16 *));
void warp_special(s32 arg);
void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused);
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);

View file

@ -20,6 +20,7 @@
#include "platform_displacement.h"
#include "profiler.h"
#include "spawn_object.h"
#include "first_person_cam.h"
#include "engine/math_util.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
@ -293,6 +294,8 @@ void bhv_mario_update(void) {
particleFlags |= gMarioState->particleFlags;
gCurrentObject->oMarioParticleFlags = particleFlags;
if (stateIndex == 0) { first_person_update(); }
// This code is meant to preserve old Lua mods' ability to set overridePaletteIndex and paletteIndex and still work
// as they expected. USE_REAL_PALETTE_VAR is meant to help support cases where mods will do:
// np.overridePaletteIndex = np.paletteIndex

View file

@ -602,12 +602,16 @@ NEXT_OPTION:
void configfile_load(void) {
bool configReadError = false;
#ifdef DEVELOPMENT
configfile_load_internal(configfile_name(), &configReadError);
#else
configfile_load_internal(configfile_name(), &configReadError);
if (configReadError) {
configfile_load_internal(configfile_backup_name(), &configReadError);
} else {
configfile_save(configfile_backup_name());
}
#endif
}
// Writes the config file to 'filename'

View file

@ -83,7 +83,9 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
djui_button_create(body, DLANG(MISC, LANGUAGE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_language_create);
if (gDjuiInMainMenu) {
djui_button_create(body, DLANG(MISC, MENU_OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
}
djui_button_create(body, DLANG(MISC, INFORMATION), DJUI_BUTTON_STYLE_NORMAL, djui_panel_info_create);
#ifdef DEVELOPMENT
djui_button_create(body, DLANG(MISC, DEBUG), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_debug_create);

View file

@ -21,11 +21,13 @@ void djui_panel_options_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(OPTIONS, OPTIONS));
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
if (gDjuiInMainMenu) {
struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
{
djui_button_left_create(&rect1->base, DLANG(PAUSE, PLAYER), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create);
djui_button_right_create(&rect1->base, DLANG(PAUSE, DYNOS_PACKS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create);
}
}
djui_button_create(body, DLANG(OPTIONS, CAMERA), DJUI_BUTTON_STYLE_NORMAL, djui_panel_camera_create);
djui_button_create(body, DLANG(OPTIONS, CONTROLS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_create);
djui_button_create(body, DLANG(OPTIONS, DISPLAY), DJUI_BUTTON_STYLE_NORMAL, djui_panel_display_create);

View file

@ -1569,6 +1569,14 @@ char gSmluaConstants[] = ""
"MARIO_SPAWN_LAUNCH_STAR_COLLECT = 0x24\n"
"MARIO_SPAWN_LAUNCH_DEATH = 0x25\n"
"MARIO_SPAWN_UNKNOWN_27 = 0x27\n"
"WARP_NODE_F0 = 0xF0\n"
"WARP_NODE_DEATH = 0xF1\n"
"WARP_NODE_F2 = 0xF2\n"
"WARP_NODE_WARP_FLOOR = 0xF3\n"
"WARP_NODE_CREDITS_START = 0xF8\n"
"WARP_NODE_CREDITS_NEXT = 0xF9\n"
"WARP_NODE_CREDITS_END = 0xFA\n"
"WARP_NODE_CREDITS_MIN = 0xF8\n"
"WARP_TYPE_NOT_WARPING = 0\n"
"WARP_TYPE_CHANGE_LEVEL = 1\n"
"WARP_TYPE_CHANGE_AREA = 2\n"
@ -2040,6 +2048,9 @@ char gSmluaConstants[] = ""
"PLAYER_INTERACTIONS_NONE = 0\n"
"PLAYER_INTERACTIONS_SOLID = 1\n"
"PLAYER_INTERACTIONS_PVP = 2\n"
"BOUNCY_LEVEL_BOUNDS_OFF = 0\n"
"BOUNCY_LEVEL_BOUNDS_ON = 1\n"
"BOUNCY_LEVEL_BOUNDS_ON_CAP = 2\n"
"UNKNOWN_LOCAL_INDEX = (-1)\n"
"UNKNOWN_GLOBAL_INDEX = (-1)\n"
"UNKNOWN_NETWORK_INDEX = (-1)\n"

View file

@ -13867,6 +13867,25 @@ int smlua_func_level_trigger_warp(lua_State* L) {
return 1;
}
int smlua_func_lvl_set_current_level(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lvl_set_current_level", 2, top);
return 0;
}
s16 arg0 = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lvl_set_current_level"); return 0; }
s32 levelNum = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "lvl_set_current_level"); return 0; }
lua_pushinteger(L, lvl_set_current_level(arg0, levelNum));
return 1;
}
int smlua_func_warp_special(lua_State* L) {
if (L == NULL) { return 0; }
@ -32084,6 +32103,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node);
smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp);
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
smlua_bind_function(L, "warp_special", smlua_func_warp_special);
// mario.h

View file

@ -11,6 +11,9 @@
#include "pc/debuglog.h"
static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction, bool doSync) {
// prevent spawning objects on mod init, this can cause issues if --server is specificed
if (gLuaLoadingMod != NULL) { return NULL; }
if (doSync) {
// prevent spawning objects before area is synchronized
if (gNetworkPlayerLocal == NULL || !gNetworkPlayerLocal->currAreaSyncValid) { return NULL; }

View file

@ -370,9 +370,8 @@ int main(int argc, char *argv[]) {
djui_panel_modlist_create(NULL);
} else {
network_init(NT_NONE, false);
}
WAPI.delay(200);
}
// Main loop
while (true) {