From 77bfffaee0c1d9255a40cfe0394eb7e5d7538b26 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 12:46:48 +0200 Subject: [PATCH 1/6] - removed a few __cdecl's from the source. --- src/win32/i_crash.cpp | 2 +- tools/zipdir/zipdir.c | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index 802a4d9e8e..4603fb4f98 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -542,7 +542,7 @@ static DWORD WINAPI WriteMiniDumpInAnotherThread (LPVOID lpParam) // //========================================================================== -void __cdecl Writef (HANDLE file, const char *format, ...) +void Writef (HANDLE file, const char *format, ...) { char buffer[1024]; va_list args; diff --git a/tools/zipdir/zipdir.c b/tools/zipdir/zipdir.c index e21b9ba13b..cee41b12ed 100644 --- a/tools/zipdir/zipdir.c +++ b/tools/zipdir/zipdir.c @@ -56,10 +56,6 @@ // MACROS ------------------------------------------------------------------ -#ifndef _WIN32 -#define __cdecl -#endif - #ifdef __GNUC__ // With versions of GCC newer than 4.2, it appears it was determined that the // cost of an unaligned pointer on PPC was high enough to add padding to the @@ -212,7 +208,7 @@ dir_tree_t *add_dir(const char *dirpath); #endif dir_tree_t *add_dirs(char **argv); int count_files(dir_tree_t *trees); -int __cdecl sort_cmp(const void *a, const void *b); +int sort_cmp(const void *a, const void *b); file_sorted_t *sort_files(dir_tree_t *trees, int num_files); void write_zip(const char *zipname, dir_tree_t *trees, int update); int append_to_zip(FILE *zip_file, file_sorted_t *file, FILE *ozip, BYTE *odir); @@ -694,7 +690,7 @@ int count_files(dir_tree_t *trees) // //========================================================================== -int __cdecl sort_cmp(const void *a, const void *b) +int sort_cmp(const void *a, const void *b) { const file_sorted_t *sort1 = (const file_sorted_t *)a; const file_sorted_t *sort2 = (const file_sorted_t *)b; @@ -1569,7 +1565,7 @@ int copy_zip_file(FILE *zip, file_entry_t *file, FILE *ozip, CentralDirectoryEnt // //========================================================================== -int __cdecl main (int argc, char **argv) +int main (int argc, char **argv) { dir_tree_t *tree, *trees; file_entry_t *file; From 99ca6499308a8df3c629c2f31cadb233b40b60f4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 20:42:43 +0200 Subject: [PATCH 2/6] - fixed NULL pointer access in SetAmmoCapacity. --- src/p_acs.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 00b3229b22..c880d87bf6 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8637,8 +8637,11 @@ scriptwait: else { item = activator->GiveInventoryType (static_cast(type)); - item->MaxAmount = STACK(1); - item->Amount = 0; + if (item != NULL) + { + item->MaxAmount = STACK(1); + item->Amount = 0; + } } } } From e72bfa8addf343dbd949d41e889af577449e2da5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 21:02:44 +0200 Subject: [PATCH 3/6] - fixed: For finding the listener's sector the sound code used the wrong coordinate. --- src/s_sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d1fee071e5..ac4dbc78fd 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -773,7 +773,7 @@ static void CalcSectorSoundOrg(const DVector3 &listenpos, const sector_t *sec, i if (!(i_compatflags & COMPATF_SECTORSOUNDS)) { // Are we inside the sector? If yes, the closest point is the one we're on. - if (P_PointInSector(pos.X, pos.Y) == sec) + if (P_PointInSector(listenpos.X, listenpos.Y) == sec) { pos.X = (float)listenpos.X; pos.Z = (float)listenpos.Y; From ae6df617ba9cc8901c3efe76b0486f9f9276fc37 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 22:10:46 +0200 Subject: [PATCH 4/6] - fixed: The FPathTraverse call in P_UsePuzzleItem was missing the PT_DELTA flag. --- src/p_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 5d01f7af2e..76d083537c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5002,7 +5002,7 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType) start = PuzzleItemUser->GetPortalTransition(PuzzleItemUser->Height / 2); end = PuzzleItemUser->Angles.Yaw.ToVector(usedist); - FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES | PT_ADDTHINGS); + FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_DELTA | PT_ADDLINES | PT_ADDTHINGS); intercept_t *in; while ((in = it.Next())) From aec1c85c0825677c7e00bac7ccb4260e22437e8e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 22:21:17 +0200 Subject: [PATCH 5/6] - fixed: alpha for patches needs to be multiplied by 65536, not divided by. --- src/textures/multipatchtexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 89fe947578..b0db481a89 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1165,7 +1165,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i else if (sc.Compare("alpha")) { sc.MustGetFloat(); - part.Alpha = clamp(int(sc.Float / BLENDUNIT), 0, BLENDUNIT); + part.Alpha = clamp(int(sc.Float * BLENDUNIT), 0, BLENDUNIT); // bComplex is not set because it is only needed when the style is not OP_COPY. } else if (sc.Compare("style")) From a97f67edb61730e11c3bb428e7191ec29be5257d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 23:12:35 +0200 Subject: [PATCH 6/6] - fixed: P_GetMidTexturePosition needs to divide by scale, not multiply, to get the proper offset. --- src/p_3dmidtex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 4bb9ec4ba6..d04decfa03 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -236,7 +236,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do double textureheight = tex->GetHeight() / totalscale; if (totalscale != 1. && !tex->bWorldPanning) { - y_offset *= totalscale; + y_offset /= totalscale; } if(line->flags & ML_DONTPEGBOTTOM)