mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Sanity check collisions, and increase efficiency of growingpool
This commit is contained in:
parent
aeb8817f0d
commit
3456e10216
2 changed files with 17 additions and 7 deletions
|
|
@ -764,6 +764,10 @@ void load_object_collision_model(void) {
|
||||||
LOG_ERROR("Object collisions had invalid vertex count");
|
LOG_ERROR("Object collisions had invalid vertex count");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (numVertices >= 4096) {
|
||||||
|
LOG_ERROR("Object collisions had too many vertices");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static s32 sVertexDataCount = 0;
|
static s32 sVertexDataCount = 0;
|
||||||
static s16* sVertexData = NULL;
|
static s16* sVertexData = NULL;
|
||||||
|
|
|
||||||
|
|
@ -135,13 +135,19 @@ void* growing_pool_alloc(struct GrowingPool *pool, u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// search for space in nodes
|
// search for space in nodes
|
||||||
struct GrowingPoolNode* node = pool->tail;
|
struct GrowingPoolNode* node = NULL;
|
||||||
u32 depth = 0;
|
if (size < pool->nodeSize) {
|
||||||
while (node) {
|
node = pool->tail;
|
||||||
depth++;
|
u32 depth = 0;
|
||||||
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
while (node && depth < 128) {
|
||||||
if (freeSpace > size) { break; }
|
depth++;
|
||||||
node = node->prev;
|
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
||||||
|
if (freeSpace > size) { break; }
|
||||||
|
node = node->prev;
|
||||||
|
}
|
||||||
|
if (depth >= 128) {
|
||||||
|
node = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate new node
|
// allocate new node
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue