From 1c517d19fa7fc73d43b96ba7665ca73c6a3add58 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 29 Dec 2021 10:25:31 +0100 Subject: [PATCH] - Backend update from Raze. This is mainly code cleanup from setting the compiler to a stricter warning level. --- src/common/2d/v_2ddrawer.cpp | 3 +- src/common/2d/v_draw.cpp | 17 +- src/common/audio/music/music.cpp | 8 +- src/common/audio/sound/oalsound.cpp | 1 - src/common/audio/sound/s_environment.cpp | 2 +- src/common/audio/sound/s_reverbedit.cpp | 3 - src/common/audio/sound/s_sound.cpp | 5 +- src/common/audio/sound/s_soundinternal.h | 5 +- src/common/console/c_console.cpp | 12 +- src/common/console/c_cvars.cpp | 15 +- src/common/console/c_dispatch.cpp | 13 +- src/common/engine/i_net.cpp | 2 +- src/common/engine/palettecontainer.cpp | 5 +- src/common/engine/sc_man.cpp | 4 +- src/common/engine/serializer.cpp | 26 +- src/common/engine/serializer.h | 8 +- src/common/filesystem/file_directory.cpp | 2 - src/common/filesystem/file_wad.cpp | 13 +- src/common/filesystem/filesystem.cpp | 18 +- src/common/filesystem/resourcefile.cpp | 4 +- src/common/filesystem/resourcefile.h | 1 + src/common/fonts/font.cpp | 17 +- src/common/fonts/singlelumpfont.cpp | 4 +- src/common/fonts/specialfont.cpp | 8 +- src/common/fonts/v_font.cpp | 6 +- src/common/fonts/v_text.cpp | 1 - src/common/menu/joystickmenu.cpp | 14 +- src/common/menu/menudef.cpp | 12 +- src/common/menu/savegamemanager.cpp | 4 +- src/common/models/model.cpp | 4 +- src/common/models/models_md2.cpp | 16 +- src/common/models/models_md3.cpp | 34 +-- src/common/models/models_voxel.cpp | 7 +- src/common/platform/posix/sdl/i_system.cpp | 4 +- src/common/platform/win32/base_sysfb.cpp | 2 +- src/common/platform/win32/i_crash.cpp | 8 +- src/common/platform/win32/i_dijoy.cpp | 8 - src/common/platform/win32/i_input.cpp | 2 - src/common/platform/win32/i_mouse.cpp | 1 - src/common/platform/win32/i_system.cpp | 4 +- src/common/platform/win32/st_start.cpp | 2 +- src/common/platform/win32/st_start_util.cpp | 4 +- src/common/platform/win32/win32glvideo.cpp | 2 - src/common/rendering/gl/gl_framebuffer.cpp | 1 - src/common/rendering/gl/gl_hwtexture.cpp | 2 - src/common/rendering/gl/gl_renderbuffers.cpp | 2 - src/common/rendering/gl/gl_renderstate.cpp | 1 - src/common/rendering/gl/gl_shader.cpp | 6 +- .../rendering/gles/gles_framebuffer.cpp | 2 +- src/common/rendering/gles/gles_hwtexture.cpp | 30 ++- .../rendering/gles/gles_postprocess.cpp | 1 - .../rendering/gles/gles_renderbuffers.cpp | 3 - src/common/rendering/gles/gles_renderer.cpp | 1 - .../rendering/gles/gles_renderstate.cpp | 21 +- .../hwrenderer/data/flatvertices.cpp | 1 - .../hwrenderer/data/hw_dynlightdata.h | 2 + .../hwrenderer/data/hw_shaderpatcher.cpp | 13 +- .../rendering/hwrenderer/data/hw_shadowmap.h | 1 + .../rendering/hwrenderer/data/hw_vrmodes.cpp | 6 +- src/common/rendering/hwrenderer/hw_draw2d.cpp | 1 - src/common/rendering/r_videoscale.cpp | 1 - src/common/rendering/v_video.cpp | 2 - .../vulkan/renderer/vk_renderbuffers.cpp | 12 +- .../rendering/vulkan/system/vk_device.cpp | 16 +- .../vulkan/system/vk_framebuffer.cpp | 5 +- .../vulkan/textures/vk_hwtexture.cpp | 12 +- src/common/scripting/backend/codegen.cpp | 28 +-- src/common/scripting/core/dynarrays.cpp | 2 +- src/common/scripting/core/vmdisasm.cpp | 5 +- src/common/scripting/frontend/zcc_compile.cpp | 27 +- src/common/scripting/jit/jit_runtime.cpp | 4 +- src/common/scripting/vm/vmexec.h | 25 +- src/common/scripting/vm/vmframe.cpp | 2 - src/common/statusbar/base_sbar.cpp | 16 +- src/common/textures/bitmap.cpp | 5 +- src/common/textures/formats/jpegtexture.cpp | 2 +- src/common/textures/formats/pcxtexture.cpp | 2 +- src/common/textures/gametexture.cpp | 2 +- src/common/textures/gametexture.h | 8 +- src/common/textures/image.cpp | 2 - src/common/textures/imagetexture.cpp | 2 +- .../textures/multipatchtexturebuilder.cpp | 11 +- src/common/textures/texturemanager.cpp | 13 +- src/common/thirdparty/base64.h | 2 + src/common/thirdparty/gain_analysis.cpp | 56 ++--- src/common/thirdparty/m_crc32.h | 5 - src/common/thirdparty/rapidjson/document.h | 4 +- src/common/thirdparty/strnatcmp.c | 4 - src/common/utility/basics.h | 7 + src/common/utility/cmdlib.cpp | 4 +- src/common/utility/filereadermusicinterface.h | 3 +- src/common/utility/i_time.cpp | 38 +++ src/common/utility/i_time.h | 6 + src/common/utility/memarena.cpp | 8 + src/common/utility/memarena.h | 1 + src/common/utility/palentry.h | 1 + src/common/utility/palette.cpp | 7 +- src/common/utility/tarray.h | 230 +++--------------- src/common/utility/tflags.h | 60 ++--- src/common/utility/utf8.cpp | 1 - src/common/utility/vectors.h | 9 +- src/common/utility/zstrformat.cpp | 4 +- 102 files changed, 491 insertions(+), 588 deletions(-) diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index 1827123499..443acb2937 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -749,7 +749,6 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints, void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2) { RenderCommand dg; - int method = 0; if (!img || !img->isValid()) return; @@ -835,13 +834,13 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu dg.mFlags = DTF_Wrap; float fs = 1.f / float(flatscale); - bool flipc = false; float sw = GetClassicFlatScalarWidth(); float sh = GetClassicFlatScalarHeight(); switch (local_origin) { + default: case 0: fU1 = float(left) / (float)src->GetDisplayWidth() * fs; fV1 = float(top) / (float)src->GetDisplayHeight() * fs; diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index 4a99b8cac0..a7d213cb43 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -144,7 +144,7 @@ int GetUIScale(F2DDrawer *drawer, int altval) // Default should try to scale to 640x400 int vscale = drawer->GetHeight() / 400; int hscale = drawer->GetWidth() / 640; - scaleval = clamp(vscale, 1, hscale); + scaleval = max(1, min(vscale, hscale)); } else scaleval = uiscale; @@ -165,7 +165,7 @@ int GetConScale(F2DDrawer* drawer, int altval) // Default should try to scale to 640x400 int vscale = drawer->GetHeight() / 800; int hscale = drawer->GetWidth() / 1280; - scaleval = clamp(vscale, 1, hscale); + scaleval = max(1, min(vscale, hscale)); } else scaleval = (uiscale+1) / 2; @@ -671,7 +671,6 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double { INTBOOL boolval; int intval; - bool translationset = false; bool fillcolorset = false; if (!fortext) @@ -1016,10 +1015,16 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double case DTA_CenterOffsetRel: assert(fortext == false); if (fortext) return false; - if (ListGetInt(tags)) + intval = ListGetInt(tags); + if (intval == 1) { - parms->left = img->GetDisplayLeftOffset() + img->GetDisplayWidth() * 0.5; - parms->top = img->GetDisplayTopOffset() + img->GetDisplayHeight() * 0.5; + parms->left = img->GetDisplayLeftOffset() + (img->GetDisplayWidth() * 0.5); + parms->top = img->GetDisplayTopOffset() + (img->GetDisplayHeight() * 0.5); + } + else if (intval == 2) + { + parms->left = img->GetDisplayLeftOffset() + floor(img->GetDisplayWidth() * 0.5); + parms->top = img->GetDisplayTopOffset() + floor(img->GetDisplayHeight() * 0.5); } break; diff --git a/src/common/audio/music/music.cpp b/src/common/audio/music/music.cpp index 1b36041da4..d8766ae900 100644 --- a/src/common/audio/music/music.cpp +++ b/src/common/audio/music/music.cpp @@ -603,13 +603,13 @@ static void CheckReplayGain(const char *musicname, EMidiDevice playertype, const { float* sbuf = (float*)readbuffer.Data(); int numsamples = fmt.mBufferSize / 8; - auto index = lbuffer.Reserve(numsamples); + auto addr = lbuffer.Reserve(numsamples); rbuffer.Reserve(numsamples); for (int i = 0; i < numsamples; i++) { - lbuffer[index + i] = sbuf[i * 2] * 32768.f; - rbuffer[index + i] = sbuf[i * 2 + 1] * 32768.f; + lbuffer[addr + i] = sbuf[i * 2] * 32768.f; + rbuffer[addr + i] = sbuf[i * 2 + 1] * 32768.f; } } float accTime = lbuffer.Size() / (float)fmt.mSampleRate; @@ -684,8 +684,6 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) return true; } - int lumpnum = -1; - int length = 0; ZMusic_MusicStream handle = nullptr; MidiDeviceSetting* devp = MidiDevices.CheckKey(musicname); diff --git a/src/common/audio/sound/oalsound.cpp b/src/common/audio/sound/oalsound.cpp index 4ef36cb4d8..f3c46746dc 100644 --- a/src/common/audio/sound/oalsound.cpp +++ b/src/common/audio/sound/oalsound.cpp @@ -329,7 +329,6 @@ public: virtual FString GetStats() { FString stats; - size_t pos = 0, len = 0; ALfloat volume; ALint offset; ALint processed; diff --git a/src/common/audio/sound/s_environment.cpp b/src/common/audio/sound/s_environment.cpp index c5f1a5cf7f..7a2dbd9a50 100644 --- a/src/common/audio/sound/s_environment.cpp +++ b/src/common/audio/sound/s_environment.cpp @@ -530,7 +530,7 @@ void S_ReadReverbDef (FScanner &sc) { const ReverbContainer *def; ReverbContainer *newenv; - REVERB_PROPERTIES props; + REVERB_PROPERTIES props = {}; char *name; int id1, id2, i, j; bool inited[NUM_REVERB_FIELDS]; diff --git a/src/common/audio/sound/s_reverbedit.cpp b/src/common/audio/sound/s_reverbedit.cpp index 398d4f2f59..9787ffa8cb 100644 --- a/src/common/audio/sound/s_reverbedit.cpp +++ b/src/common/audio/sound/s_reverbedit.cpp @@ -309,7 +309,6 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, GetValue) } } ACTION_RETURN_FLOAT(v); - return 1; } DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue) @@ -337,14 +336,12 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue) } ACTION_RETURN_FLOAT(v); - return 1; } DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck) { PARAM_PROLOGUE; ACTION_RETURN_BOOL(CurrentEnv->Builtin); - return 1; } DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment) diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index 46119a3222..5201891c00 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -164,7 +164,6 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx) { if (GSnd && !sfx->bTentative) { - sfxinfo_t *orig = sfx; while (!sfx->bRandomHeader && sfx->link != sfxinfo_t::NO_LINK) { sfx = &S_sfx[sfx->link]; @@ -1085,13 +1084,14 @@ void SoundEngine::SetPitch(FSoundChan *chan, float pitch) // Is a sound being played by a specific emitter? //========================================================================== -int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int sound_id) +int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int sound_id, int chann) { int count = 0; if (sound_id > 0) { for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) { + if (chann != -1 && chann != chan->EntChannel) continue; if (chan->OrgID == sound_id && (sourcetype == SOURCE_Any || (chan->SourceType == sourcetype && chan->Source == source))) @@ -1104,6 +1104,7 @@ int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int so { for (FSoundChan* chan = Channels; chan != NULL; chan = chan->NextChan) { + if (chann != -1 && chann != chan->EntChannel) continue; if ((sourcetype == SOURCE_Any || (chan->SourceType == sourcetype && chan->Source == source))) { count++; diff --git a/src/common/audio/sound/s_soundinternal.h b/src/common/audio/sound/s_soundinternal.h index d35cb524a5..13ca33e7a4 100644 --- a/src/common/audio/sound/s_soundinternal.h +++ b/src/common/audio/sound/s_soundinternal.h @@ -249,9 +249,6 @@ public: blockNewSounds = on; } - virtual int SoundSourceIndex(FSoundChan* chan) { return 0; } - virtual void SetSource(FSoundChan* chan, int index) {} - virtual void StopChannel(FSoundChan* chan); sfxinfo_t* LoadSound(sfxinfo_t* sfx); const sfxinfo_t* GetSfx(unsigned snd) @@ -303,7 +300,7 @@ public: bool IsSourcePlayingSomething(int sourcetype, const void* actor, int channel, int sound_id = -1); // Stop and resume music, during game PAUSE. - int GetSoundPlayingInfo(int sourcetype, const void* source, int sound_id); + int GetSoundPlayingInfo(int sourcetype, const void* source, int sound_id, int chan = -1); void UnloadAllSounds(); void Reset(); void MarkUsed(int num); diff --git a/src/common/console/c_console.cpp b/src/common/console/c_console.cpp index b40708808e..8d4f8b44ab 100644 --- a/src/common/console/c_console.cpp +++ b/src/common/console/c_console.cpp @@ -331,16 +331,16 @@ void C_DeinitConsole () // at runtime.) for (size_t i = 0; i < countof(Commands); ++i) { - FConsoleCommand *cmd = Commands[i]; + FConsoleCommand *command = Commands[i]; - while (cmd != NULL) + while (command != NULL) { - FConsoleCommand *next = cmd->m_Next; - if (cmd->IsAlias()) + FConsoleCommand *nextcmd = command->m_Next; + if (command->IsAlias()) { - delete cmd; + delete command; } - cmd = next; + command = nextcmd; } } diff --git a/src/common/console/c_cvars.cpp b/src/common/console/c_cvars.cpp index 7e5bd94ba3..6510d561ef 100644 --- a/src/common/console/c_cvars.cpp +++ b/src/common/console/c_cvars.cpp @@ -333,6 +333,7 @@ UCVarValue FBaseCVar::FromBool (bool value, ECVarType type) break; default: + ret.Int = 0; break; } @@ -363,6 +364,7 @@ UCVarValue FBaseCVar::FromInt (int value, ECVarType type) break; default: + ret.Int = 0; break; } @@ -395,6 +397,7 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type) break; default: + ret.Int = 0; break; } @@ -456,6 +459,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type) break; default: + ret.Int = 0; break; } @@ -1426,12 +1430,12 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter) cvar = cvar->m_Next; } qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp); - for (auto cvar : cvarlist) + for (auto cv : cvarlist) { - const char* const value = (cvar->Flags & CVAR_ISDEFAULT) - ? cvar->GetGenericRep(CVAR_String).String - : cvar->SafeValue.GetChars(); - f->SetValueForKey(cvar->GetName(), value); + const char* const value = (cv->Flags & CVAR_ISDEFAULT) + ? cv->GetGenericRep(CVAR_String).String + : cv->SafeValue.GetChars(); + f->SetValueForKey(cv->GetName(), value); } } @@ -1643,7 +1647,6 @@ CCMD (archivecvar) void C_ListCVarsWithoutDescription() { FBaseCVar* var = CVars; - int count = 0; while (var) { diff --git a/src/common/console/c_dispatch.cpp b/src/common/console/c_dispatch.cpp index 004c5be3ef..76e0f19e21 100644 --- a/src/common/console/c_dispatch.cpp +++ b/src/common/console/c_dispatch.cpp @@ -282,8 +282,8 @@ void C_DoCommand (const char *cmd, int keynum) } else { - auto cmd = new FStoredCommand(com, beg); - delayedCommandQueue.AddCommand(cmd); + auto command = new FStoredCommand(com, beg); + delayedCommandQueue.AddCommand(command); } } } @@ -373,8 +373,8 @@ void AddCommandString (const char *text, int keynum) // Note that deferred commands lose track of which key // (if any) they were pressed from. *brkpt = ';'; - auto cmd = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext); - delayedCommandQueue.AddCommand(cmd); + auto command = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext); + delayedCommandQueue.AddCommand(command); } return; } @@ -851,8 +851,8 @@ CCMD (key) for (i = 1; i < argv.argc(); ++i) { - unsigned int key = MakeKey (argv[i]); - Printf (" 0x%08x\n", key); + unsigned int hash = MakeKey (argv[i]); + Printf (" 0x%08x\n", hash); } } } @@ -1014,7 +1014,6 @@ void FExecList::AddPullins(TArray &wads, FConfigFile *config) const FExecList *C_ParseExecFile(const char *file, FExecList *exec) { char cmd[4096]; - int retval = 0; FileReader fr; diff --git a/src/common/engine/i_net.cpp b/src/common/engine/i_net.cpp index 64fd4acaf8..40bedd5628 100644 --- a/src/common/engine/i_net.cpp +++ b/src/common/engine/i_net.cpp @@ -736,7 +736,7 @@ bool HostGame (int i) { // If we send the packets eight times to each guest, // hopefully at least one of them will get through. - for (int i = 8; i != 0; --i) + for (int ii = 8; ii != 0; --ii) { PreSend (&packet, 2, &sendaddress[node]); } diff --git a/src/common/engine/palettecontainer.cpp b/src/common/engine/palettecontainer.cpp index 73fb2bdb90..9648f2528c 100644 --- a/src/common/engine/palettecontainer.cpp +++ b/src/common/engine/palettecontainer.cpp @@ -234,7 +234,7 @@ void PaletteContainer::UpdateTranslation(int trans, FRemapTable* remap) int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count) { - uint32_t id; + uint32_t id = 0; for (int i = 0; i < count; i++) { auto newremap = AddRemap(&remap[i]); @@ -265,7 +265,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation) unsigned int type = GetTranslationType(translation); unsigned int index = GetTranslationIndex(translation); - if (type < 0 || type >= TranslationTables.Size() || index >= NumTranslations(type)) + if (type >= TranslationTables.Size() || index >= NumTranslations(type)) { return uniqueRemaps[0]; // this is the identity table. } @@ -649,7 +649,6 @@ bool FRemapTable::AddTint(int start, int end, int r, int g, int b, int amount) bool FRemapTable::AddToTranslation(const char *range) { int start,end; - bool desaturated = false; FScanner sc; sc.OpenMem("translation", range, int(strlen(range))); diff --git a/src/common/engine/sc_man.cpp b/src/common/engine/sc_man.cpp index 29b0b445b7..68bc8542dc 100644 --- a/src/common/engine/sc_man.cpp +++ b/src/common/engine/sc_man.cpp @@ -1131,9 +1131,7 @@ FString FScanner::TokenName (int token, const char *string) } else { - FString work; - work.Format ("Unknown(%d)", token); - return work; + work.Format("Unknown(%d)", token); } return work; } diff --git a/src/common/engine/serializer.cpp b/src/common/engine/serializer.cpp index 505bd044db..f123fb42de 100644 --- a/src/common/engine/serializer.cpp +++ b/src/common/engine/serializer.cpp @@ -290,6 +290,28 @@ bool FSerializer::BeginObject(const char *name) // //========================================================================== +bool FSerializer::HasObject(const char* name) +{ + if (isReading()) + { + auto val = r->FindKey(name); + if (val != nullptr) + { + if (val->IsObject()) + { + return true; + } + } + } + return false; +} + +//========================================================================== +// +// +// +//========================================================================== + void FSerializer::EndObject() { if (isWriting()) @@ -619,7 +641,6 @@ void FSerializer::ReadObjects(bool hubtravel) if (BeginObject(nullptr)) { FString clsname; // do not deserialize the class type directly so that we can print appropriate errors. - int pindex = -1; Serialize(*this, "classtype", clsname, nullptr); PClass *cls = PClass::FindClass(clsname); @@ -643,6 +664,7 @@ void FSerializer::ReadObjects(bool hubtravel) if (!founderrors) { // Reset to start; + unsigned size = r->mObjects.Size(); r->mObjects.Last().mIndex = 0; for (unsigned i = 0; i < r->mDObjects.Size(); i++) @@ -652,7 +674,6 @@ void FSerializer::ReadObjects(bool hubtravel) { if (obj != nullptr) { - int pindex = -1; try { obj->SerializeUserVars(*this); @@ -660,6 +681,7 @@ void FSerializer::ReadObjects(bool hubtravel) } catch (CRecoverableError &err) { + r->mObjects.Clamp(size); // close all inner objects. // In case something in here throws an error, let's continue and deal with it later. Printf(TEXTCOLOR_RED "'%s'\n while restoring %s\n", err.GetMessage(), obj ? obj->GetClass()->TypeName.GetChars() : "invalid object"); mErrors++; diff --git a/src/common/engine/serializer.h b/src/common/engine/serializer.h index 400a6f4aa9..4797ca20df 100644 --- a/src/common/engine/serializer.h +++ b/src/common/engine/serializer.h @@ -85,6 +85,7 @@ public: void ReadObjects(bool hubtravel); bool BeginObject(const char *name); void EndObject(); + bool HasObject(const char* name); bool BeginArray(const char *name); void EndArray(); unsigned GetSize(const char *group); @@ -234,7 +235,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI FSerializer &Serialize(FSerializer &arc, const char *key, FString &sid, FString *def); FSerializer &Serialize(FSerializer &arc, const char *key, NumericValue &sid, NumericValue *def); -template +template >*/> FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **) { DObject *v = static_cast(value); @@ -301,6 +302,11 @@ FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray& v return arc.SerializeMemory(key, value.Storage(), value.StorageSize()); } +inline FSerializer& Serialize(FSerializer& arc, const char* key, BitArray& value, BitArray* def) +{ + return arc.SerializeMemory(key, value.Storage().Data(), value.Storage().Size()); +} + template<> FSerializer& Serialize(FSerializer& arc, const char* key, PClass*& clst, PClass** def); template<> FSerializer& Serialize(FSerializer& arc, const char* key, FFont*& font, FFont** def); template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary *&dict, Dictionary **def); diff --git a/src/common/filesystem/file_directory.cpp b/src/common/filesystem/file_directory.cpp index 8c7b578763..9d215784dd 100644 --- a/src/common/filesystem/file_directory.cpp +++ b/src/common/filesystem/file_directory.cpp @@ -41,8 +41,6 @@ #include "printf.h" #include "findfile.h" - - //========================================================================== // // Zip Lump diff --git a/src/common/filesystem/file_wad.cpp b/src/common/filesystem/file_wad.cpp index 054b0721a7..216fab58b0 100644 --- a/src/common/filesystem/file_wad.cpp +++ b/src/common/filesystem/file_wad.cpp @@ -308,14 +308,14 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name // We have found no F_START but one or more F_END markers. // mark all lumps before the last F_END marker as potential flats. unsigned int end = markers[markers.Size()-1].index; - for(unsigned int i = 0; i < end; i++) + for(unsigned int ii = 0; ii < end; ii++) { - if (Lumps[i].LumpSize == 4096) + if (Lumps[ii].LumpSize == 4096) { // We can't add this to the flats namespace but // it needs to be flagged for the texture manager. - DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[i].getName()); - Lumps[i].Flags |= LUMPF_MAYBEFLAT; + DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[ii].getName()); + Lumps[ii].Flags |= LUMPF_MAYBEFLAT; } } } @@ -428,18 +428,19 @@ void FWadFile::SkinHack () namespc++; } } + // needless to say, this check is entirely useless these days as map names can be more diverse.. if ((lump->getName()[0] == 'M' && lump->getName()[1] == 'A' && lump->getName()[2] == 'P' && lump->getName()[3] >= '0' && lump->getName()[3] <= '9' && lump->getName()[4] >= '0' && lump->getName()[4] <= '9' && - lump->getName()[5] >= '\0') + lump->getName()[5] == '\0') || (lump->getName()[0] == 'E' && lump->getName()[1] >= '0' && lump->getName()[1] <= '9' && lump->getName()[2] == 'M' && lump->getName()[3] >= '0' && lump->getName()[3] <= '9' && - lump->getName()[4] >= '\0')) + lump->getName()[4] == '\0')) { hasmap = true; } diff --git a/src/common/filesystem/filesystem.cpp b/src/common/filesystem/filesystem.cpp index 47932334d8..6151925a08 100644 --- a/src/common/filesystem/filesystem.cpp +++ b/src/common/filesystem/filesystem.cpp @@ -218,7 +218,6 @@ void FileSystem::InitMultipleFiles (TArray &filenames, bool quiet, Lump for(unsigned i=0;i