sm64coopdx/src/engine/surface_load.h
Isaac0-dev eaeaeb0f7f
add a way for mods to get dynamic surfaces that belong to specific objects (#59)
Adding this for collision minimap, but I'm sure it'd be useful for many other mods that deal with collision in this kind of way

exposes a function, obj_get_surface_from_index. pass in an object, and the index of the surface you want. numSurfaces is also added to know when to stop iterating through surfaces

Thanks to peachy for coming up with the better method of doing this

Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
2024-06-06 17:24:28 +10:00

39 lines
944 B
C

#ifndef SURFACE_LOAD_H
#define SURFACE_LOAD_H
#include <PR/ultratypes.h>
#include "surface_collision.h"
#include "types.h"
#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE)
#define NUM_CELLS_INDEX (NUM_CELLS - 1)
struct SurfaceNode
{
struct SurfaceNode *next;
struct Surface *surface;
};
enum
{
SPATIAL_PARTITION_FLOORS,
SPATIAL_PARTITION_CEILS,
SPATIAL_PARTITION_WALLS
};
typedef struct SurfaceNode SpatialPartitionCell[3];
extern SpatialPartitionCell gStaticSurfacePartition[NUM_CELLS][NUM_CELLS];
extern SpatialPartitionCell gDynamicSurfacePartition[NUM_CELLS][NUM_CELLS];
void alloc_surface_pools(void);
u32 get_area_terrain_size(s16 *data);
void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);
void clear_dynamic_surfaces(void);
void load_object_collision_model(void);
struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);
#endif // SURFACE_LOAD_H