diff --git a/memory.c b/memory.c index 2e1ac8c..6c9f02b 100644 --- a/memory.c +++ b/memory.c @@ -15,14 +15,14 @@ void mem_scratch_reset() scratch = scratch_start; } -char *mem_scratch(unsigned short size) +void *mem_scratch(unsigned short size) { #if _DEBUG if (scratch + size > scratch_start + 1024) return NULL; #endif - char *result = scratch; + void *result = scratch; scratch += size; return result; } diff --git a/memory.h b/memory.h index 8afcddc..2dd498f 100644 --- a/memory.h +++ b/memory.h @@ -7,7 +7,7 @@ * @param size The number of bytes to allocate. Be aware that the scratchpad memory only has 1024 bytes available. * @return Pointer to the allocated buffer in scratchpad memory. */ -char *mem_scratch(unsigned short size); +void *mem_scratch(unsigned short size); void mem_scratch_reset(); diff --git a/world.c b/world.c index 66916a9..c7c5568 100644 --- a/world.c +++ b/world.c @@ -40,13 +40,15 @@ void world_load(const u_long *data, world_t *world) void world_draw(const world_t *world) { - SVECTOR vecs[3]; int p; // The world doesn't move, so we just set the camera view-projection matrix gte_SetRotMatrix(&vp_matrix); gte_SetTransMatrix(&vp_matrix); + mem_scratch_reset(); + SVECTOR *vecs = mem_scratch(sizeof(SVECTOR) * 3); + for (int faceIdx = 0; faceIdx < world->header->numFaces; ++faceIdx) { const ps1bsp_face_t *face = &world->faces[faceIdx];