Misc fixes and changes

This commit is contained in:
Agent X 2024-06-26 18:51:06 -04:00
parent 8525a9a2ee
commit 0b8370eacb
7 changed files with 11 additions and 18 deletions

View File

@ -491,6 +491,7 @@ void bhv_chain_chomp_update(void) {
void bhv_wooden_post_update(void) { void bhv_wooden_post_update(void) {
if (!sync_object_is_initialized(o->oSyncID)) { if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS); sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oBehParams);
sync_object_init_field(o, &o->oWoodenPostMarioPounding); sync_object_init_field(o, &o->oWoodenPostMarioPounding);
sync_object_init_field(o, &o->oWoodenPostOffsetY); sync_object_init_field(o, &o->oWoodenPostOffsetY);
sync_object_init_field(o, &o->oWoodenPostSpeedY); sync_object_init_field(o, &o->oWoodenPostSpeedY);
@ -543,6 +544,7 @@ void bhv_wooden_post_update(void) {
if (absi(o->oWoodenPostTotalMarioAngle) > 0x30000 && o->oTimer < 200) { if (absi(o->oWoodenPostTotalMarioAngle) > 0x30000 && o->oTimer < 200) {
obj_spawn_loot_yellow_coins(o, 5, 20.0f); obj_spawn_loot_yellow_coins(o, 5, 20.0f);
set_object_respawn_info_bits(o, 1); set_object_respawn_info_bits(o, 1);
o->oBehParams = WOODEN_POST_BP_NO_COINS_MASK;
network_send_object(o); network_send_object(o);
} }
} }

View File

@ -504,7 +504,7 @@ CameraTransition sModeTransitions[] = {
extern u8 sDanceCutsceneIndexTable[][4]; extern u8 sDanceCutsceneIndexTable[][4];
extern u8 sZoomOutAreaMasks[]; extern u8 sZoomOutAreaMasks[];
static void skip_camera_interpolation(void) { void skip_camera_interpolation(void) {
gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer; gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer;
extern s32 gCamSkipInterp; extern s32 gCamSkipInterp;
gCamSkipInterp = 1; gCamSkipInterp = 1;
@ -10785,12 +10785,6 @@ BAD_RETURN(s32) cutscene_door_move_behind_mario(struct Camera *c) {
vec3s_set(sCutsceneVars[0].angle, 0, sMarioCamState->faceAngle[1] + doorRotation, 0); vec3s_set(sCutsceneVars[0].angle, 0, sMarioCamState->faceAngle[1] + doorRotation, 0);
vec3f_set(camOffset, 0.f, 125.f, 250.f); vec3f_set(camOffset, 0.f, 125.f, 250.f);
if (doorRotation == 0) { //! useless code
camOffset[0] = 0.f;
} else {
camOffset[0] = 0.f;
}
offset_rotated(c->pos, sMarioCamState->pos, camOffset, sCutsceneVars[0].angle); offset_rotated(c->pos, sMarioCamState->pos, camOffset, sCutsceneVars[0].angle);
skip_camera_interpolation(); skip_camera_interpolation();
} }

View File

@ -694,8 +694,7 @@ extern struct Object *gCutsceneFocus;
extern struct Object *gSecondCameraFocus; extern struct Object *gSecondCameraFocus;
extern u8 gRecentCutscene; extern u8 gRecentCutscene;
// TODO: sort all of this extremely messy shit out after the split void skip_camera_interpolation(void);
void set_camera_shake_from_hit(s16 shake); void set_camera_shake_from_hit(s16 shake);
void set_environmental_camera_shake(s16 shake); void set_environmental_camera_shake(s16 shake);
void set_camera_shake_from_point(s16 shake, f32 posX, f32 posY, f32 posZ); void set_camera_shake_from_point(s16 shake, f32 posX, f32 posY, f32 posZ);

View File

@ -59,7 +59,7 @@ void set_first_person_enabled(bool enable) {
gFirstPersonCamera.enabled = enable; gFirstPersonCamera.enabled = enable;
} }
void first_person_camera_update(void) { static void first_person_camera_update(void) {
struct MarioState *m = &gMarioStates[0]; struct MarioState *m = &gMarioStates[0];
f32 sensX = 0.3f * camera_config_get_x_sensitivity(); f32 sensX = 0.3f * camera_config_get_x_sensitivity();
f32 sensY = 0.4f * camera_config_get_y_sensitivity(); f32 sensY = 0.4f * camera_config_get_y_sensitivity();

View File

@ -1490,7 +1490,7 @@ void update_menu_level(void) {
if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) {
reset_volume(); reset_volume();
disable_background_sound(); disable_background_sound();
set_background_music(0, SEQ_MENU_FILE_SELECT, 0); set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0);
} else { } else {
reset_volume(); reset_volume();
disable_background_sound(); disable_background_sound();
@ -1634,9 +1634,7 @@ void update_menu_level(void) {
gMarioState->faceAngle[1] = -0x1C34; gMarioState->faceAngle[1] = -0x1C34;
break; break;
} }
gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer;
extern s32 gCamSkipInterp;
gCamSkipInterp = 1;
if (gCurrentArea != NULL) { if (gCurrentArea != NULL) {
vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos); vec3f_copy(gCurrentArea->camera->pos, gLakituState.curPos);
} }
@ -1659,6 +1657,7 @@ void update_menu_level(void) {
s32 update_level(void) { s32 update_level(void) {
// update main menu level // update main menu level
if (gDjuiInMainMenu) { if (gDjuiInMainMenu) {
skip_camera_interpolation(); // we can't have nice things with this engine and interpolation
update_menu_level(); update_menu_level();
} }
sCancelNextActSelector = gDjuiInMainMenu; sCancelNextActSelector = gDjuiInMainMenu;

View File

@ -2147,7 +2147,7 @@ s32 execute_mario_action(UNUSED struct Object *o) {
// Make remote players disappear when they enter a painting // Make remote players disappear when they enter a painting
// should use same logic as in get_painting_warp_node // should use same logic as in get_painting_warp_node
if (gMarioState->playerIndex != 0) { if (gMarioState->playerIndex != 0 && gCurrentArea->paintingWarpNodes != NULL) {
s32 paintingIndex = gMarioState->floor->type - SURFACE_PAINTING_WARP_D3; s32 paintingIndex = gMarioState->floor->type - SURFACE_PAINTING_WARP_D3;
if (paintingIndex >= PAINTING_WARP_INDEX_START && paintingIndex < PAINTING_WARP_INDEX_END) { if (paintingIndex >= PAINTING_WARP_INDEX_START && paintingIndex < PAINTING_WARP_INDEX_END) {
if (paintingIndex < PAINTING_WARP_INDEX_FA || gMarioState->pos[1] - gMarioState->floorHeight < 80.0f) { if (paintingIndex < PAINTING_WARP_INDEX_FA || gMarioState->pos[1] - gMarioState->floorHeight < 80.0f) {

View File

@ -16,7 +16,7 @@ struct StateExtras {
Vec3f prevPos; Vec3f prevPos;
f32 prevScale; f32 prevScale;
}; };
struct StateExtras sStateExtras[MAX_PLAYERS]; static struct StateExtras sStateExtras[MAX_PLAYERS];
void name_without_hex(char* input) { void name_without_hex(char* input) {
s32 i, j; s32 i, j;
@ -81,7 +81,6 @@ void nametags_render(void) {
pos[1] = m->pos[1] + 210; pos[1] = m->pos[1] + 210;
if (djui_hud_world_pos_to_screen_pos(pos, out) && if (djui_hud_world_pos_to_screen_pos(pos, out) &&
m->marioBodyState->updateTorsoTime == gMarioStates[0].marioBodyState->updateTorsoTime &&
m->action != ACT_IN_CANNON && m->action != ACT_IN_CANNON &&
(i != 0 || (i == 0 && m->action != ACT_FIRST_PERSON))) { (i != 0 || (i == 0 && m->action != ACT_FIRST_PERSON))) {
f32 scale = NAMETAG_MAX_SCALE; f32 scale = NAMETAG_MAX_SCALE;
@ -101,7 +100,7 @@ void nametags_render(void) {
}; };
f32 measure = djui_hud_measure_text(name) * scale * 0.5f; f32 measure = djui_hud_measure_text(name) * scale * 0.5f;
f32 alpha = (np->fadeOpacity / 32) * 255; f32 alpha = (np->fadeOpacity / 32.0f) * 255;
struct StateExtras* e = &sStateExtras[i]; struct StateExtras* e = &sStateExtras[i];
djui_hud_print_outlined_text_interpolated(name, e->prevPos[0] - measure, e->prevPos[1], e->prevScale, out[0] - measure, out[1], scale, color[0], color[1], color[2], alpha, 0.25); djui_hud_print_outlined_text_interpolated(name, e->prevPos[0] - measure, e->prevPos[1], e->prevScale, out[0] - measure, out[1], scale, color[0], color[1], color[2], alpha, 0.25);