From 98124c804964b8d2202d620f83aded208bd79307 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 Jul 2017 09:01:02 +0200 Subject: [PATCH 1/3] - avoid using plain chars as variables. This is all I found with a quick search, there's probably more... --- src/gl/textures/gl_material.h | 2 +- src/m_misc.cpp | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/gl/textures/gl_material.h b/src/gl/textures/gl_material.h index f93e784f4..fc10f3a49 100644 --- a/src/gl/textures/gl_material.h +++ b/src/gl/textures/gl_material.h @@ -57,7 +57,7 @@ class FGLTexture public: FTexture * tex; FTexture * hirestexture; - char bIsTransparent; + int8_t bIsTransparent; int HiresLump; private: diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 8673102a2..bda8dcb80 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -432,27 +432,27 @@ void M_LoadDefaults () struct pcx_t { - char manufacturer; - char version; - char encoding; - char bits_per_pixel; + int8_t manufacturer; + int8_t version; + int8_t encoding; + int8_t bits_per_pixel; - unsigned short xmin; - unsigned short ymin; - unsigned short xmax; - unsigned short ymax; + uint16_t xmin; + uint16_t ymin; + uint16_t xmax; + uint16_t ymax; - unsigned short hdpi; - unsigned short vdpi; + uint16_t hdpi; + uint16_t vdpi; - unsigned char palette[48]; + uint8_t palette[48]; - char reserved; - char color_planes; - unsigned short bytes_per_line; - unsigned short palette_type; + int8_t reserved; + int8_t color_planes; + uint16_t bytes_per_line; + uint16_t palette_type; - char filler[58]; + int8_t filler[58]; }; From daca12600da91665f77b27f3a542a619a161dfe5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 Jul 2017 09:14:39 +0200 Subject: [PATCH 2/3] - fixed: The ADDA_RK opcode used the wrong constant type for the offset it adds to the pointer. --- src/scripting/vm/vmops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/vm/vmops.h b/src/scripting/vm/vmops.h index fb0a9e50e..97102f5de 100644 --- a/src/scripting/vm/vmops.h +++ b/src/scripting/vm/vmops.h @@ -250,7 +250,7 @@ xx(EQV3_K, beqv3, CVRK, NOP, 0, 0), // this will never be used. // Pointer math. xx(ADDA_RR, add, RPRPRI, NOP, 0, 0), // pA = pB + dkC -xx(ADDA_RK, add, RPRPKI, ADDA_RR,4, REGT_POINTER), +xx(ADDA_RK, add, RPRPKI, ADDA_RR,4, REGT_INT), xx(SUBA, sub, RIRPRP, NOP, 0, 0), // dA = pB - pC xx(EQA_R, beq, CPRR, NOP, 0, 0), // if ((pB == pkC) != A) then pc++ xx(EQA_K, beq, CPRK, EQA_R, 4, REGT_POINTER), From ac30e47ab4a4c21f2c480a4d6340ab81116d5dfd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 Jul 2017 09:34:07 +0200 Subject: [PATCH 3/3] - Added an 'srand' call to the RBG initialization. This is needed because 'rand' gets used by parts of the sound code (e.g. playlists.) --- src/d_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_main.cpp b/src/d_main.cpp index fbc47da4c..a918ddbb5 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2055,6 +2055,7 @@ static void D_DoomInit() rngseed = I_MakeRNGSeed(); use_staticrng = false; } + srand(rngseed); FRandom::StaticClearRandom ();