From f6da144c6a4b81dd52bf5cc9181a4563ad6194e3 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 18 Jan 2023 13:47:49 +0100 Subject: [PATCH] Padded some structs to make them 32-bit aligned --- main.cpp | 6 +++--- ps1bsp.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index 4f7db64..096dfbe 100644 --- a/main.cpp +++ b/main.cpp @@ -368,7 +368,7 @@ int process_faces(const world_t* world) //if (face->ledge_num >= 10) // export_lightmap(world, face, bounds, faceIdx); - outFace.numFaceVertices = (unsigned char)(outFaceVertices.size() - outFace.firstFaceVertex); + outFace.numFaceVertices = (unsigned short)(outFaceVertices.size() - outFace.firstFaceVertex); outFaces.push_back(outFace); } @@ -390,9 +390,9 @@ int process_faces(const world_t* world) { plane_t* plane = &world->planes[planeIdx]; - ps1bsp_plane_t outPlane; + ps1bsp_plane_t outPlane = { 0 }; outPlane.normal = convertNormal(plane->normal); - outPlane.dist = (short)(plane->dist * 4); + outPlane.dist = (int)(plane->dist * 4); outPlanes.push_back(outPlane); } diff --git a/ps1bsp.h b/ps1bsp.h index 7629566..1fbf7e3 100644 --- a/ps1bsp.h +++ b/ps1bsp.h @@ -66,13 +66,13 @@ typedef struct typedef struct { unsigned short index; - unsigned char light; + unsigned short light; } ps1bsp_facevertex_t; typedef struct { unsigned short firstFaceVertex; - unsigned char numFaceVertices; + unsigned short numFaceVertices; u_long drawFrame; // Which frame was this face last drawn on? Used to check if this face should be drawn. } ps1bsp_face_t; @@ -80,7 +80,7 @@ typedef struct typedef struct { SVECTOR normal; - short dist; + int dist; } ps1bsp_plane_t; typedef struct