From be9094cb9718e2649a52eaa3617f2307011d4caf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 23 Jul 2020 16:35:54 +0200 Subject: [PATCH] Silenced lots of warnings pointed out by XCode. --- source/blood/src/blood.cpp | 27 ------------ source/blood/src/demo.cpp | 2 +- source/blood/src/nnexts.cpp | 4 +- source/build/src/engine.cpp | 42 ------------------- source/build/src/scriptfile.cpp | 2 +- source/common/audio/sound/oalsound.cpp | 4 +- source/common/filesystem/file_wad.cpp | 6 +-- source/common/fonts/singlepicfont.cpp | 2 +- source/common/models/model_kvx.h | 10 ++--- source/common/rendering/gl/gl_framebuffer.h | 2 +- source/common/scripting/core/types.h | 36 ++++++++-------- .../textures/formats/multipatchtexture.h | 2 +- source/core/gamecvars.cpp | 2 +- source/core/screenjob.cpp | 2 - source/core/statusbar.h | 1 + source/exhumed/src/movie.cpp | 3 ++ source/games/duke/src/2d_d.cpp | 22 +++++----- source/games/duke/src/2d_r.cpp | 22 +++++----- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/gamedef.cpp | 26 ++++++------ source/games/duke/src/gameexec.cpp | 8 ++-- source/games/duke/src/input.cpp | 26 +----------- source/games/duke/src/sectors_d.cpp | 2 +- source/games/duke/src/sectors_r.cpp | 2 +- source/games/duke/src/spawn.cpp | 8 ++-- source/games/duke/src/spawn_d.cpp | 4 +- 26 files changed, 89 insertions(+), 180 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 6d703a641..3d8824e20 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1337,33 +1337,6 @@ RESTART: return 0; } -// Returns: -// 0: all OK -// -1: ID declaration was invalid: -static int32_t S_DefineMusic(const char *ID, const char *name) -{ - int32_t sel = MUS_FIRST_SPECIAL; - - Bassert(ID != NULL); - - if (!Bstrcmp(ID,"intro")) - { - sel = MUS_INTRO; - } - else if (!Bstrcmp(ID,"loading")) - { - sel = MUS_LOADING; - } - else - { - sel = levelGetMusicIdx(ID); - if (sel < 0) - return -1; - } - - quoteMgr.InitializeQuote(sel, name); - return 0; -} static int parsedefinitions_game(scriptfile *, int); diff --git a/source/blood/src/demo.cpp b/source/blood/src/demo.cpp index 714e15ebe..d6103c083 100644 --- a/source/blood/src/demo.cpp +++ b/source/blood/src/demo.cpp @@ -432,7 +432,7 @@ void CDemo::LoadDemoInfo(void) #if B_BIG_ENDIAN == 1 atf.signature = B_LITTLE32(atf.signature); atf.nVersion = B_LITTLE16(atf.nVersion); -#endif, "." +#endif if ((atf.signature == 0x1a4d4544 /* '\x1aMED' */&& atf.nVersion == BloodVersion) || (atf.signature == 0x1a4d4445 /* '\x1aMDE' */ && atf.nVersion == BYTEVERSION)) { diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index df3e3a516..8d1d4fae7 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -416,7 +416,7 @@ void nnExtInitModernStuff(bool bSaveLoad) { //ThrowError("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1); if (pXSprite->rxID && pXSprite->rxID != kChannelLevelStart) - ThrowError("\nPlayer Control (SPRITE #%d) with Link command should have no RX ID!", pSprite->index, pXSprite->data1); + ThrowError("\nPlayer Control (SPRITE #%d) with Link command should have no RX ID!", pSprite->index); if (pXSprite->txID && pXSprite->txID < kChannelUser) ThrowError("\nPlayer Control (SPRITE #%d):\nTX ID should be in range of %d and %d!", pSprite->index, kChannelUser, kChannelMax); @@ -2506,7 +2506,7 @@ void condError(XSPRITE* pXCond, const char* pzFormat, ...) { va_list args; va_start(args, pzFormat); vsprintf(buffer2, pzFormat, args); - ThrowError(Bstrcat(buffer, buffer2)); + ThrowError("%s%s", buffer, buffer2); } diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index e1537f72d..a30a9e2e7 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -403,48 +403,6 @@ int32_t wallfront(int32_t l1, int32_t l2) return -2; } -// -// spritewallfront (internal) -// -static inline int32_t spritewallfront(tspritetype const * const s, int32_t w) -{ - auto const wal = (uwallptr_t)&wall[w]; - auto const wal2 = (uwallptr_t)&wall[wal->point2]; - const vec2_t v = { wal->x, wal->y }; - - return dmulscale32(wal2->x - v.x, s->y - v.y, -(s->x - v.x), wal2->y - v.y) >= 0; -} - -// -// bunchfront (internal) -// -static inline int32_t bunchfront(int32_t b1, int32_t b2) -{ - int b1f = bunchfirst[b1]; - int const x1b1 = xb1[b1f]; - int const x2b2 = xb2[bunchlast[b2]] + 1; - - if (x1b1 >= x2b2) - return -1; - - int b2f = bunchfirst[b2]; - int const x1b2 = xb1[b2f]; - int const x2b1 = xb2[bunchlast[b1]] + 1; - - if (x1b2 >= x2b1) - return -1; - - if (x1b1 >= x1b2) - { - for (; xb2[b2f] < x1b1; b2f = bunchp2[b2f]) { } - return wallfront(b1f, b2f); - } - - for (; xb2[b1f] < x1b2; b1f = bunchp2[b1f]) { } - return wallfront(b1f, b2f); -} - - // // animateoffs (internal) // diff --git a/source/build/src/scriptfile.cpp b/source/build/src/scriptfile.cpp index 245e9eb12..c6e485269 100644 --- a/source/build/src/scriptfile.cpp +++ b/source/build/src/scriptfile.cpp @@ -382,7 +382,7 @@ int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val) sscanf(name + 2, "%" PRIx64 "", &x); if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX)) - Printf("warning: number 0x%x" PRIx64 " truncated to 32 bits.\n", x); + Printf("warning: number 0x%" PRIx64 " truncated to 32 bits.\n", x); *val = x; return 1; diff --git a/source/common/audio/sound/oalsound.cpp b/source/common/audio/sound/oalsound.cpp index ee3e127c3..8b8dba87f 100644 --- a/source/common/audio/sound/oalsound.cpp +++ b/source/common/audio/sound/oalsound.cpp @@ -181,7 +181,7 @@ class OpenALSoundStream : public SoundStream ALuint Source; std::atomic Playing; - bool Looping; + //bool Looping; ALfloat Volume; bool SetupSource() @@ -227,7 +227,7 @@ class OpenALSoundStream : public SoundStream public: OpenALSoundStream(OpenALSoundRenderer *renderer) - : Renderer(renderer), Source(0), Playing(false), Looping(false), Volume(1.0f) + : Renderer(renderer), Source(0), Playing(false), Volume(1.0f) { memset(Buffers, 0, sizeof(Buffers)); Renderer->AddStream(this); diff --git a/source/common/filesystem/file_wad.cpp b/source/common/filesystem/file_wad.cpp index 2cbb4a3dc..ba27fea3d 100644 --- a/source/common/filesystem/file_wad.cpp +++ b/source/common/filesystem/file_wad.cpp @@ -70,8 +70,8 @@ public: int GetNamespace() const override { return Namespace; } - int GetFileOffset() { return Position; } - FileReader *GetReader() + int GetFileOffset() override { return Position; } + FileReader *GetReader() override { if(!Compressed) { @@ -80,7 +80,7 @@ public: } return NULL; } - int FillCache() + int FillCache() override { if(!Compressed) { diff --git a/source/common/fonts/singlepicfont.cpp b/source/common/fonts/singlepicfont.cpp index 46a723bd1..aefede946 100644 --- a/source/common/fonts/singlepicfont.cpp +++ b/source/common/fonts/singlepicfont.cpp @@ -46,7 +46,7 @@ public: // FFont interface FGameTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override; - int GetCharWidth (int code) const; + int GetCharWidth (int code) const override; protected: FTextureID PicNum; diff --git a/source/common/models/model_kvx.h b/source/common/models/model_kvx.h index bea2fdfd2..36db774c7 100644 --- a/source/common/models/model_kvx.h +++ b/source/common/models/model_kvx.h @@ -56,13 +56,13 @@ protected: public: FVoxelModel(FVoxel *voxel, bool owned); ~FVoxelModel(); - bool Load(const char * fn, int lumpnum, const char * buffer, int length); + bool Load(const char * fn, int lumpnum, const char * buffer, int length) override; void Initialize(); - virtual int FindFrame(const char * name); - virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0); - virtual void AddSkins(uint8_t *hitlist); + virtual int FindFrame(const char * name) override; + virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation=0) override; + virtual void AddSkins(uint8_t *hitlist) override; FTextureID GetPaletteTexture() const { return mPalette; } - void BuildVertexBuffer(FModelRenderer *renderer); + void BuildVertexBuffer(FModelRenderer *renderer) override; float getAspectFactor(float vscale) override; }; diff --git a/source/common/rendering/gl/gl_framebuffer.h b/source/common/rendering/gl/gl_framebuffer.h index de10ac052..8f8a139b6 100644 --- a/source/common/rendering/gl/gl_framebuffer.h +++ b/source/common/rendering/gl/gl_framebuffer.h @@ -58,7 +58,7 @@ public: void Swap(); bool IsHWGammaActive() const { return HWGammaActive; } - void SetVSync(bool vsync); + void SetVSync(bool vsync) override; void Draw2D() override; void PostProcessScene(bool swscene, int fixedcm, float flash, const std::function &afterBloomDrawEndScene2D) override; diff --git a/source/common/scripting/core/types.h b/source/common/scripting/core/types.h index 58e213837..b35047525 100644 --- a/source/common/scripting/core/types.h +++ b/source/common/scripting/core/types.h @@ -269,10 +269,10 @@ public: void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; - virtual void SetValue(void *addr, int val); - virtual void SetValue(void *addr, double val); - virtual int GetValueInt(void *addr) const; - virtual double GetValueFloat(void *addr) const; + virtual void SetValue(void *addr, int val) override; + virtual void SetValue(void *addr, double val) override; + virtual int GetValueInt(void *addr) const override; + virtual double GetValueFloat(void *addr) const override; virtual bool isNumeric() override { return IntCompatible; } bool Unsigned; @@ -299,10 +299,10 @@ public: void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; - virtual void SetValue(void *addr, int val); - virtual void SetValue(void *addr, double val); - virtual int GetValueInt(void *addr) const; - virtual double GetValueFloat(void *addr) const; + virtual void SetValue(void *addr, int val) override; + virtual void SetValue(void *addr, double val) override; + virtual int GetValueInt(void *addr) const override; + virtual double GetValueFloat(void *addr) const override; virtual bool isNumeric() override { return true; } protected: void SetOps(); @@ -410,8 +410,8 @@ public: reader = r; } - virtual bool IsMatch(intptr_t id1, intptr_t id2) const; - virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; + bool IsMatch(intptr_t id1, intptr_t id2) const override; + void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; @@ -454,8 +454,8 @@ public: bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; void SetPointer(void *base, unsigned offset, TArray *special = NULL) override; - virtual bool IsMatch(intptr_t id1, intptr_t id2) const; - virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; + bool IsMatch(intptr_t id1, intptr_t id2) const override; + void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override; }; // Compound types ----------------------------------------------------------- @@ -478,8 +478,8 @@ public: unsigned int ElementCount; unsigned int ElementSize; - virtual bool IsMatch(intptr_t id1, intptr_t id2) const; - virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; + bool IsMatch(intptr_t id1, intptr_t id2) const override; + void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; @@ -506,8 +506,8 @@ public: PType *ElementType; PStruct *BackingType; - virtual bool IsMatch(intptr_t id1, intptr_t id2) const; - virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; + bool IsMatch(intptr_t id1, intptr_t id2) const override; + void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override; void WriteValue(FSerializer &ar, const char *key, const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; @@ -539,8 +539,8 @@ public: VMFunction *mConstructor = nullptr; VMFunction *mDestructor = nullptr; - virtual PField *AddField(FName name, PType *type, uint32_t flags=0); - virtual PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0); + PField *AddField(FName name, PType *type, uint32_t flags=0) override; + PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0) override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; diff --git a/source/common/textures/formats/multipatchtexture.h b/source/common/textures/formats/multipatchtexture.h index d8f271333..48223ec5e 100644 --- a/source/common/textures/formats/multipatchtexture.h +++ b/source/common/textures/formats/multipatchtexture.h @@ -77,7 +77,7 @@ protected: int CopyPixels(FBitmap *bmp, int conversion) override; TArray CreatePalettedPixels(int conversion) override; void CopyToBlock(uint8_t *dest, int dwidth, int dheight, FImageSource *source, int xpos, int ypos, int rotate, const uint8_t *translation, int style); - void CollectForPrecache(PrecacheInfo &info, bool requiretruecolor); + void CollectForPrecache(PrecacheInfo &info, bool requiretruecolor) override; }; diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 37b8f7d1f..c0eb1c62a 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -302,7 +302,7 @@ CCMD(togglemouseaim) in_mousemode = !in_mousemode; if (!silentmouseaimtoggle) { - Printf(PRINT_MEDIUM|PRINT_NOTIFY, in_mousemode? GStrings("TXT_MOUSEAIMON") : GStrings("TXT_MOUSEAIMOFF")); + Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", in_mousemode? GStrings("TXT_MOUSEAIMON") : GStrings("TXT_MOUSEAIMOFF")); } } diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 8c2a6b5ec..df464f9d4 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -82,7 +82,6 @@ class DAnmPlayer : public DScreenJob TArray buffer; int numframes = 0; int curframe = 1; - int lastframe = -1; int frametime = 0; int ototalclock = 0; AnimTextures animtex; @@ -241,7 +240,6 @@ class ScreenJobRunner int index = -1; float screenfade; bool clearbefore; - bool skipped = false; uint64_t startTime = -1; uint64_t lastTime = -1; int actionState; diff --git a/source/core/statusbar.h b/source/core/statusbar.h index 97af9e6c2..9199cf7e4 100644 --- a/source/core/statusbar.h +++ b/source/core/statusbar.h @@ -159,6 +159,7 @@ public: }; DBaseStatusBar (); + virtual ~DBaseStatusBar() = default; void SetSize(int reltop = 32, int hres = 320, int vres = 200, int hhres = -1, int hvres = -1); void ShowPlayerName (); diff --git a/source/exhumed/src/movie.cpp b/source/exhumed/src/movie.cpp index c6f9e16ee..34ddd81da 100644 --- a/source/exhumed/src/movie.cpp +++ b/source/exhumed/src/movie.cpp @@ -166,6 +166,7 @@ int ReadFrame(FileReader &fp, uint8_t *palette) } } +#if 0 static void ServeSample(const char** ptr, uint32_t* length) { //mutex_lock(&mutex); @@ -183,6 +184,7 @@ static void ServeSample(const char** ptr, uint32_t* length) //mutex_unlock(&mutex); } +#endif void PlayMovie(const char* fileName) { @@ -276,4 +278,5 @@ void PlayMovie(const char* fileName) inputState.keyGetChar(); } } + END_PS_NS diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 1ad0a8ab6..d4b27a2e5 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -695,14 +695,14 @@ public: for (int i = 0; i < playerswhenstarted; i++) { - mysnprintf(tempbuf, 32, "%-4ld", i + 1); + mysnprintf(tempbuf, 32, "%-4d", i + 1); MiniText(92 + (i * 23), 80, tempbuf, 0, -1, 3); } for (int i = 0; i < playerswhenstarted; i++) { int xfragtotal = 0; - mysnprintf(tempbuf, 32, "%ld", i + 1); + mysnprintf(tempbuf, 32, "%d", i + 1); MiniText(30, 90 + t, tempbuf, 0); MiniText(38, 90 + t, ud.user_name[i], 0, -1, ps[i].palookup); @@ -712,13 +712,13 @@ public: int frag = frags[i][y]; if (i == y) { - mysnprintf(tempbuf, 32, "%-4ld", ps[y].fraggedself); + mysnprintf(tempbuf, 32, "%-4d", ps[y].fraggedself); MiniText(92 + (y * 23), 90 + t, tempbuf, 0, -1, 2); xfragtotal -= ps[y].fraggedself; } else { - mysnprintf(tempbuf, 32, "%-4ld", frag); + mysnprintf(tempbuf, 32, "%-4d", frag); MiniText(92 + (y * 23), 90 + t, tempbuf, 0); xfragtotal += frag; } @@ -731,7 +731,7 @@ public: */ } - mysnprintf(tempbuf, 32, "%-4ld", xfragtotal); + mysnprintf(tempbuf, 32, "%-4d", xfragtotal); MiniText(101 + (8 * 23), 90 + t, tempbuf, 0, -1, 2); t += 7; @@ -747,7 +747,7 @@ public: int frag = frags[i][y]; yfragtotal += frag; } - mysnprintf(tempbuf, 32, "%-4ld", yfragtotal); + mysnprintf(tempbuf, 32, "%-4d", yfragtotal); MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0, -1, 2); } @@ -784,7 +784,7 @@ public: void FormatTime(int time, char* tempbuf) { - mysnprintf(tempbuf, 32, "%02ld:%02ld", (time / (26 * 60)) % 60, (time / 26) % 60); + mysnprintf(tempbuf, 32, "%02d:%02d", (time / (26 * 60)) % 60, (time / 26) % 60); } void PrintTime(int totalclock) @@ -838,18 +838,18 @@ public: bonuscnt++; S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); } - mysnprintf(tempbuf, 32, "%-3ld", ps[myconnectindex].actors_killed); + mysnprintf(tempbuf, 32, "%-3d", ps[myconnectindex].actors_killed); GameText((320 >> 2) + 70, 93 + 9, tempbuf, 0); if (ud.player_skill > 3) { - mysnprintf(tempbuf, 32, GStrings("TXT_N_A")); + mysnprintf(tempbuf, 32, "%s", GStrings("TXT_N_A")); GameText((320 >> 2) + 70, 99 + 4 + 9, tempbuf, 0); } else { if ((ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed) < 0) - mysnprintf(tempbuf, 32, "%-3ld", 0); - else mysnprintf(tempbuf, 32, "%-3ld", ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed); + mysnprintf(tempbuf, 32, "%-3d", 0); + else mysnprintf(tempbuf, 32, "%-3d", ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed); GameText((320 >> 2) + 70, 99 + 4 + 9, tempbuf, 0); } } diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index 0d00c6f71..228454b2b 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -285,14 +285,14 @@ public: for (int i = 0; i < playerswhenstarted; i++) { - mysnprintf(tempbuf, 32, "%-4ld", i + 1); + mysnprintf(tempbuf, 32, "%-4d", i + 1); MiniText(92 + (i * 23), 80, tempbuf, 0); } for (int i = 0; i < playerswhenstarted; i++) { int xfragtotal = 0; - mysnprintf(tempbuf, 32, "%ld", i + 1); + mysnprintf(tempbuf, 32, "%d", i + 1); MiniText(30, 90 + t, tempbuf, 0); MiniText(38, 90 + t, ud.user_name[i], 0, -1, ps[i].palookup); @@ -302,13 +302,13 @@ public: int frag = frags[i][y]; if (i == y) { - mysnprintf(tempbuf, 32, "%-4ld", ps[y].fraggedself); + mysnprintf(tempbuf, 32, "%-4d", ps[y].fraggedself); MiniText(92 + (y * 23), 90 + t, tempbuf, 0); xfragtotal -= ps[y].fraggedself; } else { - mysnprintf(tempbuf, 32, "%-4ld", frag); + mysnprintf(tempbuf, 32, "%-4d", frag); MiniText(92 + (y * 23), 90 + t, tempbuf, 0); xfragtotal += frag; } @@ -321,7 +321,7 @@ public: */ } - mysnprintf(tempbuf, 32, "%-4ld", xfragtotal); + mysnprintf(tempbuf, 32, "%-4d", xfragtotal); MiniText(101 + (8 * 23), 90 + t, tempbuf, 0); t += 7; @@ -337,7 +337,7 @@ public: int frag = frags[i][y]; yfragtotal += frag; } - mysnprintf(tempbuf, 32, "%-4ld", yfragtotal); + mysnprintf(tempbuf, 32, "%-4d", yfragtotal); MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0); } @@ -380,7 +380,7 @@ public: void FormatTime(int time, char* tempbuf) { - mysnprintf(tempbuf, 32, "%02ld:%02ld", (time / (26 * 60)) % 60, (time / 26) % 60); + mysnprintf(tempbuf, 32, "%02d:%02d", (time / (26 * 60)) % 60, (time / 26) % 60); } void PrintTime(int totalclock) @@ -430,18 +430,18 @@ public: bonuscnt++; S_PlaySound(442, CHAN_AUTO, CHANF_UI); } - mysnprintf(tempbuf, 32, "%-3ld", ps[myconnectindex].actors_killed); + mysnprintf(tempbuf, 32, "%-3d", ps[myconnectindex].actors_killed); BigText(231, 112, tempbuf, -1); if (ud.player_skill > 3) { - mysnprintf(tempbuf, 32, GStrings("TXT_N_A")); + mysnprintf(tempbuf, 32, "%s", GStrings("TXT_N_A")); BigText(231, 128, tempbuf, -1); } else { if ((ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed) < 0) - mysnprintf(tempbuf, 32, "%-3ld", 0); - else mysnprintf(tempbuf, 32, "%-3ld", ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed); + mysnprintf(tempbuf, 32, "%-3d", 0); + else mysnprintf(tempbuf, 32, "%-3d", ps[myconnectindex].max_actors_killed - ps[myconnectindex].actors_killed); BigText(231, 128, tempbuf, -1); } } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d5838f2e7..ea121b021 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2781,7 +2781,7 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6) if (s->owner == -1) { - I_Error("Could not find any locators for SE# 6 and 14 with a hitag of %ld.", t[3]); + I_Error("Could not find any locators for SE# 6 and 14 with a hitag of %d.", t[3]); } int j = ldist(&sprite[s->owner], s); diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 6f847e4a2..3e8a0bbd8 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -257,11 +257,11 @@ void ConCompiler::ReportError(int error) fn, line_number, parsebuf); break; case ERROR_CLOSEBRACKET: - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found more '}' than '{' before '%s'.\n", + Printf(TEXTCOLOR_RED " * ERROR! (%s, line %d) Found more '}' than '{' before '%s'.\n", fn, line_number, parsebuf); break; case ERROR_NOENDSWITCH: - Printf(TEXTCOLOR_RED " * ERROR!%s(%s, line %d) Did not find endswitch before '%s'.\n", + Printf(TEXTCOLOR_RED " * ERROR! (%s, line %d) Did not find endswitch before '%s'.\n", fn, line_number, parsebuf); break; @@ -815,15 +815,15 @@ int ConCompiler::parsecommand() if (strlen(parselabel) > (MAXVARLABEL - 1)) { warningcount++; - Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Variable Name '%s' too int (max is %d)\n", fn, line_number, parselabel, MAXVARLABEL - 1); + Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Variable Name '%s' too int (max is %d)\n", fn, line_number, parselabel.GetChars(), MAXVARLABEL - 1); return 0; } int res = AddGameVar(parselabel, j, lnum & (~(GAMEVAR_FLAG_DEFAULT | GAMEVAR_FLAG_SECRET))); if (res < 0) { errorcount++; - if (res == -1) Printf(TEXTCOLOR_RED " * ERROR.(%s, line %d) Duplicate game variable definition '%s'.\n", fn, line_number, parselabel); - else if (res == -2) Printf(TEXTCOLOR_RED " * ERROR.(%s, line %d) '%s' maximum number of game variables exceeded.\n", fn, line_number, parselabel); + if (res == -1) Printf(TEXTCOLOR_RED " * ERROR.(%s, line %d) Duplicate game variable definition '%s'.\n", fn, line_number, parselabel.GetChars()); + else if (res == -2) Printf(TEXTCOLOR_RED " * ERROR.(%s, line %d) '%s' maximum number of game variables exceeded.\n", fn, line_number, parselabel.GetChars()); return 0; } @@ -890,7 +890,7 @@ int ConCompiler::parsecommand() if (labels[i].compare(parselabel) == 0) { warningcount++; - Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate move '%s' ignored.\n", fn, line_number, parselabel); + Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate move '%s' ignored.\n", fn, line_number, parselabel.GetChars()); break; } if (i == labels.Size()) @@ -1016,7 +1016,7 @@ int ConCompiler::parsecommand() if (lnum >= 0) { warningcount++; - Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate ai '%s' ignored.\n", fn, line_number, parselabel); + Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate ai '%s' ignored.\n", fn, line_number, parselabel.GetChars()); } else appendlabeladdress(LABEL_AI); @@ -1056,7 +1056,7 @@ int ConCompiler::parsecommand() if (lnum >= 0) { warningcount++; - Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate event '%s' ignored.\n", fn, line_number, parselabel); + Printf(TEXTCOLOR_RED " * WARNING.(%s, line %d) Duplicate event '%s' ignored.\n", fn, line_number, parselabel.GetChars()); } else appendlabeladdress(LABEL_ACTION); @@ -1628,7 +1628,7 @@ int ConCompiler::parsecommand() k = popscriptvalue(); if (k >= MAXQUOTES) { - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Quote number exceeds limit of %d.\n", line_number, MAXQUOTES); + Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Quote number exceeds limit of %d.\n", fn, line_number, MAXQUOTES); errorcount++; } @@ -1679,14 +1679,14 @@ int ConCompiler::parsecommand() case concmd_endevent: if (parsing_event == 0) { - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found 'endevent' without defining 'onevent'.\n", line_number); + Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found 'endevent' without defining 'onevent'.\n", fn, line_number); errorcount++; } // else { if (num_squigilly_brackets > 0) { - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found more '{' than '}' before 'endevent'.\n", line_number); + Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found more '{' than '}' before 'endevent'.\n", fn, line_number); errorcount++; } parsing_event = 0; @@ -1698,14 +1698,14 @@ int ConCompiler::parsecommand() case concmd_enda: if (parsing_actor == 0) { - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found 'enda' without defining 'actor'.\n", line_number); + Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found 'enda' without defining 'actor'.\n", fn, line_number); errorcount++; } // else { if (num_squigilly_brackets > 0) { - Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found more '{' than '}' before 'enda'.\n", line_number); + Printf(TEXTCOLOR_RED " * ERROR!(%s, line %d) Found more '{' than '}' before 'enda'.\n", fn, line_number); errorcount++; } parsing_actor = 0; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 4b8e635ce..76bdb9734 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -666,7 +666,7 @@ int ParseState::parse(void) break; case concmd_debug: insptr++; - Printf("%ld\n",*insptr); + Printf("%d\n",*insptr); insptr++; break; case concmd_endofgame: @@ -1346,7 +1346,7 @@ int ParseState::parse(void) { DPrintf(DMSG_NOTIFY, " (Global)"); } - DPrintf(DMSG_NOTIFY, " =%ld", GetGameVarID(*insptr, g_i, g_p)); + DPrintf(DMSG_NOTIFY, " =%d", GetGameVarID(*insptr, g_i, g_p)); insptr++; break; } @@ -1588,8 +1588,8 @@ int ParseState::parse(void) break; default: - Printf(TEXTCOLOR_RED "Unrecognized PCode of %ld in parse. Killing current sprite.\n",*insptr); - Printf(TEXTCOLOR_RED "Offset=%0lX\n",insptr-ScriptCode.Data()); + Printf(TEXTCOLOR_RED "Unrecognized PCode of %d in parse. Killing current sprite.\n",*insptr); + Printf(TEXTCOLOR_RED "Offset=%0X\n",int(insptr-ScriptCode.Data())); killit_flag = 1; break; } diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 31de3548b..576893cd4 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -155,7 +155,7 @@ void nonsharedkeys(void) { if (SHIFTS_IS_PRESSED) { - Printf(PRINT_NOTIFY, *CombatMacros[taunt - 1]); + Printf(PRINT_NOTIFY, "%s", **CombatMacros[taunt - 1]); //Net_SendTaunt(taunt); return; } @@ -715,30 +715,6 @@ enum MAXVELMOTO = 120, }; -//--------------------------------------------------------------------------- -// -// This one's from VoidSW, not EDuke32 -// -//--------------------------------------------------------------------------- - -static fix16_t GetDeltaQ16Angle(fix16_t ang1, fix16_t ang2) -{ - // Look at the smaller angle if > 1024 (180 degrees) - if (fix16_abs(ang1 - ang2) > fix16_from_int(1024)) - { - if (ang1 <= fix16_from_int(1024)) - ang1 += fix16_from_int(2048); - - if (ang2 <= fix16_from_int(1024)) - ang2 += fix16_from_int(2048); - } - - //if (ang1 - ang2 == -fix16_from_int(1024)) - // return(fix16_from_int(1024)); - - return ang1 - ang2; -} - //--------------------------------------------------------------------------- // // handles the input bits diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 3bd5bf4e7..cc58184ab 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -552,7 +552,7 @@ bool checkhitswitch_d(int snum, int w, int switchtype) x = headspritestat[3]; while (x >= 0) { - if (((sprite[x].hitag) == lotag)) + if (sprite[x].hitag == lotag) { switch (sprite[x].lotag) { diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 17f27df4f..f4f7c5c2d 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -826,7 +826,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype) x = headspritestat[3]; while (x >= 0) { - if (((sprite[x].hitag) == lotag)) + if (sprite[x].hitag == lotag) { switch (sprite[x].lotag) { diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index d40991930..d5f1f0d75 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -533,7 +533,7 @@ void initwaterdrip(int j, int i) auto sp = &sprite[i]; int sect = sp->sectnum; auto t = hittype[i].temp_data; - if (j >= 0 && sprite[j].statnum == 10 || sprite[j].statnum == 1) + if (j >= 0 && (sprite[j].statnum == 10 || sprite[j].statnum == 1)) { sp->shade = 32; if (sprite[j].pal != 1) @@ -971,7 +971,7 @@ void spawneffector(int i) } if (j == MAXSPRITES) { - I_Error("Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n", sp->x, sp->y); + I_Error("Found lonely Sector Effector (lotag 0) at (%d,%d)\n", sp->x, sp->y); } sp->owner = j; } @@ -987,7 +987,7 @@ void spawneffector(int i) tempwallptr++; if (tempwallptr > 2047) { - I_Error("Too many moving sectors at (%ld,%ld).\n", wall[s].x, wall[s].y); + I_Error("Too many moving sectors at (%d,%d).\n", wall[s].x, wall[s].y); } } if (sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5) @@ -1018,7 +1018,7 @@ void spawneffector(int i) if (j == 0) { - I_Error("Subway found no zero'd sectors with locators\nat (%ld,%ld).\n", sp->x, sp->y); + I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y); } sp->owner = -1; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 4d2128cbe..43eb3430a 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -702,8 +702,8 @@ int spawn_d(int j, int pn) } else { // Twentieth Anniversary World Tour addition if ((sp->pal == 1 && ud.multimode > 1) // Single-game Only - || (sp->pal == 2 && (ud.multimode == 1 || ud.multimode > 1 && ud.coop != 1)) // Co-op Only - || (sp->pal == 3 && (ud.multimode == 1 || ud.multimode > 1 && ud.coop == 1))) // Dukematch Only + || (sp->pal == 2 && (ud.multimode == 1 || (ud.multimode > 1 && ud.coop != 1))) // Co-op Only + || (sp->pal == 3 && (ud.multimode == 1 || (ud.multimode > 1 && ud.coop == 1)))) // Dukematch Only { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, 5);