Skip to content

Commit 4a35e78

Browse files
authored
Merge pull request n64decomp#31 from FazanaJ/master
Puppycam Incline Look Smoothing
2 parents df47e22 + 0642456 commit 4a35e78

File tree

3 files changed

+82
-86
lines changed

3 files changed

+82
-86
lines changed

include/config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@
101101
//Adds multiple languages to the game. Just a placeholder for the most part, because it only works with EU, and must be enabled with EU.
102102
#define MULTILANG (0 || VERSION_EU)
103103
//Enables Puppy Camera 2, a rewritten camera that can be freely configured and modified.
104-
//#define PUPPYCAM
104+
#define PUPPYCAM
105105

106106

107-
// HACKER QOL
107+
// HACKER QOL
108108
// Increase the maximum pole length (it will treat bparam1 and bparam2 as a single value)
109109
#define LONGER_POLES
110110
// Number of possible unique model ID's (keep it higher than 256)
@@ -116,8 +116,8 @@
116116
// Custom debug mode. Press DPAD left to show the debug UI. Press DPAD right to enter the noclip mode.
117117
//#define CUSTOM_DEBUG
118118
// Include Puppyprint, a display library for text and large images. Also includes a custom, enhanced performance profiler.
119-
//#define PUPPYPRINT
120-
#define PUPPYPRINT_DEBUG 0
119+
#define PUPPYPRINT
120+
#define PUPPYPRINT_DEBUG 1
121121

122122
// BUG/GAME QOL FIXES
123123
// Fix instant warp offset not working when warping across different areas

src/game/puppycam2.c

Lines changed: 72 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "mario.h"
2525
#include "puppyprint.h"
2626

27-
#ifdef PUPPYCAM
27+
//#ifdef PUPPYCAM
2828

2929
#define OFFSET 30.0f
3030
#define STEPS 4
@@ -45,23 +45,23 @@ struct MemoryPool *gPuppyMemoryPool;
4545
s32 gPuppyError = 0;
4646

4747
#if defined(VERSION_EU)
48-
static u8 gPCOptionStringsFR[][64] = {{NC_ANALOGUE_FR}, {NC_CAMX_FR}, {NC_CAMY_FR}, {NC_INVERTX_FR}, {NC_INVERTY_FR}, {NC_CAMC_FR}, {NC_SCHEME_FR}, {NC_WIDE_FR}, {OPTION_LANGUAGE_FR}};
49-
static u8 gPCOptionStringsDE[][64] = {{NC_ANALOGUE_DE}, {NC_CAMX_DE}, {NC_CAMY_DE}, {NC_INVERTX_DE}, {NC_INVERTY_DE}, {NC_CAMC_DE}, {NC_SCHEME_DE}, {NC_WIDE_DE}, {OPTION_LANGUAGE_DE}};
50-
static u8 gPCFlagStringsFR[][64] = {{OPTION_DISABLED_FR}, {OPTION_ENABLED_FR}, {OPTION_SCHEME1_FR}, {OPTION_SCHEME2_FR}, {OPTION_SCHEME3_FR}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
51-
static u8 gPCFlagStringsDE[][64] = {{OPTION_DISABLED_DE}, {OPTION_ENABLED_DE}, {OPTION_SCHEME1_DE}, {OPTION_SCHEME2_DE}, {OPTION_SCHEME3_DE}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
52-
static u8 gPCToggleStringsFR[][64] = {{NC_BUTTON_FR}, {NC_BUTTON2_FR}, {NC_OPTION_FR}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
53-
static u8 gPCToggleStringsDE[][64] = {{NC_BUTTON_DE}, {NC_BUTTON2_DE}, {NC_OPTION_DE}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
48+
static unsigned char gPCOptionStringsFR[][64] = {{NC_ANALOGUE_FR}, {NC_CAMX_FR}, {NC_CAMY_FR}, {NC_INVERTX_FR}, {NC_INVERTY_FR}, {NC_CAMC_FR}, {NC_SCHEME_FR}, {NC_WIDE_FR}, {OPTION_LANGUAGE_FR}};
49+
static unsigned char gPCOptionStringsDE[][64] = {{NC_ANALOGUE_DE}, {NC_CAMX_DE}, {NC_CAMY_DE}, {NC_INVERTX_DE}, {NC_INVERTY_DE}, {NC_CAMC_DE}, {NC_SCHEME_DE}, {NC_WIDE_DE}, {OPTION_LANGUAGE_DE}};
50+
static unsigned char gPCFlagStringsFR[][64] = {{OPTION_DISABLED_FR}, {OPTION_ENABLED_FR}, {OPTION_SCHEME1_FR}, {OPTION_SCHEME2_FR}, {OPTION_SCHEME3_FR}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
51+
static unsigned char gPCFlagStringsDE[][64] = {{OPTION_DISABLED_DE}, {OPTION_ENABLED_DE}, {OPTION_SCHEME1_DE}, {OPTION_SCHEME2_DE}, {OPTION_SCHEME3_DE}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
52+
static unsigned char gPCToggleStringsFR[][64] = {{NC_BUTTON_FR}, {NC_BUTTON2_FR}, {NC_OPTION_FR}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
53+
static unsigned char gPCToggleStringsDE[][64] = {{NC_BUTTON_DE}, {NC_BUTTON2_DE}, {NC_OPTION_DE}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
5454
#endif
55-
static u8 gPCOptionStringsEN[][64] = {{NC_ANALOGUE_EN}, {NC_CAMX_EN}, {NC_CAMY_EN}, {NC_INVERTX_EN}, {NC_INVERTY_EN}, {NC_CAMC_EN}, {NC_SCHEME_EN}, {NC_WIDE_EN}, {OPTION_LANGUAGE_EN}};
56-
static u8 gPCFlagStringsEN[][64] = {{OPTION_DISABLED_EN}, {OPTION_ENABLED_EN}, {OPTION_SCHEME1_EN}, {OPTION_SCHEME2_EN}, {OPTION_SCHEME3_EN}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
57-
static u8 gPCToggleStringsEN[][64] = {{NC_BUTTON_EN}, {NC_BUTTON2_EN}, {NC_OPTION_EN}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
55+
static unsigned char gPCOptionStringsEN[][64] = {{NC_ANALOGUE_EN}, {NC_CAMX_EN}, {NC_CAMY_EN}, {NC_INVERTX_EN}, {NC_INVERTY_EN}, {NC_CAMC_EN}, {NC_SCHEME_EN}, {NC_WIDE_EN}, {OPTION_LANGUAGE_EN}};
56+
static unsigned char gPCFlagStringsEN[][64] = {{OPTION_DISABLED_EN}, {OPTION_ENABLED_EN}, {OPTION_SCHEME1_EN}, {OPTION_SCHEME2_EN}, {OPTION_SCHEME3_EN}, {TEXT_ENGLISH}, {TEXT_FRENCH}, {TEXT_GERMAN},};
57+
static unsigned char gPCToggleStringsEN[][64] = {{NC_BUTTON_EN}, {NC_BUTTON2_EN}, {NC_OPTION_EN}, {NC_HIGHLIGHT_L}, {NC_HIGHLIGHT_R},};
5858

5959

6060
#define OPT 32 //Just a temp thing
6161

62-
static u8 (*gPCOptionStringsPtr)[OPT][64] = &gPCOptionStringsEN;
63-
static u8 (*gPCFlagStringsPtr)[OPT][64] = &gPCFlagStringsEN;
64-
static u8 (*gPCToggleStringsPtr)[OPT][64] = &gPCToggleStringsEN;
62+
static unsigned char (*gPCOptionStringsPtr)[OPT][64] = &gPCOptionStringsEN;
63+
static unsigned char (*gPCFlagStringsPtr)[OPT][64] = &gPCFlagStringsEN;
64+
static unsigned char (*gPCToggleStringsPtr)[OPT][64] = &gPCToggleStringsEN;
6565

6666

6767
static const struct gPCOptionStruct
@@ -259,7 +259,7 @@ void puppycam_change_setting(s8 toggle)
259259
#endif
260260
}
261261

262-
void puppycam_print_text(s32 x, s32 y, u8 str[], s32 col)
262+
void puppycam_print_text(s32 x, s32 y, unsigned char *str, s32 col)
263263
{
264264
s32 textX;
265265
textX = get_str_x_pos_from_center(x,str,10.0f);
@@ -280,10 +280,10 @@ void puppycam_print_text(s32 x, s32 y, u8 str[], s32 col)
280280
void puppycam_display_options()
281281
{
282282
s32 i = 0;
283-
char newstring[32];
283+
unsigned char newstring[32];
284284
s32 scroll;
285285
s32 scrollpos;
286-
s16 var = gPCOptions;
286+
s16 var;
287287
s32 vr;
288288
s32 maxvar;
289289
s32 minvar;
@@ -441,13 +441,12 @@ void puppycam_check_pause_buttons()
441441
//Just a function that sets a bunch of camera values to 0. It's a function because it's got shared functionality.
442442
void puppycam_reset_values(void)
443443
{
444-
gPuppyCam.posHeight[0] = 0;
445-
gPuppyCam.posHeight[1] = 0;
446444
gPuppyCam.swimPitch = 0;
447445
gPuppyCam.edgePitch = 0;
448446
gPuppyCam.moveZoom = 0;
449447
gPuppyCam.floorY[0] = 0;
450448
gPuppyCam.floorY[1] = 0;
449+
gPuppyCam.terrainPitch = 0;
451450
}
452451

453452
//Set up values. Runs on level load.
@@ -495,8 +494,6 @@ void puppycam_init(void)
495494

496495
void puppycam_input_pitch(void)
497496
{
498-
f32 ivY = ((gPuppyCam.options.invertY*2)-1)*(gPuppyCam.options.sensitivityY/100.f);
499-
500497
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_PITCH_ROTATION)
501498
{
502499
//Handles vertical inputs.
@@ -632,7 +629,6 @@ static void puppycam_input_hold_preset3(f32 ivX)
632629
if (gPuppyCam.mode3Flags & PUPPYCAM_MODE3_ZOOMED_IN)
633630
{
634631
gPuppyCam.flags &= ~PUPPYCAM_BEHAVIOUR_COLLISION;
635-
f32 ivY = ((gPuppyCam.options.invertY*2)-1)*(gPuppyCam.options.sensitivityY/100.f);
636632

637633
//Handles continuous movement as normal, as long as the button's held.
638634
if (ABS(gPlayer1Controller->rawStickX) > DEADZONE)
@@ -815,6 +811,8 @@ static void puppycam_view_panning(void)
815811
f32 slideSpeed = 1;
816812

817813
panMulti = CLAMP(gPuppyCam.zoom/(f32)gPuppyCam.zoomPoints[2], 0.f, 1.f);
814+
if (gPuppyCam.options.inputType == 2)
815+
panMulti /= 2;
818816

819817
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_PANSHIFT && gMarioState->action != ACT_HOLDING_BOWSER && gMarioState->action != ACT_SLEEPING && gMarioState->action != ACT_START_SLEEPING)
820818
{
@@ -830,15 +828,15 @@ static void puppycam_view_panning(void)
830828
{
831829
panFloor = CLAMP(find_floor_height((s16)(gPuppyCam.targetObj->oPosX+expectedPanX),(s16)(gPuppyCam.targetObj->oPosY + 200),
832830
(s16)(gPuppyCam.targetObj->oPosZ+expectedPanZ)),gPuppyCam.targetObj->oPosY-50,gPuppyCam.targetObj->oPosY+50);
833-
//If the floor is lower than 50 units below Mario, then ignore the Y value and tilt the camera instead.
834-
if (panFloor <= gPuppyCam.targetObj->oPosY-50)
831+
//If the floor is lower than 150 units below Mario, then ignore the Y value and tilt the camera instead.
832+
if (panFloor <= gPuppyCam.targetObj->oPosY-150)
835833
{
836834
panFloor = gPuppyCam.targetObj->oPosY;
837-
gPuppyCam.edgePitch = approach_s32(gPuppyCam.edgePitch, -0x500, 0x80, 0x80);
835+
gPuppyCam.edgePitch = approach_s32(gPuppyCam.edgePitch, -0x2000, 0x80, 0x80);
838836
}
839837
else
840838
{
841-
gPuppyCam.edgePitch = approach_s32(gPuppyCam.edgePitch, 0, 0x80, 0x80);
839+
gPuppyCam.edgePitch = approach_s32(gPuppyCam.edgePitch, 0, 0x100, 0x100);
842840
}
843841

844842
gPuppyCam.pan[1] = approach_f32_asymptotic(gPuppyCam.pan[1], panFloor-height, 0.25f);
@@ -854,37 +852,52 @@ static void puppycam_view_panning(void)
854852
}
855853
}
856854

857-
//Sets the
858-
static void puppycam_view_height_offset(void)
855+
void puppycam_terrain_angle(void)
859856
{
860-
s16 floorTemp;
861-
s16 tempDist = sqrtf((gPuppyCam.pos[0] - gPuppyCam.focus[0]) * (gPuppyCam.pos[0] - gPuppyCam.focus[0]) + (gPuppyCam.pos[1] - gPuppyCam.focus[1]) *
862-
(gPuppyCam.pos[1] - gPuppyCam.focus[1]) + (gPuppyCam.pos[2] - gPuppyCam.focus[2]) * (gPuppyCam.pos[2] - gPuppyCam.focus[2]));
863-
864-
floorTemp = find_floor_height(gPuppyCam.targetObj->oPosX, gPuppyCam.targetObj->oPosY+50, gPuppyCam.targetObj->oPosZ);
865-
if (floorTemp > gPuppyCam.targetObj->oPosY - 50 && !(gMarioState->action & ACT_FLAG_SWIMMING_OR_FLYING))
857+
f32 adjustSpeed;
858+
s32 floor2 = find_floor_height(gPuppyCam.pos[0], gPuppyCam.pos[1]+100, gPuppyCam.pos[2]);
859+
s32 ceil = 20000;//find_ceil(gPuppyCam.pos[0], gPuppyCam.pos[1]+100, gPuppyCam.pos[2]);
860+
s32 farFromSurface;
861+
s16 floorPitch;
862+
s32 gotTheOkay = FALSE;
863+
864+
if (gMarioState->action & ACT_FLAG_SWIMMING || !(gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_HEIGHT_HELPER))
866865
{
867-
gPuppyCam.posHeight[0] = approach_f32_asymptotic(gPuppyCam.posHeight[0],floorTemp-gPuppyCam.targetFloorHeight,0.05f);
868-
//if (gPuppyCam.posHeight[0]-gPuppyCam.shake[1] - gPuppyCam.floorY[1] < floorTemp)
869-
// gPuppyCam.posHeight[0] = floorTemp-gPuppyCam.shake[1]+gPuppyCam.povHeight - gPuppyCam.floorY[1];
866+
gPuppyCam.intendedTerrainPitch = 0;
867+
adjustSpeed = 0.25f;
868+
farFromSurface = TRUE;
870869
}
871870
else
872871
{
873-
gPuppyCam.posHeight[0] = approach_f32_asymptotic(gPuppyCam.posHeight[0],0,0.1f);
874-
}
872+
f32 x, z, floorHeight;
873+
adjustSpeed = CLAMP(MAX(gMarioState->forwardVel/480.0f, gPuppyCam.yawAcceleration/100.0f), 0.05f, 1.0f);
875874

875+
x = gPuppyCam.targetObj->oPosX - (10 * sins(gPuppyCam.yaw));
876+
z = gPuppyCam.targetObj->oPosZ - (10 * coss(gPuppyCam.yaw));
876877

877-
floorTemp = find_floor_height(gPuppyCam.targetObj->oPosX + LENSIN(tempDist,gPuppyCam.yaw), gPuppyCam.targetObj->oPosY+50, gPuppyCam.targetObj->oPosZ + LENCOS(tempDist,gPuppyCam.yaw));
878-
if (floorTemp > gPuppyCam.targetObj->oPosY - 50 && !(gMarioState->action & ACT_FLAG_SWIMMING_OR_FLYING) && gPuppyCam.collisionDistance != gPuppyCam.zoomTarget)
879-
{
880-
gPuppyCam.posHeight[1] = approach_f32_asymptotic(gPuppyCam.posHeight[1],floorTemp-gPuppyCam.targetFloorHeight,0.05f);
881-
//if (gPuppyCam.posHeight[1]-gPuppyCam.shake[1] - gPuppyCam.floorY[0] < floorTemp)
882-
// gPuppyCam.posHeight[1] = floorTemp-gPuppyCam.shake[1]+gPuppyCam.povHeight - gPuppyCam.floorY[0];
883-
}
884-
else
885-
{
886-
gPuppyCam.posHeight[1] = approach_f32_asymptotic(gPuppyCam.posHeight[1],0,0.1f);
878+
floorHeight = find_floor_height(x, gPuppyCam.targetObj->oPosY+100, z);
879+
880+
if (ABS(gMarioState->floorHeight - floorHeight) > 350)
881+
{
882+
gPuppyCam.intendedTerrainPitch = 0;
883+
}
884+
else
885+
{
886+
floorPitch = -atan2s(10.0f, gMarioState->floorHeight - floorHeight);
887+
gPuppyCam.intendedTerrainPitch = approach_f32_asymptotic(gPuppyCam.intendedTerrainPitch, floorPitch, adjustSpeed);
888+
gotTheOkay = TRUE;
889+
}
890+
891+
//Ensures that the camera is below and above floors and ceilings. It ignores this rule for each if the camera's headed upwards anyway.
892+
farFromSurface = ((gPuppyCam.pos[1] > floor2 + 50 || gPuppyCam.intendedTerrainPitch < gPuppyCam.terrainPitch) && (gPuppyCam.pos[1] < ceil - 50 || gPuppyCam.intendedTerrainPitch > gPuppyCam.terrainPitch));
893+
894+
//If the camera is too close to a vertical obstruction, it'll make the intended pitch much further away, making it swivel faster.
895+
if (!farFromSurface && gotTheOkay)
896+
gPuppyCam.intendedTerrainPitch = approach_f32_asymptotic(gPuppyCam.intendedTerrainPitch, floorPitch, adjustSpeed*3);
887897
}
898+
899+
if (farFromSurface)
900+
gPuppyCam.terrainPitch = approach_f32_asymptotic(gPuppyCam.terrainPitch, gPuppyCam.intendedTerrainPitch, adjustSpeed);
888901
}
889902

890903
/// Multiply vector 'dest' by a
@@ -1104,9 +1117,9 @@ const struct sPuppyAngles puppyAnglesNull =
11041117
{
11051118
{PUPPY_NULL, PUPPY_NULL, PUPPY_NULL},
11061119
{PUPPY_NULL, PUPPY_NULL, PUPPY_NULL},
1107-
{PUPPY_NULL},
1108-
{PUPPY_NULL},
1109-
{PUPPY_NULL},
1120+
PUPPY_NULL,
1121+
PUPPY_NULL,
1122+
PUPPY_NULL,
11101123
};
11111124

11121125
//Checks the bounding box of a puppycam volume. If it's inside, then set the pointer to the current index.
@@ -1166,7 +1179,7 @@ void puppycam_projection_behaviours(void)
11661179
f32 turnRate = 1;
11671180

11681181
//This will only be executed if Mario's the target. If it's not, it'll reset the
1169-
if (gPuppyCam.targetObj = gMarioState->marioObj)
1182+
if (gPuppyCam.targetObj == gMarioState->marioObj)
11701183
{
11711184
if (gPuppyCam.options.turnAggression > 0 && gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_TURN_HELPER && !(gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_INPUT_8DIR) &&
11721185
gMarioState->vel[1] == 0.0f && !(gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_INPUT_4DIR) && gPuppyCam.options.inputType != 2)
@@ -1227,12 +1240,6 @@ void puppycam_projection_behaviours(void)
12271240

12281241
if (gPuppyCam.pitchTarget < 0x2000)
12291242
gPuppyCam.pitchTarget = approach_f32_asymptotic(gPuppyCam.pitchTarget, 0x2000, 0.2f);
1230-
1231-
/*//Will tilt the camera just a wip thing though, doesn't work too well but will hopefully replace view_height_offset eventually.
1232-
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_HEIGHT_HELPER && gMarioState->floor && gMarioState->action & ACT_FLAG_MOVING)
1233-
gPuppyCam.terrainPitch = approach_f32_asymptotic(gPuppyCam.terrainPitch, find_floor_slope(gMarioState, 0), (gMarioState->intendedMag/32)*0.2);
1234-
else
1235-
gPuppyCam.terrainPitch = approach_f32_asymptotic(gPuppyCam.terrainPitch, 0, 0.2);*/
12361243
}
12371244

12381245
//Applies a light outward zoom to the camera when moving. Sets it back to 0 when not moving.
@@ -1275,15 +1282,7 @@ void puppycam_projection_behaviours(void)
12751282
puppycam_view_panning();
12761283

12771284
//This sets a pseudo tilt offset based on the floor heights in front and behind mario.
1278-
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_HEIGHT_HELPER)
1279-
{
1280-
puppycam_view_height_offset();
1281-
}
1282-
else
1283-
{
1284-
gPuppyCam.posHeight[0] = 0;
1285-
gPuppyCam.posHeight[1] = 0;
1286-
}
1285+
puppycam_terrain_angle();
12871286
}
12881287
else
12891288
{
@@ -1301,16 +1300,9 @@ void puppycam_shake(s16 x, s16 y, s16 z)
13011300
//The centrepiece behind the input side of PuppyCam. The C buttons branch off.
13021301
static void puppycam_input_core(void)
13031302
{
1304-
s32 stickMag = 0;
1305-
13061303
puppycam_analogue_stick();
13071304
gPuppyCam.moveFlagAdd = 0;
13081305

1309-
if (gPuppyCam.options.analogue)
1310-
stickMag = gPuppyCam.stick2[1]*1.25f;
1311-
else
1312-
stickMag = 100;
1313-
13141306
//Decide which input for left and right C buttons to use based on behaviour type.
13151307
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_INPUT_NORMAL)
13161308
puppycam_input_hold();
@@ -1334,7 +1326,7 @@ static void puppycam_projection(void)
13341326
gPuppyCam.yaw = gPuppyCam.yawTarget - approach_f32_asymptotic((s16)(gPuppyCam.yawTarget - gPuppyCam.yaw), 0, 0.3335f);
13351327
gPuppyCam.pitch = gPuppyCam.pitchTarget - approach_f32_asymptotic((s16)(gPuppyCam.pitchTarget - gPuppyCam.pitch), 0, 0.3335f);
13361328
//This adds the pitch effect when underwater, which is capped so it doesn't get out of control. If you're not swimming, swimpitch is 0, so it's normal.
1337-
pitchTotal = CLAMP(gPuppyCam.pitch+(gPuppyCam.swimPitch*10)+gPuppyCam.edgePitch, 800, 0x7800);
1329+
pitchTotal = CLAMP(gPuppyCam.pitch+(gPuppyCam.swimPitch*10)+gPuppyCam.edgePitch + gPuppyCam.terrainPitch, 800, 0x7800);
13381330

13391331
if (gPuppyCam.targetObj)
13401332
{
@@ -1359,14 +1351,14 @@ static void puppycam_projection(void)
13591351
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_X_MOVEMENT)
13601352
gPuppyCam.focus[0] = targetPos3[0] + gPuppyCam.shake[0] + (gPuppyCam.pan[0]*gPuppyCam.targetDist[1]/gPuppyCam.zoomPoints[2])*panD;
13611353
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_Y_MOVEMENT)
1362-
gPuppyCam.focus[1] = targetPos3[1] + gPuppyCam.shake[1] + (gPuppyCam.pan[1]*gPuppyCam.targetDist[1]/gPuppyCam.zoomPoints[2]) + gPuppyCam.povHeight - gPuppyCam.floorY[0] + gPuppyCam.posHeight[0] + (gPuppyCam.swimPitch/10);
1354+
gPuppyCam.focus[1] = targetPos3[1] + gPuppyCam.shake[1] + (gPuppyCam.pan[1]*gPuppyCam.targetDist[1]/gPuppyCam.zoomPoints[2]) + gPuppyCam.povHeight - gPuppyCam.floorY[0] + (gPuppyCam.swimPitch/10);
13631355
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_Z_MOVEMENT)
13641356
gPuppyCam.focus[2] = targetPos3[2] + gPuppyCam.shake[2] + (gPuppyCam.pan[2]*gPuppyCam.targetDist[1]/gPuppyCam.zoomPoints[2])*panD;
13651357

13661358
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_X_MOVEMENT)
13671359
gPuppyCam.pos[0] = gPuppyCam.targetObj->oPosX + LENSIN(LENSIN(gPuppyCam.targetDist[1],pitchTotal),gPuppyCam.yaw) + gPuppyCam.shake[0];
13681360
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_Y_MOVEMENT)
1369-
gPuppyCam.pos[1] = gPuppyCam.targetObj->oPosY + gPuppyCam.povHeight + LENCOS(gPuppyCam.targetDist[1],pitchTotal) + gPuppyCam.shake[1] - gPuppyCam.floorY[1] + gPuppyCam.posHeight[1];
1361+
gPuppyCam.pos[1] = gPuppyCam.targetObj->oPosY + gPuppyCam.povHeight + LENCOS(gPuppyCam.targetDist[1],pitchTotal) + gPuppyCam.shake[1] - gPuppyCam.floorY[1];
13701362
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_Z_MOVEMENT)
13711363
gPuppyCam.pos[2] = gPuppyCam.targetObj->oPosZ + LENCOS(LENSIN(gPuppyCam.targetDist[1],pitchTotal),gPuppyCam.yaw) + gPuppyCam.shake[2];
13721364
}
@@ -1460,7 +1452,7 @@ static void puppycam_collision(void)
14601452
Vec3f camdir[2];
14611453
Vec3f hitpos[2];
14621454
Vec3f target[2];
1463-
s16 pitchTotal = CLAMP(gPuppyCam.pitch+(gPuppyCam.swimPitch*10), 800, 0x7800);
1455+
s16 pitchTotal = CLAMP(gPuppyCam.pitch+(gPuppyCam.swimPitch*10) + gPuppyCam.terrainPitch, 800, 0x7800);
14641456
s32 dist[2];
14651457

14661458
if (gPuppyCam.targetObj == NULL)
@@ -1476,7 +1468,7 @@ static void puppycam_collision(void)
14761468
target[1][2] = gPuppyCam.targetObj->oPosZ;
14771469

14781470
camdir[0][0] = LENSIN(LENSIN(gPuppyCam.zoomTarget,pitchTotal),gPuppyCam.yaw) + gPuppyCam.shake[0];
1479-
camdir[0][1] = LENCOS(gPuppyCam.zoomTarget,pitchTotal) + gPuppyCam.shake[1];// + gPuppyCam.posHeight[1];
1471+
camdir[0][1] = LENCOS(gPuppyCam.zoomTarget,pitchTotal) + gPuppyCam.shake[1];
14801472
camdir[0][2] = LENCOS(LENSIN(gPuppyCam.zoomTarget,pitchTotal),gPuppyCam.yaw) + gPuppyCam.shake[2];
14811473

14821474
camdir[1][0] = camdir[0][0];
@@ -1603,4 +1595,4 @@ void puppycam_loop(void)
16031595
puppycam_apply();
16041596
}
16051597

1606-
#endif
1598+
//#endif

0 commit comments

Comments
 (0)