You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Improve puppyprint font a bit more
This commit is contained in:
@@ -21,9 +21,7 @@ struct Object *gMarioPlatform = NULL;
|
||||
*/
|
||||
void update_mario_platform(void) {
|
||||
struct Surface *floor;
|
||||
f32 marioX;
|
||||
f32 marioY;
|
||||
f32 marioZ;
|
||||
f32 marioX, marioY, marioZ;
|
||||
f32 floorHeight;
|
||||
u32 awayFromFloor;
|
||||
|
||||
@@ -41,27 +39,19 @@ void update_mario_platform(void) {
|
||||
marioZ = gMarioObject->oPosZ;
|
||||
floorHeight = find_floor(marioX, marioY, marioZ, &floor);
|
||||
|
||||
if (absf(marioY - floorHeight) < 4.0f) {
|
||||
awayFromFloor = 0;
|
||||
} else {
|
||||
awayFromFloor = 1;
|
||||
}
|
||||
awayFromFloor = (absf(marioY - floorHeight) >= 4.0f);
|
||||
|
||||
switch (awayFromFloor) {
|
||||
case 1:
|
||||
if (awayFromFloor) {
|
||||
gMarioPlatform = NULL;
|
||||
gMarioObject->platform = NULL;
|
||||
} else {
|
||||
if (floor != NULL && floor->object != NULL) {
|
||||
gMarioPlatform = floor->object;
|
||||
gMarioObject->platform = floor->object;
|
||||
} else {
|
||||
gMarioPlatform = NULL;
|
||||
gMarioObject->platform = NULL;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if (floor != NULL && floor->object != NULL) {
|
||||
gMarioPlatform = floor->object;
|
||||
gMarioObject->platform = floor->object;
|
||||
} else {
|
||||
gMarioPlatform = NULL;
|
||||
gMarioObject->platform = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,12 +221,8 @@ void apply_mario_platform_displacement(void) {
|
||||
* platform. If isMario is false, use gCurrentObject.
|
||||
*/
|
||||
void apply_platform_displacement(u32 isMario, struct Object *platform) {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
f32 platformPosX;
|
||||
f32 platformPosY;
|
||||
f32 platformPosZ;
|
||||
f32 x, y, z;
|
||||
f32 platformPosX, platformPosY, platformPosZ;
|
||||
Vec3f currentObjectOffset;
|
||||
Vec3f relativeOffset;
|
||||
Vec3f newObjectOffset;
|
||||
|
||||
@@ -20,9 +20,9 @@ void update_mario_platform(void);
|
||||
void get_mario_pos(f32 *x, f32 *y, f32 *z);
|
||||
void set_mario_pos(f32 x, f32 y, f32 z);
|
||||
#ifdef PLATFORM_DISPLACEMENT_2
|
||||
void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, Vec3f pos, s16 *yaw, struct Object *platform);
|
||||
void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, Vec3f pos, s16 *yaw, struct Object *platform);
|
||||
#else
|
||||
void apply_platform_displacement(u32 isMario, struct Object *platform);
|
||||
void apply_platform_displacement(u32 isMario, struct Object *platform);
|
||||
#endif
|
||||
void apply_mario_platform_displacement(void);
|
||||
void clear_mario_platform(void);
|
||||
|
||||
@@ -52,7 +52,7 @@ void format_integer(s32 n, s32 base, char *dest, s32 *totalLength, u8 width, s8
|
||||
s8 negative = FALSE;
|
||||
char pad;
|
||||
|
||||
if (zeroPad == TRUE) {
|
||||
if (zeroPad) {
|
||||
pad = '0';
|
||||
} else {
|
||||
pad = -1;
|
||||
@@ -207,8 +207,7 @@ void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n) {
|
||||
srcIndex++;
|
||||
|
||||
format_integer(n, base, sTextLabels[sTextLabelsCount]->buffer + len, &len, width, zeroPad);
|
||||
} else // straight copy
|
||||
{
|
||||
} else { // straight copy
|
||||
sTextLabels[sTextLabelsCount]->buffer[len] = c;
|
||||
len++;
|
||||
srcIndex++;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
static inline float smooth(float x) {
|
||||
x = CLAMP(x, 0, 1);
|
||||
return x * x * (3.f - 2.f * x);
|
||||
return sqr(x) * (3.f - 2.f * x);
|
||||
}
|
||||
|
||||
static inline float softClamp(float x, float a, float b) {
|
||||
@@ -43,12 +43,12 @@ static inline float softClamp(float x, float a, float b) {
|
||||
|
||||
struct gPuppyStruct gPuppyCam;
|
||||
struct sPuppyVolume *sPuppyVolumeStack[MAX_PUPPYCAM_VOLUMES];
|
||||
s16 sFloorHeight = 0;
|
||||
u8 gPCOptionOpen = 0;
|
||||
s8 gPCOptionSelected = 0;
|
||||
s16 sFloorHeight = 0;
|
||||
u8 gPCOptionOpen = 0;
|
||||
s8 gPCOptionSelected = 0;
|
||||
s32 gPCOptionTimer = 0;
|
||||
u8 gPCOptionIndex = 0;
|
||||
u8 gPCOptionScroll = 0;
|
||||
u8 gPCOptionIndex = 0;
|
||||
u8 gPCOptionScroll = 0;
|
||||
u16 gPuppyVolumeCount = 0;
|
||||
struct MemoryPool *gPuppyMemoryPool;
|
||||
s32 gPuppyError = 0;
|
||||
@@ -196,9 +196,9 @@ void puppycam_activate_cutscene(s32 (*scene)(), s32 lockinput) {
|
||||
gPuppyCam.sceneInput = lockinput;
|
||||
}
|
||||
|
||||
//If you've read camera.c this will look familiar.
|
||||
//It takes the next 4 spline points and extrapolates a curvature based positioning of the camera vector that's passed through.
|
||||
//It's a standard B spline
|
||||
// If you've read camera.c this will look familiar.
|
||||
// It takes the next 4 spline points and extrapolates a curvature based positioning of the camera vector that's passed through.
|
||||
// It's a standard B spline
|
||||
static void puppycam_evaluate_spline(f32 progress, Vec3s cameraPos, Vec3f spline1, Vec3f spline2, Vec3f spline3, Vec3f spline4) {
|
||||
f32 tempP[4];
|
||||
|
||||
@@ -227,11 +227,11 @@ s32 puppycam_move_spline(struct sPuppySpline splinePos[], struct sPuppySpline sp
|
||||
gPuppyCam.splineIndex = index;
|
||||
}
|
||||
if (splinePos[gPuppyCam.splineIndex].index == -1 || splinePos[gPuppyCam.splineIndex + 1].index == -1 || splinePos[gPuppyCam.splineIndex + 2].index == -1) {
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
if (mode == PUPPYSPLINE_FOLLOW) {
|
||||
if (splineFocus[gPuppyCam.splineIndex].index == -1 || splineFocus[gPuppyCam.splineIndex + 1].index == -1 || splineFocus[gPuppyCam.splineIndex + 2].index == -1) {
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
vec3f_set(prevPos, gPuppyCam.pos[0], gPuppyCam.pos[1], gPuppyCam.pos[2]);
|
||||
@@ -262,12 +262,12 @@ s32 puppycam_move_spline(struct sPuppySpline splinePos[], struct sPuppySpline sp
|
||||
if (splinePos[gPuppyCam.splineIndex + 3].index == -1) {
|
||||
gPuppyCam.splineIndex = 0;
|
||||
gPuppyCam.splineProgress = 0;
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
gPuppyCam.splineProgress -=1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void puppycam_process_cutscene(void) {
|
||||
@@ -979,7 +979,6 @@ static s32 puppycam_check_volume_bounds(struct sPuppyVolume *volume, s32 index)
|
||||
void puppycam_wall_angle(void) {
|
||||
struct Surface *wall;
|
||||
struct WallCollisionData cData;
|
||||
s16 wallYaw;
|
||||
|
||||
if (!(gMarioState->action & ACT_WALL_KICK_AIR) || ((gMarioState->action & ACT_FLAG_AIR) && ABS(gMarioState->forwardVel) < 16.0f) || !(gMarioState->action & ACT_FLAG_AIR)) {
|
||||
return;
|
||||
@@ -995,7 +994,7 @@ void puppycam_wall_angle(void) {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
wallYaw = atan2s(wall->normal.z, wall->normal.x) + 0x4000;
|
||||
s16 wallYaw = atan2s(wall->normal.z, wall->normal.x) + 0x4000;
|
||||
|
||||
wallYaw -= gPuppyCam.yawTarget;
|
||||
if (wallYaw % 0x4000) {
|
||||
@@ -1345,15 +1344,15 @@ void puppycam_loop(void) {
|
||||
puppycam_input_core();
|
||||
puppycam_projection();
|
||||
puppycam_script();
|
||||
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_COLLISION)
|
||||
if (gPuppyCam.flags & PUPPYCAM_BEHAVIOUR_COLLISION) {
|
||||
puppycam_collision();
|
||||
else
|
||||
} else {
|
||||
gPuppyCam.opacity = 255;
|
||||
}
|
||||
} else if (gPuppyCam.cutscene) {
|
||||
gPuppyCam.opacity = 255;
|
||||
puppycam_process_cutscene();
|
||||
}
|
||||
|
||||
puppycam_apply();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,31 +39,31 @@ shaped and rotated correctly, for accurate representation of their properties.
|
||||
|
||||
#ifdef PUPPYLIGHTS
|
||||
|
||||
Lights1 gLevelLight; //Existing ambient light in the area. Will be set by the level script, though can always be changed afterwards if desired.
|
||||
Lights1 gLevelLight; // Existing ambient light in the area. Will be set by the level script, though can always be changed afterwards if desired.
|
||||
u8 levelAmbient = FALSE;
|
||||
Lights1 *sLightBase; //The base value where lights are written to when worked with.
|
||||
Lights1 sDefaultLights = gdSPDefLights1(0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); //Default lights default lights
|
||||
u16 gNumLights = 0; //How many lights are loaded.
|
||||
u16 gDynLightStart = 0; //Where the dynamic lights will start.
|
||||
struct PuppyLight *gPuppyLights[MAX_LIGHTS]; //This contains all the loaded data.
|
||||
struct MemoryPool *gLightsPool; //The memory pool where the above is stored.
|
||||
Lights1 *sLightBase; // The base value where lights are written to when worked with.
|
||||
Lights1 sDefaultLights = gdSPDefLights1(0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); // Default lights default lights
|
||||
u16 gNumLights = 0; // How many lights are loaded.
|
||||
u16 gDynLightStart = 0; // Where the dynamic lights will start.
|
||||
struct PuppyLight *gPuppyLights[MAX_LIGHTS]; // This contains all the loaded data.
|
||||
struct MemoryPool *gLightsPool; // The memory pool where the above is stored.
|
||||
|
||||
//Runs after an area load, allocates the dynamic light slots.
|
||||
void puppylights_allocate(void)
|
||||
{
|
||||
// Runs after an area load, allocates the dynamic light slots.
|
||||
void puppylights_allocate(void) {
|
||||
s32 numAllocate = MIN(MAX_LIGHTS - gNumLights, MAX_LIGHTS_DYNAMIC);
|
||||
s32 i;
|
||||
|
||||
gDynLightStart = gNumLights;
|
||||
|
||||
if (numAllocate <= 0) //If this happens you've allocated too many static lights and therefore cucked dynamic.
|
||||
if (numAllocate <= 0) { // If this happens you've allocated too many static lights and therefore cucked dynamic.
|
||||
return;
|
||||
//Now it has the number it wants, it will allocate this many extra lights, intended for dynamic lights.
|
||||
for (i = 0; i < numAllocate; i++)
|
||||
{
|
||||
}
|
||||
// Now it has the number it wants, it will allocate this many extra lights, intended for dynamic lights.
|
||||
for (i = 0; i < numAllocate; i++) {
|
||||
gPuppyLights[gNumLights] = mem_pool_alloc(gLightsPool, sizeof(struct PuppyLight));
|
||||
if (gPuppyLights[gNumLights] == NULL)
|
||||
if (gPuppyLights[gNumLights] == NULL) {
|
||||
return;
|
||||
}
|
||||
gPuppyLights[gNumLights]->active = FALSE;
|
||||
gPuppyLights[gNumLights]->flags = 0;
|
||||
gNumLights++;
|
||||
@@ -72,9 +72,8 @@ void puppylights_allocate(void)
|
||||
|
||||
extern Mat4 gMatStack[32];
|
||||
|
||||
//Function that iterates through each light.
|
||||
void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object *obj, s32 flags)
|
||||
{
|
||||
// Function that iterates through each light.
|
||||
void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object *obj, s32 flags) {
|
||||
Lights1 *tempLight;
|
||||
s32 lightPos[2];
|
||||
Vec3i lightRelative;
|
||||
@@ -88,77 +87,74 @@ void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object *
|
||||
f64 scaleVal = 1.0f;
|
||||
Vec3f debugPos[2];
|
||||
|
||||
//Relative positions of the object vs. the centre of the node.
|
||||
// Relative positions of the object vs. the centre of the node.
|
||||
lightRelative[0] = light->pos[0][0] - obj->oPosX;
|
||||
lightRelative[1] = light->pos[0][1] - obj->oPosY;
|
||||
lightRelative[2] = light->pos[0][2] - obj->oPosZ;
|
||||
|
||||
//If the nodes X and Z values are equal, then a check is made if the angle is a derivative of 90.
|
||||
//If so, then it will completely skip over the calculation that figures out position from rotation.
|
||||
//If it's a cylinder, then it ignores that check, simply because an equal sided cylinder will have the
|
||||
//same result no matter the yaw. If neither is true, then it simply checks if it's 180 degrees, since
|
||||
//That will just be the same as 0.
|
||||
if (light->pos[1][0] == light->pos[1][2])
|
||||
{
|
||||
if (light->yaw % 0x4000 == 0 || light->flags & PUPPYLIGHT_SHAPE_CYLINDER)
|
||||
{
|
||||
// If the nodes X and Z values are equal, then a check is made if the angle is a derivative of 90.
|
||||
// If so, then it will completely skip over the calculation that figures out position from rotation.
|
||||
// If it's a cylinder, then it ignores that check, simply because an equal sided cylinder will have the
|
||||
// same result no matter the yaw. If neither is true, then it simply checks if it's 180 degrees, since
|
||||
// That will just be the same as 0.
|
||||
if (light->pos[1][0] == light->pos[1][2]) {
|
||||
if (light->yaw % 0x4000 == 0 || light->flags & PUPPYLIGHT_SHAPE_CYLINDER) {
|
||||
lightPos[0] = lightRelative[0];
|
||||
lightPos[1] = lightRelative[2];
|
||||
goto skippingTrig;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (light->yaw % 0x8000 == 0)
|
||||
{
|
||||
} else if (light->yaw % 0x8000 == 0) {
|
||||
lightPos[0] = lightRelative[0];
|
||||
lightPos[1] = lightRelative[2];
|
||||
goto skippingTrig;
|
||||
}
|
||||
|
||||
//Get the position based off the rotation of the box.
|
||||
// Get the position based off the rotation of the box.
|
||||
lightPos[0] = lightRelative[2] * sins(-light->yaw) + lightRelative[0] * coss(-light->yaw);
|
||||
lightPos[1] = lightRelative[2] * coss(-light->yaw) - lightRelative[0] * sins(-light->yaw);
|
||||
skippingTrig:
|
||||
|
||||
#ifdef VISUAL_DEBUG
|
||||
#ifdef VISUAL_DEBUG
|
||||
vec3f_set(debugPos[0], light->pos[0][0], light->pos[0][1], light->pos[0][2]);
|
||||
vec3f_set(debugPos[1], light->pos[1][0], light->pos[1][1], light->pos[1][2]);
|
||||
debug_box_color(0x08FF00FF);
|
||||
if (light->flags & PUPPYLIGHT_SHAPE_CYLINDER)
|
||||
if (light->flags & PUPPYLIGHT_SHAPE_CYLINDER) {
|
||||
debug_box_rot(debugPos[0], debugPos[1], light->yaw, DEBUG_SHAPE_CYLINDER | DEBUG_UCODE_DEFAULT);
|
||||
else
|
||||
} else {
|
||||
debug_box_rot(debugPos[0], debugPos[1], light->yaw, DEBUG_SHAPE_BOX | DEBUG_UCODE_DEFAULT);
|
||||
#endif
|
||||
//Check if the object is inside the box, after correcting it for rotation.
|
||||
}
|
||||
#endif
|
||||
// Check if the object is inside the box, after correcting it for rotation.
|
||||
if (-light->pos[1][0] < lightPos[0] && lightPos[0] < light->pos[1][0] &&
|
||||
-light->pos[1][1] < lightRelative[1] && lightRelative[1] < light->pos[1][1] &&
|
||||
-light->pos[1][2] < lightPos[1] && lightPos[1] < light->pos[1][2])
|
||||
{
|
||||
//If so, then start making preparations to see how alongside they're in.
|
||||
//This takes the largest side of the box and multiplies the other axis to match the numbers.
|
||||
//This way, the colour value will scale correctly, no matter which side is entered.
|
||||
//Because positions are a vector, and Y is up, it means tempID needs to be multiplied
|
||||
//By 2 in order to reach the X and Z axis. Thanks SM64.
|
||||
//It will skip scaling the opposite axis if there's no need to.
|
||||
-light->pos[1][2] < lightPos[1] && lightPos[1] < light->pos[1][2]) {
|
||||
// If so, then start making preparations to see how alongside they're in.
|
||||
// This takes the largest side of the box and multiplies the other axis to match the numbers.
|
||||
// This way, the colour value will scale correctly, no matter which side is entered.
|
||||
// Because positions are a vector, and Y is up, it means tempID needs to be multiplied
|
||||
// By 2 in order to reach the X and Z axis. Thanks SM64.
|
||||
// It will skip scaling the opposite axis if there's no need to.
|
||||
|
||||
//Every axis needs to be the same as Z, so X and Y, if necessary, will be scaled to match it.
|
||||
//This is done, so that when calculating scale, it's done spherically.
|
||||
if (light->pos[1][0] != light->pos[1][2])
|
||||
lightPos[0] /= ((f32)light->pos[1][0]/light->pos[1][2]);
|
||||
//Same for Y axis.
|
||||
if (light->pos[1][1] != light->pos[1][2])
|
||||
lightRelative[1] /= ((f32)light->pos[1][1]/light->pos[1][2]);
|
||||
|
||||
if (light->flags & PUPPYLIGHT_IGNORE_Y)
|
||||
scaleOrig = (lightPos[0] * lightPos[0]) + (lightPos[1] * lightPos[1]);
|
||||
else
|
||||
scaleOrig = (lightPos[0] * lightPos[0]) + (lightRelative[1] * lightRelative[1]) + (lightPos[1] * lightPos[1]);
|
||||
// Every axis needs to be the same as Z, so X and Y, if necessary, will be scaled to match it.
|
||||
// This is done, so that when calculating scale, it's done spherically.
|
||||
if (light->pos[1][0] != light->pos[1][2]) {
|
||||
lightPos[0] /= ((f32)light->pos[1][0] / light->pos[1][2]);
|
||||
}
|
||||
// Same for Y axis.
|
||||
if (light->pos[1][1] != light->pos[1][2]) {
|
||||
lightRelative[1] /= ((f32)light->pos[1][1] / light->pos[1][2]);
|
||||
}
|
||||
if (light->flags & PUPPYLIGHT_IGNORE_Y) {
|
||||
scaleOrig = sqr(lightPos[0]) + sqr(lightPos[1]);
|
||||
} else {
|
||||
scaleOrig = sqr(lightPos[0]) + sqr(lightRelative[1]) + sqr(lightPos[1]);
|
||||
}
|
||||
scaleVal = (light->pos[1][2]*light->pos[1][2]);
|
||||
//If it's a cylinder, then bin anything outside it.
|
||||
if (light->flags & PUPPYLIGHT_SHAPE_CYLINDER)
|
||||
{
|
||||
if (scaleOrig > scaleVal)
|
||||
// If it's a cylinder, then bin anything outside it.
|
||||
if (light->flags & PUPPYLIGHT_SHAPE_CYLINDER) {
|
||||
if (scaleOrig > scaleVal) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -167,79 +163,69 @@ void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object *
|
||||
f32 epc = (f32)(light->epicentre/100.0f);
|
||||
tempLight = segmented_to_virtual(src);
|
||||
//Now we have a scale value and a scale factor, we can start lighting things up.
|
||||
//Convert to a percentage.
|
||||
// Convert to a percentage.
|
||||
scale = CLAMP(scaleOrig/scaleVal, 0.0f, 1.0f);
|
||||
//Reduce scale2 by the epicentre.
|
||||
scale2 = CLAMP((scale - epc) * (1+epc), 0.0f, 1.0f);
|
||||
// Reduce scale2 by the epicentre.
|
||||
scale2 = CLAMP((scale - epc) * (1 + epc), 0.0f, 1.0f);
|
||||
|
||||
//Get the direction numbers we want by applying some maths to the relative positions. We use 64 because light directions range from -64 to 63.
|
||||
//Note: can this be optimised further? Simply squaring lightRelative and then dividing it by preScale doesn't work.
|
||||
if (light->flags & PUPPYLIGHT_DIRECTIONAL)
|
||||
{
|
||||
// Get the direction numbers we want by applying some maths to the relative positions. We use 64 because light directions range from -64 to 63.
|
||||
// Note: can this be optimised further? Simply squaring lightRelative and then dividing it by preScale doesn't work.
|
||||
if (light->flags & PUPPYLIGHT_DIRECTIONAL) {
|
||||
lightDir[0] = ((lightRelative[0]) * 64.0f) / light->pos[1][0];
|
||||
lightDir[1] = ((lightRelative[1]) * 64.0f) / light->pos[1][1];
|
||||
lightDir[2] = ((lightRelative[2]) * 64.0f) / light->pos[1][2];
|
||||
}
|
||||
//Get direction if applicable.
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (i = 0; i < 3; i++) {
|
||||
//So it works by starting from the final colour, and then lerping to the original colour, by a factor of the epicentre corrected scale. Light opacity affects this further.
|
||||
colour = approach_f32_asymptotic(light->rgba[i], tempLight->l[0].l.col[i], scale2*((f32)light->rgba[3]/255.0f));
|
||||
//If it's a directional light, then increase the current ambient by 50%, to give the effect better.
|
||||
//Otherwise, just normalise the brightness to keep it in line with the current ambient.
|
||||
//And now to apply the values.
|
||||
colour = approach_f32_asymptotic(light->rgba[i], tempLight->l[0].l.col[i], scale2 * ((f32)light->rgba[3]/255.0f));
|
||||
// If it's a directional light, then increase the current ambient by 50%, to give the effect better.
|
||||
// Otherwise, just normalise the brightness to keep it in line with the current ambient.
|
||||
// And now to apply the values.
|
||||
tempLight->l[0].l.col[i] = colour;
|
||||
tempLight->l[0].l.colc[i] = colour;
|
||||
//Ambient, too.
|
||||
if (!(light->flags & PUPPYLIGHT_DIRECTIONAL))
|
||||
{
|
||||
ambient = approach_f32_asymptotic(light->rgba[i]/2, tempLight->a.l.col[i], scale*((f32)light->rgba[3]/255.0f));
|
||||
// Ambient, too.
|
||||
if (!(light->flags & PUPPYLIGHT_DIRECTIONAL)) {
|
||||
ambient = approach_f32_asymptotic(light->rgba[i]/2, tempLight->a.l.col[i], scale*((f32)light->rgba[3] / 255.0f));
|
||||
tempLight->a.l.col[i] = ambient;
|
||||
tempLight->a.l.colc[i] = ambient;
|
||||
}
|
||||
//A slightly hacky way to offset the ambient lighting in order to prevent directional lighting from having a noticeable change in ambient brightness.
|
||||
if (flags & LIGHTFLAG_DIRECTIONAL_OFFSET)
|
||||
{
|
||||
ambient = approach_f32_asymptotic(MIN(tempLight->a.l.col[i] * 2, 0xFF), tempLight->a.l.col[i], scale2*((f32)light->rgba[3]/255.0f));
|
||||
// A slightly hacky way to offset the ambient lighting in order to prevent directional lighting from having a noticeable change in ambient brightness.
|
||||
if (flags & LIGHTFLAG_DIRECTIONAL_OFFSET) {
|
||||
ambient = approach_f32_asymptotic(MIN(tempLight->a.l.col[i] * 2, 0xFF), tempLight->a.l.col[i], scale2*((f32)light->rgba[3] / 255.0f));
|
||||
tempLight->a.l.col[i] = ambient;
|
||||
tempLight->a.l.colc[i] = ambient;
|
||||
}
|
||||
//Apply direction. It takes the relative positions, and then multiplies them with the perspective matrix to get a correct direction.
|
||||
//Index 1 of the first dimension of gMatStack is perspective. Note that if you ever decide to cheat your way into rendering things after the game does :^)
|
||||
if (light->flags & PUPPYLIGHT_DIRECTIONAL)
|
||||
// Apply direction. It takes the relative positions, and then multiplies them with the perspective matrix to get a correct direction.
|
||||
// Index 1 of the first dimension of gMatStack is perspective. Note that if you ever decide to cheat your way into rendering things after the game does :^)
|
||||
if (light->flags & PUPPYLIGHT_DIRECTIONAL) {
|
||||
tempLight->l->l.dir[i] = approach_f32_asymptotic((s8)(lightDir[0] * gMatStack[1][0][i] + lightDir[1] * gMatStack[1][1][i] + lightDir[2] * gMatStack[1][2][i]), tempLight->l->l.dir[i], scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Main function. Run this in the object you wish to illuminate, and just give it its light, object pointer and any potential flags if you want to use them.
|
||||
//If the object has multiple lights, then you run this for each light.
|
||||
void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour)
|
||||
{
|
||||
// Main function. Run this in the object you wish to illuminate, and just give it its light, object pointer and any potential flags if you want to use them.
|
||||
// If the object has multiple lights, then you run this for each light.
|
||||
void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour) {
|
||||
s32 i;
|
||||
s32 numlights = 0;
|
||||
s32 offsetPlaced = 0;
|
||||
s32 lightFlags = flags;
|
||||
|
||||
if (gCurrLevelNum < LEVEL_BBH)
|
||||
if (gCurrLevelNum < LEVEL_BBH) {
|
||||
return;
|
||||
//Checks if there's a hardset colour. Colours are only the first 3 bytes, so you can really put whatever you want in the last.
|
||||
//If there isn't a colour, then it decides whether to apply the ambient lighting, or the default lighting as the baseline.
|
||||
//Otherwise, it hardsets a colour to begin with. I don't recommend you use this, simply because it's intended to be used
|
||||
//As a hacky quick-fix for models coloured by lights. Lightcoloured models don't blend nearly as nicely as ones coloured
|
||||
//By other means.
|
||||
if (baseColour < 0x100)
|
||||
{
|
||||
if (levelAmbient)
|
||||
sLightBase = &gLevelLight;
|
||||
else
|
||||
sLightBase = &sDefaultLights;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Checks if there's a hardset colour. Colours are only the first 3 bytes, so you can really put whatever you want in the last.
|
||||
// If there isn't a colour, then it decides whether to apply the ambient lighting, or the default lighting as the baseline.
|
||||
// Otherwise, it hardsets a colour to begin with. I don't recommend you use this, simply because it's intended to be used
|
||||
// As a hacky quick-fix for models coloured by lights. Lightcoloured models don't blend nearly as nicely as ones coloured
|
||||
// By other means.
|
||||
if (baseColour < 0x100) {
|
||||
sLightBase = (levelAmbient ? &gLevelLight : &sDefaultLights);
|
||||
} else {
|
||||
s32 colour;
|
||||
sLightBase = (levelAmbient) ? &gLevelLight : &sDefaultLights;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (i = 0; i < 3; i++) {
|
||||
colour = (((baseColour >> (24-(i*8)))) & 0xFF);
|
||||
sLightBase->l[0].l.col[i] = colour;
|
||||
sLightBase->l[0].l.colc[i] = colour;
|
||||
@@ -250,10 +236,8 @@ void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour
|
||||
}
|
||||
memcpy(segmented_to_virtual(src), &sLightBase[0], sizeof(Lights1));
|
||||
|
||||
for (i = 0; i < gNumLights; i++)
|
||||
{
|
||||
if (gPuppyLights[i]->rgba[3] > 0 && gPuppyLights[i]->active == TRUE && gPuppyLights[i]->area == gCurrAreaIndex && (gPuppyLights[i]->room == -1 || gPuppyLights[i]->room == gMarioCurrentRoom))
|
||||
{
|
||||
for (i = 0; i < gNumLights; i++) {
|
||||
if (gPuppyLights[i]->rgba[3] > 0 && gPuppyLights[i]->active == TRUE && gPuppyLights[i]->area == gCurrAreaIndex && (gPuppyLights[i]->room == -1 || gPuppyLights[i]->room == gMarioCurrentRoom)) {
|
||||
if (gPuppyLights[i]->flags & PUPPYLIGHT_DIRECTIONAL && !offsetPlaced) {
|
||||
lightFlags |= LIGHTFLAG_DIRECTIONAL_OFFSET;
|
||||
offsetPlaced = 1;
|
||||
@@ -266,35 +250,33 @@ void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour
|
||||
}
|
||||
}
|
||||
|
||||
//Sets and updates dynamic lights from objects.
|
||||
//0xFFFF is essentially the null ID. If the display flag is met, it will find and set an ID, otherwise it frees up the spot.
|
||||
void puppylights_object_emit(struct Object *obj)
|
||||
{
|
||||
// Sets and updates dynamic lights from objects.
|
||||
// 0xFFFF is essentially the null ID. If the display flag is met, it will find and set an ID, otherwise it frees up the spot.
|
||||
void puppylights_object_emit(struct Object *obj) {
|
||||
s32 i;
|
||||
if (gCurrLevelNum < LEVEL_BBH)
|
||||
if (gCurrLevelNum < LEVEL_BBH) {
|
||||
return;
|
||||
|
||||
if (obj->oFlags & OBJ_FLAG_EMIT_LIGHT)
|
||||
{
|
||||
}
|
||||
if (obj->oFlags & OBJ_FLAG_EMIT_LIGHT) {
|
||||
f64 dist = ((obj->oPosX - gMarioState->pos[0]) * (obj->oPosX - gMarioState->pos[0])) +
|
||||
((obj->oPosY - gMarioState->pos[1]) * (obj->oPosY - gMarioState->pos[1])) +
|
||||
((obj->oPosZ - gMarioState->pos[2]) * (obj->oPosZ - gMarioState->pos[2]));
|
||||
f64 lightSize = ((obj->puppylight.pos[1][0]) * (obj->puppylight.pos[1][0])) +
|
||||
((obj->puppylight.pos[1][1]) * (obj->puppylight.pos[1][1])) +
|
||||
((obj->puppylight.pos[1][2]) * (obj->puppylight.pos[1][2]));
|
||||
if (dist > lightSize)
|
||||
goto deallocate; //That's right. I used a goto. Eat your heart out xkcd.
|
||||
if (obj->oLightID == 0xFFFF)
|
||||
{
|
||||
if (dist > lightSize) {
|
||||
goto deallocate; // That's right. I used a goto. Eat your heart out xkcd.
|
||||
}
|
||||
if (obj->oLightID == 0xFFFF) {
|
||||
s32 fadingExists = FALSE;
|
||||
if (ABS(gNumLights - gDynLightStart) < MAX_LIGHTS_DYNAMIC)
|
||||
if (ABS(gNumLights - gDynLightStart) < MAX_LIGHTS_DYNAMIC) {
|
||||
goto deallocate;
|
||||
for (i = gDynLightStart; i < MIN(gDynLightStart+MAX_LIGHTS_DYNAMIC, MAX_LIGHTS); i++)
|
||||
{
|
||||
if (gPuppyLights[i]->active == TRUE)
|
||||
{
|
||||
if (gPuppyLights[i]->flags & PUPPYLIGHT_DELETE)
|
||||
}
|
||||
for (i = gDynLightStart; i < MIN(gDynLightStart+MAX_LIGHTS_DYNAMIC, MAX_LIGHTS); i++) {
|
||||
if (gPuppyLights[i]->active == TRUE) {
|
||||
if (gPuppyLights[i]->flags & PUPPYLIGHT_DELETE) {
|
||||
fadingExists = TRUE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
memcpy(gPuppyLights[i], &obj->puppylight, sizeof(struct PuppyLight));
|
||||
@@ -304,13 +286,12 @@ void puppylights_object_emit(struct Object *obj)
|
||||
obj->oLightID = i;
|
||||
goto updatepos;
|
||||
}
|
||||
//Go through all the lights again, now this time, ignore the fading light flag and overwrite them.
|
||||
if (fadingExists)
|
||||
{
|
||||
for (i = gDynLightStart; i < MIN(gDynLightStart+MAX_LIGHTS_DYNAMIC, MAX_LIGHTS); i++)
|
||||
{
|
||||
if (gPuppyLights[i]->active == TRUE && !(gPuppyLights[i]->flags & PUPPYLIGHT_DELETE))
|
||||
// Go through all the lights again, now this time, ignore the fading light flag and overwrite them.
|
||||
if (fadingExists) {
|
||||
for (i = gDynLightStart; i < MIN(gDynLightStart+MAX_LIGHTS_DYNAMIC, MAX_LIGHTS); i++) {
|
||||
if (gPuppyLights[i]->active == TRUE && !(gPuppyLights[i]->flags & PUPPYLIGHT_DELETE)) {
|
||||
continue;
|
||||
}
|
||||
memcpy(gPuppyLights[i], &obj->puppylight, sizeof(struct PuppyLight));
|
||||
gPuppyLights[i]->active = TRUE;
|
||||
gPuppyLights[i]->area = gCurrAreaIndex;
|
||||
@@ -320,20 +301,15 @@ void puppylights_object_emit(struct Object *obj)
|
||||
goto updatepos;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
updatepos:
|
||||
gPuppyLights[obj->oLightID]->pos[0][0] = obj->oPosX;
|
||||
gPuppyLights[obj->oLightID]->pos[0][1] = obj->oPosY;
|
||||
gPuppyLights[obj->oLightID]->pos[0][2] = obj->oPosZ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
deallocate:
|
||||
if (obj->oLightID != 0xFFFF)
|
||||
{
|
||||
if (obj->oLightID != 0xFFFF) {
|
||||
gPuppyLights[obj->oLightID]->active = FALSE;
|
||||
gPuppyLights[obj->oLightID]->flags = 0;
|
||||
}
|
||||
@@ -341,10 +317,9 @@ void puppylights_object_emit(struct Object *obj)
|
||||
}
|
||||
}
|
||||
|
||||
//A bit unorthodox, but anything to avoid having to set up data to pass through in the original function.
|
||||
//Objects will completely ignore X, Y, Z and active though.
|
||||
void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 room, s32 active)
|
||||
{
|
||||
// A bit unorthodox, but anything to avoid having to set up data to pass through in the original function.
|
||||
// Objects will completely ignore X, Y, Z and active though.
|
||||
void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 room, s32 active) {
|
||||
light->active = active;
|
||||
light->pos[0][0] = x;
|
||||
light->pos[0][1] = y;
|
||||
@@ -354,7 +329,7 @@ void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 off
|
||||
light->pos[1][2] = MAX(offsetZ, 10);
|
||||
light->rgba[0] = (colour >> 24) & 0xFF;
|
||||
light->rgba[1] = (colour >> 16) & 0xFF;
|
||||
light->rgba[2] = (colour >> 8) & 0xFF;
|
||||
light->rgba[2] = (colour >> 8) & 0xFF;
|
||||
light->rgba[3] = colour & 0xFF;
|
||||
light->yaw = yaw;
|
||||
light->area = gCurrAreaIndex;
|
||||
@@ -365,45 +340,38 @@ void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 off
|
||||
light->flags |= flags | PUPPYLIGHT_DYNAMIC;
|
||||
}
|
||||
|
||||
//You can run these in objects to enable or disable their light properties.
|
||||
void cur_obj_enable_light(void)
|
||||
{
|
||||
// You can run these in objects to enable or disable their light properties.
|
||||
void cur_obj_enable_light(void) {
|
||||
gCurrentObject->oFlags |= OBJ_FLAG_EMIT_LIGHT;
|
||||
}
|
||||
|
||||
void cur_obj_disable_light(void)
|
||||
{
|
||||
void cur_obj_disable_light(void) {
|
||||
gCurrentObject->oFlags &= ~OBJ_FLAG_EMIT_LIGHT;
|
||||
if (gPuppyLights[gCurrentObject->oLightID] && gCurrentObject->oLightID != 0xFFFF)
|
||||
gPuppyLights[gCurrentObject->oLightID]->flags |= PUPPYLIGHT_DELETE;
|
||||
}
|
||||
|
||||
void obj_enable_light(struct Object *obj)
|
||||
{
|
||||
void obj_enable_light(struct Object *obj) {
|
||||
obj->oFlags |= OBJ_FLAG_EMIT_LIGHT;
|
||||
}
|
||||
|
||||
void obj_disable_light(struct Object *obj)
|
||||
{
|
||||
void obj_disable_light(struct Object *obj) {
|
||||
obj->oFlags &= ~OBJ_FLAG_EMIT_LIGHT;
|
||||
if (gPuppyLights[obj->oLightID] && obj->oLightID != 0xFFFF)
|
||||
if (gPuppyLights[obj->oLightID] && obj->oLightID != 0xFFFF) {
|
||||
gPuppyLights[obj->oLightID]->flags |= PUPPYLIGHT_DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
//This is ran during a standard area update
|
||||
void delete_lights(void)
|
||||
{
|
||||
// This is ran during a standard area update
|
||||
void delete_lights(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gNumLights; i++)
|
||||
{
|
||||
if (gPuppyLights[i]->active == TRUE && gPuppyLights[i]->flags & PUPPYLIGHT_DELETE)
|
||||
{
|
||||
for (i = 0; i < gNumLights; i++) {
|
||||
if (gPuppyLights[i]->active == TRUE && gPuppyLights[i]->flags & PUPPYLIGHT_DELETE) {
|
||||
gPuppyLights[i]->pos[1][0] = approach_f32_asymptotic(gPuppyLights[i]->pos[1][0], 0, 0.15f);
|
||||
gPuppyLights[i]->pos[1][1] = approach_f32_asymptotic(gPuppyLights[i]->pos[1][1], 0, 0.15f);
|
||||
gPuppyLights[i]->pos[1][2] = approach_f32_asymptotic(gPuppyLights[i]->pos[1][2], 0, 0.15f);
|
||||
if (gPuppyLights[i]->pos[1][0] < 1.0f && gPuppyLights[i]->pos[1][1] < 1.0f && gPuppyLights[i]->pos[1][2] < 1.0f)
|
||||
{
|
||||
if (gPuppyLights[i]->pos[1][0] < 1.0f && gPuppyLights[i]->pos[1][1] < 1.0f && gPuppyLights[i]->pos[1][2] < 1.0f) {
|
||||
gPuppyLights[i]->flags &= ~ PUPPYLIGHT_DELETE;
|
||||
gPuppyLights[i]->active = FALSE;
|
||||
}
|
||||
|
||||
@@ -47,18 +47,18 @@ a modern game engine's developer's console.
|
||||
#include "debug_box.h"
|
||||
|
||||
ColorRGBA currEnv;
|
||||
u8 fDebug = 0;
|
||||
u8 fDebug = FALSE;
|
||||
|
||||
#if PUPPYPRINT_DEBUG
|
||||
s8 benchViewer = 0;
|
||||
s8 benchViewer = FALSE;
|
||||
u8 benchOption = 0;
|
||||
s8 logViewer = 0;
|
||||
s8 logViewer = FALSE;
|
||||
// Profiler values
|
||||
s8 perfIteration = 0;
|
||||
s8 perfIteration = 0;
|
||||
s16 benchmarkLoop = 0;
|
||||
s32 benchmarkTimer = 0;
|
||||
s32 benchmarkProgramTimer = 0;
|
||||
s8 benchmarkType = 0;
|
||||
s8 benchmarkType = 0;
|
||||
// General
|
||||
OSTime cpuTime = 0;
|
||||
OSTime rspTime = 0;
|
||||
@@ -67,34 +67,41 @@ OSTime ramTime = 0;
|
||||
OSTime loadTime = 0;
|
||||
OSTime gLastOSTime = 0;
|
||||
OSTime rspDelta = 0;
|
||||
s32 benchMark[NUM_BENCH_ITERATIONS+2];
|
||||
s32 benchMark[NUM_BENCH_ITERATIONS + 2];
|
||||
// CPU
|
||||
OSTime collisionTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime behaviourTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime scriptTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime graphTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime audioTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime dmaTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime dmaAudioTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime faultTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime taskTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime profilerTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime profilerTime2[NUM_PERF_ITERATIONS+1];
|
||||
OSTime collisionTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime behaviourTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime scriptTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime graphTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime audioTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime dmaTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime dmaAudioTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime faultTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime taskTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime profilerTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime profilerTime2[NUM_PERF_ITERATIONS + 1];
|
||||
// RSP
|
||||
OSTime audioTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime rspGenTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime audioTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime rspGenTime[NUM_PERF_ITERATIONS + 1];
|
||||
// RDP
|
||||
OSTime bufferTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime tmemTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime busTime[NUM_PERF_ITERATIONS+1];
|
||||
OSTime bufferTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime tmemTime[NUM_PERF_ITERATIONS + 1];
|
||||
OSTime busTime[NUM_PERF_ITERATIONS + 1];
|
||||
// RAM
|
||||
s8 ramViewer = 0;
|
||||
s32 ramsizeSegment[33] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
s8 ramViewer = FALSE;
|
||||
s32 ramsizeSegment[33] = { 0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0 };
|
||||
s32 audioPool[12];
|
||||
s32 mempool;
|
||||
// Collision
|
||||
u8 collisionViewer = 0;
|
||||
s32 numSurfaces = 0;
|
||||
|
||||
extern u8 _mainSegmentStart[];
|
||||
extern u8 _mainSegmentEnd[];
|
||||
@@ -107,7 +114,7 @@ extern u8 _buffersSegmentBssEnd[];
|
||||
extern u8 _goddardSegmentStart[];
|
||||
extern u8 _goddardSegmentEnd[];
|
||||
|
||||
//Here is stored the rom addresses of the global code segments. If you get rid of any, it's best to just write them as NULL.
|
||||
// Here is stored the rom addresses of the global code segments. If you get rid of any, it's best to just write them as NULL.
|
||||
s32 ramP[5][2] = {
|
||||
{(u32)&_buffersSegmentBssStart, (u32)&_buffersSegmentBssEnd},
|
||||
{(u32)&_mainSegmentStart, (u32)&_mainSegmentEnd},
|
||||
@@ -143,7 +150,7 @@ void puppyprint_profiler_finished(void) {
|
||||
benchMark[NUM_BENCH_ITERATIONS] = 0;
|
||||
benchMark[NUM_BENCH_ITERATIONS+1] = 0;
|
||||
benchmarkTimer = 300;
|
||||
benchViewer = 0;
|
||||
benchViewer = FALSE;
|
||||
for (i = 0; i < NUM_BENCH_ITERATIONS - 2; i++) {
|
||||
benchMark[NUM_BENCH_ITERATIONS] += benchMark[i];
|
||||
if (benchMark[i] > benchMark[NUM_BENCH_ITERATIONS + 1]) {
|
||||
@@ -521,17 +528,17 @@ void puppyprint_profiler_process(void) {
|
||||
}
|
||||
if (fDebug) {
|
||||
if (gPlayer1Controller->buttonPressed & D_JPAD) {
|
||||
benchViewer ^= 1;
|
||||
ramViewer = 0;
|
||||
logViewer = 0;
|
||||
benchViewer ^= TRUE;
|
||||
ramViewer = FALSE;
|
||||
logViewer = FALSE;
|
||||
} else if (gPlayer1Controller->buttonPressed & U_JPAD) {
|
||||
ramViewer ^= 1;
|
||||
benchViewer = 0;
|
||||
logViewer = 0;
|
||||
ramViewer ^= TRUE;
|
||||
benchViewer = FALSE;
|
||||
logViewer = FALSE;
|
||||
} else if (gPlayer1Controller->buttonPressed & L_JPAD) {
|
||||
logViewer ^= 1;
|
||||
ramViewer = 0;
|
||||
benchViewer = 0;
|
||||
logViewer ^= TRUE;
|
||||
ramViewer = FALSE;
|
||||
benchViewer = FALSE;
|
||||
}
|
||||
#ifdef VISUAL_DEBUG
|
||||
else if (!benchViewer && !ramViewer && !logViewer) {
|
||||
@@ -551,9 +558,9 @@ void puppyprint_profiler_process(void) {
|
||||
benchmark_custom();
|
||||
}
|
||||
if (gPlayer1Controller->buttonDown & U_JPAD && gPlayer1Controller->buttonPressed & L_TRIG) {
|
||||
ramViewer = 0;
|
||||
benchViewer = 0;
|
||||
fDebug ^= 1;
|
||||
ramViewer = FALSE;
|
||||
benchViewer = FALSE;
|
||||
fDebug ^= TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,25 +35,25 @@ extern OSTime rdpTime;
|
||||
extern OSTime ramTime;
|
||||
extern OSTime loadTime;
|
||||
extern OSTime rspDelta;
|
||||
extern s32 benchMark[NUM_BENCH_ITERATIONS+2];
|
||||
extern s32 benchMark[NUM_BENCH_ITERATIONS + 2];
|
||||
|
||||
//CPU
|
||||
extern OSTime collisionTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime behaviourTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime scriptTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime graphTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime audioTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime dmaTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime dmaAudioTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime faultTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime taskTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime profilerTime[NUM_PERF_ITERATIONS+1];
|
||||
//RSP
|
||||
extern OSTime rspGenTime[NUM_PERF_ITERATIONS+1];
|
||||
//RDP
|
||||
extern OSTime bufferTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime tmemTime[NUM_PERF_ITERATIONS+1];
|
||||
extern OSTime busTime[NUM_PERF_ITERATIONS+1];
|
||||
// CPU
|
||||
extern OSTime collisionTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime behaviourTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime scriptTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime graphTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime audioTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime dmaTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime dmaAudioTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime faultTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime taskTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime profilerTime[NUM_PERF_ITERATIONS + 1];
|
||||
// RSP
|
||||
extern OSTime rspGenTime[NUM_PERF_ITERATIONS + 1];
|
||||
// RDP
|
||||
extern OSTime bufferTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime tmemTime[NUM_PERF_ITERATIONS + 1];
|
||||
extern OSTime busTime[NUM_PERF_ITERATIONS + 1];
|
||||
|
||||
extern void profiler_update(OSTime *time, OSTime time2);
|
||||
extern void puppyprint_profiler_process(void);
|
||||
@@ -65,8 +65,8 @@ extern void finish_blank_box(void);
|
||||
extern void render_blank_box(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b, u8 a);
|
||||
extern void print_small_text(s32 x, s32 y, const char *str, s32 align, s32 amount);
|
||||
extern void render_multi_image(Texture *image, s32 x, s32 y, s32 width, s32 height, s32 scaleX, s32 scaleY, s32 mode);
|
||||
extern s32 get_text_height(const char *str);
|
||||
extern s32 get_text_width(const char *str);
|
||||
extern s32 get_text_height(const char *str);
|
||||
extern s32 get_text_width(const char *str);
|
||||
extern void prepare_blank_box(void);
|
||||
extern void finish_blank_box(void);
|
||||
extern void render_blank_box(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b, u8 a);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user