Merge branch 'unstable-dev' into unstable

This commit is contained in:
MysterD 2022-02-27 01:34:25 -08:00
commit 02968831c7
11 changed files with 35 additions and 26 deletions

View file

@ -2,6 +2,7 @@ Developers:
djoslin0 djoslin0
fgsfds fgsfds
FluffaLuigi FluffaLuigi
Isaac0-dev
kebabstorm kebabstorm
MegaMech MegaMech
theclashingfritz theclashingfritz
@ -22,7 +23,6 @@ Contributors:
Filipianosol Filipianosol
GammaTendonNine GammaTendonNine
gunvalk gunvalk
IsaacBrumby
jkcoxson jkcoxson
Llennpie Llennpie
LuigiNoodle LuigiNoodle

View file

@ -889,6 +889,9 @@ s32 anim_spline_poll(struct MarioState* m, Vec3f result) {
vec3f_copy(result, gVec3fZero); vec3f_copy(result, gVec3fZero);
spline_get_weights(m, weights, m->splineKeyframeFraction, m->splineState); spline_get_weights(m, weights, m->splineKeyframeFraction, m->splineState);
if (m->splineKeyframe == NULL) { return FALSE; }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
result[0] += weights[i] * m->splineKeyframe[i][1]; result[0] += weights[i] * m->splineKeyframe[i][1];
result[1] += weights[i] * m->splineKeyframe[i][2]; result[1] += weights[i] * m->splineKeyframe[i][2];

View file

@ -71,6 +71,7 @@ static struct Surface *alloc_surface(void) {
// we, um... // we, um...
// Perhaps originally just debug feedback? // Perhaps originally just debug feedback?
if (gSurfacesAllocated >= sSurfacePoolSize) { if (gSurfacesAllocated >= sSurfacePoolSize) {
return NULL;
} }
surface->type = 0; surface->type = 0;
@ -363,6 +364,7 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
nz *= mag; nz *= mag;
surface = alloc_surface(); surface = alloc_surface();
if (surface == NULL) { return NULL; }
vec3s_copy(surface->prevVertex1, surface->vertex1); vec3s_copy(surface->prevVertex1, surface->vertex1);
vec3s_copy(surface->prevVertex2, surface->vertex2); vec3s_copy(surface->prevVertex2, surface->vertex2);

View file

@ -213,7 +213,7 @@ void coin_inside_boo_act_1(void) {
} }
cur_obj_move_standard(-30); cur_obj_move_standard(-30);
bhv_coin_sparkles_init(); bhv_coin_sparkles_init();
if (cur_obj_has_model(MODEL_BLUE_COIN)) if (cur_obj_has_model(smlua_model_util_load(E_MODEL_BLUE_COIN)))
o->oDamageOrCoinValue = 5; o->oDamageOrCoinValue = 5;
if (cur_obj_wait_then_blink(400, 20)) if (cur_obj_wait_then_blink(400, 20))
obj_mark_for_deletion(o); obj_mark_for_deletion(o);

View file

@ -53,9 +53,8 @@ void exclamation_box_act_0(void) {
void exclamation_box_act_1(void) { void exclamation_box_act_1(void) {
cur_obj_become_intangible(); cur_obj_become_intangible();
if (o->oTimer == 0) { if (o->oTimer == 0) {
u8 loadedModelId = smlua_model_util_load(E_MODEL_EXCLAMATION_POINT); spawn_object(o, smlua_model_util_load(E_MODEL_EXCLAMATION_POINT), bhvRotatingExclamationMark);
spawn_object(o, loadedModelId, bhvRotatingExclamationMark); cur_obj_set_model(smlua_model_util_load(E_MODEL_EXCLAMATION_BOX_OUTLINE));
cur_obj_set_model(loadedModelId);
} }
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte]) if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
|| ((o->oBehParams >> 24) & 0xFF) != 0) { || ((o->oBehParams >> 24) & 0xFF) != 0) {

View file

@ -423,6 +423,7 @@ void configfile_save(const char *filename) {
// save enabled mods // save enabled mods
for (unsigned int i = 0; i < gModTableLocal.entryCount; i++) { for (unsigned int i = 0; i < gModTableLocal.entryCount; i++) {
struct ModListEntry* entry = &gModTableLocal.entries[i]; struct ModListEntry* entry = &gModTableLocal.entries[i];
if (entry == NULL) { continue; }
if (!entry->enabled) { continue; } if (!entry->enabled) { continue; }
fprintf(file, "%s %s\n", "enable-mod:", entry->name); fprintf(file, "%s %s\n", "enable-mod:", entry->name);
} }

View file

@ -329,6 +329,11 @@ void djui_base_destroy(struct DjuiBase* base) {
gDjuiHovered = NULL; gDjuiHovered = NULL;
} }
// remove binding
if (gInteractableBinding == base) {
gInteractableBinding = NULL;
}
// remove myself from parent's linked list // remove myself from parent's linked list
if (base->parent != NULL) { if (base->parent != NULL) {
struct DjuiBaseChild* child = base->parent->child; struct DjuiBaseChild* child = base->parent->child;

View file

@ -21,7 +21,7 @@ static bool sIgnoreInteractableUntilCursorReleased = false;
struct DjuiBase* gDjuiHovered = NULL; struct DjuiBase* gDjuiHovered = NULL;
struct DjuiBase* gDjuiCursorDownOn = NULL; struct DjuiBase* gDjuiCursorDownOn = NULL;
struct DjuiBase* gInteractableFocus = NULL; struct DjuiBase* gInteractableFocus = NULL;
static struct DjuiBase* sInteractableBinding = NULL; struct DjuiBase* gInteractableBinding = NULL;
static struct DjuiBase* sMouseDown = NULL; static struct DjuiBase* sMouseDown = NULL;
bool gInteractableOverridePad = false; bool gInteractableOverridePad = false;
OSContPad gInteractablePad = { 0 }; OSContPad gInteractablePad = { 0 };
@ -163,11 +163,11 @@ static void djui_interactable_cursor_update_active(struct DjuiBase* base) {
} }
bool djui_interactable_is_binding(void) { bool djui_interactable_is_binding(void) {
return sInteractableBinding != NULL; return gInteractableBinding != NULL;
} }
void djui_interactable_set_binding(struct DjuiBase* base) { void djui_interactable_set_binding(struct DjuiBase* base) {
sInteractableBinding = base; gInteractableBinding = base;
djui_cursor_set_visible(base == NULL); djui_cursor_set_visible(base == NULL);
if (base == NULL) { if (base == NULL) {
sIgnoreInteractableUntilCursorReleased = true; sIgnoreInteractableUntilCursorReleased = true;
@ -186,7 +186,7 @@ bool djui_interactable_is_input_focus(struct DjuiBase* base) {
} }
bool djui_interactable_on_key_down(int scancode) { bool djui_interactable_on_key_down(int scancode) {
if (sInteractableBinding != NULL) { if (gInteractableBinding != NULL) {
return true; return true;
} }
@ -377,8 +377,8 @@ void djui_interactable_update(void) {
if (gDjuiPanelPauseCreated) { djui_panel_shutdown(); } if (gDjuiPanelPauseCreated) { djui_panel_shutdown(); }
} }
if (sInteractableBinding != NULL) { if (gInteractableBinding != NULL) {
djui_interactable_on_bind(sInteractableBinding); djui_interactable_on_bind(gInteractableBinding);
} else if ((padButtons & PAD_BUTTON_A) || (mouseButtons & MOUSE_BUTTON_1)) { } else if ((padButtons & PAD_BUTTON_A) || (mouseButtons & MOUSE_BUTTON_1)) {
// cursor down events // cursor down events
if (gDjuiHovered != NULL) { if (gDjuiHovered != NULL) {

View file

@ -45,6 +45,7 @@ extern OSContPad gInteractablePad;
extern struct DjuiBase* gDjuiHovered; extern struct DjuiBase* gDjuiHovered;
extern struct DjuiBase* gDjuiCursorDownOn; extern struct DjuiBase* gDjuiCursorDownOn;
extern struct DjuiBase* gInteractableFocus; extern struct DjuiBase* gInteractableFocus;
extern struct DjuiBase* gInteractableBinding;
bool djui_interactable_is_binding(void); bool djui_interactable_is_binding(void);
void djui_interactable_set_binding(struct DjuiBase* base); void djui_interactable_set_binding(struct DjuiBase* base);

View file

@ -22,6 +22,7 @@ static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum Mod
} }
struct Object* obj = spawn_object(gMarioStates[0].marioObj, loadedModelId, behavior); struct Object* obj = spawn_object(gMarioStates[0].marioObj, loadedModelId, behavior);
if (obj == NULL) { if (obj == NULL) {
LOG_ERROR("failed to allocate object"); LOG_ERROR("failed to allocate object");
return NULL; return NULL;

View file

@ -21,26 +21,24 @@ static int64_t applicationId = 752700005210390568;
struct DiscordApplication app = { 0 }; struct DiscordApplication app = { 0 };
bool gDiscordInitialized = false; bool gDiscordInitialized = false;
bool gDiscordFailed = false; bool gDiscordFailed = false;
static int already_run = 0;
static void discord_sdk_log_callback(UNUSED void* hook_data, enum EDiscordLogLevel level, const char* message) { static void discord_sdk_log_callback(UNUSED void* hook_data, enum EDiscordLogLevel level, const char* message) {
LOGFILE_INFO(LFT_DISCORD, "callback (%d): %s", level, message); LOGFILE_INFO(LFT_DISCORD, "callback (%d): %s", level, message);
} }
void discord_fatal(int rc) { void discord_fatal_message(int rc) {
#if defined(_WIN32) || defined(_WIN64)
char errorMessage[132] = { 0 }; char errorMessage[132] = { 0 };
snprintf(errorMessage, 132, "Discord threw an error.\r\n\r\nTo fix: \r\n1. Close the game.\r\n2. Restart Discord.\r\n3. Start the game.\r\n\r\nRC: %d", rc); snprintf(errorMessage, 132, "Discord threw an error.\nTo fix: \n1. Close the game.\n2. Restart Discord.\n3. Start the game.\nRC: %d", rc);
fflush(stdout); djui_popup_create(errorMessage, 6);
fflush(stderr); }
LOGFILE_ERROR(LFT_DISCORD, "discord fatal %d", rc);
logfile_close(LFT_DISCORD); void discord_fatal(int rc) {
MessageBox(NULL, if (already_run == 0) {
errorMessage, already_run = 1;
"Fatal Discord Error", discord_fatal_message(rc);
MB_ICONERROR | MB_OK | MB_DEFBUTTON1 }
);
exit(1);
#else
SOFT_ASSERT(rc != DiscordResult_ServiceUnavailable); SOFT_ASSERT(rc != DiscordResult_ServiceUnavailable);
SOFT_ASSERT(rc != DiscordResult_InvalidVersion); SOFT_ASSERT(rc != DiscordResult_InvalidVersion);
SOFT_ASSERT(rc != DiscordResult_LockFailed); SOFT_ASSERT(rc != DiscordResult_LockFailed);
@ -83,7 +81,6 @@ void discord_fatal(int rc) {
SOFT_ASSERT(rc != DiscordResult_PurchaseError); SOFT_ASSERT(rc != DiscordResult_PurchaseError);
SOFT_ASSERT(rc != DiscordResult_TransactionAborted); SOFT_ASSERT(rc != DiscordResult_TransactionAborted);
SOFT_ASSERT(rc == DiscordResult_Ok); SOFT_ASSERT(rc == DiscordResult_Ok);
#endif
} }
static void set_instance_env_variable(void) { static void set_instance_env_variable(void) {