From 2dff0e7309904b5b4eebf38e370a22b8380797d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 4 May 2017 23:52:16 +0200 Subject: [PATCH] - fixed: P_TranslateLinedef should not do any byte swapping but require passing of properly ordered values. This gets called from several places, and the only one passing in potentially byte swapped values is P_LoadLineDefs. All other uses of this function were essentially broken on PowerPC. --- src/doomdata.h | 2 +- src/p_setup.cpp | 3 +++ src/p_xlat.cpp | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/doomdata.h b/src/doomdata.h index e6cb728ec..5f681fa76 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -106,7 +106,7 @@ struct maplinedef_t uint16_t v1; uint16_t v2; uint16_t flags; - int16_t special; + uint16_t special; int16_t tag; uint16_t sidenum[2]; // sidenum[1] will be -1 if one sided diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d19e65295..f89ad6704 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2173,6 +2173,9 @@ void P_LoadLineDefs (MapData * map) // [RH] Translate old linedef special and flags to be // compatible with the new format. + mld->special = LittleShort(mld->special); + mld->tag = LittleShort(mld->tag); + mld->flags = LittleShort(mld->flags); P_TranslateLineDef (ld, mld, -1); // do not assign the tag for Extradata lines. if (ld->special != Static_Init || (ld->args[1] != Init_EDLine && ld->args[1] != Init_EDSector)) diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index 9ec582a92..4f3b45611 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -64,9 +64,9 @@ typedef enum void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid) { - unsigned short special = (unsigned short) LittleShort(mld->special); - short tag = LittleShort(mld->tag); - uint32_t flags = LittleShort(mld->flags); + uint32_t special = mld->special; + short tag = mld->tag; + uint32_t flags =mld->flags; INTBOOL passthrough = 0; uint32_t flags1 = flags;