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
fgsfds
FluffaLuigi
Isaac0-dev
kebabstorm
MegaMech
theclashingfritz
@ -22,7 +23,6 @@ Contributors:
Filipianosol
GammaTendonNine
gunvalk
IsaacBrumby
jkcoxson
Llennpie
LuigiNoodle

View file

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

View file

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

View file

@ -213,7 +213,7 @@ void coin_inside_boo_act_1(void) {
}
cur_obj_move_standard(-30);
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;
if (cur_obj_wait_then_blink(400, 20))
obj_mark_for_deletion(o);

View file

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

View file

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

View file

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

View file

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

View file

@ -45,6 +45,7 @@ extern OSContPad gInteractablePad;
extern struct DjuiBase* gDjuiHovered;
extern struct DjuiBase* gDjuiCursorDownOn;
extern struct DjuiBase* gInteractableFocus;
extern struct DjuiBase* gInteractableBinding;
bool djui_interactable_is_binding(void);
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);
if (obj == NULL) {
LOG_ERROR("failed to allocate object");
return NULL;

View file

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