- addressed most unused/uninitialized variable warnings from MSVC.

This commit is contained in:
Christoph Oelckers 2021-11-14 15:03:50 +01:00
parent c6bd5c04c7
commit 01abe7b2ac
158 changed files with 94 additions and 468 deletions

View file

@ -23,9 +23,10 @@ if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif()
endif()
# Build does not work with signed chars!
# Build does not work with signed chars! Also set a stricter warning level, but silence the pointless and annoying parts of level 4 (Intentionally only for C++! The C code we use is too old and would warn too much)
if (MSVC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J /W4 /wd4100 /wd4127 /wd4131 /wd4201 /wd4210 /wd4244 /wd4245 /wd4324 /wd4389 /wd4505 /wd4706 /wd4456 /wd4457 /wd4458 /wd4459 /wd4703" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4189" ) # "unused initialized local variable" - useful warning that creates too much noise in external or macro based code. Can be enabled for cleanup passes on the code.
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funsigned-char -Wno-missing-braces -Wno-char-subscripts -Wno-unused-variable" )
endif()

View file

@ -474,7 +474,6 @@ int32_t clipmove(vec3_t * const pos, int * const sectnum, int32_t xvect, int32_t
vec2_t const clipMin = { cent.x - rad, cent.y - rad };
vec2_t const clipMax = { cent.x + rad, cent.y + rad };
int clipshapeidx = -1;
int clipsectcnt = 0;
int clipspritecnt = 0;
@ -958,8 +957,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
int32_t clipsectcnt = 0;
uspriteptr_t curspr=NULL; // non-NULL when handling sprite with sector-like clipping
int32_t curidx=-1, clipspritecnt = 0;
int32_t clipspritecnt = 0;
//Extra walldist for sprites on sector lines
const int32_t extradist = walldist+MAXCLIPDIST+1;
@ -1063,7 +1061,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
while ((j = it.NextIndex()) >= 0)
{
const int32_t cstat = sprite[j].cstat;
int32_t daz, daz2;
int32_t daz = 0, daz2 = 0;
if (sprite[j].cstat2 & CSTAT2_SPRITE_NOFIND) continue;
if (cstat&dasprclipmask)
@ -1203,7 +1201,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t *
int32_t vx, int32_t vy, int32_t vz,
uint16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp)
{
int32_t x1 = INT32_MAX, y1, z1;
int32_t x1 = INT32_MAX, y1 = 0, z1 = 0;
int32_t i;
if (stat&2)
@ -1278,7 +1276,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
int16_t tempshortcnt, tempshortnum;
uspriteptr_t curspr = NULL;
int32_t clipspritecnt, curidx=-1;
int32_t clipspritecnt;
// tmp: { (int32_t)curidx, (spritetype *)curspr, (!=0 if outer sector) }
intptr_t *tmpptr=NULL;
const int32_t dawalclipmask = (cliptype&65535);

View file

@ -359,7 +359,6 @@ FGameTexture *mdloadskin(idmodel_t *m, int32_t number, int32_t pal, int32_t surf
{
int32_t i;
mdskinmap_t *sk, *skzero = NULL;
int32_t doalloc = 1;
if (m->mdnum == 2)
surf = 0;
@ -1361,9 +1360,6 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
if (!tex)
continue;
FGameTexture *det = nullptr, *glow = nullptr;
float detscale = 1.f;
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
GLInterface.SetTexture(tex, palid, CLAMP_XY);

View file

@ -3921,7 +3921,6 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate)
GLInterface.SetMatrix(Matrix_Model, mat);
int palId = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetPalswap(globalpal);
GLInterface.SetFade(sector[tspr->sectnum].floorpal);

View file

@ -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,7 +834,6 @@ 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();

View file

@ -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)

View file

@ -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);

View file

@ -329,7 +329,6 @@ public:
virtual FString GetStats()
{
FString stats;
size_t pos = 0, len = 0;
ALfloat volume;
ALint offset;
ALint processed;

View file

@ -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];

View file

@ -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)

View file

@ -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];

View file

@ -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;
}
@ -1643,7 +1647,6 @@ CCMD (archivecvar)
void C_ListCVarsWithoutDescription()
{
FBaseCVar* var = CVars;
int count = 0;
while (var)
{

View file

@ -1014,7 +1014,6 @@ void FExecList::AddPullins(TArray<FString> &wads, FConfigFile *config) const
FExecList *C_ParseExecFile(const char *file, FExecList *exec)
{
char cmd[4096];
int retval = 0;
FileReader fr;

View file

@ -805,7 +805,6 @@ DEFINE_ACTION_FUNCTION(_MoviePlayer, Frame)
PARAM_SELF_STRUCT_PROLOGUE(MoviePlayer);
PARAM_FLOAT(clock);
ACTION_RETURN_INT(self->Frame(int64_t(clock)));
return 0;
}
DEFINE_ACTION_FUNCTION(_MoviePlayer, Destroy)

View file

@ -142,7 +142,6 @@ DObject* CreateRunner(bool clearbefore)
void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
{
auto obj = runnerclass->CreateNew();
auto func = LookupFunction("ScreenJobRunner.AddGenericVideo", false);
VMValue val[] = { runner, &fn, soundid, fps };
VMCall(func, val, 4, nullptr, 0);

View file

@ -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)));

View file

@ -619,7 +619,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);
@ -652,7 +651,6 @@ void FSerializer::ReadObjects(bool hubtravel)
{
if (obj != nullptr)
{
int pindex = -1;
try
{
obj->SerializeUserVars(*this);

View file

@ -218,7 +218,6 @@ void FileSystem::InitMultipleFiles (TArray<FString> &filenames, bool quiet, Lump
for(unsigned i=0;i<filenames.Size(); i++)
{
int baselump = NumEntries;
AddFile (filenames[i], nullptr, quiet, filter);
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");

View file

@ -490,7 +490,7 @@ bool FResourceFile::FindPrefixRange(FString filter, void *lumps, size_t lumpsize
{
uint32_t min, max, mid, inside;
FResourceLump *lump;
int cmp;
int cmp = 0;
end = start = 0;
@ -499,7 +499,7 @@ bool FResourceFile::FindPrefixRange(FString filter, void *lumps, size_t lumpsize
lumps = (uint8_t *)lumps - lumpsize;
// Binary search to find any match at all.
min = 1, max = maxlump;
mid = min = 1, max = maxlump;
while (min <= max)
{
mid = min + (max - min) / 2;

View file

@ -424,7 +424,6 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
LastChar = maxchar;
auto count = maxchar - minchar + 1;
Chars.Resize(count);
int fontheight = 0;
for (int i = 0; i < count; i++)
{

View file

@ -88,7 +88,6 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
{
if (*string == '[')
{
const uint8_t* start = string;
while (*string != ']' && *string != '\0')
{
string++;

View file

@ -205,7 +205,6 @@ void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3
float PivotX = mVoxel->Mips[0].Pivot.X;
float PivotY = mVoxel->Mips[0].Pivot.Y;
float PivotZ = mVoxel->Mips[0].Pivot.Z;
int h = mVoxel->Mips[0].SizeZ;
FModelVertex vert;
unsigned int indx[4];

View file

@ -279,7 +279,7 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall)
RECT r;
LONG style, exStyle;
RECT monRect;
RECT monRect = {};
if (!m_Fullscreen && fullscreen && !initialcall) SaveWindowedPos();
if (m_Monitor)

View file

@ -340,7 +340,7 @@ static HANDLE WriteMyMiniDump (void)
MINIDUMP_EXCEPTION_INFORMATION exceptor = { DbgThreadID, &CrashPointers, FALSE };
WCHAR dbghelpPath[MAX_PATH+12], *bs;
WRITEDUMP pMiniDumpWriteDump;
HANDLE file;
HANDLE file = INVALID_HANDLE_VALUE;
BOOL good = FALSE;
HMODULE dbghelp = NULL;

View file

@ -281,14 +281,6 @@ CUSTOM_CVAR(Bool, joy_dinput, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCA
static const uint8_t POVButtons[9] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09, 0x00 };
//("dc12a687-737f-11cf-884d-00aa004b2e24")
static const IID IID_IWbemLocator = { 0xdc12a687, 0x737f, 0x11cf,
{ 0x88, 0x4d, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24 } };
//("4590f811-1d3a-11d0-891f-00aa004b2e24")
static const CLSID CLSID_WbemLocator = { 0x4590f811, 0x1d3a, 0x11d0,
{ 0x89, 0x1f, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24 } };
// CODE --------------------------------------------------------------------
//===========================================================================

View file

@ -514,8 +514,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_WTSSESSION_CHANGE:
case WM_POWERBROADCAST:
{
int oldstate = SessionState;
if (message == WM_WTSSESSION_CHANGE && lParam == (LPARAM)SessionID)
{
#ifdef _DEBUG

View file

@ -268,7 +268,6 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
}
else
{
bool pauseState = false;
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
(!captureModeInGame || GUICapture));

View file

@ -288,8 +288,8 @@ static void DoPrintStr(const char *cpt, HWND edit, HANDLE StdOut)
wchar_t wbuf[256];
int bpos = 0;
CHARRANGE selection;
CHARRANGE endselection;
CHARRANGE selection = {};
CHARRANGE endselection = {};
LONG lines_before = 0, lines_after;
CHARFORMAT format;

View file

@ -113,7 +113,7 @@ CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
{
FStartupScreen *scr = NULL;
HRESULT hr;
HRESULT hr = -1;
if (!Args->CheckParm("-nostartup"))
{

View file

@ -751,9 +751,9 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, long& hr)
if (lumpnum >= 0 && (lumplen = fileSystem.FileLength(lumpnum)) == StrifeStartupPicSizes[i])
{
auto lumpr = fileSystem.OpenFileReader(lumpnum);
auto lumpr1 = fileSystem.OpenFileReader(lumpnum);
StartupPics[i] = new uint8_t[lumplen];
lumpr.Read(StartupPics[i], lumplen);
lumpr1.Read(StartupPics[i], lumplen);
}
}

View file

@ -423,8 +423,6 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
}
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
const char *version = Args->CheckValue("-glversion");
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
{

View file

@ -326,7 +326,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
{
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
int flags = mat->GetScaleFlags();
int numLayers = mat->NumLayers();
MaterialLayerInfo* layer;
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &layer));

View file

@ -301,8 +301,6 @@ void FHardwareTexture::BindToFrameBuffer(int width, int height)
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
{
int usebright = false;
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
// Bind it to the system.

View file

@ -444,8 +444,6 @@ bool FGLRenderBuffers::CheckFrameBufferCompleteness()
if (result == GL_FRAMEBUFFER_COMPLETE)
return true;
bool FailedCreate = true;
if (gl_debug_level > 0)
{
FString error = "glCheckFramebufferStatus failed: ";

View file

@ -318,7 +318,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
lastClamp = clampmode;
lastTranslation = translation;
int usebright = false;
int maxbound = 0;
int numLayers = mat->NumLayers();

View file

@ -286,7 +286,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
{
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
int flags = mat->GetScaleFlags();
int numLayers = mat->NumLayers();
MaterialLayerInfo* layer;
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &layer));

View file

@ -166,9 +166,6 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
void FHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
{
int rw = GetTexDimension(w);
int rh = GetTexDimension(h);
if (texelsize < 1 || texelsize > 4) texelsize = 4;
glTextureBytes = texelsize;
bufferpitch = w;
@ -287,8 +284,6 @@ void FHardwareTexture::BindToFrameBuffer(int width, int height)
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
{
int usebright = false;
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
// Bind it to the system.

View file

@ -161,7 +161,6 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
for (size_t n = 0; n < mPresentShader->Uniforms.mFields.size(); n++)
{
int index = -1;
UniformFieldDesc desc = mPresentShader->Uniforms.mFields[n];
int loc = mPresentShader->Uniforms.UniformLocation[n];
switch (desc.Type)

View file

@ -302,9 +302,6 @@ namespace OpenGLESRenderer
if (result == GL_FRAMEBUFFER_COMPLETE)
return true;
bool FailedCreate = true;
FString error = "glCheckFramebufferStatus failed: ";
switch (result)
{

View file

@ -110,7 +110,6 @@ FGLRenderer::~FGLRenderer()
bool FGLRenderer::StartOffscreen()
{
bool firstBind = (mFBID == 0);
if (mFBID == 0)
glGenFramebuffers(1, &mFBID);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mOldFBID);

View file

@ -458,7 +458,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
lastClamp = clampmode;
lastTranslation = translation;
int usebright = false;
int maxbound = 0;
int numLayers = mat->NumLayers();

View file

@ -392,7 +392,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
assert(screen->mLights != NULL);
bool lightbuffertype = screen->mLights->GetBufferType();
unsigned int lightbuffersize = screen->mLights->GetBlockSize();
vp_comb.Format("#version 100\n#define NUM_UBO_LIGHTS %d\n#define NO_CLIPDISTANCE_SUPPORT\n", lightbuffersize);
@ -851,7 +850,7 @@ void FShaderCollection::CompileShaders(EPassType passType)
mMaterialShaders.Push(shc);
if (i < SHADER_NoTexture)
{
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
mMaterialShadersNAT.Push(shc);
}
}

View file

@ -149,7 +149,6 @@ std::pair<FFlatVertex *, unsigned int> FFlatVertexBuffer::AllocVertices(unsigned
{
FFlatVertex *p = GetBuffer();
auto index = mCurIndex.fetch_add(count);
auto offset = index;
if (index + count >= BUFFER_SIZE_TO_USE)
{
// If a single scene needs 2'000'000 vertices there must be something very wrong.

View file

@ -152,7 +152,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
char *chars = code.LockBuffer();
ptrdiff_t startIndex = 0;
ptrdiff_t startpos, endpos;
ptrdiff_t startpos, endpos = 0;
while (true)
{
ptrdiff_t matchIndex = code.IndexOf("layout(binding", startIndex);
@ -216,7 +216,6 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
{
ptrdiff_t len = code.Len();
char *chars = code.LockBuffer();
ptrdiff_t startIndex = 0;

View file

@ -89,7 +89,6 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
for(auto &cmd : commands)
{
int gltrans = -1;
state.SetRenderStyle(cmd.mRenderStyle);
state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
state.EnableFog(2); // Special 2D mode 'fog'.

View file

@ -105,7 +105,6 @@ namespace
// minimum set in GZDoom 4.0.0, but only while those fonts are required.
static bool lastspecialUI = false;
bool isInActualMenu = false;
bool specialUI = (!sysCallbacks.IsSpecialUI || sysCallbacks.IsSpecialUI());

View file

@ -374,8 +374,6 @@ void V_InitScreen()
void V_Init2()
{
float gamma = static_cast<DDummyFrameBuffer *>(screen)->Gamma;
{
DFrameBuffer *s = screen;
screen = NULL;

View file

@ -347,8 +347,6 @@ void VulkanDevice::CreateInstance()
VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* callbackData, void* userData)
{
VulkanDevice *device = (VulkanDevice*)userData;
static std::mutex mtx;
static std::set<FString> seenMessages;
static int totalMessages;

View file

@ -421,7 +421,6 @@ IDataBuffer *VulkanFrameBuffer::CreateDataBuffer(int bindingpoint, bool ssbo, bo
{
auto buffer = new VKDataBuffer(bindingpoint, ssbo, needsresize);
auto fb = GetVulkanFrameBuffer();
switch (bindingpoint)
{
case LIGHTBUF_BINDINGPOINT: LightBufferSSO = buffer; break;

View file

@ -2436,7 +2436,7 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
ExpEmit result;
bool intconst = false;
int intconstval;
int intconstval = 0;
if (Right->isConstant() && Right->ValueType->GetRegType() == REGT_INT)
{
@ -4396,7 +4396,7 @@ ExpEmit FxBinaryLogical::Emit(VMFunctionBuilder *build)
build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 1 : 0);
build->Emit(OP_JMP, 1);
build->BackpatchListToHere(no);
auto ctarget = build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 0 : 1);
build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 0 : 1);
list.DeleteAndClear();
list.ShrinkToFit();
return to;
@ -8036,7 +8036,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
}
// No need to create a dedicated node here, all builtins map directly to trivial operations.
Self->ValueType = TypeSInt32; // all builtins treat the texture index as integer.
FxExpression *x;
FxExpression *x = nullptr;
switch (MethodName.GetIndex())
{
case NAME_IsValid:

View file

@ -265,7 +265,7 @@ void VMDumpConstants(FILE *out, const VMScriptFunction *func)
void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction *func)
{
VMFunction *callfunc;
VMFunction *callfunc = nullptr;
const char *name;
int col;
int mode;
@ -665,7 +665,6 @@ static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const
default:
return col+printf_wrapper(out, "$%d", arg);
}
return col;
}
//==========================================================================

View file

@ -1302,12 +1302,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
fb = reg.f[B]; fc = konstf[C];
goto Do_MODF;
NEXTOP;
OP(MODF_KR):
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
fb = konstf[B]; fc = reg.f[C];
goto Do_MODF;
NEXTOP;
OP(POWF_RR):
ASSERTF(a); ASSERTF(B); ASSERTF(C);
@ -1712,7 +1710,6 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
// PrintParameters(reg.param + f->NumParam - B, B);
throw;
}
return 0;
}
static double DoFLOP(int flop, double v)

View file

@ -694,7 +694,6 @@ void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...)
va_list ap;
va_start(ap, moreinfo);
throw CVMAbortException(reason, moreinfo, ap);
va_end(ap);
}
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...)
@ -706,7 +705,6 @@ void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
throw err;
va_end(ap);
}
DEFINE_ACTION_FUNCTION(DObject, ThrowAbortException)

View file

@ -618,8 +618,6 @@ void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flag
{
double texwidth = tex->GetDisplayWidth() * scaleX;
double texheight = tex->GetDisplayHeight() * scaleY;
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
// resolve auto-alignment before making any adjustments to the position values.
if (!(flags & DI_SCREEN_MANUAL_ALIGN))

View file

@ -296,7 +296,7 @@ TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
while (cinfo.output_scanline < cinfo.output_height)
{
int num_scanlines = jpeg_read_scanlines(&cinfo, &buff, 1);
jpeg_read_scanlines(&cinfo, &buff, 1);
uint8_t *in = buff;
uint8_t *out = Pixels.Data() + y;
switch (cinfo.out_color_space)

View file

@ -383,7 +383,7 @@ TArray<uint8_t> FPCXTexture::CreatePalettedPixels(int conversion)
else if (bitcount == 8)
{
lump.Seek(-769, FileReader::SeekEnd);
uint8_t c = lump.ReadUInt8();
lump.ReadUInt8();
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
//else
for(int i=0;i<256;i++)

View file

@ -85,7 +85,6 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion)
FString name;
fileSystem.GetFileShortName(name, SourceLump);
std::pair<int, int> *info = nullptr;
auto imageID = ImageID;
// Do we have this image in the cache?
@ -201,7 +200,6 @@ FBitmap FImageSource::GetCachedBitmap(const PalEntry *remap, int conversion, int
int trans = -1;
fileSystem.GetFileShortName(name, SourceLump);
std::pair<int, int> *info = nullptr;
auto imageID = ImageID;
if (remap != nullptr)

View file

@ -853,7 +853,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
ResolvePatches(bi);
}
// Now try to resolve the images. We only can do this at the end when all multipatch textures are set up.
int i = 0;
// reverse the list so that the Delete operation in the loop below deletes at the end.
// For normal sized lists this is of no real concern, but Total Chaos has over 250000 textures where this becomes a performance issue.

View file

@ -717,7 +717,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
sc.String[8]=0;
tlist.Clear();
int amount = ListTextures(sc.String, tlist);
ListTextures(sc.String, tlist);
FName texname = sc.String;
sc.MustGetString();
@ -919,7 +919,6 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
{
int firsttexture = Textures.Size();
int lumpcount = fileSystem.GetNumEntries();
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
FirstTextureForFile.Push(firsttexture);

View file

@ -85,8 +85,6 @@ compare_right(nat_char const *a, nat_char const *b)
} else if (!*a && !*b)
return bias;
}
return 0;
}
@ -107,8 +105,6 @@ compare_left(nat_char const *a, nat_char const *b)
else if (*a > *b)
return +1;
}
return 0;
}

View file

@ -903,7 +903,6 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
fr.Seek(33, FileReader::SeekSet);
fr.Read(&len, 4);
fr.Read(&id, 4);
bool succeeded = false;
while (id != MAKE_ID('I', 'D', 'A', 'T') && id != MAKE_ID('I', 'E', 'N', 'D'))
{
len = BigLong((unsigned int)len);

View file

@ -428,7 +428,6 @@ int getAlternative(int code)
case 0x457: return 0xef;
case 0x458: return 'j';
}
return code;
}
//==========================================================================

View file

@ -318,9 +318,9 @@ namespace StringFormat
*/
const char *decimal_point = ".";/* locale specific decimal point */
int signflag; /* true if float is negative */
int expt; /* integer value of exponent */
int expt = 0; /* integer value of exponent */
char expchar = 'e'; /* exponent character: [eEpP\0] */
char *dtoaend; /* pointer to end of converted digits */
char* dtoaend = nullptr; /* pointer to end of converted digits */
int expsize = 0; /* character count for expstr */
int ndig = 0; /* actual number of digits returned by dtoa */
char expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */

View file

@ -680,15 +680,12 @@ void DrawOverheadMap(int pl_x, int pl_y, int pl_angle, double const smoothratio)
int y = follow_y;
follow_a = am_rotate ? pl_angle : 0;
AutomapControl();
int width = screen->GetWidth();
if (automapMode == am_full)
{
twod->ClearScreen();
renderDrawMapView(x, y, gZoom, follow_a);
}
int32_t tmpydim = (width * 5) / 8;
drawredlines(x, y, gZoom, follow_a);
drawwhitelines(x, y, gZoom, follow_a);
if (!gi->DrawAutomapPlayer(x, y, gZoom, follow_a, smoothratio))

View file

@ -318,7 +318,7 @@ void parseCopyTile(FScanner& sc, FScriptPosition& pos)
FScanner::SavedPos blockend;
int tile = -1, source = -1;
int havetile = 0, xoffset = -1024, yoffset = -1024;
int flags = 0, tsiz = 0, temppal = -1, tempsource = -1;
int flags = 0, temppal = -1, tempsource = -1;
if (!sc.GetNumber(tile, true)) return;
@ -1953,7 +1953,7 @@ void parseModel(FScanner& sc, FScriptPosition& pos)
FString modelfn;
double scale = 1.0, mzadd = 0.0, myoffset = 0.0;
int32_t shadeoffs = 0, pal = 0, flags = 0;
int32_t shadeoffs = 0, flags = 0;
FixedBitArray<1024> usedframes;
usedframes.Zero();

View file

@ -697,7 +697,6 @@ CCMD(mapinfo)
int lump = fileSystem.FindFile(map->fileName);
if (lump >= 0)
{
int rfnum = fileSystem.GetFileContainer(lump);
Printf("map %s \"%s\"\n{\n", map->labelName.GetChars(), map->DisplayName());
Printf("\tlevelnum = %d\n\tCluster = %d\n", map->levelNumber, map->cluster);
if (map->Author.IsNotEmpty())
@ -1049,9 +1048,6 @@ void FMapInfoParser::ParseCutsceneInfo()
FString map;
FString pic;
FString name;
bool remove = false;
char key = 0;
int flags = 0;
ParseOpenBrace();
@ -1107,9 +1103,6 @@ void FMapInfoParser::ParseGameInfo()
FString map;
FString pic;
FString name;
bool remove = false;
char key = 0;
int flags = 0;
ParseOpenBrace();
@ -1302,10 +1295,6 @@ void G_ParseMapInfo ()
int lump, lastlump = 0;
MapRecord gamedefaults;
// first parse the internal one which sets up the needed basics and patches the legacy definitions of each game.
FMapInfoParser parse;
MapRecord defaultinfo;
// Parse internal RMAPINFOs.
while ((lump = fileSystem.FindLumpFullName("engine/rmapinfo.txt", &lastlump, false)) != -1)
{

View file

@ -326,7 +326,6 @@ void FGameConfigFile::DoGameSetup (const char *gamename)
strncpy (subsection, "ConsoleAliases", sublen);
if (SetSection (section))
{
const char *name = NULL;
while (NextInSection (key, value))
{
FStringf cmd("alias %s \"%s\"", key, value);

View file

@ -1029,7 +1029,6 @@ int RunGame()
palindexmap[0] = 255;
for (int i = 1; i <= 255; i++) palindexmap[i] = i;
GPalette.Init(MAXPALOOKUPS + 2, palindexmap); // one slot for each translation, plus a separate one for the base palettes and the internal one
int v = ColorMatcher.Pick(0, 0, 0);
gi->loadPalette();
StartScreen->Progress();
InitTextures();
@ -1396,7 +1395,6 @@ CVAR(Int, crosshair, 0, CVAR_ARCHIVE)
void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double scale, PalEntry color)
{
int type = -1;
if (automapMode == am_off && cl_crosshair)
{
if (deftile < MAXTILES && crosshair == 0)

View file

@ -134,7 +134,6 @@ inline void copyfloorpal(spritetype* spr, const sectortype* sect)
inline void spriteSetSlope(spritetype* spr, int heinum)
{
int cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK;
if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
spr->xoffset = heinum & 255;

View file

@ -413,14 +413,13 @@ static void BuildEpisodeMenu()
double y = ld->mYpos;
// Volume definitions should be sorted by intended menu order.
auto font = PickSmallFont();
for (auto &vol : volumes)
{
if (vol.name.IsNotEmpty() && !(vol.flags & VF_HIDEFROMSP))
{
int isShareware = ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && (vol.flags & VF_SHAREWARELOCK));
bool isShareware = ((g_gameType & GAMEFLAG_DUKE) && (g_gameType & GAMEFLAG_SHAREWARE) && (vol.flags & VF_SHAREWARELOCK));
auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing, vol.name[0],
vol.name, ld->mFont, CR_UNTRANSLATED, isShareware, NAME_Skillmenu, vol.index); // font colors are not used, so hijack one for the shareware flag.
vol.name, ld->mFont, CR_UNTRANSLATED, int(isShareware), NAME_Skillmenu, vol.index); // font colors are not used, so hijack one for the shareware flag.
y += ld->mLinespacing;
ld->mItems.Push(it);

View file

@ -251,7 +251,6 @@ void LookupTableInfo::postLoadLookups()
{
int numpalettes = GPalette.NumTranslations(Translation_BasePalettes);
if (numpalettes == 0) return;
auto basepalette = GPalette.GetTranslation(Translation_BasePalettes, 0);
for (int i = 0; i < numpalettes; i++)
{

View file

@ -246,7 +246,7 @@ void WriteSavePic(FileWriter* file, int width, int height)
savefile = file;
savewidth = width;
saveheight = height;
bool didit = gi->GenerateSavePic();
/*bool didit =*/ gi->GenerateSavePic();
writingsavepic = false;
xdim = oldx;
ydim = oldy;

View file

@ -487,7 +487,6 @@ void HWDrawInfo::CreateScene(bool portal)
void HWDrawInfo::RenderScene(FRenderState &state)
{
const auto &vp = Viewpoint;
RenderAll.Clock();
state.SetDepthMask(true);
@ -675,7 +674,6 @@ void HWDrawInfo::DrawScene(int drawmode, bool portal)
{
static int recursion = 0;
static int ssao_portals_available = 0;
const auto& vp = Viewpoint;
bool applySSAO = false;
if (drawmode == DM_MAINVIEW)

View file

@ -317,8 +317,6 @@ void HWPortal::RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestenci
bool needdepth = NeedDepthBuffer();
// Restore the old view
auto &vp = di->Viewpoint;
//if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
if (usestencil)
{

View file

@ -37,8 +37,6 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
{
int indexed = hw_int_useindexedcolortextures;
hw_int_useindexedcolortextures = false; // this code does not work with indexed textures.
bool drawBoth = false;
auto &vp = di->Viewpoint;
if (di->isSoftwareLighting())
{
@ -64,7 +62,6 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
else if (!origin->cloudy)
{
auto tex = origin->texture;
float texw = tex->GetDisplayWidth();
float texh = tex->GetDisplayHeight();
auto& modelMatrix = state.mModelMatrix;
auto& textureMatrix = state.mTextureMatrix;

View file

@ -56,7 +56,6 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
{
bool additivefog = false;
bool foglayer = false;
auto& vp = di->Viewpoint;
if (translucent)
{

View file

@ -1052,8 +1052,6 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
PlanesAtPoint(backsector, wal->x, wal->y, &bch1, &bfh1);
PlanesAtPoint(backsector, p2wall->x, p2wall->y, &bch2, &bfh2);
float zalign = 0.f;
SkyTop(di, wal, frontsector, backsector, v1, v2, fch1, fch2);
SkyBottom(di, wal, frontsector, backsector, v1, v2, ffh1, ffh2);

View file

@ -157,7 +157,7 @@ void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
FString path;
for (int i = 0; entry.subpaths[i]; i++)
{
path.Format("%s%s", buf, entry.subpaths[i]);
path.Format("%s%s", buf.GetChars(), entry.subpaths[i]);
AddSearchPath(searchpaths, path);
}
}

View file

@ -295,7 +295,7 @@ bool SectorGeometry::MakeVertices(unsigned int secnum, int plane, const FVector2
{
for (auto& pt : polygon[a])
{
float planez;
float planez = 0;
PlanesAtPoint(sectorp, (pt.first * 16), (pt.second * -16), plane ? &planez : nullptr, !plane ? &planez : nullptr);
FVector3 point = { pt.first, pt.second, planez };
points[p++] = point;
@ -523,7 +523,7 @@ nexti:;
{
auto& pt = entry.vertices[i];
float planez;
float planez = 0;
PlanesAtPoint(sectorp, (pt.X * 16), (pt.Y * -16), plane ? &planez : nullptr, !plane ? &planez : nullptr);
entry.vertices[i].Z = planez;
entry.texcoords[i] = uvcalc.GetUV(int(pt.X * 16.), int(pt.Y * -16.), pt.Z);

View file

@ -109,7 +109,6 @@ void setViewport(int viewSize)
reserved.top = xs_CRoundToInt((reserved.top * hud_scalefactor * ydim) / 200);
reserved.statusbar = xs_CRoundToInt((reserved.statusbar * hud_scalefactor * ydim) / 200);
int xdimcorrect = min(Scale(ydim, 4, 3), xdim);
if (viewSize > Hud_Stbar)
{
x0 = 0;

View file

@ -411,7 +411,6 @@ bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flag
bool foggy = state && (state->GetFogColor() & 0xffffff);
if (PickTexture(tex, translation, pick, hw_int_useindexedcolortextures && !foggy))
{
int TextureType = (pick.translation & 0x80000000) ? TT_INDEXED : TT_TRUECOLOR;
int lookuppal = pick.translation & 0x7fffffff;
if (pick.translation & 0x80000000)

View file

@ -124,8 +124,6 @@ void processSpritesOnOtherSideOfPortal(int x, int y, int interpolation)
void render3DViewPolymost(int nSectnum, int cX, int cY, int cZ, binangle cA, fixedhoriz cH)
{
int yxAspect = yxaspect;
int viewingRange = viewingrange;
videoSetCorrectedAspect();
int v1 = xs_CRoundToInt(double(viewingrange) * tan(r_fov * (pi::pi() / 360.)));
@ -252,7 +250,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{
renderPrepareMirror(x, y, z, a, horiz, nWall, &cx, &cy, &ca);
}
int32_t didmirror = renderDrawRoomsQ16(cx, cy, z, ca, horiz, mirrorsector, true);
renderDrawRoomsQ16(cx, cy, z, ca, horiz, mirrorsector, true);
viewProcessSprites(pm_tsprite, pm_spritesortcnt, cx, cy, z, FixedToInt(ca), smooth);
renderDrawMasks();
if (GetWallType(nWall) != kWallStack)
@ -267,7 +265,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{
r_rorphase = 1;
int nSector = mirror[i].link;
int bakCstat;
int bakCstat = 0;
if (viewPlayer >= 0)
{
bakCstat = gPlayer[viewPlayer].pSprite->cstat;
@ -299,7 +297,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{
r_rorphase = 1;
int nSector = mirror[i].link;
int bakCstat;
int bakCstat = 0;
if (viewPlayer >= 0)
{
bakCstat = gPlayer[viewPlayer].pSprite->cstat;

View file

@ -2437,7 +2437,6 @@ static void actInitDudes()
BloodStatIterator it(kStatDude);
while (auto act = it.Next())
{
spritetype* pSprite = &act->s();
if (act->hasX() && act->x().key > 0) // Drop Key
actDropObject(act, kItemKeyBase + (act->x().key - 1));
DeleteSprite(act);
@ -2852,7 +2851,6 @@ static DBloodActor* actDropKey(DBloodActor* actor, int nType)
if (act2 && gGameOptions.nGameType == 1)
{
act2->addX();
auto pSprite2 = &act2->s();
act2->x().respawn = 3;
act2->hit.florhit = 0;
act2->hit.ceilhit = 0;
@ -3334,7 +3332,6 @@ static void burningCultistDeath(DBloodActor* actor, int nSeq)
static void modernCustomDudeDeath(DBloodActor* actor, int nSeq, int damageType)
{
auto pSprite = &actor->s();
auto pXSprite = &actor->x();
playGenDudeSound(actor, kGenDudeSndDeathNormal);
@ -3363,8 +3360,6 @@ static void modernCustomDudeDeath(DBloodActor* actor, int nSeq, int damageType)
static void modernCustomDudeBurningDeath(DBloodActor* actor, int nSeq)
{
auto pSprite = &actor->s();
playGenDudeSound(actor, kGenDudeSndDeathExplode);
int dudeToGib = (actCheckRespawn(actor)) ? -1 : nDudeToGibClient1;
@ -3436,7 +3431,6 @@ static void zombieButcherDeath(DBloodActor* actor, int nSeq)
static void genericDeath(DBloodActor* actor, int nSeq, int sound1, int seqnum)
{
auto pSprite = &actor->s();
if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(actor, sound1 + 2, -1, 0);
else sfxPlay3DSound(actor, sound1 + Random(2), -1, 0);
seqSpawn(seqnum, actor, -1);
@ -3450,11 +3444,9 @@ static void genericDeath(DBloodActor* actor, int nSeq, int sound1, int seqnum)
void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damageType, int damage)
{
spritetype* pKillerSprite = &killerActor->s();
auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax&& actor->hasX());
int nType = pSprite->type - kDudeBase;
XSPRITE* pXSprite = &actor->x();
if (actKillDudeStage1(actor, damageType)) return;
@ -4406,7 +4398,6 @@ static void checkHit(DBloodActor* actor)
static void checkFloorHit(DBloodActor* actor)
{
auto pSprite = &actor->s();
auto pXSprite = actor->hasX() ? &actor->x() : nullptr;
Collision coll(actor->hit.florhit);
switch (coll.type)
@ -4626,7 +4617,6 @@ static Collision MoveThing(DBloodActor* actor)
{
auto pSprite = &actor->s();
assert(actor->hasX());
XSPRITE* pXSprite = &actor->x();
assert(pSprite->type >= kThingBase && pSprite->type < kThingMax);
const THINGINFO* pThingInfo = &thingInfo[pSprite->type - kThingBase];
int nSector = pSprite->sectnum;
@ -5330,7 +5320,6 @@ void MoveDude(DBloodActor* actor)
int MoveMissile(DBloodActor* actor)
{
auto pSprite = &actor->s();
auto pXSprite = &actor->x();
auto Owner = actor->GetOwner();
int cliptype = -1;
int bakCstat = 0;
@ -5358,8 +5347,6 @@ int MoveMissile(DBloodActor* actor)
RotatePoint(&vx, &vy, (nTargetAngle + 1536) & 2047, 0, 0);
actor->xvel = vx;
actor->yvel = vy;
int dx = pTarget->x - pSprite->x;
int dy = pTarget->y - pSprite->y;
int dz = pTarget->z - pSprite->z;
int deltaz = dz / 10;
@ -7336,7 +7323,6 @@ void actPostProcess(void)
void MakeSplash(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
pSprite->flags &= ~2;
pSprite->z -= 4 << 8;

View file

@ -1527,7 +1527,6 @@ void RecoilDude(DBloodActor* actor)
void aiThinkTarget(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);

View file

@ -64,7 +64,6 @@ AISTATE batDodgeDownLeft = { kAiStateMove, 6, -1, 90, NULL, batMoveDodgeDown, 0,
void batBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
@ -135,7 +134,6 @@ static void batThinkTarget(DBloodActor* actor)
static void batThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
batThinkTarget(actor);
}
@ -158,7 +156,6 @@ static void batThinkGoto(DBloodActor* actor)
static void batThinkPonder(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{
@ -266,7 +263,6 @@ static void batMoveDodgeDown(DBloodActor* actor)
static void batThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -65,7 +65,6 @@ AISTATE beast138FEC = { kAiStateOther, 9, -1, 120, NULL, aiMoveTurn, NULL, &beas
void SlashSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
@ -84,7 +83,6 @@ void SlashSeqCallback(int, DBloodActor* actor)
void StompSeqCallback(int, DBloodActor* actor1)
{
uint8_t sectmap[(kMaxSectors + 7) >> 3];
XSPRITE* pXSprite = &actor1->x();
spritetype* pSprite = &actor1->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -176,7 +174,6 @@ void StompSeqCallback(int, DBloodActor* actor1)
static void MorphToBeast(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
actHealDude(actor, dudeInfo[51].startHealth, dudeInfo[51].startHealth);
pSprite->type = kDudeBeast;
@ -185,7 +182,6 @@ static void MorphToBeast(DBloodActor* actor)
static void beastThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -219,7 +215,6 @@ static void beastThinkGoto(DBloodActor* actor)
static void beastThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{
@ -398,7 +393,6 @@ static void beastThinkSwimGoto(DBloodActor* actor)
static void beastThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -63,7 +63,6 @@ AISTATE eelDodgeDownLeft = { kAiStateMove, 0, -1, 90, NULL, eelMoveDodgeDown, NU
void eelBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
/*
@ -149,7 +148,6 @@ static void eelThinkTarget(DBloodActor* actor)
static void eelThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
eelThinkTarget(actor);
}
@ -172,7 +170,6 @@ static void eelThinkGoto(DBloodActor* actor)
static void eelThinkPonder(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{
@ -279,7 +276,6 @@ static void eelMoveDodgeDown(DBloodActor* actor)
static void eelThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -78,7 +78,6 @@ void BurnSeqCallback(int, DBloodActor*)
static void burnThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -128,7 +127,6 @@ static void burnThinkGoto(DBloodActor* actor)
static void burnThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -85,7 +85,6 @@ void SeqAttackCallback(int, DBloodActor* actor)
static void calebThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -119,7 +118,6 @@ static void calebThinkGoto(DBloodActor* actor)
static void calebThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{
@ -263,7 +261,6 @@ static void calebThinkSwimGoto(DBloodActor* actor)
static void calebThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -58,7 +58,6 @@ AISTATE cerberus1398AC = { kAiStateOther, 7, -1, 120, NULL, aiMoveTurn, NULL, &c
void cerberusBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -77,7 +76,6 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
void cerberusBurnSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight * pSprite->yrepeat;
@ -155,7 +153,6 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
void cerberusBurnSeqCallback2(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
@ -238,7 +235,6 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
static void cerberusThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -336,7 +332,6 @@ static void cerberusThinkGoto(DBloodActor* actor)
static void cerberusThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr) {
switch (pSprite->type) {

View file

@ -75,7 +75,6 @@ AISTATE cultistSwimRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &culti
void TommySeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -89,7 +88,6 @@ void TommySeqCallback(int, DBloodActor* actor)
void TeslaSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (Chance(dword_138BB0[gGameOptions.nDifficulty]))
{
@ -106,7 +104,6 @@ void TeslaSeqCallback(int, DBloodActor* actor)
void ShotSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -129,7 +126,6 @@ void ShotSeqCallback(int, DBloodActor* actor)
void cultThrowSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2)
@ -155,8 +151,6 @@ void cultThrowSeqCallback(int, DBloodActor* actor)
void sub_68170(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2)
nMissile = kThingArmedTNTBundle;
@ -167,7 +161,6 @@ void sub_68170(int, DBloodActor* actor)
void sub_68230(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2)

View file

@ -72,14 +72,12 @@ AISTATE statueFBreakSEQ = { kAiStateOther, 5, -1, 0, entryFStatue, NULL, playSta
AISTATE statueSBreakSEQ = { kAiStateOther, 5, -1, 0, entrySStatue, NULL, playStatueBreakSnd, &gargoyleSMorph2 };
static void playStatueBreakSnd(DBloodActor* actor) {
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiPlay3DSound(actor, 313, AI_SFX_PRIORITY_1, -1);
}
void SlashFSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
@ -101,8 +99,6 @@ void SlashFSeqCallback(int, DBloodActor* actor)
void ThrowFSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
actFireThing(actor, 0, 0, actor->dudeSlope - 7500, kThingBone, 0xeeeee);
}
@ -114,8 +110,6 @@ void BlastSSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
int height = (pSprite->yrepeat * getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX - pSprite->x;
int dy = pXSprite->targetY - pSprite->y;
int x = pSprite->x;
int y = pSprite->y;
int z = height;
@ -353,7 +347,6 @@ static void gargMoveDodgeDown(DBloodActor* actor)
static void gargThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -63,7 +63,6 @@ AISTATE ghostDodgeDownLeft = { kAiStateMove, 0, -1, 90, NULL, ghostMoveDodgeDown
void ghostSlashSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
@ -97,8 +96,6 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
int height = (pSprite->yrepeat * getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX - pSprite->x;
int dy = pXSprite->targetY - pSprite->y;
int x = pSprite->x;
int y = pSprite->y;
int z = height;
@ -243,7 +240,6 @@ static void ghostThinkTarget(DBloodActor* actor)
static void ghostThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}

View file

@ -60,7 +60,6 @@ AISTATE gillBeast13A170 = { kAiStateOther, 10, -1, 120, NULL, NULL, aiMoveTurn,
void GillBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
@ -77,7 +76,6 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
static void gillThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -111,7 +109,6 @@ static void gillThinkGoto(DBloodActor* actor)
static void gillThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{
@ -252,7 +249,6 @@ static void gillThinkSwimGoto(DBloodActor* actor)
static void gillThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -44,8 +44,6 @@ AISTATE handJump = { kAiStateChase, 7, nJumpClient, 120, NULL, NULL, NULL, &hand
void HandJumpSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
if (IsPlayerSprite(pTarget))
@ -62,7 +60,6 @@ void HandJumpSeqCallback(int, DBloodActor* actor)
static void handThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -85,7 +82,6 @@ static void handThinkGoto(DBloodActor* actor)
static void handThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -45,7 +45,6 @@ AISTATE houndBurn = { kAiStateChase, 7, nHoundBurnClient, 60, NULL, NULL, NULL,
void houndBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -75,7 +74,6 @@ void houndBurnSeqCallback(int, DBloodActor* actor)
static void houndThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -103,7 +101,6 @@ static void houndThinkGoto(DBloodActor* actor)
static void houndThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -63,7 +63,6 @@ void sub_6FF54(int, DBloodActor* actor)
void podAttack(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
@ -133,7 +132,6 @@ void sub_70284(int, DBloodActor* actor)
static void aiPodSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -171,7 +169,6 @@ static void aiPodMove(DBloodActor* actor)
static void aiPodChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr) {
switch (pSprite->type) {

View file

@ -44,7 +44,6 @@ AISTATE ratBite = { kAiStateChase, 6, nRatBiteClient, 120, NULL, NULL, NULL, &ra
void ratBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -58,7 +57,6 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
static void ratThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -81,7 +79,6 @@ static void ratThinkGoto(DBloodActor* actor)
static void ratThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -63,7 +63,6 @@ static char spidBlindEffect(DBloodActor* dudeactor, int nBlind, int max)
void SpidBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -75,7 +74,6 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
auto const target = actor->GetTarget();
spritetype* pTarget = &target->s();
XSPRITE* pXTarget = &target->x();
if (IsPlayerSprite(pTarget))
{
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
@ -115,7 +113,6 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
void SpidJumpSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = bcos(pSprite->ang);
int dy = bsin(pSprite->ang);
@ -176,7 +173,6 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
static void spidThinkSearch(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -199,7 +195,6 @@ static void spidThinkGoto(DBloodActor* actor)
static void spidThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

View file

@ -48,8 +48,6 @@ AISTATE tcherno13AA28 = { kAiStateChase, 8, -1, 60, NULL, aiMoveTurn, NULL, &tch
void sub_71A90(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
if (target->x().burnTime == 0)
@ -61,7 +59,6 @@ void sub_71A90(int, DBloodActor* actor)
void sub_71BD4(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat * pDudeInfo->eyeHeight;
@ -131,7 +128,6 @@ void sub_71BD4(int, DBloodActor* actor)
void sub_720AC(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!actor->ValidateTarget(__FUNCTION__)) return;
@ -207,7 +203,6 @@ void sub_720AC(int, DBloodActor* actor)
static void sub_72580(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
aiChooseDirection(actor, pXSprite->goalAng);
aiThinkTarget(actor);
}
@ -293,7 +288,6 @@ static void sub_72850(DBloodActor* actor)
static void sub_72934(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (actor->GetTarget() == nullptr)
{

Some files were not shown because too many files have changed in this diff Show more