mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- addressed more shadowed variables in common code.
This commit is contained in:
parent
0bb4ec7c33
commit
9e14b168bb
39 changed files with 193 additions and 203 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1430,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,12 +292,12 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
auto position = strtoll(base.GetChars(), &endp, 16);
|
||||
if ((*endp == 0 || (*endp == '.' && position >= '!' && position < 0xffff)))
|
||||
{
|
||||
auto lump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||
if (lump.isValid())
|
||||
auto texlump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||
if (texlump.isValid())
|
||||
{
|
||||
if ((int)position < minchar) minchar = (int)position;
|
||||
if ((int)position > maxchar) maxchar = (int)position;
|
||||
auto tex = TexMan.GetGameTexture(lump);
|
||||
auto tex = TexMan.GetGameTexture(texlump);
|
||||
tex->SetScale((float)Scale.X, (float)Scale.Y);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
|
@ -313,10 +313,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
auto charlump = charMap.CheckKey(FirstChar + i);
|
||||
if (charlump != nullptr)
|
||||
{
|
||||
auto pic = *lump;
|
||||
auto pic = *charlump;
|
||||
if (pic != nullptr)
|
||||
{
|
||||
double fheight = pic->GetDisplayHeight();
|
||||
|
@ -399,8 +399,8 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
part[0].OriginY = -height * y;
|
||||
part[0].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
||||
FImageTexture *tex = new FImageTexture(image);
|
||||
auto gtex = MakeGameTexture(tex, nullptr, ETextureType::FontChar);
|
||||
FImageTexture *imgtex = new FImageTexture(image);
|
||||
auto gtex = MakeGameTexture(imgtex, nullptr, ETextureType::FontChar);
|
||||
gtex->SetWorldPanning(true);
|
||||
gtex->SetOffsets(0, 0, 0);
|
||||
gtex->SetOffsets(1, 0, 0);
|
||||
|
|
|
@ -309,9 +309,9 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
|||
}
|
||||
|
||||
Palette[0] = 0;
|
||||
for (int i = 1; i < ActiveColors; i++)
|
||||
for (int pp = 1; pp < ActiveColors; pp++)
|
||||
{
|
||||
Palette[i] = PalEntry(255, palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]);
|
||||
Palette[pp] = PalEntry(255, palette[pp * 3], palette[pp * 3 + 1], palette[pp * 3 + 2]);
|
||||
}
|
||||
|
||||
data_p = palette + ActiveColors*3;
|
||||
|
|
|
@ -102,12 +102,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
|||
|
||||
if (charlumps[i] != nullptr)
|
||||
{
|
||||
auto pic = charlumps[i];
|
||||
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic, true);
|
||||
auto charpic = charlumps[i];
|
||||
Chars[i].OriginalPic = MakeGameTexture(charpic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(charpic, true);
|
||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic);
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(charpic, Chars[i].OriginalPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -725,9 +725,9 @@ static void CalcDefaultTranslation(FFont* base, int index)
|
|||
auto lum = otherluminosity[i];
|
||||
if (lum >= 0 && lum <= 1)
|
||||
{
|
||||
int index = int(lum * 255);
|
||||
remap[index] = GPalette.BaseColors[i];
|
||||
remap[index].a = 255;
|
||||
int lumidx = int(lum * 255);
|
||||
remap[lumidx] = GPalette.BaseColors[i];
|
||||
remap[lumidx].a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,12 +160,12 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
it = opt->GetItem("ConnectMessage2");
|
||||
if (it != nullptr) it->SetValue(0, !use_joystick);
|
||||
|
||||
for (int i = 0; i < (int)Joysticks.Size(); ++i)
|
||||
for (int ii = 0; ii < (int)Joysticks.Size(); ++ii)
|
||||
{
|
||||
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[i]->GetName(), Joysticks[i]);
|
||||
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[ii]->GetName(), Joysticks[ii]);
|
||||
GC::WriteBarrier(opt, it);
|
||||
opt->mItems.Push(it);
|
||||
if (i == itemnum) opt->mSelectedItem = opt->mItems.Size();
|
||||
if (ii == itemnum) opt->mSelectedItem = opt->mItems.Size();
|
||||
}
|
||||
if (opt->mSelectedItem >= (int)opt->mItems.Size())
|
||||
{
|
||||
|
@ -179,15 +179,15 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
|
||||
if (p != nullptr)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < Joysticks.Size(); ++i)
|
||||
unsigned ii;
|
||||
for (ii = 0; ii < Joysticks.Size(); ++ii)
|
||||
{
|
||||
if (Joysticks[i] == p)
|
||||
if (Joysticks[ii] == p)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == Joysticks.Size())
|
||||
if (ii == Joysticks.Size())
|
||||
{
|
||||
CurrentMenu->Close();
|
||||
}
|
||||
|
|
|
@ -567,8 +567,8 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
|||
// NB: index has been incremented, so we're not affecting the newly inserted item here.
|
||||
for (unsigned int i = insertIndex; i < desc->mItems.Size(); i++)
|
||||
{
|
||||
auto item = desc->mItems[i];
|
||||
if (item->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
||||
auto litem = desc->mItems[i];
|
||||
if (litem->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
||||
{
|
||||
desc->mItems[i]->mYpos += desc->mLinespacing;
|
||||
}
|
||||
|
@ -664,9 +664,9 @@ static bool FindMatchingItem(DMenuItemBase *desc)
|
|||
MenuDescriptorList::Pair *pair;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
for (auto it : pair->Value->mItems)
|
||||
for (auto item : pair->Value->mItems)
|
||||
{
|
||||
if (it->mAction == name && GetGroup(it) == grp) return true;
|
||||
if (item->mAction == name && GetGroup(item) == grp) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -151,8 +151,6 @@ int FSavegameManagerBase::InsertSaveNode(FSaveGameNode *node)
|
|||
|
||||
void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave)
|
||||
{
|
||||
FSaveGameNode *node;
|
||||
|
||||
if (file.IsEmpty())
|
||||
return;
|
||||
|
||||
|
@ -180,7 +178,7 @@ void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &tit
|
|||
}
|
||||
}
|
||||
|
||||
node = new FSaveGameNode;
|
||||
auto node = new FSaveGameNode;
|
||||
node->SaveTitle = title;
|
||||
node->Filename = file;
|
||||
node->bOldVersion = false;
|
||||
|
|
|
@ -98,7 +98,7 @@ static int FindGFXFile(FString & fn)
|
|||
|
||||
for (const char ** extp=extensions; *extp; extp++)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||
lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||
if (lump >= best) best = lump;
|
||||
}
|
||||
return best;
|
||||
|
|
|
@ -217,10 +217,10 @@ void FDMDModel::LoadGeometry()
|
|||
memcpy(lods[i].triangles, buffer + lodInfo[i].offsetTriangles, lodInfo[i].numTriangles * sizeof(FTriangle));
|
||||
for (int j = 0; j < lodInfo[i].numTriangles; j++)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int kk = 0; kk < 3; kk++)
|
||||
{
|
||||
lods[i].triangles[j].textureIndices[k] = LittleShort(lods[i].triangles[j].textureIndices[k]);
|
||||
lods[i].triangles[j].vertexIndices[k] = LittleShort(lods[i].triangles[j].vertexIndices[k]);
|
||||
lods[i].triangles[j].textureIndices[kk] = LittleShort(lods[i].triangles[j].textureIndices[kk]);
|
||||
lods[i].triangles[j].vertexIndices[kk] = LittleShort(lods[i].triangles[j].vertexIndices[kk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ void FDMDModel::BuildVertexBuffer(FModelRenderer *renderer)
|
|||
|
||||
FTriangle *tri = lods[0].triangles;
|
||||
|
||||
for (int i = 0; i < lodInfo[0].numTriangles; i++)
|
||||
for (int ii = 0; ii < lodInfo[0].numTriangles; ii++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -541,10 +541,10 @@ void FMD2Model::LoadGeometry()
|
|||
memcpy(lods[0].triangles, buffer + lodInfo[0].offsetTriangles, sizeof(FTriangle) * cnt);
|
||||
for (int j = 0; j < cnt; j++)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int kk = 0; kk < 3; kk++)
|
||||
{
|
||||
lods[0].triangles[j].textureIndices[k] = LittleShort(lods[0].triangles[j].textureIndices[k]);
|
||||
lods[0].triangles[j].vertexIndices[k] = LittleShort(lods[0].triangles[j].vertexIndices[k]);
|
||||
lods[0].triangles[j].textureIndices[kk] = LittleShort(lods[0].triangles[j].textureIndices[kk]);
|
||||
lods[0].triangles[j].vertexIndices[kk] = LittleShort(lods[0].triangles[j].vertexIndices[kk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,15 +164,15 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
md3_shader_t * shader = (md3_shader_t*)(((char*)ss) + LittleLong(ss->Ofs_Shaders));
|
||||
s->Skins.Resize(s->numSkins);
|
||||
|
||||
for (unsigned i = 0; i < s->numSkins; i++)
|
||||
for (unsigned ii = 0; ii < s->numSkins; ii++)
|
||||
{
|
||||
// [BB] According to the MD3 spec, Name is supposed to include the full path.
|
||||
// ... and since some tools seem to output backslashes, these need to be replaced with forward slashes to work.
|
||||
FixPathSeperator(shader[i].Name);
|
||||
s->Skins[i] = LoadSkin("", shader[i].Name);
|
||||
FixPathSeperator(shader[ii].Name);
|
||||
s->Skins[ii] = LoadSkin("", shader[ii].Name);
|
||||
// [BB] Fall back and check if Name is relative.
|
||||
if (!s->Skins[i].isValid())
|
||||
s->Skins[i] = LoadSkin(path, shader[i].Name);
|
||||
if (!s->Skins[ii].isValid())
|
||||
s->Skins[ii] = LoadSkin(path, shader[ii].Name);
|
||||
}
|
||||
}
|
||||
mLumpNum = lumpnum;
|
||||
|
@ -203,31 +203,31 @@ void FMD3Model::LoadGeometry()
|
|||
md3_triangle_t * tris = (md3_triangle_t*)(((char*)ss) + LittleLong(ss->Ofs_Triangles));
|
||||
s->Tris.Resize(s->numTriangles);
|
||||
|
||||
for (unsigned i = 0; i < s->numTriangles; i++) for (int j = 0; j < 3; j++)
|
||||
for (unsigned ii = 0; ii < s->numTriangles; ii++) for (int j = 0; j < 3; j++)
|
||||
{
|
||||
s->Tris[i].VertIndex[j] = LittleLong(tris[i].vt_index[j]);
|
||||
s->Tris[ii].VertIndex[j] = LittleLong(tris[ii].vt_index[j]);
|
||||
}
|
||||
|
||||
// Load texture coordinates
|
||||
md3_texcoord_t * tc = (md3_texcoord_t*)(((char*)ss) + LittleLong(ss->Ofs_Texcoord));
|
||||
s->Texcoords.Resize(s->numVertices);
|
||||
|
||||
for (unsigned i = 0; i < s->numVertices; i++)
|
||||
for (unsigned ii = 0; ii < s->numVertices; ii++)
|
||||
{
|
||||
s->Texcoords[i].s = tc[i].s;
|
||||
s->Texcoords[i].t = tc[i].t;
|
||||
s->Texcoords[ii].s = tc[ii].s;
|
||||
s->Texcoords[ii].t = tc[ii].t;
|
||||
}
|
||||
|
||||
// Load vertices and texture coordinates
|
||||
md3_vertex_t * vt = (md3_vertex_t*)(((char*)ss) + LittleLong(ss->Ofs_XYZNormal));
|
||||
s->Vertices.Resize(s->numVertices * Frames.Size());
|
||||
|
||||
for (unsigned i = 0; i < s->numVertices * Frames.Size(); i++)
|
||||
for (unsigned ii = 0; ii < s->numVertices * Frames.Size(); ii++)
|
||||
{
|
||||
s->Vertices[i].x = LittleShort(vt[i].x) / 64.f;
|
||||
s->Vertices[i].y = LittleShort(vt[i].y) / 64.f;
|
||||
s->Vertices[i].z = LittleShort(vt[i].z) / 64.f;
|
||||
UnpackVector(LittleShort(vt[i].n), s->Vertices[i].nx, s->Vertices[i].ny, s->Vertices[i].nz);
|
||||
s->Vertices[ii].x = LittleShort(vt[ii].x) / 64.f;
|
||||
s->Vertices[ii].y = LittleShort(vt[ii].y) / 64.f;
|
||||
s->Vertices[ii].z = LittleShort(vt[ii].z) / 64.f;
|
||||
UnpackVector(LittleShort(vt[ii].n), s->Vertices[ii].nx, s->Vertices[ii].ny, s->Vertices[ii].nz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,8 +285,8 @@ void FVoxelModel::MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &chec
|
|||
}
|
||||
if (cull & 32)
|
||||
{
|
||||
int z = ztop+zleng-1;
|
||||
AddFace(x+1, y, z+1, x, y, z+1, x+1, y+1, z+1, x, y+1, z+1, voxptr->col[zleng-1], check);
|
||||
int zz = ztop+zleng-1;
|
||||
AddFace(x+1, y, zz+1, x, y, zz+1, x+1, y+1, zz+1, x, y+1, zz+1, voxptr->col[zleng-1], check);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
{
|
||||
char stringbuf[20];
|
||||
mysnprintf(stringbuf, 20, "texture%d", i);
|
||||
int tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||
tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
||||
}
|
||||
|
||||
|
@ -783,8 +783,8 @@ 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);
|
||||
mMaterialShadersNAT.Push(shc);
|
||||
FShader *shc1 = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
||||
mMaterialShadersNAT.Push(shc1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,10 +188,10 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
if (isSamplerUniformName)
|
||||
{
|
||||
samplerstobind.Push(std::make_pair(identifier, val));
|
||||
for (auto pos = startpos; pos < endpos; pos++)
|
||||
for (auto posi = startpos; posi < endpos; posi++)
|
||||
{
|
||||
if (!IsGlslWhitespace(chars[pos]))
|
||||
chars[pos] = ' ';
|
||||
if (!IsGlslWhitespace(chars[posi]))
|
||||
chars[posi] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
|||
if (keywordFound && IsGlslWhitespace(chars[endIndex + i]))
|
||||
{
|
||||
// yes - replace declaration with spaces
|
||||
for (auto i = matchIndex; i < endIndex; i++)
|
||||
chars[i] = ' ';
|
||||
for (auto ii = matchIndex; ii < endIndex; ii++)
|
||||
chars[ii] = ' ';
|
||||
}
|
||||
|
||||
startIndex = endIndex;
|
||||
|
|
|
@ -154,9 +154,9 @@ VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio)
|
|||
double bottom = -fH;
|
||||
double top = fH;
|
||||
|
||||
VSMatrix result(1);
|
||||
result.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||
return result;
|
||||
VSMatrix fmat(1);
|
||||
fmat.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||
return fmat;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -522,10 +522,10 @@ FxExpression *FxConstant::MakeConstant(PSymbol *sym, const FScriptPosition &pos)
|
|||
}
|
||||
else
|
||||
{
|
||||
PSymbolConstString *csym = dyn_cast<PSymbolConstString>(sym);
|
||||
if (csym != nullptr)
|
||||
PSymbolConstString *csymbol = dyn_cast<PSymbolConstString>(sym);
|
||||
if (csymbol != nullptr)
|
||||
{
|
||||
x = new FxConstant(csym->Str, pos);
|
||||
x = new FxConstant(csymbol->Str, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5134,7 +5134,7 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
int outerside = -1;
|
||||
if (!val->isConstant())
|
||||
{
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
}
|
||||
|
@ -5569,8 +5569,6 @@ FxExpression *FxRandomPick::Resolve(FCompileContext &ctx)
|
|||
|
||||
ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
assert(choices.Size() > 0);
|
||||
|
||||
// Call BuiltinRandom to generate a random number.
|
||||
|
@ -5603,7 +5601,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
|||
|
||||
// Allocate space for the jump table.
|
||||
size_t jumptable = build->Emit(OP_JMP, 0);
|
||||
for (i = 1; i < choices.Size(); ++i)
|
||||
for (unsigned i = 1; i < choices.Size(); ++i)
|
||||
{
|
||||
build->Emit(OP_JMP, 0);
|
||||
}
|
||||
|
@ -5639,7 +5637,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
|||
}
|
||||
}
|
||||
// Backpatch each case (except the last, since it ends here) to jump to here.
|
||||
for (i = 0; i < choices.Size() - 1; ++i)
|
||||
for (unsigned i = 0; i < choices.Size() - 1; ++i)
|
||||
{
|
||||
build->BackpatchToHere(finishes[i]);
|
||||
}
|
||||
|
@ -7855,8 +7853,8 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
else if (!ArgList.Size())
|
||||
{
|
||||
auto cls = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
||||
ArgList.Push(new FxConstant(cls, NewClassPointer(cls), ScriptPosition));
|
||||
auto clss = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
||||
ArgList.Push(new FxConstant(clss, NewClassPointer(clss), ScriptPosition));
|
||||
}
|
||||
|
||||
func = new FxNew(ArgList[0]);
|
||||
|
@ -8369,8 +8367,8 @@ isresolved:
|
|||
if (!novirtual || !(afd->Variants[0].Flags & VARF_Virtual))
|
||||
{
|
||||
auto clstype = PType::toClass(ctx.Class);
|
||||
auto ccls = PType::toClass(cls);
|
||||
if (clstype == nullptr || ccls == nullptr || !clstype->Descriptor->IsDescendantOf(ccls->Descriptor))
|
||||
auto cclss = PType::toClass(cls);
|
||||
if (clstype == nullptr || cclss == nullptr || !clstype->Descriptor->IsDescendantOf(cclss->Descriptor))
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot call non-static function %s::%s from here", cls->TypeName.GetChars(), MethodName.GetChars());
|
||||
delete this;
|
||||
|
|
|
@ -606,7 +606,6 @@ PSymbolTreeNode *ZCCCompiler::AddTreeNode(FName name, ZCC_TreeNode *node, PSymbo
|
|||
else
|
||||
{
|
||||
auto sy = Create<PSymbolTreeNode>(name, node);
|
||||
FString name;
|
||||
treenodes->AddSymbol(sy);
|
||||
return sy;
|
||||
}
|
||||
|
@ -1930,19 +1929,19 @@ PType *ZCCCompiler::ResolveArraySize(PType *baseType, ZCC_Expression *arraysize,
|
|||
if (mVersion >= MakeVersion(3, 7, 2))
|
||||
{
|
||||
TArray<ZCC_Expression *> fixedIndices;
|
||||
for (auto node : indices)
|
||||
for (auto index : indices)
|
||||
{
|
||||
fixedIndices.Insert (0, node);
|
||||
fixedIndices.Insert (0, index);
|
||||
}
|
||||
|
||||
indices = std::move(fixedIndices);
|
||||
}
|
||||
|
||||
FCompileContext ctx(OutNamespace, cls, false);
|
||||
for (auto node : indices)
|
||||
for (auto index : indices)
|
||||
{
|
||||
// There is no float->int casting here.
|
||||
FxExpression *ex = ConvertNode(node);
|
||||
FxExpression *ex = ConvertNode(index);
|
||||
ex = ex->Resolve(ctx);
|
||||
|
||||
if (ex == nullptr) return TypeError;
|
||||
|
@ -2425,17 +2424,17 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
|
||||
auto parentfunc = clstype->ParentClass? dyn_cast<PFunction>(clstype->ParentClass->VMType->Symbols.FindSymbol(sym->SymbolName, true)) : nullptr;
|
||||
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc, exactReturnType);
|
||||
int virtindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc, exactReturnType);
|
||||
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
|
||||
if (varflags & VARF_Override)
|
||||
{
|
||||
if (vindex == -1)
|
||||
if (virtindex == -1)
|
||||
{
|
||||
Error(f, "Attempt to override non-existent virtual function %s", FName(f->Name).GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto oldfunc = clstype->Virtuals[vindex];
|
||||
auto oldfunc = clstype->Virtuals[virtindex];
|
||||
if (parentfunc && parentfunc->mVersion > mVersion)
|
||||
{
|
||||
Error(f, "Attempt to override function %s which is incompatible with version %d.%d.%d", FName(f->Name).GetChars(), mVersion.major, mVersion.minor, mVersion.revision);
|
||||
|
@ -2467,8 +2466,8 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
if (oldfunc->VarFlags & VARF_Protected)
|
||||
sym->Variants[0].Flags |= VARF_Protected;
|
||||
|
||||
clstype->Virtuals[vindex] = sym->Variants[0].Implementation;
|
||||
sym->Variants[0].Implementation->VirtualIndex = vindex;
|
||||
clstype->Virtuals[virtindex] = sym->Variants[0].Implementation;
|
||||
sym->Variants[0].Implementation->VirtualIndex = virtindex;
|
||||
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
|
||||
|
||||
// Defaults must be identical to parent class
|
||||
|
@ -2493,7 +2492,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vindex != -1)
|
||||
if (virtindex != -1)
|
||||
{
|
||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||
}
|
||||
|
@ -2507,8 +2506,8 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
}
|
||||
else if (forclass)
|
||||
{
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
||||
if (vindex != -1)
|
||||
int virtindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
||||
if (virtindex != -1)
|
||||
{
|
||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||
}
|
||||
|
|
|
@ -831,11 +831,11 @@ public:
|
|||
if (result)
|
||||
{
|
||||
IMAGEHLP_LINE64 line64;
|
||||
DWORD displacement = 0;
|
||||
displacement = 0;
|
||||
memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
|
||||
line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, &line64);
|
||||
if (result)
|
||||
auto symresult = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, &line64);
|
||||
if (symresult)
|
||||
{
|
||||
s.Format("Called from %s at %s, line %d\n", symbol64->Name, line64.FileName, (int)line64.LineNumber);
|
||||
}
|
||||
|
|
|
@ -692,7 +692,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
{
|
||||
VMFunction *call = (VMFunction *)ptr;
|
||||
VMReturn returns[MAX_RETURNS];
|
||||
int numret;
|
||||
int numret1;
|
||||
|
||||
b = B;
|
||||
FillReturns(reg, f, returns, pc+1, C);
|
||||
|
@ -701,7 +701,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
try
|
||||
{
|
||||
VMCycles[0].Unclock();
|
||||
numret = static_cast<VMNativeFunction *>(call)->NativeCall(VM_INVOKE(reg.param + f->NumParam - b, b, returns, C, call->RegTypes));
|
||||
numret1 = static_cast<VMNativeFunction *>(call)->NativeCall(VM_INVOKE(reg.param + f->NumParam - b, b, returns, C, call->RegTypes));
|
||||
VMCycles[0].Clock();
|
||||
}
|
||||
catch (CVMAbortException &err)
|
||||
|
@ -714,10 +714,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto sfunc = static_cast<VMScriptFunction *>(call);
|
||||
numret = sfunc->ScriptCall(sfunc, reg.param + f->NumParam - b, b, returns, C);
|
||||
auto sfunc1 = static_cast<VMScriptFunction *>(call);
|
||||
numret1 = sfunc1->ScriptCall(sfunc1, reg.param + f->NumParam - b, b, returns, C);
|
||||
}
|
||||
assert(numret == C && "Number of parameters returned differs from what was expected by the caller");
|
||||
assert(numret1 == C && "Number of parameters returned differs from what was expected by the caller");
|
||||
f->NumParam -= B;
|
||||
pc += C; // Skip RESULTs
|
||||
}
|
||||
|
@ -858,31 +858,31 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
// chosen to conserve a few opcodes by condensing all the
|
||||
// string comparisons into a single one.
|
||||
{
|
||||
const FString *b, *c;
|
||||
const FString *b1, *c1;
|
||||
int test, method;
|
||||
bool cmp;
|
||||
|
||||
if (a & CMP_BK)
|
||||
{
|
||||
ASSERTKS(B);
|
||||
b = &konsts[B];
|
||||
b1 = &konsts[B];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERTS(B);
|
||||
b = ®.s[B];
|
||||
b1 = ®.s[B];
|
||||
}
|
||||
if (a & CMP_CK)
|
||||
{
|
||||
ASSERTKS(C);
|
||||
c = &konsts[C];
|
||||
c1 = &konsts[C];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERTS(C);
|
||||
c = ®.s[C];
|
||||
c1 = ®.s[C];
|
||||
}
|
||||
test = (a & CMP_APPROX) ? b->CompareNoCase(*c) : b->Compare(*c);
|
||||
test = (a & CMP_APPROX) ? b1->CompareNoCase(*c1) : b1->Compare(*c1);
|
||||
method = a & CMP_METHOD_MASK;
|
||||
if (method == CMP_EQ)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,6 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
int i;
|
||||
int fac;
|
||||
uint8_t r,g,b;
|
||||
int gray;
|
||||
int a;
|
||||
|
||||
switch(inf? inf->blend : BLEND_NONE)
|
||||
|
@ -119,7 +118,7 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
gray = clamp<int>(TSrc::Gray(pin),0,255);
|
||||
int gray = clamp<int>(TSrc::Gray(pin),0,255);
|
||||
|
||||
PalEntry pe = cm->GrayscaleToColor[gray];
|
||||
TBlend::OpC(pout[TDest::RED], pe.r , a, inf);
|
||||
|
@ -140,7 +139,7 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
gray = TSrc::Gray(pin);
|
||||
int gray = TSrc::Gray(pin);
|
||||
r = (TSrc::R(pin)*(31-fac) + gray*fac)/31;
|
||||
g = (TSrc::G(pin)*(31-fac) + gray*fac)/31;
|
||||
b = (TSrc::B(pin)*(31-fac) + gray*fac)/31;
|
||||
|
|
|
@ -295,12 +295,12 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
|
|||
// Catalog the patches these textures use so we know which
|
||||
// textures they represent.
|
||||
patchlookup.Resize(numpatches);
|
||||
for (uint32_t i = 0; i < numpatches; ++i)
|
||||
for (uint32_t ii = 0; ii < numpatches; ++ii)
|
||||
{
|
||||
char pname[9];
|
||||
pnames.Read(pname, 8);
|
||||
pname[8] = '\0';
|
||||
patchlookup[i].Name = pname;
|
||||
patchlookup[ii].Name = pname;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -777,12 +777,12 @@ void FMultipatchTextureBuilder::ResolvePatches(BuildInfo &buildinfo)
|
|||
{
|
||||
TArray<FTextureID> list;
|
||||
TexMan.ListTextures(buildinfo.Inits[i].TexName, list, true);
|
||||
for (int i = list.Size() - 1; i >= 0; i--)
|
||||
for (int ii = list.Size() - 1; ii >= 0; ii--)
|
||||
{
|
||||
auto gtex = TexMan.GetGameTexture(list[i]);
|
||||
auto gtex = TexMan.GetGameTexture(list[ii]);
|
||||
if (gtex && gtex != buildinfo.texture && gtex->GetTexture() && gtex->GetTexture()->GetImage() && !dynamic_cast<FMultiPatchTexture*>(gtex->GetTexture()->GetImage()))
|
||||
{
|
||||
texno = list[i];
|
||||
texno = list[ii];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -565,9 +565,9 @@ int V_GetColorFromString(const char* cstr, FScriptPosition* sc)
|
|||
{
|
||||
if (strlen(cstr) == 6)
|
||||
{
|
||||
char* p;
|
||||
int color = strtol(cstr, &p, 16);
|
||||
if (*p == 0)
|
||||
char* endp;
|
||||
int color = strtol(cstr, &endp, 16);
|
||||
if (*endp == 0)
|
||||
{
|
||||
// RRGGBB string
|
||||
c[0] = (color & 0xff0000) >> 16;
|
||||
|
|
|
@ -182,9 +182,9 @@ static TArray<FString> CheckGameInfo(TArray<FString>& pwads)
|
|||
if (resfile != NULL)
|
||||
{
|
||||
uint32_t cnt = resfile->LumpCount();
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
for (int c = cnt - 1; c >= 0; c--)
|
||||
{
|
||||
FResourceLump* lmp = resfile->GetLump(i);
|
||||
FResourceLump* lmp = resfile->GetLump(c);
|
||||
|
||||
if (FName(lmp->getName(), true) == gameinfo)
|
||||
{
|
||||
|
@ -368,16 +368,16 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
// Finally, if the last entry in the chain is a directory, it's being considered the mod directory, and all GRPs inside need to be loaded, too.
|
||||
if (userConfig.AddFiles->NumArgs() > 0)
|
||||
{
|
||||
auto fn = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1];
|
||||
auto fname = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1];
|
||||
bool isdir = false;
|
||||
if (DirEntryExists(fn, &isdir) && isdir)
|
||||
if (DirEntryExists(fname, &isdir) && isdir)
|
||||
{
|
||||
// Insert the GRPs before this entry itself.
|
||||
FString lastfn;
|
||||
Files.Pop(lastfn);
|
||||
for (auto ext : validexts)
|
||||
{
|
||||
D_AddDirectory(Files, fn, ext, GameConfig);
|
||||
D_AddDirectory(Files, fname, ext, GameConfig);
|
||||
}
|
||||
Files.Push(lastfn);
|
||||
}
|
||||
|
@ -412,10 +412,10 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
if (Args->CheckParm("-dumpfs"))
|
||||
{
|
||||
FILE* f = fopen("filesystem.dir", "wb");
|
||||
for (int i = 0; i < fileSystem.GetNumEntries(); i++)
|
||||
for (int num = 0; num < fileSystem.GetNumEntries(); num++)
|
||||
{
|
||||
auto fd = fileSystem.GetFileAt(i);
|
||||
fprintf(f, "%.50s %60s %d\n", fd->getName(), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(i)), fd->Size());
|
||||
auto fd = fileSystem.GetFileAt(num);
|
||||
fprintf(f, "%.50s %60s %d\n", fd->getName(), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(num)), fd->Size());
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ static void GameTicker()
|
|||
if ((gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL) || paused)
|
||||
{
|
||||
size_t ac = max<size_t>(10, GC::AllocCount);
|
||||
for (size_t i = 0; i < ac; i++)
|
||||
for (size_t cnt = 0; cnt < ac; cnt++)
|
||||
{
|
||||
if (!GC::CheckGC()) break;
|
||||
}
|
||||
|
|
|
@ -426,10 +426,10 @@ static void BuildEpisodeMenu()
|
|||
addedVolumes++;
|
||||
if (vol.subtitle.IsNotEmpty())
|
||||
{
|
||||
auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing * 6 / 10, 1,
|
||||
auto item = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing * 6 / 10, 1,
|
||||
vol.subtitle, SmallFont, CR_GRAY, false, NAME_None, vol.index);
|
||||
y += ld->mLinespacing * 6 / 10;
|
||||
ld->mItems.Push(it);
|
||||
ld->mItems.Push(item);
|
||||
textadded = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,13 +143,13 @@ static void S_AddSNDINFO (int lump)
|
|||
|
||||
case SI_MusicAlias: {
|
||||
sc.MustGetString();
|
||||
int lump = fileSystem.FindFile(sc.String);
|
||||
if (lump < 0)
|
||||
lump = fileSystem.FindFile(FStringf("music/%s", sc.String));
|
||||
if (lump >= 0)
|
||||
int mlump = fileSystem.FindFile(sc.String);
|
||||
if (mlump < 0)
|
||||
mlump = fileSystem.FindFile(FStringf("music/%s", sc.String));
|
||||
if (mlump >= 0)
|
||||
{
|
||||
// do not set the alias if a later WAD defines its own music of this name
|
||||
int file = fileSystem.GetFileContainer(lump);
|
||||
int file = fileSystem.GetFileContainer(mlump);
|
||||
int sndifile = fileSystem.GetFileContainer(sc.LumpNum);
|
||||
if (file > sndifile)
|
||||
{
|
||||
|
|
|
@ -90,9 +90,9 @@ static void doprecache(int picnum, int palette)
|
|||
|
||||
for (int i = 0; i <= surfaces; i++)
|
||||
{
|
||||
auto tex = mdloadskin((md2model_t *)models[mid], 0, palette, i, nullptr);
|
||||
int palid = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||
if (tex) PrecacheTex(tex, palid);
|
||||
auto skintex = mdloadskin((md2model_t *)models[mid], 0, palette, i, nullptr);
|
||||
int paletteid = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||
if (skintex) PrecacheTex(skintex, paletteid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,10 +126,10 @@ IHardwareTexture* PaletteManager::GetLookup(int index)
|
|||
memcpy(lookup.Data(), lookups.getTable(index), lookup.Size());
|
||||
for (int i = 0; i < numshades; i++)
|
||||
{
|
||||
auto p = &lookup[i * 256];
|
||||
p[255] = p[0];
|
||||
p[0] = 0;
|
||||
for (int v = 1; v <= 255; v++) if (p[v] == 0) p[v] = 255;
|
||||
auto palette = &lookup[i * 256];
|
||||
palette[255] = palette[0];
|
||||
palette[0] = 0;
|
||||
for (int v = 1; v <= 255; v++) if (palette[v] == 0) palette[v] = 255;
|
||||
}
|
||||
p->CreateTexture(lookup.Data(), 256, numshades, 15, false, "PaletteLookup");
|
||||
lookuptextures[index] = p;
|
||||
|
|
|
@ -251,10 +251,10 @@ static void CollectLoops(TArray<loopcollect>& sectors)
|
|||
}
|
||||
Printf("found already visited wall %d\nLinked by:", ww);
|
||||
bugged.Insert(i, true);
|
||||
for (unsigned i = 0; i < wall.Size(); i++)
|
||||
for (unsigned walnum = 0; walnum < wall.Size(); walnum++)
|
||||
{
|
||||
if (wall[i].point2 == ww)
|
||||
Printf(" %d,", i);
|
||||
if (wall[walnum].point2 == ww)
|
||||
Printf(" %d,", walnum);
|
||||
}
|
||||
Printf("\n");
|
||||
sectors.Last().bugged = ESEctionFlag::Unclosed;
|
||||
|
@ -302,9 +302,9 @@ static int insideLoop(int vertex, TArray<int>& loop)
|
|||
// SW: Wanton Destrcution's $bath.map, sector 601 is an example for that.
|
||||
if (i == 1) pt += wall[vertex].delta() / 2;
|
||||
bool c = false;
|
||||
for (unsigned i = 0; i < loop.Size() - 1; i++)
|
||||
for (unsigned ii = 0; ii < loop.Size() - 1; ii++)
|
||||
{
|
||||
auto& wal = wall[loop[i]];
|
||||
auto& wal = wall[loop[ii]];
|
||||
auto& pt1 = wal.pos;
|
||||
auto& pt2 = wal.point2Wall()->pos;
|
||||
|
||||
|
@ -481,9 +481,9 @@ static void GroupData(TArray<loopcollect>& collect, TArray<sectionbuildsector>&
|
|||
{
|
||||
if (inside[c] == a)
|
||||
{
|
||||
auto& loop = sectloops[c];
|
||||
builder.sections.Last().wallcount += loop.Size() - 1;
|
||||
builder.sections.Last().loops.Push(std::move(loop));
|
||||
auto& iloop = sectloops[c];
|
||||
builder.sections.Last().wallcount += iloop.Size() - 1;
|
||||
builder.sections.Last().loops.Push(std::move(iloop));
|
||||
inside[c] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -645,13 +645,13 @@ static void ConstructSections(TArray<sectionbuildsector>& builders)
|
|||
section->loops.Set(loops, srcloops);
|
||||
|
||||
int curwall = 0;
|
||||
for (unsigned i = 0; i < srcloops; i++)
|
||||
for (unsigned ii = 0; ii < srcloops; ii++)
|
||||
{
|
||||
auto& srcloop = srcsect.loops[i];
|
||||
auto& loop = section->loops[i];
|
||||
auto& srcloop = srcsect.loops[ii];
|
||||
auto& loop = section->loops[ii];
|
||||
unsigned numsectionwalls = srcloop.Size() - 1;
|
||||
auto walls = (int*)sectionArena.Calloc(numsectionwalls * sizeof(int));
|
||||
loop.walls.Set(walls, numsectionwalls);
|
||||
auto wallarray = (int*)sectionArena.Calloc(numsectionwalls * sizeof(int));
|
||||
loop.walls.Set(wallarray, numsectionwalls);
|
||||
for (unsigned w = 0; w < numsectionwalls; w++)
|
||||
{
|
||||
int wall_i = srcloop[w];
|
||||
|
|
|
@ -520,8 +520,6 @@ void Clipper::AddWindowRange(int start, int end, float topclip, float bottomclip
|
|||
|
||||
else if (node->start >= start && node->start < end)
|
||||
{
|
||||
auto next = node->next; // get this before making any edits.
|
||||
|
||||
// if the old range is closed, just shorten the new one and continue.
|
||||
if (node->topclip < node->bottomclip)
|
||||
{
|
||||
|
|
|
@ -153,10 +153,10 @@ static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
|
|||
sc.MustGetString();
|
||||
strncpy(lstats.info, sc.String, 59);
|
||||
|
||||
int h,m,s;
|
||||
int hour,min,sec;
|
||||
sc.MustGetString();
|
||||
sscanf(sc.String, "%d:%d:%d", &h, &m, &s);
|
||||
lstats.timeneeded= ((((h*60)+m)*60)+s);
|
||||
sscanf(sc.String, "%d:%d:%d", &hour, &min, &sec);
|
||||
lstats.timeneeded= ((((hour*60)+min)*60)+sec);
|
||||
|
||||
lstats.skill = 0;
|
||||
}
|
||||
|
|
|
@ -222,15 +222,15 @@ void highTileSetup()
|
|||
if (rep.issky) continue; // do not muck around with skyboxes (yet)
|
||||
if (rep.palnum < NORMALPAL)
|
||||
{
|
||||
auto tex = rep.image;
|
||||
auto imgtex = rep.image;
|
||||
// Make a copy so that multiple appearances of the same texture with different layers can be handled. They will all refer to the same internal texture anyway.
|
||||
tex = MakeGameTexture(tex->GetTexture(), "", ETextureType::Any);
|
||||
if (glowTex) tex->SetGlowmap(glowTex->GetTexture());
|
||||
if (detailTex) tex->SetDetailmap(detailTex->GetTexture());
|
||||
if (normalTex) tex->SetNormalmap(normalTex->GetTexture());
|
||||
if (specTex) tex->SetSpecularmap(specTex->GetTexture());
|
||||
tex->SetDetailScale(scalex, scaley);
|
||||
rep.image = tex;
|
||||
imgtex = MakeGameTexture(imgtex->GetTexture(), "", ETextureType::Any);
|
||||
if (glowTex) imgtex->SetGlowmap(glowTex->GetTexture());
|
||||
if (detailTex) imgtex->SetDetailmap(detailTex->GetTexture());
|
||||
if (normalTex) imgtex->SetNormalmap(normalTex->GetTexture());
|
||||
if (specTex) imgtex->SetSpecularmap(specTex->GetTexture());
|
||||
imgtex->SetDetailScale(scalex, scaley);
|
||||
rep.image = imgtex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,12 +424,12 @@ bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flag
|
|||
FVector4 addcol(0, 0, 0, 0);
|
||||
FVector4 modcol(pick.basepalTint.r * (1.f / 255.f), pick.basepalTint.g * (1.f / 255.f), pick.basepalTint.b * (1.f / 255.f), 0);
|
||||
FVector4 blendcol(0, 0, 0, 0);
|
||||
int flags = 0;
|
||||
int tmflags = 0;
|
||||
|
||||
if (pick.basepalTint != 0xffffff) flags |= TextureManipulation::ActiveBit;
|
||||
if (pick.basepalTint != 0xffffff) tmflags |= TextureManipulation::ActiveBit;
|
||||
if (pick.tintFlags != -1)
|
||||
{
|
||||
flags |= TextureManipulation::ActiveBit;
|
||||
tmflags |= TextureManipulation::ActiveBit;
|
||||
if (pick.tintFlags & TINTF_COLORIZE)
|
||||
{
|
||||
modcol.X *= pick.tintColor.r * (1.f / 64.f);
|
||||
|
@ -440,15 +440,15 @@ bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flag
|
|||
modcol.W = 1.f;
|
||||
|
||||
if (pick.tintFlags & TINTF_INVERT)
|
||||
flags |= TextureManipulation::InvertBit;
|
||||
tmflags |= TextureManipulation::InvertBit;
|
||||
|
||||
if (pick.tintFlags & TINTF_BLENDMASK)
|
||||
{
|
||||
blendcol = modcol; // WTF???, but the tinting code really uses the same color for both!
|
||||
flags |= (((pick.tintFlags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
|
||||
tmflags |= (((pick.tintFlags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
|
||||
}
|
||||
}
|
||||
addcol.W = (float)flags;
|
||||
addcol.W = (float)tmflags;
|
||||
if ((pick.translation & 0x80000000) && hw_shadeinterpolate) addcol.W += 16384; // hijack a free bit in here.
|
||||
state->SetTextureColors(&modcol.X, &addcol.X, &blendcol.X);
|
||||
}
|
||||
|
|
|
@ -65,9 +65,9 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilema
|
|||
int tilewidth = tileWidth(basetile);
|
||||
for(int i = 0; i < numtiles; i++)
|
||||
{
|
||||
auto tex = tileGetTexture(basetile + tilemap[i]);
|
||||
if (!tex || !tex->isValid() || tex->GetTexture() == 0) return nullptr;
|
||||
build[i].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||
auto texture = tileGetTexture(basetile + tilemap[i]);
|
||||
if (!texture || !texture->isValid() || texture->GetTexture() == 0) return nullptr;
|
||||
build[i].TexImage = static_cast<FImageTexture*>(texture->GetTexture());
|
||||
build[i].OriginX = tilewidth * i;
|
||||
build[i].Translation = GPalette.GetTranslation(GetTranslationType(remap), GetTranslationIndex(remap));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue