24
24
#include "mario.h"
25
25
#include "puppyprint.h"
26
26
27
- #ifdef PUPPYCAM
27
+ // #ifdef PUPPYCAM
28
28
29
29
#define OFFSET 30.0f
30
30
#define STEPS 4
@@ -45,23 +45,23 @@ struct MemoryPool *gPuppyMemoryPool;
45
45
s32 gPuppyError = 0 ;
46
46
47
47
#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 },};
54
54
#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 },};
58
58
59
59
60
60
#define OPT 32 //Just a temp thing
61
61
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 ;
65
65
66
66
67
67
static const struct gPCOptionStruct
@@ -259,7 +259,7 @@ void puppycam_change_setting(s8 toggle)
259
259
#endif
260
260
}
261
261
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 )
263
263
{
264
264
s32 textX ;
265
265
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)
280
280
void puppycam_display_options ()
281
281
{
282
282
s32 i = 0 ;
283
- char newstring [32 ];
283
+ unsigned char newstring [32 ];
284
284
s32 scroll ;
285
285
s32 scrollpos ;
286
- s16 var = gPCOptions ;
286
+ s16 var ;
287
287
s32 vr ;
288
288
s32 maxvar ;
289
289
s32 minvar ;
@@ -441,13 +441,12 @@ void puppycam_check_pause_buttons()
441
441
//Just a function that sets a bunch of camera values to 0. It's a function because it's got shared functionality.
442
442
void puppycam_reset_values (void )
443
443
{
444
- gPuppyCam .posHeight [0 ] = 0 ;
445
- gPuppyCam .posHeight [1 ] = 0 ;
446
444
gPuppyCam .swimPitch = 0 ;
447
445
gPuppyCam .edgePitch = 0 ;
448
446
gPuppyCam .moveZoom = 0 ;
449
447
gPuppyCam .floorY [0 ] = 0 ;
450
448
gPuppyCam .floorY [1 ] = 0 ;
449
+ gPuppyCam .terrainPitch = 0 ;
451
450
}
452
451
453
452
//Set up values. Runs on level load.
@@ -495,8 +494,6 @@ void puppycam_init(void)
495
494
496
495
void puppycam_input_pitch (void )
497
496
{
498
- f32 ivY = ((gPuppyCam .options .invertY * 2 )- 1 )* (gPuppyCam .options .sensitivityY /100.f );
499
-
500
497
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_PITCH_ROTATION )
501
498
{
502
499
//Handles vertical inputs.
@@ -632,7 +629,6 @@ static void puppycam_input_hold_preset3(f32 ivX)
632
629
if (gPuppyCam .mode3Flags & PUPPYCAM_MODE3_ZOOMED_IN )
633
630
{
634
631
gPuppyCam .flags &= ~PUPPYCAM_BEHAVIOUR_COLLISION ;
635
- f32 ivY = ((gPuppyCam .options .invertY * 2 )- 1 )* (gPuppyCam .options .sensitivityY /100.f );
636
632
637
633
//Handles continuous movement as normal, as long as the button's held.
638
634
if (ABS (gPlayer1Controller -> rawStickX ) > DEADZONE )
@@ -815,6 +811,8 @@ static void puppycam_view_panning(void)
815
811
f32 slideSpeed = 1 ;
816
812
817
813
panMulti = CLAMP (gPuppyCam .zoom /(f32 )gPuppyCam .zoomPoints [2 ], 0.f , 1.f );
814
+ if (gPuppyCam .options .inputType == 2 )
815
+ panMulti /= 2 ;
818
816
819
817
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_PANSHIFT && gMarioState -> action != ACT_HOLDING_BOWSER && gMarioState -> action != ACT_SLEEPING && gMarioState -> action != ACT_START_SLEEPING )
820
818
{
@@ -830,15 +828,15 @@ static void puppycam_view_panning(void)
830
828
{
831
829
panFloor = CLAMP (find_floor_height ((s16 )(gPuppyCam .targetObj -> oPosX + expectedPanX ),(s16 )(gPuppyCam .targetObj -> oPosY + 200 ),
832
830
(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 )
835
833
{
836
834
panFloor = gPuppyCam .targetObj -> oPosY ;
837
- gPuppyCam .edgePitch = approach_s32 (gPuppyCam .edgePitch , -0x500 , 0x80 , 0x80 );
835
+ gPuppyCam .edgePitch = approach_s32 (gPuppyCam .edgePitch , -0x2000 , 0x80 , 0x80 );
838
836
}
839
837
else
840
838
{
841
- gPuppyCam .edgePitch = approach_s32 (gPuppyCam .edgePitch , 0 , 0x80 , 0x80 );
839
+ gPuppyCam .edgePitch = approach_s32 (gPuppyCam .edgePitch , 0 , 0x100 , 0x100 );
842
840
}
843
841
844
842
gPuppyCam .pan [1 ] = approach_f32_asymptotic (gPuppyCam .pan [1 ], panFloor - height , 0.25f );
@@ -854,37 +852,52 @@ static void puppycam_view_panning(void)
854
852
}
855
853
}
856
854
857
- //Sets the
858
- static void puppycam_view_height_offset (void )
855
+ void puppycam_terrain_angle (void )
859
856
{
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 ))
866
865
{
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 ;
870
869
}
871
870
else
872
871
{
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 );
875
874
875
+ x = gPuppyCam .targetObj -> oPosX - (10 * sins (gPuppyCam .yaw ));
876
+ z = gPuppyCam .targetObj -> oPosZ - (10 * coss (gPuppyCam .yaw ));
876
877
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 );
887
897
}
898
+
899
+ if (farFromSurface )
900
+ gPuppyCam .terrainPitch = approach_f32_asymptotic (gPuppyCam .terrainPitch , gPuppyCam .intendedTerrainPitch , adjustSpeed );
888
901
}
889
902
890
903
/// Multiply vector 'dest' by a
@@ -1104,9 +1117,9 @@ const struct sPuppyAngles puppyAnglesNull =
1104
1117
{
1105
1118
{PUPPY_NULL , PUPPY_NULL , PUPPY_NULL },
1106
1119
{PUPPY_NULL , PUPPY_NULL , PUPPY_NULL },
1107
- { PUPPY_NULL } ,
1108
- { PUPPY_NULL } ,
1109
- { PUPPY_NULL } ,
1120
+ PUPPY_NULL ,
1121
+ PUPPY_NULL ,
1122
+ PUPPY_NULL ,
1110
1123
};
1111
1124
1112
1125
//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)
1166
1179
f32 turnRate = 1 ;
1167
1180
1168
1181
//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 )
1170
1183
{
1171
1184
if (gPuppyCam .options .turnAggression > 0 && gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_TURN_HELPER && !(gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_INPUT_8DIR ) &&
1172
1185
gMarioState -> vel [1 ] == 0.0f && !(gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_INPUT_4DIR ) && gPuppyCam .options .inputType != 2 )
@@ -1227,12 +1240,6 @@ void puppycam_projection_behaviours(void)
1227
1240
1228
1241
if (gPuppyCam .pitchTarget < 0x2000 )
1229
1242
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);*/
1236
1243
}
1237
1244
1238
1245
//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)
1275
1282
puppycam_view_panning ();
1276
1283
1277
1284
//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 ();
1287
1286
}
1288
1287
else
1289
1288
{
@@ -1301,16 +1300,9 @@ void puppycam_shake(s16 x, s16 y, s16 z)
1301
1300
//The centrepiece behind the input side of PuppyCam. The C buttons branch off.
1302
1301
static void puppycam_input_core (void )
1303
1302
{
1304
- s32 stickMag = 0 ;
1305
-
1306
1303
puppycam_analogue_stick ();
1307
1304
gPuppyCam .moveFlagAdd = 0 ;
1308
1305
1309
- if (gPuppyCam .options .analogue )
1310
- stickMag = gPuppyCam .stick2 [1 ]* 1.25f ;
1311
- else
1312
- stickMag = 100 ;
1313
-
1314
1306
//Decide which input for left and right C buttons to use based on behaviour type.
1315
1307
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_INPUT_NORMAL )
1316
1308
puppycam_input_hold ();
@@ -1334,7 +1326,7 @@ static void puppycam_projection(void)
1334
1326
gPuppyCam .yaw = gPuppyCam .yawTarget - approach_f32_asymptotic ((s16 )(gPuppyCam .yawTarget - gPuppyCam .yaw ), 0 , 0.3335f );
1335
1327
gPuppyCam .pitch = gPuppyCam .pitchTarget - approach_f32_asymptotic ((s16 )(gPuppyCam .pitchTarget - gPuppyCam .pitch ), 0 , 0.3335f );
1336
1328
//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 );
1338
1330
1339
1331
if (gPuppyCam .targetObj )
1340
1332
{
@@ -1359,14 +1351,14 @@ static void puppycam_projection(void)
1359
1351
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_X_MOVEMENT )
1360
1352
gPuppyCam .focus [0 ] = targetPos3 [0 ] + gPuppyCam .shake [0 ] + (gPuppyCam .pan [0 ]* gPuppyCam .targetDist [1 ]/gPuppyCam .zoomPoints [2 ])* panD ;
1361
1353
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 );
1363
1355
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_Z_MOVEMENT )
1364
1356
gPuppyCam .focus [2 ] = targetPos3 [2 ] + gPuppyCam .shake [2 ] + (gPuppyCam .pan [2 ]* gPuppyCam .targetDist [1 ]/gPuppyCam .zoomPoints [2 ])* panD ;
1365
1357
1366
1358
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_X_MOVEMENT )
1367
1359
gPuppyCam .pos [0 ] = gPuppyCam .targetObj -> oPosX + LENSIN (LENSIN (gPuppyCam .targetDist [1 ],pitchTotal ),gPuppyCam .yaw ) + gPuppyCam .shake [0 ];
1368
1360
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 ];
1370
1362
if (gPuppyCam .flags & PUPPYCAM_BEHAVIOUR_Z_MOVEMENT )
1371
1363
gPuppyCam .pos [2 ] = gPuppyCam .targetObj -> oPosZ + LENCOS (LENSIN (gPuppyCam .targetDist [1 ],pitchTotal ),gPuppyCam .yaw ) + gPuppyCam .shake [2 ];
1372
1364
}
@@ -1460,7 +1452,7 @@ static void puppycam_collision(void)
1460
1452
Vec3f camdir [2 ];
1461
1453
Vec3f hitpos [2 ];
1462
1454
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 );
1464
1456
s32 dist [2 ];
1465
1457
1466
1458
if (gPuppyCam .targetObj == NULL )
@@ -1476,7 +1468,7 @@ static void puppycam_collision(void)
1476
1468
target [1 ][2 ] = gPuppyCam .targetObj -> oPosZ ;
1477
1469
1478
1470
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 ];
1480
1472
camdir [0 ][2 ] = LENCOS (LENSIN (gPuppyCam .zoomTarget ,pitchTotal ),gPuppyCam .yaw ) + gPuppyCam .shake [2 ];
1481
1473
1482
1474
camdir [1 ][0 ] = camdir [0 ][0 ];
@@ -1603,4 +1595,4 @@ void puppycam_loop(void)
1603
1595
puppycam_apply ();
1604
1596
}
1605
1597
1606
- #endif
1598
+ // #endif
0 commit comments