forked from sm64-port/sm64-port
-
Notifications
You must be signed in to change notification settings - Fork 33
/
puppycam.patch
2285 lines (2217 loc) · 86.1 KB
/
puppycam.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/Makefile b/Makefile
index 780e51b..dce88c6 100644
--- a/Makefile
+++ b/Makefile
@@ -266,7 +266,7 @@ else
ifeq ($(VERSION),sh)
OPT_FLAGS := -O2
else
- OPT_FLAGS := -g
+ OPT_FLAGS := -O2
endif
endif
@@ -700,6 +700,8 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
+$(BUILD_DIR)/src/game/camera.o: $(BUILD_DIR)/include/text_strings.h
+
################################################################
# TEXTURE GENERATION #
diff --git a/include/segments.h b/include/segments.h
index 8963446..46b8bac 100644
--- a/include/segments.h
+++ b/include/segments.h
@@ -1,5 +1,7 @@
-#ifndef SEGMENTS_H
-#define SEGMENTS_H
+#ifndef _SEGMENTS_H
+#define _SEGMENTS_H
+
+#define USE_EXT_RAM
/*
* Memory addresses for segments. Ideally, this header file would not be
@@ -44,10 +46,10 @@
*/
#define SEG_BUFFERS 0x8005C000 // 0x0085000 in size
-#define SEG_MAIN 0x800E1000 // 0x1328000 in size
-#define SEG_ENGINE 0x80213800 // 0x0017000 in size
-#define SEG_FRAMEBUFFERS 0x8022A800 // 0x0070800 in size
-#define SEG_POOL_START 0x8029B000 // 0x0165000 in size
+#define SEG_MAIN 0x800F1000 // 0x1328000 in size
+#define SEG_ENGINE 0x80223800 // 0x0017000 in size
+#define SEG_FRAMEBUFFERS 0x8023A800 // 0x0070800 in size
+#define SEG_POOL_START 0x802AB000 // 0x0165000 in size
#define SEG_POOL_END 0x80800000
#define SEG_POOL_END_4MB 0x80400000 // For the error message screen enhancement.
#define SEG_GODDARD SEG_POOL_START + 0x113000
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 749179b..eea9ac0 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -3,6 +3,74 @@
#include "text_menu_strings.h"
+#if defined(VERSION_JP)
+ #define NC_CAMX _("Camera X Sensitivity")
+ #define NC_CAMY _("Camera Y Sensitivity")
+ #define NC_INVERTX _("Invert X Axis")
+ #define NC_INVERTY _("Invert Y Axis")
+ #define NC_CAMC _("Camera Centre Aggression")
+ #define NC_CAMD _("Camera Deceleration Speed")
+ #define NC_CAMP _("Camera Pan Level")
+ #define NC_ENABLED _("Enabled")
+ #define NC_DISABLED _("Disabled")
+ #define NC_BUTTON _("[R]: Options")
+ #define NC_BUTTON2 _("[R]: Return")
+ #define NC_OPTION _("PUPPYCAM OPTIONS")
+ #define NC_HIGHLIGHT_L _(">")
+ #define NC_HIGHLIGHT_R _("<")
+ #define NC_ANALOGUE _("Analogue Camera")
+#else
+ #define NC_CAMX _("Camera X Sensitivity")
+ #define NC_CAMY _("Camera Y Sensitivity")
+ #define NC_INVERTX _("Invert X Axis")
+ #define NC_INVERTY _("Invert Y Axis")
+ #define NC_CAMC _("Camera Centre Aggression")
+ #define NC_CAMD _("Camera Deceleration Speed")
+ #define NC_CAMP _("Camera Pan Level")
+ #define NC_ENABLED _("Enabled")
+ #define NC_DISABLED _("Disabled")
+ #define NC_BUTTON _("[R]: Options")
+ #define NC_BUTTON2 _("[R]: Return")
+ #define NC_OPTION _("PUPPYCAM OPTIONS")
+ #define NC_HIGHLIGHT_L _(">")
+ #define NC_HIGHLIGHT_R _("<")
+ #define NC_ANALOGUE _("Analogue Camera")
+#endif
+
+#if defined(VERSION_EU)
+ #define NC_CAMX_FR _("Sensitivité de caméra X")
+ #define NC_CAMY_FR _("Sensitivité de caméra Y")
+ #define NC_INVERTX_FR _("Inverser l'axe X")
+ #define NC_INVERTY_FR _("Inverser l'axe Y")
+ #define NC_CAMC_FR _("Centre d'agression de caméra")
+ #define NC_CAMD_FR _("Velocità di Decelerazione")
+ #define NC_CAMP_FR _("Niveau de mouvement panoramique")
+ #define NC_ENABLED_FR _("Activé")
+ #define NC_DISABLED_FR _("Désactivé")
+ #define NC_BUTTON_FR _("[R]: Options")
+ #define NC_BUTTON2_FR _("[R]: Retour")
+ #define NC_OPTION_FR _("OPTIONS PUPPYCAM")
+ #define NC_HIGHLIGHT_L_FR _(">")
+ #define NC_HIGHLIGHT_R_FR _("<")
+ #define NC_ANALOGUE_FR _("Caméra analogique")
+
+ #define NC_CAMX_DE _("Kamera X Empfindlichkeit")
+ #define NC_CAMY_DE _("Kamera Y Empfindlichkeit")
+ #define NC_INVERTX_DE _("X Achse umdrehen ")
+ #define NC_INVERTY_DE _("Y Achse umdrehen ")
+ #define NC_CAMC_DE _("Mittengeschwindigkeit")
+ #define NC_CAMD_DE _("Kamera Verzögerungsgeschwindigkeit")
+ #define NC_CAMP_DE _("Kamera Schwenklevel")
+ #define NC_ENABLED_DE _("Aktiviert")
+ #define NC_DISABLED_DE _("Deaktiviert")
+ #define NC_BUTTON_DE _("[R]: Optionen")
+ #define NC_BUTTON2_DE _("[R]: Zurück")
+ #define NC_OPTION_DE _("PUPPYCAM OPTIONS")
+ #define NC_HIGHLIGHT_L_DE _(">")
+ #define NC_HIGHLIGHT_R_DE _("<")
+ #define NC_ANALOGUE_DE _("Analogkamera")
+#endif
+
/**
* Global Symbols
*/
diff --git a/src/engine/math_util.c b/src/engine/math_util.c
index 58c5e3f..4bbde69 100644
--- a/src/engine/math_util.c
+++ b/src/engine/math_util.c
@@ -49,6 +49,36 @@ void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
return &dest; //! warning: function returns address of local variable
}
+/// Multiply vector 'dest' by a
+void *vec3f_mul(Vec3f dest, f32 a)
+{
+ dest[0] *= a;
+ dest[1] *= a;
+ dest[2] *= a;
+ return &dest; //! warning: function returns address of local variable
+}
+
+/// Get length of vector 'a'
+f32 vec3f_length(Vec3f a)
+{
+ return sqrtf(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
+}
+
+/// Get dot product of vectors 'a' and 'b'
+f32 vec3f_dot(Vec3f a, Vec3f b)
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+/// Make 'dest' the difference of vectors a and b.
+void *vec3f_dif(Vec3f dest, Vec3f a, Vec3f b)
+{
+ dest[0] = a[0] - b[0];
+ dest[1] = a[1] - b[1];
+ dest[2] = a[2] - b[2];
+ return &dest; //! warning: function returns address of local variable
+}
+
/// Copy vector src to dest
void *vec3s_copy(Vec3s dest, Vec3s src) {
dest[0] = src[0];
diff --git a/src/engine/math_util.h b/src/engine/math_util.h
index cb37d52..2013402 100644
--- a/src/engine/math_util.h
+++ b/src/engine/math_util.h
@@ -32,15 +32,21 @@ extern f32 gCosineTable[];
#define sqr(x) ((x) * (x))
+#define abs(x) ((x) < 0 ? -(x) : (x))
+
void *vec3f_copy(Vec3f dest, Vec3f src);
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z);
void *vec3f_add(Vec3f dest, Vec3f a);
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b);
+void *vec3f_dif(Vec3f dest, Vec3f a, Vec3f b);
+void *vec3f_mul(Vec3f dest, f32 a);
void *vec3s_copy(Vec3s dest, Vec3s src);
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z);
void *vec3s_add(Vec3s dest, Vec3s a);
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b);
void *vec3s_sub(Vec3s dest, Vec3s a);
+f32 vec3f_length(Vec3f a);
+f32 vec3f_dot(Vec3f a, Vec3f b);
void *vec3s_to_vec3f(Vec3f dest, Vec3s a);
void *vec3f_to_vec3s(Vec3s dest, Vec3f a);
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c);
diff --git a/src/engine/surface_collision.c b/src/engine/surface_collision.c
index 9aff62f..822d30a 100644
--- a/src/engine/surface_collision.c
+++ b/src/engine/surface_collision.c
@@ -7,6 +7,8 @@
#include "game/object_list_processor.h"
#include "surface_collision.h"
#include "surface_load.h"
+#include "math_util.h"
+#include "game/game_init.h"
/**************************************************
* WALLS *
diff --git a/src/game/camera.c b/src/game/camera.c
index 30ad26e..bd12d51 100644
--- a/src/game/camera.c
+++ b/src/game/camera.c
@@ -700,6 +700,8 @@ f32 calc_y_to_curr_floor(f32 *posOff, f32 posMul, f32 posBound, f32 *focOff, f32
*focOff = -focBound;
}
}
+//Compiler gets mad if I put this any further above. thanks refresh 7
+#include "src/puppycam/puppycam.inc.c"
void focus_on_mario(Vec3f focus, Vec3f pos, f32 posYOff, f32 focYOff, f32 dist, s16 pitch, s16 yaw) {
Vec3f marioPos;
@@ -2855,6 +2857,8 @@ void set_camera_mode(struct Camera *c, s16 mode, s16 frames) {
struct LinearTransitionPoint *start = &sModeInfo.transitionStart;
struct LinearTransitionPoint *end = &sModeInfo.transitionEnd;
+ if (mode != CAM_MODE_NEWCAM && gLakituState.mode != CAM_MODE_NEWCAM)
+ {
if (mode == CAMERA_MODE_WATER_SURFACE && gCurrLevelArea == AREA_TTM_OUTSIDE) {
} else {
// Clear movement flags that would affect the transition
@@ -2898,6 +2902,7 @@ void set_camera_mode(struct Camera *c, s16 mode, s16 frames) {
vec3f_get_dist_and_angle(start->focus, start->pos, &start->dist, &start->pitch, &start->yaw);
vec3f_get_dist_and_angle(end->focus, end->pos, &end->dist, &end->pitch, &end->yaw);
}
+ }
}
/**
@@ -2982,7 +2987,7 @@ void update_lakitu(struct Camera *c) {
gLakituState.roll += sHandheldShakeRoll;
gLakituState.roll += gLakituState.keyDanceRoll;
- if (c->mode != CAMERA_MODE_C_UP && c->cutscene == 0) {
+ if (c->mode != CAMERA_MODE_C_UP && c->cutscene == 0 && c->mode != CAM_MODE_NEWCAM) {
gCheckingSurfaceCollisionsForCamera = TRUE;
distToFloor = find_floor(gLakituState.pos[0],
gLakituState.pos[1] + 20.0f,
@@ -3015,7 +3020,7 @@ void update_camera(struct Camera *c) {
update_camera_hud_status(c);
if (c->cutscene == 0) {
// Only process R_TRIG if 'fixed' is not selected in the menu
- if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO) {
+ if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO && c->mode != CAM_MODE_NEWCAM) {
if (gPlayer1Controller->buttonPressed & R_TRIG) {
if (set_cam_angle(0) == CAM_ANGLE_LAKITU) {
set_cam_angle(CAM_ANGLE_MARIO);
@@ -3053,10 +3058,18 @@ void update_camera(struct Camera *c) {
c->mode = gLakituState.mode;
c->defMode = gLakituState.defMode;
+ if (c->mode != CAM_MODE_NEWCAM)
+ {
camera_course_processing(c);
stub_camera_3(c);
- sCButtonsPressed = find_c_buttons_pressed(sCButtonsPressed, gPlayer1Controller->buttonPressed,
- gPlayer1Controller->buttonDown);
+ sCButtonsPressed = find_c_buttons_pressed(sCButtonsPressed, gPlayer1Controller->buttonPressed,gPlayer1Controller->buttonDown);
+ }
+
+ if (gMarioState->action == ACT_SHOT_FROM_CANNON && newcam_active)
+ {
+ gMarioState->area->camera->mode = CAM_MODE_NEWCAM;
+ gLakituState.mode = CAM_MODE_NEWCAM;
+ }
if (c->cutscene != 0) {
sYawSpeed = 0;
@@ -3094,6 +3107,10 @@ void update_camera(struct Camera *c) {
mode_cannon_camera(c);
break;
+ case CAM_MODE_NEWCAM:
+ newcam_loop(c);
+ break;
+
default:
mode_mario_camera(c);
}
@@ -3153,6 +3170,10 @@ void update_camera(struct Camera *c) {
case CAMERA_MODE_SPIRAL_STAIRS:
mode_spiral_stairs_camera(c);
break;
+
+ case CAM_MODE_NEWCAM:
+ newcam_loop(c);
+ break;
}
}
}
@@ -3428,6 +3449,13 @@ void init_camera(struct Camera *c) {
gLakituState.nextYaw = gLakituState.yaw;
c->yaw = gLakituState.yaw;
c->nextYaw = gLakituState.yaw;
+
+ if (newcam_active == 1)
+ {
+ gLakituState.mode = CAM_MODE_NEWCAM;
+ gLakituState.defMode = CAM_MODE_NEWCAM;
+ newcam_init(c, 0);
+ }
}
/**
@@ -5516,6 +5544,9 @@ void set_camera_mode_8_directions(struct Camera *c) {
s8DirModeBaseYaw = 0;
s8DirModeYawOffset = 0;
}
+
+ if (newcam_active == 1)
+ c->mode = CAM_MODE_NEWCAM;
}
/**
@@ -5527,6 +5558,9 @@ void set_camera_mode_boss_fight(struct Camera *c) {
transition_to_camera_mode(c, CAMERA_MODE_BOSS_FIGHT, 15);
sModeOffsetYaw = c->nextYaw - DEGREES(45);
}
+
+ if (newcam_active == 1)
+ c->mode = CAM_MODE_NEWCAM;
}
void set_camera_mode_close_cam(u8 *mode) {
@@ -5534,6 +5568,9 @@ void set_camera_mode_close_cam(u8 *mode) {
sStatusFlags &= ~CAM_FLAG_SMOOTH_MOVEMENT;
*mode = CAMERA_MODE_CLOSE;
}
+
+ if (newcam_active == 1)
+ *mode = CAM_MODE_NEWCAM;
}
/**
@@ -5558,6 +5595,9 @@ void set_camera_mode_radial(struct Camera *c, s16 transitionTime) {
}
sModeOffsetYaw = 0;
}
+
+ if (newcam_active == 1)
+ c->mode = CAM_MODE_NEWCAM;
}
/**
@@ -6936,6 +6976,7 @@ s16 cutscene_object(u8 cutscene, struct Object *o) {
void update_camera_yaw(struct Camera *c) {
c->nextYaw = calculate_yaw(c->focus, c->pos);
c->yaw = c->nextYaw;
+ newcam_apply_outside_values(c,0);
}
void cutscene_reset_spline(void) {
@@ -9204,7 +9245,12 @@ BAD_RETURN(s32) cutscene_non_painting_end(struct Camera *c) {
if (c->defMode == CAMERA_MODE_CLOSE) {
c->mode = CAMERA_MODE_CLOSE;
- } else {
+ } else
+ if (c->defMode == CAM_MODE_NEWCAM) {
+ c->mode = CAM_MODE_NEWCAM;
+ }
+ else
+ {
c->mode = CAMERA_MODE_FREE_ROAM;
}
@@ -9960,6 +10006,7 @@ BAD_RETURN(s32) cutscene_sliding_doors_follow_mario(struct Camera *c) {
BAD_RETURN(s32) cutscene_sliding_doors_open(struct Camera *c) {
UNUSED u32 pad[2];
+ newcam_apply_outside_values(c,1);
reset_pan_distance(c);
cutscene_event(cutscene_sliding_doors_open_start, c, 0, 8);
cutscene_event(cutscene_sliding_doors_open_set_cvars, c, 8, 8);
@@ -10156,7 +10203,10 @@ BAD_RETURN(s32) cutscene_unused_exit_focus_mario(struct Camera *c) {
* Give control back to the player.
*/
BAD_RETURN(s32) cutscene_exit_painting_end(struct Camera *c) {
- c->mode = CAMERA_MODE_CLOSE;
+ if (newcam_active == 1)
+ c->mode = CAM_MODE_NEWCAM;
+ else
+ c->mode = CAMERA_MODE_CLOSE;
c->cutscene = 0;
gCutsceneTimer = CUTSCENE_STOP;
sStatusFlags |= CAM_FLAG_SMOOTH_MOVEMENT;
@@ -10316,10 +10366,15 @@ BAD_RETURN(s32) cutscene_door_follow_mario(struct Camera *c) {
* Ends the door cutscene. Sets the camera mode to close mode unless the default is free roam.
*/
BAD_RETURN(s32) cutscene_door_end(struct Camera *c) {
- if (c->defMode == CAMERA_MODE_FREE_ROAM) {
- c->mode = CAMERA_MODE_FREE_ROAM;
- } else {
+ if (c->defMode == CAMERA_MODE_CLOSE) {
c->mode = CAMERA_MODE_CLOSE;
+ } else
+ if (c->defMode == CAM_MODE_NEWCAM) {
+ c->mode = CAM_MODE_NEWCAM;
+ }
+ else
+ {
+ c->mode = CAMERA_MODE_FREE_ROAM;
}
c->cutscene = 0;
diff --git a/src/game/camera.h b/src/game/camera.h
index f56ed02..36bb6d9 100644
--- a/src/game/camera.h
+++ b/src/game/camera.h
@@ -112,6 +112,7 @@
#define CAMERA_MODE_8_DIRECTIONS 0x0E // AKA Parallel Camera, Bowser Courses & Rainbow Ride
#define CAMERA_MODE_FREE_ROAM 0x10
#define CAMERA_MODE_SPIRAL_STAIRS 0x11
+#define CAM_MODE_NEWCAM 0x12
#define CAM_MOVE_RETURN_TO_MIDDLE 0x0001
#define CAM_MOVE_ZOOMED_OUT 0x0002
@@ -656,8 +657,6 @@ struct LakituState
/*0xBC*/ s16 unused;
};
-// bss order hack to not affect BSS order. if possible, remove me, but it will be hard to match otherwise
-#ifndef INCLUDED_FROM_CAMERA_C
// BSS
extern s16 sSelectionFlags;
extern s16 sCameraSoundFlags;
@@ -667,7 +666,6 @@ extern struct LakituState gLakituState;
extern s16 gCameraMovementFlags;
extern s32 gObjCutsceneDone;
extern struct Camera *gCamera;
-#endif
extern struct Object *gCutsceneFocus;
extern struct Object *gSecondCameraFocus;
diff --git a/src/game/game_init.c b/src/game/game_init.c
index e5552ec..332a544 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -20,6 +20,8 @@
#include "segment_symbols.h"
#include "thread6.h"
#include <prevent_bss_reordering.h>
+#include "src/puppycam/puppycam.h"
+#include "pc/controller/controller_3ds.h"
#ifdef TARGET_N3DS
#include "src/pc/gfx/color_conversion.h"
@@ -614,6 +616,7 @@ void thread5_game_loop(UNUSED void *arg) {
play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0);
set_sound_mode(save_file_get_sound_mode());
+ newcam_init_settings();
#ifdef TARGET_N64
rendering_init();
diff --git a/src/game/hud.c b/src/game/hud.c
index 8d4daa5..e562364 100644
--- a/src/game/hud.c
+++ b/src/game/hud.c
@@ -13,6 +13,7 @@
#include "area.h"
#include "save_file.h"
#include "print.h"
+#include "src/puppycam/puppycam.h"
/* @file hud.c
* This file implements HUD rendering and power meter animations.
@@ -469,7 +470,8 @@ void render_hud(void) {
if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA_AND_POWER) {
render_hud_power_meter();
- render_hud_camera_status();
+ if (!newcam_active)
+ render_hud_camera_status();
}
if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER) {
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index b9a43df..e2aac23 100644
--- a/src/game/ingame_menu.c
+++ b/src/game/ingame_menu.c
@@ -22,6 +22,7 @@
#include "sm64.h"
#include "text_strings.h"
#include "types.h"
+#include "src/puppycam/puppycam.h"
u16 gDialogColorFadeTimer;
s8 gLastDialogLineNum;
@@ -2603,7 +2604,10 @@ s16 render_pause_courses_and_castle(void) {
#ifdef VERSION_EU
gInGameLanguage = eu_get_language();
#endif
-
+ #ifndef NC_CODE_NOMENU
+ if (newcam_option_open == 0)
+ {
+ #endif
switch (gDialogBoxState) {
case DIALOG_STATE_OPENING:
gDialogLineNum = 1;
@@ -2679,6 +2683,16 @@ s16 render_pause_courses_and_castle(void) {
if (gDialogTextAlpha < 250) {
gDialogTextAlpha += 25;
}
+#ifndef NC_CODE_NOMENU
+ }
+ else
+ {
+ shade_screen();
+ newcam_display_options();
+ }
+ newcam_check_pause_buttons();
+ newcam_render_option_text();
+#endif
return 0;
}
diff --git a/src/game/mario.c b/src/game/mario.c
index 5b103fa..488fc95 100644
--- a/src/game/mario.c
+++ b/src/game/mario.c
@@ -33,6 +33,7 @@
#include "save_file.h"
#include "sound_init.h"
#include "thread6.h"
+#include "src/puppycam/puppycam.h"
u32 unused80339F10;
s8 filler80339F1C[20];
@@ -1306,7 +1307,10 @@ void update_mario_joystick_inputs(struct MarioState *m) {
}
if (m->intendedMag > 0.0f) {
- m->intendedYaw = atan2s(-controller->stickY, controller->stickX) + m->area->camera->yaw;
+ if (gLakituState.mode != CAM_MODE_NEWCAM)
+ m->intendedYaw = atan2s(-controller->stickY, controller->stickX) + m->area->camera->yaw;
+ else
+ m->intendedYaw = atan2s(-controller->stickY, controller->stickX)-newcam_yaw+0x4000;
m->input |= INPUT_NONZERO_ANALOG;
} else {
m->intendedYaw = m->faceAngle[1];
@@ -1616,7 +1620,7 @@ void mario_update_hitbox_and_cap_model(struct MarioState *m) {
struct MarioBodyState *bodyState = m->marioBodyState;
s32 flags = update_and_return_cap_flags(m);
- if (flags & MARIO_VANISH_CAP) {
+ if (flags & MARIO_VANISH_CAP || newcam_xlu < 255) {
bodyState->modelState = MODEL_STATE_NOISE_ALPHA;
}
diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c
index e6354e8..c29d651 100644
--- a/src/game/mario_misc.c
+++ b/src/game/mario_misc.c
@@ -23,6 +23,7 @@
#include "save_file.h"
#include "skybox.h"
#include "sound_init.h"
+#include "src/puppycam/puppycam.h"
#define TOAD_STAR_1_REQUIREMENT 12
#define TOAD_STAR_2_REQUIREMENT 25
@@ -296,12 +297,45 @@ void bhv_unlock_door_star_loop(void) {
}
}
+static u32 find_capflag(struct MarioState *m) {
+ u32 flags = m->flags;
+ u64 sCapFlickerFrames = 0x4444449249255555;
+ u32 action;
+
+ if (m->capTimer > 0) {
+ action = m->action;
+
+ if (m->capTimer == 0) {
+
+ m->flags &= ~(MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP);
+ if ((m->flags & (MARIO_NORMAL_CAP | MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP))
+ == 0) {
+ m->flags &= ~MARIO_CAP_ON_HEAD;
+ }
+ }
+
+ // This code flickers the cap through a long binary string, increasing in how
+ // common it flickers near the end.
+ if ((m->capTimer < 0x40) && ((1ULL << m->capTimer) & sCapFlickerFrames)) {
+ flags &= ~(MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP);
+ if ((flags & (MARIO_NORMAL_CAP | MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP))
+ == 0) {
+ flags &= ~MARIO_CAP_ON_HEAD;
+ }
+ }
+ }
+
+ return flags;
+}
+
/**
* Generate a display list that sets the correct blend mode and color for mirror Mario.
*/
static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
Gfx *gfx;
Gfx *gfxHead = NULL;
+ u8 alphaBias;
+ s32 flags = find_capflag(gMarioState);
if (alpha == 255) {
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
@@ -311,9 +345,17 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8);
gfxHead = alloc_display_list(3 * sizeof(*gfxHead));
gfx = gfxHead;
- gDPSetAlphaCompare(gfx++, G_AC_DITHER);
+ if (flags & MARIO_VANISH_CAP || gMarioState->flags & MARIO_TELEPORTING)
+ {
+ gDPSetAlphaCompare(gfx++, G_AC_DITHER);
+ }
+ else
+ {
+ gDPSetAlphaCompare(gfx++, G_AC_NONE);
+ }
}
- gDPSetEnvColor(gfx++, 255, 255, 255, alpha);
+ alphaBias = min(alpha, newcam_xlu);
+ gDPSetEnvColor(gfx++, 255, 255, 255, alphaBias);
gSPEndDisplayList(gfx);
return gfxHead;
}
diff --git a/src/game/save_file.c b/src/game/save_file.c
index 4748b99..5991195 100644
--- a/src/game/save_file.c
+++ b/src/game/save_file.c
@@ -11,11 +11,13 @@
#include "level_table.h"
#include "course_table.h"
#include "thread6.h"
+#include "src/puppycam/puppycam.h"
#define MENU_DATA_MAGIC 0x4849
#define SAVE_FILE_MAGIC 0x4441
-STATIC_ASSERT(sizeof(struct SaveBuffer) == EEPROM_SIZE, "eeprom buffer size must match");
+STATIC_ASSERT(sizeof(struct SaveBuffer) <= EEPROM_SIZE, "eeprom buffer size higher than intended");
+STATIC_ASSERT(sizeof(struct SaveBuffer) >= EEPROM_SIZE, "eeprom buffer size lower than intended");
extern struct SaveBuffer gSaveBuffer;
@@ -565,6 +567,51 @@ u16 save_file_get_sound_mode(void) {
return gSaveBuffer.menuData[0].soundMode;
}
+#ifndef NC_CODE_NOSAVE
+void save_file_set_setting(void) {
+
+ gSaveBuffer.menuData[0].camx = (s16)newcam_sensitivityX;
+ gSaveBuffer.menuData[0].camy = (s16)newcam_sensitivityY;
+ gSaveBuffer.menuData[0].invertx = (s16)newcam_invertX;
+ gSaveBuffer.menuData[0].inverty = (s16)newcam_invertY;
+ gSaveBuffer.menuData[0].camc = (s16)newcam_aggression;
+ gSaveBuffer.menuData[0].camp = (s16)newcam_panlevel;
+ gSaveBuffer.menuData[0].analogue = (s16)newcam_analogue;
+ gSaveBuffer.menuData[0].degrade = (s16)newcam_degrade;
+
+ gSaveBuffer.menuData[0].firsttime = 1;
+
+
+ gMainMenuDataModified = TRUE;
+ save_main_menu_data();
+}
+
+void save_file_get_setting(void) {
+ newcam_sensitivityX = gSaveBuffer.menuData[0].camx;
+ newcam_sensitivityY = gSaveBuffer.menuData[0].camy;
+ newcam_invertX = gSaveBuffer.menuData[0].invertx;
+ newcam_invertY = gSaveBuffer.menuData[0].inverty;
+ newcam_aggression = gSaveBuffer.menuData[0].camc;
+ newcam_panlevel = gSaveBuffer.menuData[0].camp;
+ newcam_analogue = gSaveBuffer.menuData[0].analogue;
+ newcam_degrade = gSaveBuffer.menuData[0].degrade;
+}
+
+u8 save_check_firsttime(void)
+{
+ return gSaveBuffer.menuData[0].firsttime;
+}
+
+
+void save_set_firsttime(void)
+{
+ gSaveBuffer.menuData[0].firsttime = 1;
+
+ gMainMenuDataModified = TRUE;
+ save_main_menu_data();
+}
+#endif
+
void save_file_move_cap_to_default_location(void) {
if (save_file_get_flags() & SAVE_FLAG_CAP_ON_GROUND) {
switch (gSaveBuffer.files[gCurrSaveFileNum - 1][0].capLevel) {
diff --git a/src/game/save_file.h b/src/game/save_file.h
index 3ee5a19..824ee79 100644
--- a/src/game/save_file.h
+++ b/src/game/save_file.h
@@ -8,7 +8,12 @@
#include "course_table.h"
-#define EEPROM_SIZE 0x200
+#ifndef NC_CODE_NOSAVE
+ #define EEPROM_SIZE 0x800
+#else
+ #define EEPROM_SIZE 0x200
+#endif
+
#define NUM_SAVE_FILES 4
struct SaveBlockSignature
@@ -52,16 +57,28 @@ struct MainMenuSaveData
// on the high score screen.
u32 coinScoreAges[NUM_SAVE_FILES];
u16 soundMode;
-
+ #ifndef NC_CODE_NOSAVE
+ s16 camx;
+ s16 camy;
+ s16 analogue;
+ s16 invertx;
+ s16 inverty;
+ s16 camc;
+ s16 camp;
+ s16 firsttime;
+ s16 degrade;
+ #endif
#ifdef VERSION_EU
u16 language;
#define SUBTRAHEND 8
#else
-#define SUBTRAHEND 6
+#define SUBTRAHEND 15
#endif
+ #ifdef NC_CODE_NOSAVE
// Pad to match the EEPROM size of 0x200 (10 bytes on JP/US, 8 bytes on EU)
u8 filler[EEPROM_SIZE / 2 - SUBTRAHEND - NUM_SAVE_FILES * (4 + sizeof(struct SaveFile))];
+ #endif
struct SaveBlockSignature signature;
};
@@ -72,6 +89,11 @@ struct SaveBuffer
struct SaveFile files[NUM_SAVE_FILES][2];
// The main menu data has two copies. If one is bad, the other is used as a backup.
struct MainMenuSaveData menuData[2];
+ #ifndef NC_CODE_NOSAVE
+ //u8 filler[1520]; //!I still haven't done an algorithm for this yet lol
+ ///I think I figured it out lol
+ u8 filler[EEPROM_SIZE - ((NUM_SAVE_FILES*(sizeof(struct SaveFile))+sizeof(struct MainMenuSaveData))*2)];
+ #endif
};
extern u8 gLastCompletedCourseNum;
@@ -144,6 +166,12 @@ s32 save_file_get_cap_pos(Vec3s capPos);
void save_file_set_sound_mode(u16 mode);
u16 save_file_get_sound_mode(void);
void save_file_move_cap_to_default_location(void);
+#ifndef NC_CODE_NOSAVE
+void save_set_firsttime(void);
+u8 save_check_firsttime(void);
+void save_file_get_setting(void);
+void save_file_set_setting(void);
+#endif
void disable_warp_checkpoint(void);
void check_if_should_set_warp_checkpoint(struct WarpNode *warpNode);
diff --git a/src/pc/configfile.c b/src/pc/configfile.c
index 87d00d1..aa7d8d3 100644
--- a/src/pc/configfile.c
+++ b/src/pc/configfile.c
@@ -76,6 +76,15 @@ unsigned int configKeyDLeft = 0;
unsigned int configKeyDRight = 0;
#endif
+unsigned int puppycam_sensitivityX = 75;
+unsigned int puppycam_sensitivityY = 75;
+unsigned int puppycam_invertX = 0;
+unsigned int puppycam_invertY = 0;
+unsigned int puppycam_degrade = 10;
+unsigned int puppycam_aggression = 0;
+unsigned int puppycam_panlevel = 75;
+
+
static const struct ConfigOption options[] = {
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configFullscreen},
@@ -93,6 +102,13 @@ static const struct ConfigOption options[] = {
{.name = "key_ddown", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyDDown},
{.name = "key_dleft", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyDLeft},
{.name = "key_dright", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyDRight},
+ {.name = "puppycam_sensitivity_x", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_sensitivityX},
+ {.name = "puppycam_sensitivity_y", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_sensitivityY},
+ {.name = "puppycam_invert_x", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_invertX},
+ {.name = "puppycam_invert_y", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_invertY},
+ {.name = "puppycam_stopping_speed", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_degrade},
+ {.name = "puppycam_centre_aggression", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_aggression},
+ {.name = "puppycam_pan_amount", .type = CONFIG_TYPE_UINT, .uintValue = &puppycam_panlevel},
#ifndef TARGET_N3DS
{.name = "key_stickup", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyStickUp},
{.name = "key_stickdown", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyStickDown},
diff --git a/src/pc/configfile.h b/src/pc/configfile.h
index 2a18979..810c1d8 100644
--- a/src/pc/configfile.h
+++ b/src/pc/configfile.h
@@ -21,6 +21,14 @@ extern unsigned int configKeyDDown;
extern unsigned int configKeyDLeft;
extern unsigned int configKeyDRight;
+extern unsigned int puppycam_sensitivityX;
+extern unsigned int puppycam_sensitivityY;
+extern unsigned int puppycam_invertX;
+extern unsigned int puppycam_invertY;
+extern unsigned int puppycam_degrade;
+extern unsigned int puppycam_aggression;
+extern unsigned int puppycam_panlevel;
+
void configfile_load(const char *filename);
void configfile_save(const char *filename);
diff --git a/src/pc/controller/controller_3ds.c b/src/pc/controller/controller_3ds.c
index 654dbbc..750edae 100644
--- a/src/pc/controller/controller_3ds.c
+++ b/src/pc/controller/controller_3ds.c
@@ -37,6 +37,11 @@
#include "../configfile.h"
+#include <include/types.h>
+#include "src/puppycam/puppycam.h"
+
+s16 rightstick[2];
+
static int button_mapping[14][2];
static void set_button_mapping(int index, int mask_n64, int mask_3ds)
@@ -101,10 +106,21 @@ static void controller_3ds_read(OSContPad *pad)
{
pad->button = controller_3ds_get_held();
- circlePosition pos;
- hidCircleRead(&pos);
- pad->stick_x = pos.dx / 2;
- pad->stick_y = pos.dy / 2;
+ circlePosition circlePad;
+ hidCircleRead(&circlePad);
+ pad->stick_x = circlePad.dx / 2;
+ pad->stick_y = circlePad.dy / 2;
+
+ circlePosition cStick;
+ hidCstickRead(&cStick);
+ rightstick[0] = cStick.dx / 1.25f;
+ rightstick[1] = cStick.dy / 1.25f;
+
+ if (rightstick[0] == 0 && rightstick[1] == 0) {
+ newcam_analogue = 0;
+ } else {
+ newcam_analogue = 1;
+ }
}
struct ControllerAPI controller_3ds = {
diff --git a/src/pc/controller/controller_3ds.h b/src/pc/controller/controller_3ds.h
index 00f3fae..038216d 100644
--- a/src/pc/controller/controller_3ds.h
+++ b/src/pc/controller/controller_3ds.h
@@ -4,5 +4,6 @@
#include "controller_api.h"
extern struct ControllerAPI controller_3ds;
+extern s16 rightstick[2];
#endif
diff --git a/src/puppycam/puppycam.h b/src/puppycam/puppycam.h
new file mode 100644
index 0000000..dc4481e
--- /dev/null
+++ b/src/puppycam/puppycam.h
@@ -0,0 +1,64 @@
+///Some Settings for the external code.
+
+//#define NC_CODE_NOSAVE //If this is defined, this will disable saving the user settings.
+//#define NC_CODE_NOMENU //If this is defined, this will disable the settings menu. It does NOT disable saving as well, because you might want that in, regardless.
+
+#ifndef TARGET_N64
+ #define NC_CODE_NOSAVE //This gets disabled off the N64 because it's no longer using the EEPROM or the old save system.
+#endif // TARGET_N64
+
+enum newcam_flagvalues
+{
+ NC_FLAG_XTURN = 0x0001,//If this flag is set, the camera's yaw can be moved by the player.
+ NC_FLAG_YTURN = 0x0002, //If this flag is set, the camera's pitch can be moved by the player.
+ NC_FLAG_ZOOM = 0x0004, //If this flag is set, the camera's distance can be set by the player.
+ NC_FLAG_8D = 0x0008, //If this flag is set, the camera will snap to an 8 directional axis
+ NC_FLAG_4D = 0x0010, //If this flag is set, the camera will snap to a 4 directional axis
+ NC_FLAG_2D = 0x0020, //If this flag is set, the camera will stick to 2D.
+ NC_FLAG_FOCUSX = 0x0040, //If this flag is set, the camera will point towards its focus on the X axis.
+ NC_FLAG_FOCUSY = 0x0080, //If this flag is set, the camera will point towards its focus on the Y axis.
+ NC_FLAG_FOCUSZ = 0x0100, //If this flag is set, the camera will point towards its focus on the Z axis.
+ NC_FLAG_POSX = 0x0200, //If this flag is set, the camera will move along the X axis.
+ NC_FLAG_POSY = 0x0400, //If this flag is set, the camera will move along the Y axis.
+ NC_FLAG_POSZ = 0x0800, //If this flag is set, the camera will move along the Z axis.
+ NC_FLAG_COLLISION = 0x1000, //If this flag is set, the camera will collide and correct itself with terrain.
+ NC_FLAG_SLIDECORRECT = 0x2000, //If this flag is set, the camera will attempt to centre itself behind Mario whenever he's sliding.
+
+ NC_MODE_NORMAL = NC_FLAG_XTURN | NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION,
+ NC_MODE_SLIDE = NC_FLAG_XTURN | NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION | NC_FLAG_SLIDECORRECT,
+ NC_MODE_FIXED = NC_FLAG_XTURN | NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ,
+ NC_MODE_2D = NC_FLAG_XTURN | NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION,
+ NC_MODE_8D = NC_FLAG_XTURN | NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_8D | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION,
+ NC_MODE_FIXED_NOMOVE = 0x0000,
+ NC_MODE_NOTURN = NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION,
+ NC_MODE_NOROTATE = NC_FLAG_YTURN | NC_FLAG_ZOOM | NC_FLAG_FOCUSX | NC_FLAG_FOCUSY | NC_FLAG_FOCUSZ | NC_FLAG_POSX | NC_FLAG_POSY | NC_FLAG_POSZ | NC_FLAG_COLLISION
+
+};
+
+extern void newcam_display_options(void);
+extern void newcam_check_pause_buttons(void);
+extern void newcam_init_settings(void);
+extern void newcam_render_option_text(void);
+extern void newcam_diagnostics(void);
+extern void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Vec3f hit_pos);
+
+extern u8 newcam_option_open;
+
+extern s16 newcam_sensitivityX; //How quick the camera works.
+extern s16 newcam_sensitivityY;
+extern s16 newcam_invertX;
+extern s16 newcam_invertY;
+extern s16 newcam_panlevel; //How much the camera sticks out a bit in the direction you're looking.
+extern s16 newcam_aggression; //How much the camera tries to centre itself to Mario's facing and movement.
+extern u8 newcam_active; // basically the thing that governs if newcam is on.
+extern s16 newcam_analogue;
+extern u16 newcam_intendedmode;
+extern s16 newcam_degrade;
+extern u8 newcam_xlu;
+
+extern u16 newcam_mode;
+extern s16 newcam_yaw;
+
+#ifndef TARGET_N64
+extern s16 mousepos[2];
+#endif // TARGET_N64
diff --git a/src/puppycam/puppycam.inc.c b/src/puppycam/puppycam.inc.c
new file mode 100644
index 0000000..7ac208c
--- /dev/null
+++ b/src/puppycam/puppycam.inc.c
@@ -0,0 +1,1058 @@
+#include "sm64.h"
+#include "game/camera.h"
+#include "game/level_update.h"
+#include "game/print.h"
+#include "engine/math_util.h"
+#include "game/segment2.h"
+#include "game/save_file.h"
+#include "puppycam.h"
+#include "include/text_strings.h"
+#include "puppycam_collision.inc.c"
+#include "gfx_dimensions.h"
+#include "pc/controller/controller_3ds.h"
+#include "pc/configfile.h"
+
+/**
+Quick explanation of the camera modes
+
+NC_MODE_NORMAL: Standard mode, allows dualaxial movement and free control of the camera.
+NC_MODE_FIXED: Disables control of camera, and the actual position of the camera doesn't update.
+NC_MODE_2D: Disables horizontal control of the camera and locks Mario's direction to the X axis. NYI though.
+NC_MODE_8D: 8 directional movement. Similar to standard, except the camera direction snaps to 8 directions.
+NC_MODE_FIXED_NOMOVE: Disables control and movement of the camera.
+NC_MODE_NOTURN: Disables horizontal and vertical control of the camera. Perfect for when running scripts alongside the camera angle.
+**/
+
+//!A bunch of developer intended options, to cover every base, really.
+//#define NEWCAM_DEBUG //Some print values for puppycam. Not useful anymore, but never hurts to keep em around.
+//#define nosound //If for some reason you hate the concept of audio, you can disable it.
+//#define noaccel //Disables smooth movement of the camera with the C buttons.
+//#define EXT_BOUNDS
+
+#ifdef EXT_BOUNDS
+ #define MULTI 4.0f