From aeee80c8fa4d3e7e04f8da6579bfa50cc69392f9 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 26 Dec 2016 15:59:44 +0200 Subject: [PATCH 1/2] Fixed endianness issue in script VM See https://forum.zdoom.org/viewtopic.php?t=54549 --- src/scripting/vm/vm.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 1869c410b..fdf5f3c9f 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -21,27 +21,35 @@ typedef VM_UBYTE VM_ATAG; #define VM_EPSILON (1/65536.0) +#ifdef __BIG_ENDIAN__ +#define VM_DEFINE_OP2(TYPE, ARG1, ARG2) TYPE ARG2, ARG1 +#define VM_DEFINE_OP4(TYPE, ARG1, ARG2, ARG3, ARG4) TYPE ARG4, ARG3, ARG2, ARG1 +#else // little endian +#define VM_DEFINE_OP2(TYPE, ARG1, ARG2) TYPE ARG1, ARG2 +#define VM_DEFINE_OP4(TYPE, ARG1, ARG2, ARG3, ARG4) TYPE ARG1, ARG2, ARG3, ARG4 +#endif // __BIG_ENDIAN__ + union VMOP { struct { - VM_UBYTE op, a, b, c; + VM_DEFINE_OP4(VM_UBYTE, op, a, b, c); }; struct { - VM_SBYTE pad0, as, bs, cs; + VM_DEFINE_OP4(VM_SBYTE, pad0, as, bs, cs); }; struct { - VM_SWORD pad1:8, i24:24; + VM_DEFINE_OP2(VM_SWORD, pad1:8, i24:24); }; struct { - VM_SWORD pad2:16, i16:16; + VM_DEFINE_OP2(VM_SWORD, pad2:16, i16:16); }; struct { - VM_UHALF pad3, i16u; + VM_DEFINE_OP2(VM_UHALF, pad3, i16u); }; VM_UWORD word; @@ -56,6 +64,9 @@ union VMOP // sar eax,10h }; +#undef VM_DEFINE_OP4 +#undef VM_DEFINE_OP2 + enum { #include "vmops.h" From 625e97dfd1708ccb3a02db74b8f0150c0f2a7b23 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 26 Dec 2016 16:21:44 +0100 Subject: [PATCH 2/2] - fixed: UpdateRenderSectorList needs to reset the sector before traversing floor portals. --- src/p_map.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_map.cpp b/src/p_map.cpp index 20796ed23..85c3e3da8 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -6755,6 +6755,7 @@ void AActor::UpdateRenderSectorList() sec = P_PointInSector(newpos); render_sectorlist = P_AddSecnode(sec, this, render_sectorlist, sec->render_thinglist); } + sec = Sector; lasth = FLT_MAX; while (!sec->PortalBlocksMovement(sector_t::floor)) {