60fps more camera fixes

This commit is contained in:
Niko 2024-04-15 20:27:03 -07:00
parent 4f0fba6a3f
commit 9f021a1318
5 changed files with 38 additions and 15 deletions

View File

@ -9,10 +9,11 @@ void DECOMP_CAM_EndOfRace_Battle(struct CameraDC* cDC, struct Driver* d) {
int height; int height;
struct PushBuffer* pb; struct PushBuffer* pb;
// transition to the radius of // This is NOT TransitionTo,
// the camera that spins around player // spin360's spinSpeed (missing union)
// and spinHeight, spinDistance, etc
height = data.Spin360_heightOffset_cameraPos[sdata->gGT->numPlyrCurrGame]; height = data.Spin360_heightOffset_cameraPos[sdata->gGT->numPlyrCurrGame];
cDC->transitionTo.pos[0] = 0xffe5; cDC->transitionTo.pos[0] = FPS_HALF(0xffe5);
cDC->transitionTo.pos[1] = height; cDC->transitionTo.pos[1] = height;
cDC->transitionTo.pos[2] = 0xc0; cDC->transitionTo.pos[2] = 0xc0;

View File

@ -3,16 +3,21 @@
void DECOMP_CAM_FollowDriver_Spin360(struct CameraDC* cDC, int param_2, struct Driver* d, short* desiredPos, short* desiredRot) void DECOMP_CAM_FollowDriver_Spin360(struct CameraDC* cDC, int param_2, struct Driver* d, short* desiredPos, short* desiredRot)
{ {
int ratio; int ratio;
short posX; short spinSpeed;
// === Union Missing ===
// Not really "transitionTo" but the variables
// are shared with other camera modes, therefore
// need a union with proper names for each mode
// rotate one way // rotate one way
posX = cDC->transitionTo.pos[0]; spinSpeed = cDC->transitionTo.pos[0];
// rotate other way for odd number // rotate other way for odd number
if ((d->driverID & 1) != 0) if ((d->driverID & 1) != 0)
posX = -posX; spinSpeed = -spinSpeed;
int angle = cDC->unk90 + posX; int angle = cDC->unk90 + spinSpeed;
cDC->unk90 = angle; cDC->unk90 = angle;
ratio = MATH_Sin(angle); ratio = MATH_Sin(angle);

View File

@ -253,10 +253,16 @@ void DECOMP_CAM_ThTick(struct Thread *t)
(cDC->transitionTo).rot[2] = psVar21[7]; (cDC->transitionTo).rot[2] = psVar21[7];
*(short *)&cDC->unk_b0[0] = psVar21[8]; *(short *)&cDC->unk_b0[0] = psVar21[8];
break; break;
// Spin360
case 10: case 10:
sVar6 = *psVar19;
// spinSpeed
sVar6 = FPS_HALF(*psVar19);
psVar19 = psVar21 + 2; psVar19 = psVar21 + 2;
goto LAB_8001b928; goto LAB_8001b928;
case 11: case 11:
sVar6 = *(short *)&pb->distanceToScreen_CURR; sVar6 = *(short *)&pb->distanceToScreen_CURR;
pb->pos[0] = *psVar19; pb->pos[0] = *psVar19;
@ -432,13 +438,19 @@ LAB_8001c128:
{ {
if ((gGT->level1->cnt_restart_points != 0) && ((gGT->gameMode1 & 0xf) == 0)) if ((gGT->level1->cnt_restart_points != 0) && ((gGT->gameMode1 & 0xf) == 0))
{ {
uVar9 = CAM_FollowDriver_TrackPath(cDC, (short *)0x1f800390, (int)*(short *)&cDC->unk_b0[0], 1); uVar9 = CAM_FollowDriver_TrackPath(
iVar7 = FPS_HALF(-0xc0); cDC, (short *)0x1f800390,
FPS_HALF(*(short *)&cDC->unk_b0[0]),
1);
iVar7 = -0xc0;
if (-1 < *(short *)&cDC->unk_b0[0]) if (-1 < *(short *)&cDC->unk_b0[0])
{ iVar7 = 0xc0;
iVar7 = FPS_HALF(0xc0);
} uVar10 = CAM_FollowDriver_TrackPath(
uVar10 = CAM_FollowDriver_TrackPath(cDC, (short *)0x1f800398, iVar7, 0); cDC, (short *)0x1f800398,
FPS_HALF(iVar7),
0);
// interpolate two rotations // interpolate two rotations

View File

@ -1124,6 +1124,8 @@ void FUN_80018d9c(int param_1,int param_2)
undefined2 uVar1; undefined2 uVar1;
long lVar2; long lVar2;
// This is NOT TransitionTo,
// spin360's spinSpeed (missing union)
*(undefined2 *)(param_1 + 0xa4) = 0xffe5; *(undefined2 *)(param_1 + 0xa4) = 0xffe5;
// Activate end-of-race Battle flag // Activate end-of-race Battle flag

View File

@ -166,6 +166,8 @@ struct CameraDC
// difference between 8e and 9e? // difference between 8e and 9e?
// 0xa4 // 0xa4
// union shared between camera modes
// Spin360 uses 0xa4 for spin speed
struct struct
{ {
short pos[3]; short pos[3];
@ -173,7 +175,8 @@ struct CameraDC
} transitionTo; } transitionTo;
// 0xb0 - next byte // 0xb0 - next byte
// 0xb0 - 2 byte short, speed of camera on track path // union between multiple camera modes
// TrackPath uses 0xb0 for movement speed
char unk_b0[8]; char unk_b0[8];
// X axis (0xb8) // X axis (0xb8)