|
|
@ -25,17 +25,16 @@ void world_load(const u_long *data, world_t *world) |
|
|
{ |
|
|
{ |
|
|
const char *bytes = (const char*)data; |
|
|
const char *bytes = (const char*)data; |
|
|
|
|
|
|
|
|
world->header = (ps1bsp_header_t*)bytes; |
|
|
|
|
|
bytes += sizeof(ps1bsp_header_t); |
|
|
|
|
|
|
|
|
ps1bsp_header_t* header = (ps1bsp_header_t*)bytes; |
|
|
|
|
|
|
|
|
world->vertices = (ps1bsp_vertex_t*)bytes; |
|
|
|
|
|
bytes += sizeof(ps1bsp_vertex_t) * world->header->numVertices; |
|
|
|
|
|
|
|
|
world->vertices = (ps1bsp_vertex_t*)(bytes + header->vertices.offset); |
|
|
|
|
|
world->numVertices = header->vertices.size / sizeof(ps1bsp_vertex_t); |
|
|
|
|
|
|
|
|
world->faceVertices = (ps1bsp_facevertex_t*)bytes; |
|
|
|
|
|
bytes += sizeof(ps1bsp_facevertex_t) * world->header->numFaceVertices; |
|
|
|
|
|
|
|
|
world->faces = (ps1bsp_face_t*)(bytes + header->faces.offset); |
|
|
|
|
|
world->numFaces = header->faces.size / sizeof(ps1bsp_face_t); |
|
|
|
|
|
|
|
|
world->faces = (ps1bsp_face_t*)bytes; |
|
|
|
|
|
bytes += sizeof(ps1bsp_face_t) * world->header->numFaces; |
|
|
|
|
|
|
|
|
world->faceVertices = (ps1bsp_facevertex_t*)(bytes + header->faceVertices.offset); |
|
|
|
|
|
world->numFaceVertices = header->faceVertices.size / sizeof(ps1bsp_facevertex_t); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static INLINE void drawface_triangle_fan(const ps1bsp_face_t *face, SVECTOR *vecs) |
|
|
static INLINE void drawface_triangle_fan(const ps1bsp_face_t *face, SVECTOR *vecs) |
|
|
@ -185,7 +184,7 @@ static INLINE void drawface_quad_strip(const ps1bsp_face_t *face, SVECTOR *vecs) |
|
|
if (depth <= 0 || depth >= OTLEN) |
|
|
if (depth <= 0 || depth >= OTLEN) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
// Draw a flat-shaded untextured colored triangle |
|
|
|
|
|
|
|
|
// Draw a flat-shaded untextured colored quad |
|
|
POLY_G4 *poly = (POLY_G4*)mem_prim(sizeof(POLY_G4)); |
|
|
POLY_G4 *poly = (POLY_G4*)mem_prim(sizeof(POLY_G4)); |
|
|
if (poly == NULL) |
|
|
if (poly == NULL) |
|
|
break; |
|
|
break; |
|
|
@ -218,7 +217,7 @@ void world_draw(const world_t *world) |
|
|
gte_SetRotMatrix(&vp_matrix); |
|
|
gte_SetRotMatrix(&vp_matrix); |
|
|
gte_SetTransMatrix(&vp_matrix); |
|
|
gte_SetTransMatrix(&vp_matrix); |
|
|
|
|
|
|
|
|
for (int faceIdx = 0; faceIdx < world->header->numFaces; ++faceIdx) |
|
|
|
|
|
|
|
|
for (int faceIdx = 0; faceIdx < world->numFaces; ++faceIdx) |
|
|
{ |
|
|
{ |
|
|
const ps1bsp_face_t *face = &world->faces[faceIdx]; |
|
|
const ps1bsp_face_t *face = &world->faces[faceIdx]; |
|
|
const CVECTOR *col = &colors[faceIdx % numColors]; |
|
|
const CVECTOR *col = &colors[faceIdx % numColors]; |
|
|
|