fix building interpolation

This commit is contained in:
Sonic Dreamcaster 2024-10-16 21:16:05 -03:00
parent bdf56300df
commit 7496dd4c2e
4 changed files with 59 additions and 3 deletions

6
include/debug.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef DEBUG_H
#define DEBUG_H
#define DEBUG_SPEED_CONTROL 1
#endif

View File

@ -2,6 +2,7 @@
#define GLOBAL_H
#include "sys.h"
#include "debug.h"
typedef enum OverlayCalls {
/* 90 */ OVLCALL_FO_CS_COMPLETE = 90,

View File

@ -1907,4 +1907,27 @@ void Display_Update(void) {
Display_DrawHelpAlert();
sPlayersVisible[gPlayerNum] = false;
Matrix_Pop(&gGfxMatrix);
#if DEBUG_SPEED_CONTROL == 1 // baseSpeed control
{
Player* player = gPlayer;
static s32 prevSpeed;
static bool debugFreeze = false;
if (gControllerPress[0].button & L_JPAD) {
player->baseSpeed -= 50;
} else if (gControllerPress[0].button & R_JPAD) {
player->baseSpeed += 50;
}
if ((!debugFreeze) && (gControllerPress[0].button & D_JPAD)) {
prevSpeed = player->baseSpeed;
player->baseSpeed = 0;
debugFreeze = true;
} else if ((debugFreeze) && (gControllerPress[0].button & D_JPAD)) {
player->baseSpeed = prevSpeed;
debugFreeze = false;
}
}
#endif
}

View File

@ -186,7 +186,7 @@ void CoBuilding9_Draw(CoBuilding9* this) {
}
void CoBuilding10_Draw(CoBuilding10* this) {
gSPDisplayList(gMasterDisp++, aCoBuilding10DL);
gSPDisplayList(gMasterDisp++, aCoBuilding9DL);
}
// repurposed into OBJ_SCENERY_CO_BUILDING_6
@ -943,6 +943,22 @@ void ItemMeteoWarp_Draw(ItemMeteoWarp* this) {
}
void func_edisplay_8005D008(Object* obj, s32 drawType) {
bool isBanned = (obj->id >= OBJ_SCENERY_CO_BUILDING_5 &&
obj->id <= OBJ_SCENERY_CO_BUILDING_8 || obj->id == OBJ_SCENERY_CO_BUILDING_10);
bool skipRot = false;
if(isBanned){
f32 prevRot = obj->rot.y;
if (gPlayer[0].cam.eye.x < obj->pos.x) {
obj->rot.y = 271.0f;
} else {
obj->rot.y = 0.0f;
}
skipRot = prevRot != obj->rot.y;
}
if (drawType == 2) {
Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, gPathProgress, MTXF_APPLY);
Matrix_Translate(gCalcMatrix, obj->pos.x, obj->pos.y, obj->pos.z, MTXF_NEW);
@ -950,17 +966,27 @@ void func_edisplay_8005D008(Object* obj, s32 drawType) {
Matrix_Mult(gGfxMatrix, gCalcMatrix, MTXF_APPLY);
Matrix_Copy(&D_edisplay_801615F0, gGfxMatrix);
Matrix_Pop(&gGfxMatrix);
if(isBanned && skipRot){
FrameInterpolation_ShouldInterpolateFrame(false);
}
Matrix_RotateY(gCalcMatrix, obj->rot.y * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gCalcMatrix, obj->rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gCalcMatrix, obj->rot.z * M_DTOR, MTXF_APPLY);
} else {
Matrix_Translate(gGfxMatrix, obj->pos.x, obj->pos.y, obj->pos.z + gPathProgress, MTXF_APPLY);
Matrix_Copy(&D_edisplay_801615F0, gGfxMatrix);
if(isBanned && skipRot){
FrameInterpolation_ShouldInterpolateFrame(false);
}
Matrix_RotateY(gGfxMatrix, obj->rot.y * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, obj->rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, obj->rot.z * M_DTOR, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
}
if(isBanned && skipRot){
FrameInterpolation_ShouldInterpolateFrame(true);
}
}
void func_edisplay_8005D1F0(Object* obj, s32 drawType) {
@ -1697,15 +1723,15 @@ void Object_DrawAll(s32 arg0) {
RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if (scenery->obj.status >= OBJ_ACTIVE) {
FrameInterpolation_RecordOpenChild(scenery, i);
if (arg0 > 0) {
Display_SetSecondLight(&scenery->obj.pos);
}
Matrix_Push(&gGfxMatrix);
FrameInterpolation_RecordOpenChild(scenery, i);
Scenery_Draw(scenery, arg0);
FrameInterpolation_RecordCloseChild();
Matrix_Pop(&gGfxMatrix);
Object_UpdateSfxSource(scenery->sfxSource);
FrameInterpolation_RecordCloseChild();
}
}
}