Skip to content

Commit

Permalink
swars: Made proper mapping for few old map fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mefistotelis committed Jan 18, 2024
1 parent 88a140e commit d78e3d4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions src/enginsngobjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,35 @@
void refresh_old_object_face_format(struct SingleObjectFace3 *p_objface,
struct SingleObjectFace3OldV7 *p_oldobjface, ulong fmtver)
{
int i;

//TODO make sane matching for old fields
LbMemoryCopy(p_objface, p_oldobjface, 32);

for (i = 0; i < 3; i++)
p_objface->PointNo[i] = p_oldobjface->PointNo[i];
p_objface->Texture = p_oldobjface->Texture;
p_objface->Object = p_oldobjface->Object;
p_objface->FaceNormal = p_oldobjface->FaceNormal;
p_objface->WalkHeader = p_oldobjface->WalkHeader;
}

/** Maps fields from old SingleObjectFace4 struct to the current one.
*/
void refresh_old_object_face4_format(struct SingleObjectFace4 *p_objface4,
struct SingleObjectFace4OldV7 *p_oldobjface4, ulong fmtver)
{
int i;

//TODO make sane matching for old fields
LbMemoryCopy(p_objface4, p_oldobjface4, 40);

for (i = 0; i < 4; i++)
p_objface4->PointNo[i] = p_oldobjface4->PointNo[i];
p_objface4->Texture = p_oldobjface4->Texture;
p_objface4->Object = p_oldobjface4->Object;
p_objface4->FaceNormal = p_oldobjface4->FaceNormal;
p_objface4->WalkHeader = p_oldobjface4->WalkHeader;
}

/******************************************************************************/
10 changes: 5 additions & 5 deletions src/enginsngobjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ struct SingleObjectFace3OldV7 { // sizeof=48
ushort Light0;
ushort Light1;
ushort Light2;
ushort FaceNormal;
ushort FaceNormalDoubt;
ubyte field_1C[3];
ubyte field_1F;
ubyte field_20[6];
ushort FaceNormal2;
ushort WalkHeader; /**< offs=0x34 Index of the WalkHeader created for this face. */
ushort FaceNormal; /**< offs=0x26 Index of the Normal vector created for this face. */
ushort WalkHeader; /**< offs=0x28 Index of the WalkHeader created for this face. */
ubyte field_2A[6];
};

Expand Down Expand Up @@ -104,11 +104,11 @@ struct SingleObjectFace4OldV7 { // sizeof=60
short Light1;
short Light2;
short Light3;
ushort FaceNormal;
ushort FaceNormalDoubt;
ubyte field_22[5];
ubyte field_27;
ubyte field_28[10];
ushort FaceNormal2;
ushort FaceNormal; /**< offs=0x32 Index of the Normal vector created for this face. */
ushort WalkHeader; /**< offs=0x34 Index of the WalkHeader created for this face. */
ubyte field_36[4];
ushort field_3A;
Expand Down

0 comments on commit d78e3d4

Please sign in to comment.