Merge branch 'master' into puppycamera2

This commit is contained in:
Fazana committed 2021-08-15 11:55:57 +01:00
commit 280baf58ad
19 files changed
+1336 -14

No files matched your search

+1
View File
@@ -31,6 +31,7 @@ extern f32 gCosineTable[];
#define min(a, b) ((a) <= (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define sqr(x) ((x) * (x))
+49
View File
@@ -7,6 +7,7 @@
#include "game/object_list_processor.h"
#include "surface_collision.h"
#include "surface_load.h"
#include "game/puppyprint.h"
/**************************************************
* WALLS *
@@ -187,6 +188,9 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
s32 numCollisions = 0;
s16 x = colData->x;
s16 z = colData->z;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
colData->numWalls = 0;
@@ -213,6 +217,10 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
// Increment the debug tracker.
gNumCalls.wall += 1;
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return numCollisions;
}
@@ -299,6 +307,9 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
f32 height = CELL_HEIGHT_LIMIT;
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
s16 x, y, z;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
//! (Parallel Universes) Because position is casted to an s16, reaching higher
// float locations can return ceilings despite them not existing there.
@@ -337,6 +348,10 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
// Increment the debug tracker.
gNumCalls.ceil += 1;
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
}
@@ -562,6 +577,9 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
*/
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
s16 cellZ, cellX;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
struct Surface *floor, *dynamicFloor;
struct SurfaceNode *surfaceList;
@@ -579,9 +597,15 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
*pfloor = NULL;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
}
if (z <= -LEVEL_BOUNDARY_MAX || z >= LEVEL_BOUNDARY_MAX) {
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
}
@@ -628,6 +652,10 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
// Increment the debug tracker.
gNumCalls.floor += 1;
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return height;
}
@@ -685,6 +713,9 @@ f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor = NULL;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
@@ -715,6 +746,10 @@ f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
*pfloor = floor;
}
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return waterLevel;
}
@@ -729,6 +764,9 @@ f32 find_water_level(f32 x, f32 z) {
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
@@ -757,6 +795,10 @@ f32 find_water_level(f32 x, f32 z) {
}
}
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return waterLevel;
}
@@ -771,6 +813,9 @@ f32 find_poison_gas_level(f32 x, f32 z) {
f32 loX, hiX, loZ, hiZ;
f32 gasLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
if (p != NULL) {
numRegions = *p++;
@@ -797,6 +842,10 @@ f32 find_poison_gas_level(f32 x, f32 z) {
}
}
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
return gasLevel;
}
+13
View File
@@ -14,6 +14,7 @@
#include "game/mario.h"
#include "game/object_list_processor.h"
#include "surface_load.h"
#include "game/puppyprint.h"
#include "config.h"
@@ -617,6 +618,9 @@ void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects
s16 terrainLoadType;
s16 *vertexData = NULL;
UNUSED s32 unused;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
// Initialize the data for this.
gEnvironmentRegions = NULL;
@@ -665,6 +669,9 @@ void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects
gNumStaticSurfaceNodes = gSurfaceNodesAllocated;
gNumStaticSurfaces = gSurfacesAllocated;
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
}
/**
@@ -796,6 +803,9 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
void load_object_collision_model(void) {
UNUSED s32 unused;
s16 vertexData[600];
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
s16 *collisionData = gCurrentObject->collisionData;
f32 marioDist = gCurrentObject->oDistanceToMario;
@@ -830,4 +840,7 @@ void load_object_collision_model(void) {
} else {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
}
#ifdef PUPPYPRINT
collisionTime[perfIteration] += osGetTime()-first;
#endif
}