Merge pull request #28 from Reonu/puppycamera2

Puppycamera2
This commit is contained in:
Reonu
2021-08-15 17:50:08 +01:00
committed by GitHub
18 changed files with 2126 additions and 134 deletions

View File

@@ -585,6 +585,7 @@ $(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/puppycam2.o: $(BUILD_DIR)/include/text_strings.h
#==============================================================================#

View File

@@ -98,6 +98,8 @@
#define PARALLEL_LAKITU_CAM
// Allows Mario to ledgegrab sloped floors
#define NO_FALSE_LEDGEGRABS
//Enables Puppy Camera 2, a rewritten camera that can be freely configured and modified.
//#define PUPPYCAM
// HACKER QOL

View File

@@ -76,13 +76,13 @@
*
* IMPLEMENTATION NOTE:
* There is another group of RDP commands that includes the triangle commands
* generated by the RSP code. These are the raw commands the rasterizer
* hardware chews on, with slope info, etc. They will follow the RDP
* generated by the RSP code. These are the raw commands the rasterizer
* hardware chews on, with slope info, etc. They will follow the RDP
* ordering...
*
* IMPLEMENTATION NOTE:
* The RDP hardware has some of these bit patterns wired up. If the hardware
* changes, we must adjust this table, likewise we can't change/add things
* The RDP hardware has some of these bit patterns wired up. If the hardware
* changes, we must adjust this table, likewise we can't change/add things
* once the hardware is frozen. (actually, the RDP hardware only looks at
* the lower 6 bits of the command byte)
*
@@ -206,7 +206,7 @@
#define G_TEXRECT 0xe4 /* -28 */
/*
/*
* The following commands are the "generated" RDP commands; the user
* never sees them, the RSP microcode generates them.
*
@@ -326,7 +326,7 @@
*
* DO NOT USE THE LOW 8 BITS OF GEOMETRYMODE:
* The weird bit-ordering is for the micro-code: the lower byte
* can be OR'd in with G_TRI_SHADE (11001100) to construct
* can be OR'd in with G_TRI_SHADE (11001100) to construct
* the triangle command directly. Don't break it...
*
* DO NOT USE THE HIGH 8 BITS OF GEOMETRYMODE:
@@ -340,7 +340,7 @@
* appropriately and use primcolor to see anything.
*
* G_SHADING_SMOOTH enabled means use all 3 colors of the triangle.
* If it is not set, then do 'flat shading', where only one vertex color
* If it is not set, then do 'flat shading', where only one vertex color
* is used (and all 3 vertices are set to that same color by the ucode)
* See the man page for gSP1Triangle().
*
@@ -718,154 +718,162 @@
#define G_BL_1 2
#define G_BL_0 3
#ifdef DISABLE_AA
#define AA_DEF
#define RD_DEF
#else
#define AA_DEF AA_EN |
#define RD_DEF IM_RD |
#endif
#define GBL_c1(m1a, m1b, m2a, m2b) \
(m1a) << 30 | (m1b) << 26 | (m2a) << 22 | (m2b) << 18
#define GBL_c2(m1a, m1b, m2a, m2b) \
(m1a) << 28 | (m1b) << 24 | (m2a) << 20 | (m2b) << 16
#define RM_AA_ZB_OPA_SURF(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_RA_ZB_OPA_SURF(clk) \
AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_XLU_SURF(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
AA_DEF Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
FORCE_BL | ZMODE_XLU | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_OPA_DECAL(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ALPHA_CVG_SEL | \
AA_DEF Z_CMP | RD_DEF CVG_DST_WRAP | ALPHA_CVG_SEL | \
ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_RA_ZB_OPA_DECAL(clk) \
AA_EN | Z_CMP | CVG_DST_WRAP | ALPHA_CVG_SEL | \
AA_DEF Z_CMP | CVG_DST_WRAP | ALPHA_CVG_SEL | \
ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_XLU_DECAL(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
AA_DEF Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
FORCE_BL | ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_OPA_INTER(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
ALPHA_CVG_SEL | ZMODE_INTER | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_RA_ZB_OPA_INTER(clk) \
AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | CVG_DST_CLAMP | \
ALPHA_CVG_SEL | ZMODE_INTER | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_XLU_INTER(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
AA_DEF Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \
FORCE_BL | ZMODE_INTER | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_XLU_LINE(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \
AA_DEF Z_CMP | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \
ALPHA_CVG_SEL | FORCE_BL | ZMODE_XLU | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_DEC_LINE(clk) \
AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | CVG_X_ALPHA | \
AA_DEF Z_CMP | IM_RD | CVG_DST_SAVE | CVG_X_ALPHA | \
ALPHA_CVG_SEL | FORCE_BL | ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_TEX_EDGE(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_EN | Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_TEX_INTER(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_INTER | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_SUB_SURF(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \
AA_DEF Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_ZB_PCL_SURF(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
ZMODE_OPA | G_AC_DITHER | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_OPA_TERR(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_TEX_TERR(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \
AA_DEF Z_CMP | Z_UPD | RD_DEF CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_ZB_SUB_TERR(clk) \
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \
AA_DEF Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_OPA_SURF(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | \
AA_DEF RD_DEF CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_RA_OPA_SURF(clk) \
AA_EN | CVG_DST_CLAMP | \
AA_DEF CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_XLU_SURF(clk) \
AA_EN | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | \
AA_DEF IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | \
ZMODE_OPA | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_XLU_LINE(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \
AA_DEF IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \
ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_DEC_LINE(clk) \
AA_EN | IM_RD | CVG_DST_FULL | CVG_X_ALPHA | \
AA_DEF IM_RD | CVG_DST_FULL | CVG_X_ALPHA | \
ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_TEX_EDGE(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | \
AA_EN | RD_DEF CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_SUB_SURF(clk) \
AA_EN | IM_RD | CVG_DST_FULL | \
AA_DEF IM_RD | CVG_DST_FULL | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_AA_PCL_SURF(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | \
AA_DEF IM_RD | CVG_DST_CLAMP | \
ZMODE_OPA | G_AC_DITHER | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_OPA_TERR(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | \
AA_DEF RD_DEF CVG_DST_CLAMP | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_TEX_TERR(clk) \
AA_EN | IM_RD | CVG_DST_CLAMP | \
AA_DEF RD_DEF CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_AA_SUB_TERR(clk) \
AA_EN | IM_RD | CVG_DST_FULL | \
AA_DEF IM_RD | CVG_DST_FULL | \
ZMODE_OPA | ALPHA_CVG_SEL | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
@@ -874,27 +882,27 @@
Z_CMP | Z_UPD | CVG_DST_FULL | ALPHA_CVG_SEL | \
ZMODE_OPA | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_ZB_XLU_SURF(clk) \
Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_ZB_OPA_DECAL(clk) \
Z_CMP | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM)
#define RM_ZB_XLU_DECAL(clk) \
Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_ZB_CLD_SURF(clk) \
Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_XLU | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_ZB_OVL_SURF(clk) \
Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_DEC | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define RM_ZB_PCL_SURF(clk) \
Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \
G_AC_DITHER | \
@@ -1151,7 +1159,7 @@
* element, we can't depend on the C compiler to align things
* properly.
*
* 64-bit structure alignment is enforced by wrapping structures with
* 64-bit structure alignment is enforced by wrapping structures with
* unions that contain a dummy "long long int". Why this works is
* explained in the ANSI C Spec, or on page 186 of the second edition
* of K&R, "The C Programming Language".
@@ -1223,14 +1231,14 @@ typedef struct {
/* 20 bytes for above */
/* padding to bring structure size to 64 bit allignment */
char dummy[4];
char dummy[4];
} uSprite_t;
typedef union {
typedef union {
uSprite_t s;
/* Need to make sure this is 64 bit aligned */
/* Need to make sure this is 64 bit aligned */
long long int force_structure_allignment[3];
} uSprite;
@@ -1315,7 +1323,7 @@ typedef union {
*/
#ifdef F3DEX_GBI_2
/* 0,4 are reserved by G_MTX */
# define G_MV_MMTX 2
# define G_MV_MMTX 2
# define G_MV_PMTX 6
# define G_MV_VIEWPORT 8
# define G_MV_LIGHT 10
@@ -1373,7 +1381,7 @@ typedef union {
/*
* These are offsets from the address in the dmem table
*/
*/
#define G_MWO_NUMLIGHT 0x00
#define G_MWO_CLIP_RNX 0x04
#define G_MWO_CLIP_RNY 0x0c
@@ -1455,7 +1463,7 @@ typedef union {
*
* Note: only directional (infinite) lights are currently supported.
*
* Note: the weird order is for the DMEM alignment benefit of
* Note: the weird order is for the DMEM alignment benefit of
* the microcode.
*
*/
@@ -1775,7 +1783,7 @@ typedef struct {
/*
* Textured rectangles are 128 bits not 64 bits
*/
*/
typedef struct {
unsigned long w0;
unsigned long w1;
@@ -1933,7 +1941,7 @@ typedef union {
gsDma1p(G_VTX, v, sizeof(Vtx)*(n), ((n)-1)<<4|(v0))
#endif
#ifdef F3DEX_GBI_2
# define gSPViewport(pkt, v) \
gDma2p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0)
@@ -2192,7 +2200,7 @@ typedef union {
/***
*** 1 Triangle
***/
***/
#define gSP1Triangle(pkt, v0, v1, v2, flag) \
{ \
Gfx *_g = (Gfx *)(pkt); \
@@ -2368,7 +2376,7 @@ typedef union {
* Insert values into Matrix
*
* where = element of matrix (byte offset)
* num = new element (32 bit value replacing 2 int or 2 frac matrix
* num = new element (32 bit value replacing 2 int or 2 frac matrix
* componants
*/
#ifdef F3DEX_GBI_2
@@ -2396,7 +2404,7 @@ typedef union {
#define gsSPForceMatrix(mptr) \
gsDma2p(G_MOVEMEM,(mptr),sizeof(Mtx),G_MV_MATRIX,0), \
gsMoveWd(G_MW_FORCEMTX,0,0x00010000)
#else /* F3DEX_GBI_2 */
#define gSPForceMatrix(pkt, mptr) \
{ \
@@ -2444,7 +2452,7 @@ typedef union {
/*
* gSPBranchLessZ Branch DL if (vtx.z) less than or equal (zval).
*
* dl = DL branch to
* dl = DL branch to
* vtx = Vertex
* zval = Screen depth
* near = Near plane
@@ -2491,7 +2499,7 @@ typedef union {
/*
* gSPBranchLessZraw Branch DL if (vtx.z) less than or equal (raw zval).
*
* dl = DL branch to
* dl = DL branch to
* vtx = Vertex
* zval = Raw value of screen depth
*/
@@ -2592,7 +2600,7 @@ typedef union {
#define NUMLIGHTS_7 7
/*
* n should be one of: NUMLIGHTS_0, NUMLIGHTS_1, ..., NUMLIGHTS_7
* NOTE: in addition to the number of directional lights specified,
* NOTE: in addition to the number of directional lights specified,
* there is always 1 ambient light
*/
#define gSPNumLights(pkt, n) \
@@ -2604,7 +2612,7 @@ typedef union {
#define LIGHT_2 2
#define LIGHT_3 3
#define LIGHT_4 4
#define LIGHT_5 5
#define LIGHT_5 5
#define LIGHT_6 6
#define LIGHT_7 7
#define LIGHT_8 8
@@ -2829,7 +2837,7 @@ typedef union {
* min, max: range 0 to 1000: 0=nearplane, 1000=farplane
* min is where fog begins (usually less than max and often 0)
* max is where fog is thickest (usually 1000)
*
*
*/
#define gSPFogFactor(pkt, fm, fo) \
gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \
@@ -2869,7 +2877,7 @@ typedef union {
_SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | _SHIFTL((on),1,7)),\
(_SHIFTL((s),16,16) | _SHIFTL((t),0,16)) \
}}
/*
/*
* Different version of SPTexture macro, has an additional parameter
* which is currently reserved in the microcode.
*/
@@ -2908,7 +2916,7 @@ typedef union {
_SHIFTL((level),11,3)|_SHIFTL((tile),8,3)|_SHIFTL((on),0,8)), \
(_SHIFTL((s),16,16)|_SHIFTL((t),0,16)) \
}}
/*
/*
* Different version of SPTexture macro, has an additional parameter
* which is currently reserved in the microcode.
*/
@@ -3135,7 +3143,7 @@ typedef union {
gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode)
#endif
/* 'blendmask' is not supported anymore.
/* 'blendmask' is not supported anymore.
* The bits are reserved for future use.
* Fri May 26 13:45:55 PDT 1995
*/
@@ -3341,7 +3349,7 @@ typedef union {
*
* This command makes all othermode parameters set.
* Do not use this command in the same DL with another g*SPSetOtherMode DLs.
*
*
* [Usage]
* gDPSetOtherMode(pkt, modeA, modeB)
*
@@ -3594,9 +3602,9 @@ typedef union {
((height)-1) << G_TEXTURE_IMAGE_FRAC) \
}
/*
/*
* Allow tmem address and render tile to be specified.
* The S at the end means odd lines are already word Swapped
* The S at the end means odd lines are already word Swapped
*/
#define gDPLoadMultiBlockS(pkt, timg, tmem, rtile, fmt, siz, width, \
height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
@@ -3812,13 +3820,13 @@ typedef union {
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC)
/*
/*
* Allows tmem and render tile to be specified. Useful when loading
* several tiles at a time.
*
* Here is the static form of the pre-swapped texture block loading
* See gDPLoadTextureBlockS() for reference. Basically, just don't
* calculate DxT, use 0
* calculate DxT, use 0
*/
#define gsDPLoadMultiBlockS(timg, tmem, rtile, fmt, siz, width, height, \
@@ -3902,7 +3910,7 @@ typedef union {
}
/*
* 4-bit load block. Allows tmem and render tile to be specified. Useful when
* 4-bit load block. Allows tmem and render tile to be specified. Useful when
* loading multiple tiles. The S means odd lines are already word swapped.
*/
#define gDPLoadMultiBlock_4bS(pkt, timg, tmem, rtile, fmt, width, height,\
@@ -4337,7 +4345,7 @@ typedef union {
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \
pal, 0, 0, 0, 0, 0, 0)
#endif /* _HW_VERSION_1 */
#endif /* _HW_VERSION_1 */
/*
* Load a 256-entry palette (for 8-bit CI textures)
@@ -4379,7 +4387,7 @@ typedef union {
gsDPLoadSync(), \
gsDPLoadTLUTCmd(G_TX_LOADTILE, 255), \
gsDPPipeSync()
#else /* **** WORKAROUND hardware 1 load_tlut bug ****** */
#define gsDPLoadTLUT_pal256(dram) \
@@ -4434,7 +4442,7 @@ typedef union {
G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, count, \
0, 0, 0, 0, 0, 0, 0)
#endif /* _HW_VERSION_1 */
#endif /* _HW_VERSION_1 */
#define gDPSetScissor(pkt, mode, ulx, uly, lrx, lry) \
{ \
@@ -4611,7 +4619,7 @@ typedef union {
}}
/* Notice that textured rectangles are 128-bit commands, therefore
* gsDPTextureRectangle() should not be used in display lists
* gsDPTextureRectangle() should not be used in display lists
* under normal circumstances (use gsSPTextureRectangle()).
* That is also why there is no gDPTextureRectangle() macros.
*/

View File

@@ -3,6 +3,77 @@
#include "text_menu_strings.h"
#ifdef PUPPYCAM
#define NC_CAMX_EN _("Camera X Sensitivity")
#define NC_CAMY_EN _("Camera Y Sensitivity")
#define NC_INVERTX_EN _("Invert X Axis")
#define NC_INVERTX_FR _("Invertir Axe X")
#define NC_INVERTX_DE _("Invert X Axis")
#define NC_INVERTY_EN _("Invert Y Axis")
#define NC_CAMC_EN _("Camera Centre Speed")
#define NC_ANALOGUE_EN _("Analogue Camera")
#define NC_SCHEME_EN _("Control Scheme")
#define OPTION_ENABLED_EN _("Enabled")
#define OPTION_DISABLED_EN _("Disabled")
#define OPTION_SCHEME1_EN _("Double Tap")
#define OPTION_SCHEME2_EN _("Single Press")
#define OPTION_SCHEME3_EN _("Classic")
#define NC_WIDE_EN _("Widescreen")
#define NC_HIGHLIGHT_L _(">")
#define NC_HIGHLIGHT_R _("<")
#define NC_BUTTON_EN _("[R]: Options")
#define NC_BUTTON2_EN _("[R]: Return")
#define NC_OPTION_EN _("PUPPYCAM OPTIONS")
#if defined(VERSION_EU)
#define NC_CAMX_FR _("Sensibilite sur l'axe X")
#define NC_CAMX_DE _("Camera X Sensitivity")
#define NC_CAMY_FR _("Sensibilite sur l'axe Y")
#define NC_CAMY_DE _("Camera Y Sensitivity")
#define NC_INVERTY_FR _("Invertir Axe Y")
#define NC_INVERTY_DE _("Invert Y Axis")
#define NC_CAMC_FR _("Vitesse de Centrage")
#define NC_CAMC_DE _("Camera Centre Speed")
#define NC_ANALOGUE_FR _("Camera Analogue")
#define NC_ANALOGUE_DE _("Analogue Camera")
#define NC_SCHEME_FR _("Control Scheme")
#define NC_SCHEME_DE _("Control Scheme")
#define NC_WIDE_FR _("Widescreen")
#define NC_WIDE_DE _("Widescreen")
#define OPTION_ENABLED_FR _("Active")
#define OPTION_ENABLED_DE _("Enabled")
#define OPTION_DISABLED_FR _("Desactive")
#define OPTION_DISABLED_DE _("Disabled")
#define OPTION_SCHEME1_FR _("Double Tap")
#define OPTION_SCHEME1_DE _("Double Tap")
#define OPTION_SCHEME2_FR _("Single Press")
#define OPTION_SCHEME2_DE _("Single Press")
#define OPTION_SCHEME3_FR _("Classic")
#define OPTION_SCHEME3_DE _("Classic")
#define NC_BUTTON_FR _("[R]: Options")
#define NC_BUTTON_DE _("[R]: Options")
#define NC_BUTTON2_FR _("[R]: Retournez")
#define NC_BUTTON2_DE _("[R]: Return")
#define NC_OPTION_FR _("OPTIONS PUPPYCAM")
#define NC_OPTION_DE _("PUPPYCAM OPTIONS")
#endif
#endif
/**
* Global Symbols
*/

View File

@@ -24,6 +24,7 @@
#include "math_util.h"
#include "surface_collision.h"
#include "surface_load.h"
#include "game/puppycam2.h"
#include "config.h"
@@ -757,6 +758,42 @@ static void level_cmd_get_or_set_var(void) {
sCurrentCmd = CMD_NEXT;
}
#ifdef PUPPYCAM
static void level_cmd_puppyvolume(void)
{
if ((sPuppyVolumeStack[gPuppyVolumeCount] = mem_pool_alloc(gPuppyMemoryPool,sizeof(struct sPuppyVolume))) == NULL)
{
sCurrentCmd = CMD_NEXT;
gPuppyError |= PUPPY_ERROR_POOL_FULL;
return;
}
sPuppyVolumeStack[gPuppyVolumeCount]->pos[0] = CMD_GET(s16, 2);
sPuppyVolumeStack[gPuppyVolumeCount]->pos[1] = CMD_GET(s16, 4);
sPuppyVolumeStack[gPuppyVolumeCount]->pos[2] = CMD_GET(s16, 6);
sPuppyVolumeStack[gPuppyVolumeCount]->radius[0] = CMD_GET(s16, 8);
sPuppyVolumeStack[gPuppyVolumeCount]->radius[1] = CMD_GET(s16, 10);
sPuppyVolumeStack[gPuppyVolumeCount]->radius[2] = CMD_GET(s16, 12);
sPuppyVolumeStack[gPuppyVolumeCount]->rot = CMD_GET(s16, 14);
sPuppyVolumeStack[gPuppyVolumeCount]->func = CMD_GET(void *, 16);
sPuppyVolumeStack[gPuppyVolumeCount]->angles = segmented_to_virtual(CMD_GET(void *, 20));
sPuppyVolumeStack[gPuppyVolumeCount]->flagsAdd = CMD_GET(s32, 24);
sPuppyVolumeStack[gPuppyVolumeCount]->flagsRemove = CMD_GET(s32, 28);
sPuppyVolumeStack[gPuppyVolumeCount]->flagPersistance = CMD_GET(u8, 32);
sPuppyVolumeStack[gPuppyVolumeCount]->shape = CMD_GET(u8, 33);
sPuppyVolumeStack[gPuppyVolumeCount]->room = CMD_GET(s16, 34);
gPuppyVolumeCount++;
sCurrentCmd = CMD_NEXT;
}
#endif
static void (*LevelScriptJumpTable[])(void) = {
/*00*/ level_cmd_load_and_execute,
/*01*/ level_cmd_exit_and_execute,
@@ -819,6 +856,9 @@ static void (*LevelScriptJumpTable[])(void) = {
/*3A*/ level_cmd_3A,
/*3B*/ level_cmd_create_whirlpool,
/*3C*/ level_cmd_get_or_set_var,
#ifdef PUPPYCAM
/*3E*/ level_cmd_puppyvolume,
#endif
};
struct LevelCommand *level_script_execute(struct LevelCommand *cmd) {

View File

@@ -1202,7 +1202,7 @@ void mode_8_directions_camera(struct Camera *c) {
}
else if (gPlayer1Controller->buttonPressed & D_JPAD) {
s8DirModeYawOffset = s8DirModeYawOffset&0xE000;
}
}
#endif
lakitu_zoom(400.f, 0x900);
@@ -3038,7 +3038,11 @@ void update_camera(struct Camera *c) {
gCamera = c;
update_camera_hud_status(c);
if (c->cutscene == 0) {
if (c->cutscene == 0 &&
#ifdef PUPPYCAM
!gPuppyCam.enabled &&
#endif
!(gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON)) {
// Only process R_TRIG if 'fixed' is not selected in the menu
if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO) {
if (gPlayer1Controller->buttonPressed & R_TRIG) {
@@ -3060,6 +3064,9 @@ void update_camera(struct Camera *c) {
sStatusFlags |= CAM_FLAG_FRAME_AFTER_CAM_INIT;
}
#ifdef PUPPYCAM
if (!gPuppyCam.enabled || c->cutscene != 0 || gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
#endif
// Store previous geometry information
sMarioGeometry.prevFloorHeight = sMarioGeometry.currFloorHeight;
sMarioGeometry.prevCeilHeight = sMarioGeometry.currCeilHeight;
@@ -3182,10 +3189,16 @@ void update_camera(struct Camera *c) {
}
}
}
#ifdef PUPPYCAM
}
#endif
// Start any Mario-related cutscenes
start_cutscene(c, get_cutscene_from_mario_status(c));
stub_camera_2(c);
gCheckingSurfaceCollisionsForCamera = FALSE;
#ifdef PUPPYCAM
if (!gPuppyCam.enabled || c->cutscene != 0 || gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
#endif
if (gCurrLevelNum != LEVEL_CASTLE) {
// If fixed camera is selected as the alternate mode, then fix the camera as long as the right
// trigger is held
@@ -3223,7 +3236,43 @@ void update_camera(struct Camera *c) {
}
update_lakitu(c);
#ifdef PUPPYCAM
}
//Just a cute little bit that syncs puppycamera up to vanilla when playing a vanilla cutscene :3
if (c->cutscene != 0)
{
gPuppyCam.yawTarget = gCamera->yaw;
gPuppyCam.yaw = gCamera->yaw;
if (gMarioState->action == ACT_ENTERING_STAR_DOOR)
{ //god this is stupid and the fact I have to continue doing this is testament to the idiocy of the star door cutscene >:(
gPuppyCam.yawTarget = gMarioState->faceAngle[1]+0x8000;
gPuppyCam.yaw = gMarioState->faceAngle[1]+0x8000;
}
}
if (c->cutscene == 0 && gPuppyCam.enabled && !(gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON))
{
// Clear the recent cutscene after 8 frames
if (gRecentCutscene != 0 && sFramesSinceCutsceneEnded < 8) {
sFramesSinceCutsceneEnded++;
if (sFramesSinceCutsceneEnded >= 8) {
gRecentCutscene = 0;
sFramesSinceCutsceneEnded = 0;
}
}
puppycam_loop();
// Apply camera shakes
shake_camera_pitch(gLakituState.pos, gLakituState.focus);
shake_camera_yaw(gLakituState.pos, gLakituState.focus);
shake_camera_roll(&gLakituState.roll);
shake_camera_handheld(gLakituState.pos, gLakituState.focus);
if (sMarioCamState->action == ACT_DIVE && gLakituState.lastFrameAction != ACT_DIVE) {
set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW);
}
gLakituState.roll += sHandheldShakeRoll;
gLakituState.roll += gLakituState.keyDanceRoll;
}
#endif
gLakituState.lastFrameAction = sMarioCamState->action;
}
@@ -3460,6 +3509,9 @@ void init_camera(struct Camera *c) {
gLakituState.nextYaw = gLakituState.yaw;
c->yaw = gLakituState.yaw;
c->nextYaw = gLakituState.yaw;
#ifdef PUPPYCAM
puppycam_init();
#endif
}
/**

View File

@@ -7,6 +7,7 @@
#include "area.h"
#include "engine/geo_layout.h"
#include "engine/graph_node.h"
#include "puppycam2.h"
#include "level_table.h"

View File

@@ -31,6 +31,7 @@
#endif
#include "puppyprint.h"
#include <prevent_bss_reordering.h>
#include "puppycam2.h"
// First 3 controller slots
struct Controller gControllers[3];
@@ -81,7 +82,7 @@ UNUSED static s32 sUnusedGameInitValue = 0;
// General timer that runs as the game starts
u32 gGlobalTimer = 0;
#ifdef WIDE
u8 gWidescreen;
s16 gWidescreen;
#endif
// Framebuffer rendering values (max 3)
@@ -290,7 +291,7 @@ void create_gfx_task_structure(void) {
gGfxSPTask->task.t.ucode_data = gspF3DEX_fifoDataStart;
#elif SUPER3D_GBI
gGfxSPTask->task.t.ucode = gspSuper3D_fifoTextStart;
gGfxSPTask->task.t.ucode_data = gspSuper3D_fifoDataStart;
gGfxSPTask->task.t.ucode_data = gspSuper3D_fifoDataStart;
#else
gGfxSPTask->task.t.ucode = gspFast3D_fifoTextStart;
gGfxSPTask->task.t.ucode_data = gspFast3D_fifoDataStart;
@@ -727,6 +728,9 @@ void thread5_game_loop(UNUSED void *arg) {
createHvqmThread();
#endif
save_file_load_all();
#ifdef PUPPYCAM
puppycam_boot();
#endif
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1);

View File

@@ -43,7 +43,7 @@ extern struct GfxPool *gGfxPool;
extern u8 gControllerBits;
extern u8 gIsConsole;
#ifdef WIDE
extern u8 gWidescreen;
extern s16 gWidescreen;
#endif
extern u8 gBorderHeight;
#ifdef CUSTOM_DEBUG

View File

@@ -14,6 +14,7 @@
#include "save_file.h"
#include "print.h"
#include "engine/surface_load.h"
#include "puppycam2.h"
#include "puppyprint.h"
#include "config.h"
@@ -525,7 +526,10 @@ void render_hud(void) {
if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA_AND_POWER) {
render_hud_power_meter();
render_hud_camera_status();
#ifdef PUPPYCAM
if (!gPuppyCam.enabled)
#endif
render_hud_camera_status();
}
if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER) {

View File

@@ -23,6 +23,7 @@
#include "text_strings.h"
#include "types.h"
#include "config.h"
#include "puppycam2.h"
u16 gDialogColorFadeTimer;
s8 gLastDialogLineNum;
@@ -1492,13 +1493,15 @@ void render_pause_red_coins(void) {
print_animated_red_coin(GFX_DIMENSIONS_FROM_RIGHT_EDGE(30) - x * 20, 16);
}
}
#ifdef WIDE
///By default, not needed as puppycamera has an option, but should you wish to revert that, you are legally allowed.
#if defined(WIDE) && !defined(PUPPYCAM)
void render_widescreen_setting(void) {
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
if (!gWidescreen) {
print_generic_string(10, 20, textCurrRatio43);
print_generic_string(10, 7, textPressL);
print_generic_string(10, 7, textPressL);
}
else {
print_generic_string(10, 20, textCurrRatio169);
@@ -1799,7 +1802,11 @@ s8 gHudFlash = 0;
s16 render_pause_courses_and_castle(void) {
s16 index;
#ifdef PUPPYCAM
puppycam_check_pause_buttons();
if (!gPCOptionOpen)
{
#endif
switch (gDialogBoxState) {
case DIALOG_STATE_OPENING:
gDialogLineNum = MENU_OPT_DEFAULT;
@@ -1864,13 +1871,22 @@ s16 render_pause_courses_and_castle(void) {
}
break;
}
#ifdef WIDE
#if defined(WIDE) && !defined(PUPPYCAM)
render_widescreen_setting();
#endif
if (gDialogTextAlpha < 250) {
gDialogTextAlpha += 25;
}
#ifdef PUPPYCAM
}
else
{
shade_screen();
puppycam_display_options();
}
puppycam_render_option_text();
#endif
return MENU_OPT_NONE;
}

View File

@@ -1417,6 +1417,14 @@ void update_mario_inputs(struct MarioState *m) {
m->collidedObjInteractTypes = m->marioObj->collidedObjInteractTypes;
m->flags &= 0xFFFFFF;
#ifdef PUPPYCAM
if (gPuppyCam.mode3Flags & PUPPYCAM_MODE3_ENTER_FIRST_PERSON)
{
m->input = INPUT_FIRST_PERSON;
return;
}
#endif
update_mario_button_inputs(m);
update_mario_joystick_inputs(m);
update_mario_geometry_inputs(m);
@@ -1434,7 +1442,7 @@ void update_mario_inputs(struct MarioState *m) {
if (!(m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED))) {
m->input |= INPUT_UNKNOWN_5;
}
// These 3 flags are defined by Bowser stomping attacks
if (m->marioObj->oInteractStatus
& (INT_STATUS_MARIO_STUNNED | INT_STATUS_MARIO_KNOCKBACK_DMG | INT_STATUS_MARIO_SHOCKWAVE)) {

View File

@@ -24,6 +24,7 @@
#include "save_file.h"
#include "skybox.h"
#include "sound_init.h"
#include "puppycam2.h"
#include "config.h"
@@ -127,7 +128,7 @@ static void toad_message_opaque(void) {
}
static void toad_message_talking(void) {
if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_DOWN,
if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_DOWN,
DIALOG_FLAG_TURN_TO_MARIO, CUTSCENE_DIALOG, gCurrentObject->oToadMessageDialogId)) {
gCurrentObject->oToadMessageRecentlyTalked = TRUE;
gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
@@ -314,7 +315,14 @@ 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 (gMarioState->flags & MARIO_VANISH_CAP)
{
gDPSetAlphaCompare(gfx++, G_AC_DITHER);
}
else
{
gDPSetAlphaCompare(gfx++, G_AC_NONE);
}
}
gDPSetEnvColor(gfx++, 255, 255, 255, alpha);
gSPEndDisplayList(gfx);
@@ -334,6 +342,13 @@ Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED
if (callContext == GEO_CONTEXT_RENDER) {
alpha = (bodyState->modelState & 0x100) ? (bodyState->modelState & 0xFF) : 255;
#ifdef PUPPYCAM
if (alpha > gPuppyCam.opacity)
{
alpha = gPuppyCam.opacity;
bodyState->modelState |= MODEL_STATE_NOISE_ALPHA;
}
#endif
gfx = make_gfx_mario_alpha(asGenerated, alpha);
}
return gfx;

1595
src/game/puppycam2.c Normal file

File diff suppressed because it is too large Load Diff

179
src/game/puppycam2.h Normal file
View File

@@ -0,0 +1,179 @@
#ifndef PUPPYCAM2_H
#define PUPPYCAM2_H
#ifdef PUPPYCAM
#define PUPPYCAM_FLAGS_CUTSCENE 0x0001
#define PUPPYCAM_FLAGS_SMOOTH 0x0002
#define PUPPY_ERROR_POOL_FULL 0x1
#define PUPPY_NULL 15151
#define MAX_PUPPYCAM_VOLUMES 128
#define PUPPYCAM_BEHAVIOUR_TEMPORARY 0x0
#define PUPPYCAM_BEHAVIOUR_PERMANENT 0x1
#define PUPPYVOLUME_SHAPE_BOX 0x0
#define PUPPYVOLUME_SHAPE_CYLINDER 0x1
#define PUPPYCAM_MODE3_ZOOMED_IN 0x1
#define PUPPYCAM_MODE3_ZOOMED_MED 0x2
#define PUPPYCAM_MODE3_ZOOMED_OUT 0x4
#define PUPPYCAM_MODE3_ENTER_FIRST_PERSON 0x8
#include "include/command_macros_base.h"
#define PUPPYVOLUME(x, y, z, length, height, width, yaw, functionptr, anglesptr, addflags, removeflags, flagpersistance, room, shape) \
CMD_BBH(0x3D, 0x24, x), \
CMD_HHHHHH(y, z, length, height, width, yaw), \
CMD_PTR(functionptr), \
CMD_PTR(anglesptr), \
CMD_W(addflags), \
CMD_W(removeflags), \
CMD_BBH(flagpersistance, shape, room)
//Some macros for the sake of basic human sanity.
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define ABS(x) ((x) > 0.f ? (x) : -(x))
struct gPuppyOptions
{
s16 analogue;
s16 sensitivityX;
s16 sensitivityY;
s16 invertX;
s16 invertY;
s16 turnAggression;
s16 inputType;
};
struct gPuppyStruct
{
s16 yaw; //Horizontal Direction the game reads as the active value.
s16 yawTarget; //Horizontal Direction that yaw tries to be.
f32 yawAcceleration; //Horizontal Direction that sets yawTarget.
s16 pitch; //Vertical Direction the game reads as the active value.
s16 pitchTarget; //Vertical Direction that pitch tries to be.
f32 pitchAcceleration; //Vertical Direction that sets pitchTarget.
s16 posHeight[2]; //The first index is the ground offset of pos[1], the second index is the ground offset of focus[1].
s16 zoom; //How far the camera is currently zoomed out
u8 zoomSet; //The current setting of which zoompoint to set the target to.
s16 zoomTarget; //The value that zoom tries to be.
s16 zoomPoints[3]; //An array containing distances.
s16 targetFloorHeight; //Mario's current floor height
s16 lastTargetFloorHeight; //Mirror's mario's floor height when his velocity is not above 0.
Vec3s pos; //Where the camera is
Vec3s focus; //Where the camera's looking
Vec3s pan; //An offset of the camera's focus
s32 intendedFlags; //The flagset the camera tries to be when it's not held hostage.
s32 flags; //Behaviour flags that affect different properties of the camera's behaviour
Vec3s shake; //How much the camera's shaking
u8 shakeFrames; //How long the camera's shaking for
f32 shakeForce; //How violently the camera's shaking
s32 framesSinceC[2]; //Counts the number of frames since the last C left or right press, to track double presses.
s16 collisionDistance; //Tries to be zoom, but will be overwritten by collision detection
struct Object *targetObj; //The object that the focus will base its positioning off. Usually Mario.
struct Object *targetObj2; //This is the second focus point that the camera will focus on. It'll focus between them.
s16 povHeight; //An offset of the focus object's Y value.
s16 floorY[2]; //Floor offsets, to allow a grace period before following Mario into the air.
u8 opacity; //A value set by collision distance, to fade Mario out if you're too close.
s8 stick2[2];//The value that's set and read for analogue stick.
u8 stickN[2]; //This is set when the stick is neutral. It's to prevent rapidfire input.
u8 enabled; //A boolean that decides whether to use vanilla camera or puppy camera. Of course, anybody with this enabled is obligated to a death sentence :)
s16 swimPitch; //Pitch adjustment that's applied when swimming. All pitch adjustment is clamped.
s16 edgePitch; //Pitch adjustment that's applied when stood near an edge. All pitch adjustment is clamped.
s16 moveZoom; //A small zoom value that's added on top of the regular zoom when moving. It's pretty subtle, but gives the feeling of a bit of speed.
u8 mode3Flags; //A flagset for classic mode.
u8 moveFlagAdd; //A bit that multiplies movement rate of axes when moving, to centre them faster.
s16 targetDist[2];
u8 cutscene; //A boolean that decides whether a cutscene is active
s32 (*sceneFunc)();
u8 sceneInput; //A boolean that decides whether the controller updates during the scene.
s32 sceneTimer; //The cutscene timer that goes up during a cutscene.
Vec3s scenePos; //Where the camera is during a cutscene
Vec3s sceneFocus; //Where the camera looks during a cutscene
struct gPuppyOptions options;
};
//A second container for bounds that have 2 pairs of coordinates. Optional.
struct sPuppyAngles
{
Vec3s pos;
Vec3s focus;
s16 yaw;
s16 pitch;
s16 zoom;
};
//A bounding volume for activating puppycamera scripts and angles.
struct sPuppyVolume
{
Vec3s pos; //The set position of the volume
Vec3s radius; //Where it extends.
s16 rot; //The rotational angle of the volume.
s32 *func; //a pointer to a function. Optional.
struct sPuppyAngles *angles; //A pointer to a gPuppyAngles struct. Optional
s32 flagsAdd; //Adds behaviour flags.
s32 flagsRemove; //Removes behaviour flags.
u8 flagPersistance; //Decides if adding or removing the flags is temporary or permanent.
u8 shape;
s16 room;
};
enum gPuppyCamBeh
{
PUPPYCAM_BEHAVIOUR_X_MOVEMENT = 0x0001,
PUPPYCAM_BEHAVIOUR_Y_MOVEMENT = 0x0002,
PUPPYCAM_BEHAVIOUR_Z_MOVEMENT = 0x0004,
PUPPYCAM_BEHAVIOUR_YAW_ROTATION = 0x0008,
PUPPYCAM_BEHAVIOUR_PITCH_ROTATION = 0x0010,
PUPPYCAM_BEHAVIOUR_ZOOM_CHANGE = 0x0020,
PUPPYCAM_BEHAVIOUR_INPUT_NORMAL = 0x0040,
PUPPYCAM_BEHAVIOUR_INPUT_8DIR = 0x0080,
PUPPYCAM_BEHAVIOUR_INPUT_4DIR = 0x0100,
PUPPYCAM_BEHAVIOUR_INPUT_2D = 0x0200,
PUPPYCAM_BEHAVIOUR_SLIDE_CORRECTION = 0x0400,
PUPPYCAM_BEHAVIOUR_TURN_HELPER = 0x0800,
PUPPYCAM_BEHAVIOUR_HEIGHT_HELPER = 0x1000,
PUPPYCAM_BEHAVIOUR_PANSHIFT = 0x2000,
PUPPYCAM_BEHAVIOUR_COLLISION = 0x4000,
PUPPYCAM_BEHAVIOUR_DEFAULT = PUPPYCAM_BEHAVIOUR_X_MOVEMENT | PUPPYCAM_BEHAVIOUR_Y_MOVEMENT | PUPPYCAM_BEHAVIOUR_Z_MOVEMENT |
PUPPYCAM_BEHAVIOUR_YAW_ROTATION | PUPPYCAM_BEHAVIOUR_PITCH_ROTATION | PUPPYCAM_BEHAVIOUR_ZOOM_CHANGE |
PUPPYCAM_BEHAVIOUR_HEIGHT_HELPER | PUPPYCAM_BEHAVIOUR_TURN_HELPER | PUPPYCAM_BEHAVIOUR_INPUT_NORMAL | PUPPYCAM_BEHAVIOUR_PANSHIFT | PUPPYCAM_BEHAVIOUR_COLLISION
};
extern u8 gPCOptionOpen;
extern s32 gPuppyError;
extern struct gPuppyStruct gPuppyCam;
extern struct sPuppyVolume *sPuppyVolumeStack[MAX_PUPPYCAM_VOLUMES];
extern u16 gPuppyVolumeCount;
extern struct MemoryPool *gPuppyMemoryPool;
extern void puppycam_boot(void);
extern void puppycam_init(void);
extern void puppycam_loop(void);
extern void puppycam_shake(s16 x, s16 y, s16 z);
extern void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Vec3f hit_pos);
extern f32 approach_f32_asymptotic(f32 current, f32 target, f32 multiplier);
extern void puppycam_default_config(void);
extern s16 LENCOS(s16 length, s16 direction);
extern s16 LENSIN(s16 length, s16 direction);
extern void puppycam_display_options(void);
extern void puppycam_set_save(void);
extern void puppycam_check_pause_buttons(void);
extern void puppycam_activate_cutscene(s32 *scene, s32 lockinput);
extern void puppycam_render_option_text();
void puppycam_warp(f32 displacementX, f32 displacementY, f32 displacementZ);
#endif
#endif // PUPPYCAM2_H

View File

@@ -78,52 +78,6 @@ struct RenderModeContainer {
};
/* Rendermode settings for cycle 1 for all 8 layers. */
#ifdef DISABLE_AA
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_TEX_EDGE,
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
} },
{ {
/* z-buffered */
G_RM_ZB_OPA_SURF,
G_RM_ZB_OPA_SURF,
G_RM_ZB_OPA_DECAL,
G_RM_AA_ZB_OPA_INTER,
G_RM_AA_ZB_TEX_EDGE,
G_RM_ZB_XLU_SURF,
G_RM_ZB_XLU_DECAL,
G_RM_AA_ZB_XLU_INTER,
} } };
/* Rendermode settings for cycle 2 for all 8 layers. */
struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_TEX_EDGE2,
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
} },
{ {
/* z-buffered */
G_RM_ZB_OPA_SURF2,
G_RM_ZB_OPA_SURF2,
G_RM_ZB_OPA_DECAL2,
G_RM_AA_ZB_OPA_INTER2,
G_RM_AA_ZB_TEX_EDGE2,
G_RM_ZB_XLU_SURF2,
G_RM_ZB_XLU_DECAL2,
G_RM_AA_ZB_XLU_INTER2,
} } };
#else
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_OPA_SURF,
G_RM_AA_OPA_SURF,
@@ -168,7 +122,6 @@ struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_AA_ZB_XLU_DECAL2,
G_RM_AA_ZB_XLU_INTER2,
} } };
#endif
struct GraphNodeRoot *gCurGraphNodeRoot = NULL;
struct GraphNodeMasterList *gCurGraphNodeMasterList = NULL;
@@ -333,7 +286,7 @@ static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
#else
distanceFromCam = -gMatStack[gMatStackIndex][3][2];
#endif
if ((f32)node->minDistance <= distanceFromCam && distanceFromCam < (f32)node->maxDistance) {
if (node->node.children != 0) {
geo_process_node_and_siblings(node->node.children);

View File

@@ -15,6 +15,7 @@
#ifdef SRAM
#include "sram.h"
#endif
#include "puppycam2.h"
#define ALIGN4(val) (((val) + 0x3) & ~0x3)
@@ -390,6 +391,37 @@ void save_file_load_all(void) {
}
}
#ifdef PUPPYCAM
void puppycam_check_save(void)
{
if (gSaveBuffer.menuData[0].firstBoot != 4 || gSaveBuffer.menuData[0].saveOptions.sensitivityX < 5 || gSaveBuffer.menuData[0].saveOptions.sensitivityY < 5)
{
wipe_main_menu_data();
gSaveBuffer.menuData[0].firstBoot = 4;
puppycam_default_config();
}
}
void puppycam_get_save(void)
{
gPuppyCam.options = gSaveBuffer.menuData[0].saveOptions;
gSaveBuffer.menuData[0].firstBoot = gSaveBuffer.menuData[0].firstBoot;
puppycam_check_save();
}
void puppycam_set_save(void)
{
gSaveBuffer.menuData[0].saveOptions = gPuppyCam.options;
gSaveBuffer.menuData[0].firstBoot = 4;
gMainMenuDataModified = TRUE;
save_main_menu_data();
}
#endif
/**
* Reload the current save file from its backup copy, which is effectively a
* a cached copy of what has been written to EEPROM.

View File

@@ -5,6 +5,7 @@
#include "types.h"
#include "area.h"
#include "puppycam2.h"
#include "course_table.h"
@@ -69,10 +70,14 @@ struct MainMenuSaveData
#else
#define SUBTRAHEND 6
#endif
u8 firstBoot;
// 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))];
#ifdef PUPPYCAM
struct gPuppyOptions saveOptions;
#endif
struct SaveBlockSignature signature;
};
@@ -81,9 +86,15 @@ struct SaveBuffer
// Each of the four save files has two copies. If one is bad, the other is used as a backup.
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];
struct MainMenuSaveData menuData[1];
};
#ifdef PUPPYCAM
extern void puppycam_set_save(void);
extern void puppycam_get_save(void);
extern void puppycam_check_save(void);
#endif
STATIC_ASSERT(sizeof(struct SaveBuffer) <= EEPROM_SIZE, "ERROR: Save struct too big for specified save type");
extern u8 gLastCompletedCourseNum;