Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/engine/surface_collision.h
7857 views
1
#ifndef SURFACE_COLLISION_H
2
#define SURFACE_COLLISION_H
3
4
#include <PR/ultratypes.h>
5
6
#include "types.h"
7
8
// Range level area is 16384x16384 (-8192 to +8192 in x and z)
9
#define LEVEL_BOUNDARY_MAX 0x2000 // 8192
10
11
#define CELL_SIZE (1 << 10) // 0x400
12
13
#define CELL_HEIGHT_LIMIT 20000
14
#define FLOOR_LOWER_LIMIT -11000
15
#define FLOOR_LOWER_LIMIT_MISC (FLOOR_LOWER_LIMIT + 1000)
16
// same as FLOOR_LOWER_LIMIT_MISC, explicitly for shadow.c
17
// It doesn't match if ".0" is removed or ".f" is added
18
#define FLOOR_LOWER_LIMIT_SHADOW (FLOOR_LOWER_LIMIT + 1000.0)
19
20
struct WallCollisionData
21
{
22
/*0x00*/ f32 x, y, z;
23
/*0x0C*/ f32 offsetY;
24
/*0x10*/ f32 radius;
25
/*0x14*/ s16 unused;
26
/*0x16*/ s16 numWalls;
27
/*0x18*/ struct Surface *walls[4];
28
};
29
30
struct FloorGeometry
31
{
32
f32 unused[4]; // possibly position data?
33
f32 normalX;
34
f32 normalY;
35
f32 normalZ;
36
f32 originOffset;
37
};
38
39
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius);
40
s32 find_wall_collisions(struct WallCollisionData *colData);
41
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
42
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);
43
f32 find_floor_height(f32 x, f32 y, f32 z);
44
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
45
f32 find_water_level(f32 x, f32 z);
46
f32 find_poison_gas_level(f32 x, f32 z);
47
void debug_surface_list_info(f32 xPos, f32 zPos);
48
49
#endif // SURFACE_COLLISION_H
50
51