mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
Merge remote-tracking branch 'origin/master' into gles2_merge
This commit is contained in:
commit
92a3731f20
58 changed files with 412 additions and 231 deletions
|
@ -124,7 +124,7 @@ static void Shape2D_Clear(DShape2D* self, int which)
|
|||
if (which & C_Verts) self->mVertices.Clear();
|
||||
if (which & C_Coords) self->mCoords.Clear();
|
||||
if (which & C_Indices) self->mIndices.Clear();
|
||||
self->needsVertexUpload = true;
|
||||
self->bufferInfo->needsVertexUpload = true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, Clear, Shape2D_Clear)
|
||||
|
@ -138,7 +138,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, Clear, Shape2D_Clear)
|
|||
static void Shape2D_PushVertex(DShape2D* self, double x, double y)
|
||||
{
|
||||
self->mVertices.Push(DVector2(x, y));
|
||||
self->needsVertexUpload = true;
|
||||
self->bufferInfo->needsVertexUpload = true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, PushVertex, Shape2D_PushVertex)
|
||||
|
@ -153,7 +153,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, PushVertex, Shape2D_PushVertex)
|
|||
static void Shape2D_PushCoord(DShape2D* self, double u, double v)
|
||||
{
|
||||
self->mCoords.Push(DVector2(u, v));
|
||||
self->needsVertexUpload = true;
|
||||
self->bufferInfo->needsVertexUpload = true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, PushCoord, Shape2D_PushCoord)
|
||||
|
@ -170,7 +170,7 @@ static void Shape2D_PushTriangle(DShape2D* self, int a, int b, int c)
|
|||
self->mIndices.Push(a);
|
||||
self->mIndices.Push(b);
|
||||
self->mIndices.Push(c);
|
||||
self->needsVertexUpload = true;
|
||||
self->bufferInfo->needsVertexUpload = true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, PushTriangle, Shape2D_PushTriangle)
|
||||
|
@ -528,13 +528,15 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
|||
offset = osave;
|
||||
}
|
||||
|
||||
static TArray<RefCountedPtr<DShape2DBufferInfo>> buffersToDestroy;
|
||||
|
||||
void DShape2D::OnDestroy() {
|
||||
if (lastParms) delete lastParms;
|
||||
lastParms = nullptr;
|
||||
mIndices.Reset();
|
||||
mVertices.Reset();
|
||||
mCoords.Reset();
|
||||
buffers.Reset();
|
||||
buffersToDestroy.Push(std::move(bufferInfo));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -567,11 +569,11 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
|||
shape->lastParms = new DrawParms(parms);
|
||||
}
|
||||
else if (shape->lastParms->vertexColorChange(parms)) {
|
||||
shape->needsVertexUpload = true;
|
||||
if (!shape->uploadedOnce) {
|
||||
shape->bufIndex = -1;
|
||||
shape->buffers.Clear();
|
||||
shape->lastCommand = -1;
|
||||
shape->bufferInfo->needsVertexUpload = true;
|
||||
if (!shape->bufferInfo->uploadedOnce) {
|
||||
shape->bufferInfo->bufIndex = -1;
|
||||
shape->bufferInfo->buffers.Clear();
|
||||
shape->bufferInfo->lastCommand = -1;
|
||||
}
|
||||
delete shape->lastParms;
|
||||
shape->lastParms = new DrawParms(parms);
|
||||
|
@ -583,7 +585,7 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
|||
auto osave = offset;
|
||||
if (parms.nooffset) offset = { 0,0 };
|
||||
|
||||
if (shape->needsVertexUpload)
|
||||
if (shape->bufferInfo->needsVertexUpload)
|
||||
{
|
||||
shape->minx = 16383;
|
||||
shape->miny = 16383;
|
||||
|
@ -622,15 +624,15 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
|||
dg.transform = shape->transform;
|
||||
dg.transform.Cells[0][2] += offset.X;
|
||||
dg.transform.Cells[1][2] += offset.Y;
|
||||
dg.shape2D = shape;
|
||||
dg.shape2DBufInfo = shape->bufferInfo;
|
||||
dg.shape2DIndexCount = shape->mIndices.Size();
|
||||
if (shape->needsVertexUpload)
|
||||
if (shape->bufferInfo->needsVertexUpload)
|
||||
{
|
||||
shape->bufIndex += 1;
|
||||
shape->bufferInfo->bufIndex += 1;
|
||||
|
||||
shape->buffers.Reserve(1);
|
||||
shape->bufferInfo->buffers.Reserve(1);
|
||||
|
||||
auto buf = &shape->buffers[shape->bufIndex];
|
||||
auto buf = &shape->bufferInfo->buffers[shape->bufferInfo->bufIndex];
|
||||
|
||||
auto verts = TArray<TwoDVertex>(dg.mVertCount, true);
|
||||
for ( int i=0; i<dg.mVertCount; i++ )
|
||||
|
@ -649,12 +651,12 @@ void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
|||
}
|
||||
|
||||
buf->UploadData(&verts[0], dg.mVertCount, &shape->mIndices[0], shape->mIndices.Size());
|
||||
shape->needsVertexUpload = false;
|
||||
shape->uploadedOnce = true;
|
||||
shape->bufferInfo->needsVertexUpload = false;
|
||||
shape->bufferInfo->uploadedOnce = true;
|
||||
}
|
||||
dg.shape2DBufIndex = shape->bufIndex;
|
||||
shape->lastCommand += 1;
|
||||
dg.shape2DCommandCounter = shape->lastCommand;
|
||||
dg.shape2DBufIndex = shape->bufferInfo->bufIndex;
|
||||
shape->bufferInfo->lastCommand += 1;
|
||||
dg.shape2DCommandCounter = shape->bufferInfo->lastCommand;
|
||||
AddCommand(&dg);
|
||||
offset = osave;
|
||||
}
|
||||
|
@ -1082,6 +1084,17 @@ void F2DDrawer::Clear()
|
|||
screenFade = 1.f;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::OnFrameDone()
|
||||
{
|
||||
buffersToDestroy.Clear();
|
||||
}
|
||||
|
||||
F2DVertexBuffer::F2DVertexBuffer()
|
||||
{
|
||||
mVertexBuffer = screen->CreateVertexBuffer();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "textures.h"
|
||||
#include "renderstyle.h"
|
||||
#include "dobject.h"
|
||||
#include "refcounted.h"
|
||||
|
||||
struct DrawParms;
|
||||
struct FColormap;
|
||||
|
@ -49,6 +50,7 @@ struct F2DPolygons
|
|||
};
|
||||
|
||||
class DShape2D;
|
||||
struct DShape2DBufferInfo;
|
||||
|
||||
class F2DDrawer
|
||||
{
|
||||
|
@ -123,7 +125,7 @@ public:
|
|||
bool useTransform;
|
||||
DMatrix3x3 transform;
|
||||
|
||||
DShape2D* shape2D;
|
||||
RefCountedPtr<DShape2DBufferInfo> shape2DBufInfo;
|
||||
int shape2DBufIndex;
|
||||
int shape2DIndexCount;
|
||||
int shape2DCommandCounter;
|
||||
|
@ -136,7 +138,7 @@ public:
|
|||
// If these fields match, two draw commands can be batched.
|
||||
bool isCompatible(const RenderCommand &other) const
|
||||
{
|
||||
if (shape2D != nullptr || other.shape2D != nullptr) return false;
|
||||
if (shape2DBufInfo != nullptr || other.shape2DBufInfo != nullptr) return false;
|
||||
return mTexture == other.mTexture &&
|
||||
mType == other.mType &&
|
||||
mTranslationId == other.mTranslationId &&
|
||||
|
@ -214,6 +216,7 @@ public:
|
|||
void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; }
|
||||
void End() { isIn2D = false; }
|
||||
bool HasBegun2D() { return isIn2D; }
|
||||
void OnFrameDone();
|
||||
|
||||
void ClearClipRect() { clipleft = cliptop = 0; clipwidth = clipheight = -1; }
|
||||
void SetClipRect(int x, int y, int w, int h);
|
||||
|
@ -240,12 +243,22 @@ public:
|
|||
bool mIsFirstPass = true;
|
||||
};
|
||||
|
||||
struct DShape2DBufferInfo : NoVirtualRefCountedBase
|
||||
{
|
||||
TArray<F2DVertexBuffer> buffers;
|
||||
bool needsVertexUpload = true;
|
||||
int bufIndex = -1;
|
||||
int lastCommand = -1;
|
||||
bool uploadedOnce = false;
|
||||
};
|
||||
|
||||
class DShape2D : public DObject
|
||||
{
|
||||
|
||||
DECLARE_CLASS(DShape2D,DObject)
|
||||
public:
|
||||
DShape2D()
|
||||
: bufferInfo(new DShape2DBufferInfo)
|
||||
{
|
||||
transform.Identity();
|
||||
}
|
||||
|
@ -261,12 +274,8 @@ public:
|
|||
|
||||
DMatrix3x3 transform;
|
||||
|
||||
TArray<F2DVertexBuffer> buffers;
|
||||
bool needsVertexUpload = true;
|
||||
int bufIndex = -1;
|
||||
int lastCommand = -1;
|
||||
RefCountedPtr<DShape2DBufferInfo> bufferInfo;
|
||||
|
||||
bool uploadedOnce = false;
|
||||
DrawParms* lastParms;
|
||||
|
||||
void OnDestroy() override;
|
||||
|
|
|
@ -291,7 +291,7 @@ void FCommandBuffer::AddString(FString clip)
|
|||
if (clip.IsNotEmpty())
|
||||
{
|
||||
// Only paste the first line.
|
||||
long brk = clip.IndexOfAny("\r\n\b");
|
||||
auto brk = clip.IndexOfAny("\r\n\b");
|
||||
std::u32string build;
|
||||
if (brk >= 0)
|
||||
{
|
||||
|
|
|
@ -533,7 +533,7 @@ FString BuildString (int argc, FString *argv)
|
|||
else if (strchr(argv[arg], '"'))
|
||||
{ // If it contains one or more quotes, we need to escape them.
|
||||
buf << '"';
|
||||
long substr_start = 0, quotepos;
|
||||
ptrdiff_t substr_start = 0, quotepos;
|
||||
while ((quotepos = argv[arg].IndexOf('"', substr_start)) >= 0)
|
||||
{
|
||||
if (substr_start < quotepos)
|
||||
|
|
|
@ -435,7 +435,7 @@ void FStringTable::InsertString(int lumpnum, int langid, FName label, const FStr
|
|||
{
|
||||
const char *strlangid = (const char *)&langid;
|
||||
TableElement te = { fileSystem.GetFileContainer(lumpnum), { string, string, string, string } };
|
||||
long index;
|
||||
ptrdiff_t index;
|
||||
while ((index = te.strings[0].IndexOf("@[")) >= 0)
|
||||
{
|
||||
auto endindex = te.strings[0].IndexOf(']', index);
|
||||
|
|
|
@ -234,6 +234,8 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter)
|
|||
}
|
||||
|
||||
name.ToLower();
|
||||
if (name.IndexOf("filter/") == 0)
|
||||
continue; // 'filter' is a reserved name of the file system.
|
||||
if (name.IndexOf("__macosx") == 0)
|
||||
continue; // skip Apple garbage. At this stage only the root folder matters.
|
||||
if (!foundprefix)
|
||||
|
|
|
@ -113,7 +113,20 @@ struct FileSystem::LumpRecord
|
|||
if (Namespace == ns_hidden) shortName.qword = 0;
|
||||
else
|
||||
{
|
||||
long slash = longName.LastIndexOf('/');
|
||||
ptrdiff_t encodedResID = longName.LastIndexOf(".{");
|
||||
if (resourceId == -1 && encodedResID >= 0)
|
||||
{
|
||||
const char* p = longName.GetChars() + encodedResID;
|
||||
char* q;
|
||||
int id = (int)strtoull(p+2, &q, 10); // only decimal numbers allowed here.
|
||||
if (q[0] == '}' && (q[1] == '.' || q[1] == 0))
|
||||
{
|
||||
FString toDelete(p, q - p + 1);
|
||||
longName.Substitute(toDelete, "");
|
||||
resourceId = id;
|
||||
}
|
||||
}
|
||||
ptrdiff_t slash = longName.LastIndexOf('/');
|
||||
FString base = (slash >= 0) ? longName.Mid(slash + 1) : longName;
|
||||
auto dot = base.LastIndexOf('.');
|
||||
if (dot >= 0) base.Truncate(dot);
|
||||
|
@ -1533,7 +1546,7 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)
|
|||
if (lump < 0) return false; // Does not exist.
|
||||
|
||||
auto oldlump = FileInfo[lump];
|
||||
int slash = oldlump.longName.LastIndexOf('/');
|
||||
ptrdiff_t slash = oldlump.longName.LastIndexOf('/');
|
||||
|
||||
if (slash == -1)
|
||||
{
|
||||
|
|
|
@ -348,8 +348,8 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize, LumpFilterI
|
|||
uint32_t max = NumLumps;
|
||||
max -= FilterLumpsByGameType(filter, lumps, lumpsize, max);
|
||||
|
||||
long len;
|
||||
int lastpos = -1;
|
||||
ptrdiff_t len;
|
||||
ptrdiff_t lastpos = -1;
|
||||
FString file;
|
||||
FString LumpFilter = filter->dotFilter;
|
||||
while ((len = LumpFilter.IndexOf('.', lastpos+1)) > 0)
|
||||
|
|
|
@ -437,7 +437,7 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
Chars[i].OriginalPic->CopySize(*lump, true);
|
||||
if (Chars[i].OriginalPic != *lump) TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||
}
|
||||
Chars[i].XMove = width;
|
||||
Chars[i].XMove = int(width / Scale.X);
|
||||
}
|
||||
|
||||
if (map1252)
|
||||
|
|
|
@ -407,6 +407,7 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
|||
count = LastChar - FirstChar + 1;
|
||||
Chars.Resize(count);
|
||||
// BMF palettes are only six bits per component. Fix that.
|
||||
Palette[0] = 0;
|
||||
for (i = 0; i < ActiveColors; ++i)
|
||||
{
|
||||
int r = (data[17 + i * 3] << 2) | (data[17 + i * 3] >> 4);
|
||||
|
|
|
@ -88,7 +88,7 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
|
|||
{
|
||||
if (*string == '[')
|
||||
{
|
||||
const uint8_t *start = string;
|
||||
const uint8_t* start = string;
|
||||
while (*string != ']' && *string != '\0')
|
||||
{
|
||||
string++;
|
||||
|
@ -97,11 +97,6 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
|
|||
{
|
||||
string++;
|
||||
}
|
||||
lastcolor = FString((const char *)start, string - start);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastcolor = *string++;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -130,6 +125,33 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
|
|||
}
|
||||
|
||||
auto index = Lines.Reserve(1);
|
||||
for (const uint8_t* pos = start; pos < space; pos++)
|
||||
{
|
||||
if (*pos == TEXTCOLOR_ESCAPE)
|
||||
{
|
||||
pos++;
|
||||
if (*pos)
|
||||
{
|
||||
if (*pos == '[')
|
||||
{
|
||||
const uint8_t* cstart = pos;
|
||||
while (*pos != ']' && *pos != '\0')
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
if (*pos != '\0')
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
lastcolor = FString((const char*)cstart, pos - start);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastcolor = *pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
breakit (&Lines[index], font, start, space, linecolor);
|
||||
if (c == '\n' && !preservecolor)
|
||||
{
|
||||
|
|
|
@ -90,8 +90,8 @@ static int FindGFXFile(FString & fn)
|
|||
if (lump != -1) return lump;
|
||||
|
||||
int best = -1;
|
||||
int dot = fn.LastIndexOf('.');
|
||||
int slash = fn.LastIndexOf('/');
|
||||
auto dot = fn.LastIndexOf('.');
|
||||
auto slash = fn.LastIndexOf('/');
|
||||
if (dot > slash) fn.Truncate(dot);
|
||||
|
||||
static const char * extensions[] = { ".png", ".jpg", ".tga", ".pcx", nullptr };
|
||||
|
|
|
@ -44,8 +44,8 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
|||
{
|
||||
// Ensure usemtl statements remain intact
|
||||
TArray<FString> mtlUsages;
|
||||
TArray<long> mtlUsageIdxs;
|
||||
long bpos = 0, nlpos = 0, slashpos = 0;
|
||||
TArray<ptrdiff_t> mtlUsageIdxs;
|
||||
ptrdiff_t bpos = 0, nlpos = 0, slashpos = 0;
|
||||
while (1)
|
||||
{
|
||||
bpos = objBuf.IndexOf("\nusemtl", bpos);
|
||||
|
@ -58,7 +58,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
|||
}
|
||||
if (nlpos == -1)
|
||||
{
|
||||
nlpos = (long)objBuf.Len();
|
||||
nlpos = objBuf.Len();
|
||||
}
|
||||
FString lineStr(objBuf.GetChars() + bpos, nlpos - bpos);
|
||||
mtlUsages.Push(lineStr);
|
||||
|
@ -76,7 +76,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
|||
nlpos = objBuf.IndexOf('\n', bpos);
|
||||
if (nlpos == -1)
|
||||
{
|
||||
nlpos = (long)objBuf.Len();
|
||||
nlpos = objBuf.Len();
|
||||
}
|
||||
memcpy(wObjBuf + bpos, mtlUsages[i].GetChars(), nlpos - bpos);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ static bool ReadSystemVersionFromPlist(NSOperatingSystemVersion& version)
|
|||
if (const char *patchVersionString = strstr(minorVersionString, "."))
|
||||
{
|
||||
patchVersionString++;
|
||||
plistVersion.patchVersion = atoi(minorVersionString);
|
||||
plistVersion.patchVersion = atoi(patchVersionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ void I_PrintStr(const char *cp)
|
|||
{ // gray
|
||||
if (v < 0.33) attrib = 0x8;
|
||||
else if (v < 0.90) attrib = 0x7;
|
||||
else attrib = 0x15;
|
||||
else attrib = 0xF;
|
||||
}
|
||||
|
||||
printData.AppendFormat("\033[%um",((attrib & 0x8) ? 90 : 30) + (attrib & 0x7));
|
||||
|
|
|
@ -545,6 +545,20 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool restartrequest;
|
||||
|
||||
void CheckForRestart()
|
||||
{
|
||||
if (restartrequest)
|
||||
{
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
restartrequest = false;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
|
@ -559,11 +573,7 @@ INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
|
|||
{
|
||||
if (LOWORD(wParam) == IDC_BUTTON1) // we pressed the restart button, so run GZDoom again
|
||||
{
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
|
||||
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
|
||||
restartrequest = true;
|
||||
}
|
||||
PostQuitMessage (0);
|
||||
return TRUE;
|
||||
|
@ -969,6 +979,8 @@ int DoMain (HINSTANCE hInstance)
|
|||
atexit (UnCOM);
|
||||
|
||||
int ret = GameMain ();
|
||||
CheckForRestart();
|
||||
|
||||
DestroyCustomCursor();
|
||||
if (ret == 1337) // special exit code for 'norun'.
|
||||
{
|
||||
|
|
|
@ -52,15 +52,15 @@ static bool IsGlslWhitespace(char c)
|
|||
}
|
||||
}
|
||||
|
||||
static FString NextGlslToken(const char *chars, long len, long &pos)
|
||||
static FString NextGlslToken(const char *chars, ptrdiff_t len, ptrdiff_t &pos)
|
||||
{
|
||||
// Eat whitespace
|
||||
long tokenStart = pos;
|
||||
ptrdiff_t tokenStart = pos;
|
||||
while (tokenStart != len && IsGlslWhitespace(chars[tokenStart]))
|
||||
tokenStart++;
|
||||
|
||||
// Find token end
|
||||
long tokenEnd = tokenStart;
|
||||
ptrdiff_t tokenEnd = tokenStart;
|
||||
while (tokenEnd != len && !IsGlslWhitespace(chars[tokenEnd]) && chars[tokenEnd] != ';')
|
||||
tokenEnd++;
|
||||
|
||||
|
@ -82,13 +82,13 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
|
||||
// The following code searches for legacy uniform declarations in the shader itself and replaces them with whitespace.
|
||||
|
||||
long len = (long)code.Len();
|
||||
ptrdiff_t len = code.Len();
|
||||
char *chars = code.LockBuffer();
|
||||
|
||||
long startIndex = 0;
|
||||
ptrdiff_t startIndex = 0;
|
||||
while (true)
|
||||
{
|
||||
long matchIndex = code.IndexOf("uniform", startIndex);
|
||||
ptrdiff_t matchIndex = code.IndexOf("uniform", startIndex);
|
||||
if (matchIndex == -1)
|
||||
break;
|
||||
|
||||
|
@ -98,7 +98,7 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
bool isKeywordEnd = matchIndex + 7 == len || IsGlslWhitespace(chars[matchIndex + 7]);
|
||||
if (isKeywordStart && isKeywordEnd)
|
||||
{
|
||||
long pos = matchIndex + 7;
|
||||
ptrdiff_t pos = matchIndex + 7;
|
||||
FString type = NextGlslToken(chars, len, pos);
|
||||
FString identifier = NextGlslToken(chars, len, pos);
|
||||
|
||||
|
@ -107,10 +107,10 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
|
||||
if (isLegacyUniformName)
|
||||
{
|
||||
long statementEndIndex = code.IndexOf(';', matchIndex + 7);
|
||||
ptrdiff_t statementEndIndex = code.IndexOf(';', matchIndex + 7);
|
||||
if (statementEndIndex == -1)
|
||||
statementEndIndex = len;
|
||||
for (long i = matchIndex; i <= statementEndIndex; i++)
|
||||
for (ptrdiff_t i = matchIndex; i <= statementEndIndex; i++)
|
||||
{
|
||||
if (!IsGlslWhitespace(chars[i]))
|
||||
chars[i] = ' ';
|
||||
|
@ -127,7 +127,7 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
// Modern GLSL only allows use of 'texture'.
|
||||
while (true)
|
||||
{
|
||||
long matchIndex = code.IndexOf("texture2d", startIndex);
|
||||
ptrdiff_t matchIndex = code.IndexOf("texture2d", startIndex);
|
||||
if (matchIndex == -1)
|
||||
break;
|
||||
|
||||
|
@ -148,14 +148,14 @@ FString RemoveLegacyUserUniforms(FString code)
|
|||
|
||||
FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &samplerstobind)
|
||||
{
|
||||
long len = (long)code.Len();
|
||||
ptrdiff_t len = code.Len();
|
||||
char *chars = code.LockBuffer();
|
||||
|
||||
long startIndex = 0;
|
||||
long startpos, endpos;
|
||||
ptrdiff_t startIndex = 0;
|
||||
ptrdiff_t startpos, endpos;
|
||||
while (true)
|
||||
{
|
||||
long matchIndex = code.IndexOf("layout(binding", startIndex);
|
||||
ptrdiff_t matchIndex = code.IndexOf("layout(binding", startIndex);
|
||||
if (matchIndex == -1)
|
||||
break;
|
||||
|
||||
|
@ -165,7 +165,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
bool isKeywordEnd = matchIndex + 14 == len || IsGlslWhitespace(chars[matchIndex + 14]) || chars[matchIndex + 14] == '=';
|
||||
if (isKeywordStart && isKeywordEnd)
|
||||
{
|
||||
long pos = matchIndex + 14;
|
||||
ptrdiff_t pos = matchIndex + 14;
|
||||
startpos = matchIndex;
|
||||
while (IsGlslWhitespace(chars[pos])) pos++;
|
||||
if (chars[pos] == '=')
|
||||
|
@ -175,7 +175,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
auto val = strtol(&chars[pos], &p, 0);
|
||||
if (p != &chars[pos])
|
||||
{
|
||||
pos = long(p - chars);
|
||||
pos = (p - chars);
|
||||
while (IsGlslWhitespace(chars[pos])) pos++;
|
||||
if (chars[pos] == ')')
|
||||
{
|
||||
|
@ -216,17 +216,17 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
|
||||
FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
||||
{
|
||||
long len = (long)code.Len();
|
||||
ptrdiff_t len = code.Len();
|
||||
char *chars = code.LockBuffer();
|
||||
|
||||
long startIndex = 0;
|
||||
ptrdiff_t startIndex = 0;
|
||||
while (true)
|
||||
{
|
||||
long matchIndex = code.IndexOf("layout(location", startIndex);
|
||||
ptrdiff_t matchIndex = code.IndexOf("layout(location", startIndex);
|
||||
if (matchIndex == -1)
|
||||
break;
|
||||
|
||||
long endIndex = matchIndex;
|
||||
ptrdiff_t endIndex = matchIndex;
|
||||
|
||||
// Find end of layout declaration
|
||||
while (chars[endIndex] != ')' && chars[endIndex] != 0)
|
||||
|
@ -255,7 +255,7 @@ FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
|||
if (keywordFound && IsGlslWhitespace(chars[endIndex + i]))
|
||||
{
|
||||
// yes - replace declaration with spaces
|
||||
for (long i = matchIndex; i < endIndex; i++)
|
||||
for (auto i = matchIndex; i < endIndex; i++)
|
||||
chars[i] = ' ';
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,8 @@ bool IShadowMap::PerformUpdate()
|
|||
LightsProcessed = 0;
|
||||
LightsShadowmapped = 0;
|
||||
|
||||
if (gl_light_shadowmap && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER) && screen->mPipelineType == 0 && CollectLights != nullptr)
|
||||
// CollectLights will be null if the calling code decides that shadowmaps are not needed.
|
||||
if (CollectLights != nullptr)
|
||||
{
|
||||
UpdateCycles.Clock();
|
||||
UploadAABBTree();
|
||||
|
|
|
@ -57,6 +57,11 @@ public:
|
|||
mLights[index + 3] = r;
|
||||
}
|
||||
|
||||
bool Enabled() const
|
||||
{
|
||||
return mAABBTree != nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Upload the AABB-tree to the GPU
|
||||
void UploadAABBTree();
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
#include "i_interface.h"
|
||||
|
||||
// Set up 3D-specific console variables:
|
||||
CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
||||
|
||||
// switch left and right eye views
|
||||
CVAR(Bool, vr_swap_eyes, false, CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, vr_swap_eyes, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
|
||||
// intraocular distance in meters
|
||||
CVAR(Float, vr_ipd, 0.062f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // METERS
|
||||
|
|
|
@ -178,22 +178,22 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
state.EnableTexture(false);
|
||||
}
|
||||
|
||||
if (cmd.shape2D != nullptr)
|
||||
if (cmd.shape2DBufInfo != nullptr)
|
||||
{
|
||||
state.SetVertexBuffer(&cmd.shape2D->buffers[cmd.shape2DBufIndex]);
|
||||
state.SetVertexBuffer(&cmd.shape2DBufInfo->buffers[cmd.shape2DBufIndex]);
|
||||
state.DrawIndexed(DT_Triangles, 0, cmd.shape2DIndexCount);
|
||||
state.SetVertexBuffer(&vb);
|
||||
if (cmd.shape2DCommandCounter == cmd.shape2D->lastCommand)
|
||||
if (cmd.shape2DCommandCounter == cmd.shape2DBufInfo->lastCommand)
|
||||
{
|
||||
cmd.shape2D->lastCommand = -1;
|
||||
if (cmd.shape2D->bufIndex > 0)
|
||||
cmd.shape2DBufInfo->lastCommand = -1;
|
||||
if (cmd.shape2DBufInfo->bufIndex > 0)
|
||||
{
|
||||
cmd.shape2D->needsVertexUpload = true;
|
||||
cmd.shape2D->buffers.Clear();
|
||||
cmd.shape2D->bufIndex = -1;
|
||||
cmd.shape2DBufInfo->needsVertexUpload = true;
|
||||
cmd.shape2DBufInfo->buffers.Clear();
|
||||
cmd.shape2DBufInfo->bufIndex = -1;
|
||||
}
|
||||
}
|
||||
cmd.shape2D->uploadedOnce = false;
|
||||
cmd.shape2DBufInfo->uploadedOnce = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -9823,6 +9823,8 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
CHECKRESOLVED();
|
||||
|
||||
SAFE_RESOLVE(Condition, ctx);
|
||||
|
||||
if (WhenTrue == nullptr && WhenFalse == nullptr)
|
||||
{ // We don't do anything either way, so disappear
|
||||
delete this;
|
||||
|
@ -9830,8 +9832,6 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx)
|
|||
return new FxNop(ScriptPosition);
|
||||
}
|
||||
|
||||
SAFE_RESOLVE(Condition, ctx);
|
||||
|
||||
if (Condition->ValueType != TypeBool)
|
||||
{
|
||||
Condition = new FxBoolCast(Condition, false);
|
||||
|
|
|
@ -419,7 +419,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, Filter, StringFilter)
|
|||
|
||||
static int StringIndexOf(FString *self, const FString &substr, int startIndex)
|
||||
{
|
||||
return self->IndexOf(substr, startIndex);
|
||||
return (int)self->IndexOf(substr, startIndex);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, IndexOf, StringIndexOf)
|
||||
|
@ -427,12 +427,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, IndexOf, StringIndexOf)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_STRING(substr);
|
||||
PARAM_INT(startIndex);
|
||||
ACTION_RETURN_INT(self->IndexOf(substr, startIndex));
|
||||
ACTION_RETURN_INT(StringIndexOf(self, substr, startIndex));
|
||||
}
|
||||
|
||||
static int StringLastIndexOf(FString *self, const FString &substr, int endIndex)
|
||||
{
|
||||
return self->LastIndexOfBroken(substr, endIndex);
|
||||
return (int)self->LastIndexOfBroken(substr, endIndex);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, LastIndexOf, StringLastIndexOf)
|
||||
|
@ -440,12 +440,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, LastIndexOf, StringLastIndexOf)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_STRING(substr);
|
||||
PARAM_INT(endIndex);
|
||||
ACTION_RETURN_INT(self->LastIndexOfBroken(substr, endIndex));
|
||||
ACTION_RETURN_INT(StringLastIndexOf(self, substr, endIndex));
|
||||
}
|
||||
|
||||
static int StringRightIndexOf(FString *self, const FString &substr, int endIndex)
|
||||
{
|
||||
return self->LastIndexOf(substr, endIndex);
|
||||
return (int)self->LastIndexOf(substr, endIndex);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, RightIndexOf, StringRightIndexOf)
|
||||
|
@ -453,7 +453,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, RightIndexOf, StringRightIndexOf)
|
|||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_STRING(substr);
|
||||
PARAM_INT(endIndex);
|
||||
ACTION_RETURN_INT(self->LastIndexOf(substr, endIndex));
|
||||
ACTION_RETURN_INT(StringRightIndexOf(self, substr, endIndex));
|
||||
}
|
||||
|
||||
static void StringToUpper(FString *self)
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
// Simple lightweight reference counting pointer alternative for std::shared_ptr which stores the reference counter in the handled object itself.
|
||||
|
||||
// Base class for handled objects
|
||||
|
||||
// Base classes for handled objects
|
||||
class NoVirtualRefCountedBase
|
||||
{
|
||||
public:
|
||||
void IncRef() { refCount++; }
|
||||
void DecRef() { if (--refCount <= 0) delete this; }
|
||||
private:
|
||||
int refCount = 0;
|
||||
};
|
||||
|
||||
class RefCountedBase
|
||||
{
|
||||
public:
|
||||
void IncRef() { refCount++; }
|
||||
void DecRef() { if (--refCount <= 0) delete this; }
|
||||
void IncRef() { refCount++; }
|
||||
void DecRef() { if (--refCount <= 0) delete this; }
|
||||
private:
|
||||
int refCount = 0;
|
||||
int refCount = 0;
|
||||
protected:
|
||||
virtual ~RefCountedBase() = default;
|
||||
virtual ~RefCountedBase() = default;
|
||||
};
|
||||
|
||||
// The actual pointer object
|
||||
|
||||
// The actual pointer object
|
||||
template<class T>
|
||||
class RefCountedPtr
|
||||
{
|
||||
|
@ -31,10 +40,20 @@ public:
|
|||
{
|
||||
if (ptr) ptr->IncRef();
|
||||
}
|
||||
|
||||
|
||||
RefCountedPtr(const RefCountedPtr& r) : ptr(r.ptr)
|
||||
{
|
||||
if (ptr) ptr->IncRef();
|
||||
}
|
||||
|
||||
RefCountedPtr(RefCountedPtr&& r) : ptr(r.ptr)
|
||||
{
|
||||
r.ptr = nullptr;
|
||||
}
|
||||
|
||||
RefCountedPtr & operator=(const RefCountedPtr& r)
|
||||
{
|
||||
if (ptr != r.ptr)
|
||||
if (this != &r)
|
||||
{
|
||||
if (ptr) ptr->DecRef();
|
||||
ptr = r.ptr;
|
||||
|
@ -54,11 +73,14 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
RefCountedPtr & operator=(const RefCountedPtr&& r)
|
||||
RefCountedPtr & operator=(RefCountedPtr&& r)
|
||||
{
|
||||
if (ptr) ptr->DecRef();
|
||||
ptr = r.ptr;
|
||||
r.ptr = nullptr;
|
||||
if (this != &r)
|
||||
{
|
||||
if (ptr) ptr->DecRef();
|
||||
ptr = r.ptr;
|
||||
r.ptr = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ bool FPlayList::ChangeList (const char *path)
|
|||
}
|
||||
|
||||
// Check for relative paths.
|
||||
long slashpos = song.IndexOf('/');
|
||||
auto slashpos = song.IndexOf('/');
|
||||
|
||||
if (slashpos == 0)
|
||||
{
|
||||
|
|
|
@ -422,7 +422,7 @@ void FString::Remove(size_t index, size_t remlen)
|
|||
{
|
||||
if (index + remlen >= Len())
|
||||
{
|
||||
Truncate((long)index);
|
||||
Truncate(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -500,12 +500,12 @@ void FString::DeleteLastCharacter()
|
|||
}
|
||||
|
||||
|
||||
long FString::IndexOf (const FString &substr, long startIndex) const
|
||||
ptrdiff_t FString::IndexOf (const FString &substr, ptrdiff_t startIndex) const
|
||||
{
|
||||
return IndexOf (substr.Chars, startIndex);
|
||||
}
|
||||
|
||||
long FString::IndexOf (const char *substr, long startIndex) const
|
||||
ptrdiff_t FString::IndexOf (const char *substr, ptrdiff_t startIndex) const
|
||||
{
|
||||
if (startIndex > 0 && Len() <= (size_t)startIndex)
|
||||
{
|
||||
|
@ -516,10 +516,10 @@ long FString::IndexOf (const char *substr, long startIndex) const
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
return long(str - Chars);
|
||||
return str - Chars;
|
||||
}
|
||||
|
||||
long FString::IndexOf (char subchar, long startIndex) const
|
||||
ptrdiff_t FString::IndexOf (char subchar, ptrdiff_t startIndex) const
|
||||
{
|
||||
if (startIndex > 0 && Len() <= (size_t)startIndex)
|
||||
{
|
||||
|
@ -530,15 +530,15 @@ long FString::IndexOf (char subchar, long startIndex) const
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
return long(str - Chars);
|
||||
return str - Chars;
|
||||
}
|
||||
|
||||
long FString::IndexOfAny (const FString &charset, long startIndex) const
|
||||
ptrdiff_t FString::IndexOfAny (const FString &charset, ptrdiff_t startIndex) const
|
||||
{
|
||||
return IndexOfAny (charset.Chars, startIndex);
|
||||
}
|
||||
|
||||
long FString::IndexOfAny (const char *charset, long startIndex) const
|
||||
ptrdiff_t FString::IndexOfAny (const char *charset, ptrdiff_t startIndex) const
|
||||
{
|
||||
if (startIndex > 0 && Len() <= (size_t)startIndex)
|
||||
{
|
||||
|
@ -549,19 +549,19 @@ long FString::IndexOfAny (const char *charset, long startIndex) const
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
return long(brk - Chars);
|
||||
return brk - Chars;
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (char subchar) const
|
||||
ptrdiff_t FString::LastIndexOf (char subchar) const
|
||||
{
|
||||
return LastIndexOf (subchar, long(Len()));
|
||||
return LastIndexOf (subchar, Len());
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (char subchar, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOf (char subchar, ptrdiff_t endIndex) const
|
||||
{
|
||||
if ((size_t)endIndex > Len())
|
||||
{
|
||||
endIndex = long(Len());
|
||||
endIndex = Len();
|
||||
}
|
||||
while (--endIndex >= 0)
|
||||
{
|
||||
|
@ -573,16 +573,16 @@ long FString::LastIndexOf (char subchar, long endIndex) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
long FString::LastIndexOfBroken (const FString &_substr, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOfBroken (const FString &_substr, ptrdiff_t endIndex) const
|
||||
{
|
||||
const char *substr = _substr.GetChars();
|
||||
size_t substrlen = _substr.Len();
|
||||
if ((size_t)endIndex > Len())
|
||||
{
|
||||
endIndex = long(Len());
|
||||
endIndex = Len();
|
||||
}
|
||||
substrlen--;
|
||||
while (--endIndex >= long(substrlen))
|
||||
while (--endIndex >= ptrdiff_t(substrlen))
|
||||
{
|
||||
if (strncmp (substr, Chars + endIndex - substrlen, substrlen + 1) == 0)
|
||||
{
|
||||
|
@ -592,26 +592,26 @@ long FString::LastIndexOfBroken (const FString &_substr, long endIndex) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
long FString::LastIndexOfAny (const FString &charset) const
|
||||
ptrdiff_t FString::LastIndexOfAny (const FString &charset) const
|
||||
{
|
||||
return LastIndexOfAny (charset.Chars, long(Len()));
|
||||
return LastIndexOfAny (charset.Chars, Len());
|
||||
}
|
||||
|
||||
long FString::LastIndexOfAny (const char *charset) const
|
||||
ptrdiff_t FString::LastIndexOfAny (const char *charset) const
|
||||
{
|
||||
return LastIndexOfAny (charset, long(Len()));
|
||||
}
|
||||
|
||||
long FString::LastIndexOfAny (const FString &charset, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOfAny (const FString &charset, ptrdiff_t endIndex) const
|
||||
{
|
||||
return LastIndexOfAny (charset.Chars, endIndex);
|
||||
}
|
||||
|
||||
long FString::LastIndexOfAny (const char *charset, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOfAny (const char *charset, ptrdiff_t endIndex) const
|
||||
{
|
||||
if ((size_t)endIndex > Len())
|
||||
{
|
||||
endIndex = long(Len());
|
||||
endIndex = Len();
|
||||
}
|
||||
while (--endIndex >= 0)
|
||||
{
|
||||
|
@ -623,31 +623,31 @@ long FString::LastIndexOfAny (const char *charset, long endIndex) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const FString &substr) const
|
||||
ptrdiff_t FString::LastIndexOf (const FString &substr) const
|
||||
{
|
||||
return LastIndexOf(substr.Chars, long(Len() - substr.Len()), substr.Len());
|
||||
return LastIndexOf(substr.Chars, Len() - substr.Len(), substr.Len());
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const FString &substr, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOf (const FString &substr, ptrdiff_t endIndex) const
|
||||
{
|
||||
return LastIndexOf(substr.Chars, endIndex, substr.Len());
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const char *substr) const
|
||||
ptrdiff_t FString::LastIndexOf (const char *substr) const
|
||||
{
|
||||
return LastIndexOf(substr, long(Len() - strlen(substr)), strlen(substr));
|
||||
return LastIndexOf(substr, Len() - strlen(substr), strlen(substr));
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const char *substr, long endIndex) const
|
||||
ptrdiff_t FString::LastIndexOf (const char *substr, ptrdiff_t endIndex) const
|
||||
{
|
||||
return LastIndexOf(substr, endIndex, strlen(substr));
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const char *substr, long endIndex, size_t substrlen) const
|
||||
ptrdiff_t FString::LastIndexOf (const char *substr, ptrdiff_t endIndex, size_t substrlen) const
|
||||
{
|
||||
if ((size_t)endIndex + substrlen > Len())
|
||||
{
|
||||
endIndex = long(Len() - substrlen);
|
||||
endIndex = Len() - substrlen;
|
||||
}
|
||||
while (endIndex >= 0)
|
||||
{
|
||||
|
@ -1256,15 +1256,15 @@ void FString::Split(TArray<FString>& tokens, const char *delimiter, EmptyTokenTy
|
|||
{
|
||||
assert(nullptr != delimiter);
|
||||
|
||||
const long selfLen = static_cast<long>(Len());
|
||||
const long delimLen = static_cast<long>(strlen(delimiter));
|
||||
long lastPos = 0;
|
||||
const auto selfLen = static_cast<ptrdiff_t>(Len());
|
||||
const auto delimLen = static_cast<ptrdiff_t>(strlen(delimiter));
|
||||
ptrdiff_t lastPos = 0;
|
||||
|
||||
if (selfLen == 0) return; // Empty strings do not contain tokens, even with TOK_KEEPEMPTY.
|
||||
|
||||
while (lastPos <= selfLen)
|
||||
{
|
||||
long pos = IndexOf(delimiter, lastPos);
|
||||
auto pos = IndexOf(delimiter, lastPos);
|
||||
|
||||
if (-1 == pos)
|
||||
{
|
||||
|
|
|
@ -215,28 +215,28 @@ public:
|
|||
void AppendCharacter(int codepoint);
|
||||
void DeleteLastCharacter();
|
||||
|
||||
long IndexOf (const FString &substr, long startIndex=0) const;
|
||||
long IndexOf (const char *substr, long startIndex=0) const;
|
||||
long IndexOf (char subchar, long startIndex=0) const;
|
||||
ptrdiff_t IndexOf (const FString &substr, ptrdiff_t startIndex=0) const;
|
||||
ptrdiff_t IndexOf (const char *substr, ptrdiff_t startIndex=0) const;
|
||||
ptrdiff_t IndexOf (char subchar, ptrdiff_t startIndex=0) const;
|
||||
|
||||
long IndexOfAny (const FString &charset, long startIndex=0) const;
|
||||
long IndexOfAny (const char *charset, long startIndex=0) const;
|
||||
ptrdiff_t IndexOfAny (const FString &charset, ptrdiff_t startIndex=0) const;
|
||||
ptrdiff_t IndexOfAny (const char *charset, ptrdiff_t startIndex=0) const;
|
||||
|
||||
// This is only kept for backwards compatibility with old ZScript versions that used this function and depend on its bug.
|
||||
long LastIndexOf (char subchar) const;
|
||||
long LastIndexOfBroken (const FString &substr, long endIndex) const;
|
||||
long LastIndexOf (char subchar, long endIndex) const;
|
||||
ptrdiff_t LastIndexOf (char subchar) const;
|
||||
ptrdiff_t LastIndexOfBroken (const FString &substr, ptrdiff_t endIndex) const;
|
||||
ptrdiff_t LastIndexOf (char subchar, ptrdiff_t endIndex) const;
|
||||
|
||||
long LastIndexOfAny (const FString &charset) const;
|
||||
long LastIndexOfAny (const char *charset) const;
|
||||
long LastIndexOfAny (const FString &charset, long endIndex) const;
|
||||
long LastIndexOfAny (const char *charset, long endIndex) const;
|
||||
ptrdiff_t LastIndexOfAny (const FString &charset) const;
|
||||
ptrdiff_t LastIndexOfAny (const char *charset) const;
|
||||
ptrdiff_t LastIndexOfAny (const FString &charset, ptrdiff_t endIndex) const;
|
||||
ptrdiff_t LastIndexOfAny (const char *charset, ptrdiff_t endIndex) const;
|
||||
|
||||
long LastIndexOf (const FString &substr) const;
|
||||
long LastIndexOf (const FString &substr, long endIndex) const;
|
||||
long LastIndexOf (const char *substr) const;
|
||||
long LastIndexOf (const char *substr, long endIndex) const;
|
||||
long LastIndexOf (const char *substr, long endIndex, size_t substrlen) const;
|
||||
ptrdiff_t LastIndexOf (const FString &substr) const;
|
||||
ptrdiff_t LastIndexOf (const FString &substr, ptrdiff_t endIndex) const;
|
||||
ptrdiff_t LastIndexOf (const char *substr) const;
|
||||
ptrdiff_t LastIndexOf (const char *substr, ptrdiff_t endIndex) const;
|
||||
ptrdiff_t LastIndexOf (const char *substr, ptrdiff_t endIndex, size_t substrlen) const;
|
||||
|
||||
void ToUpper ();
|
||||
void ToLower ();
|
||||
|
|
|
@ -762,7 +762,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
|
|||
FString path;
|
||||
if (info.Load[i][0] != ':')
|
||||
{
|
||||
long lastslash = picks[pick].mFullPath.LastIndexOf('/');
|
||||
auto lastslash = picks[pick].mFullPath.LastIndexOf('/');
|
||||
|
||||
if (lastslash == -1)
|
||||
{
|
||||
|
|
|
@ -903,6 +903,7 @@ static void End2DAndUpdate()
|
|||
twod->End();
|
||||
CheckBench();
|
||||
screen->Update();
|
||||
twod->OnFrameDone();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -2121,8 +2122,8 @@ static void AddAutoloadFiles(const char *autoname)
|
|||
// Add common (global) wads
|
||||
D_AddConfigFiles(allwads, "Global.Autoload", "*.wad", GameConfig);
|
||||
|
||||
long len;
|
||||
int lastpos = -1;
|
||||
ptrdiff_t len;
|
||||
ptrdiff_t lastpos = -1;
|
||||
|
||||
while ((len = LumpFilterIWAD.IndexOf('.', lastpos+1)) > 0)
|
||||
{
|
||||
|
|
|
@ -1014,7 +1014,7 @@ bool G_Responder (event_t *ev)
|
|||
{
|
||||
if (ST_Responder (ev))
|
||||
return true; // status window ate it
|
||||
if (!viewactive && primaryLevel->automap->Responder (ev, false))
|
||||
if (!viewactive && primaryLevel->automap && primaryLevel->automap->Responder (ev, false))
|
||||
return true; // automap ate it
|
||||
}
|
||||
else if (gamestate == GS_FINALE)
|
||||
|
|
|
@ -378,6 +378,10 @@ void G_NewInit ()
|
|||
if (primaryLevel->FraggleScriptThinker) primaryLevel->FraggleScriptThinker->Destroy();
|
||||
primaryLevel->FraggleScriptThinker = nullptr;
|
||||
|
||||
// Destroy thinkers that may remain after change level failure
|
||||
// Usually, the list contains just a sentinel when such error occurred
|
||||
primaryLevel->Thinkers.DestroyThinkersInList(STAT_TRAVELLING);
|
||||
|
||||
G_ClearSnapshots ();
|
||||
netgame = false;
|
||||
multiplayer = multiplayernext;
|
||||
|
|
|
@ -255,7 +255,7 @@ void FGameConfigFile::DoAutoloadSetup (FIWadManager *iwad_man)
|
|||
{
|
||||
FString section = workname + ".Autoload";
|
||||
CreateSectionAtStart(section.GetChars());
|
||||
long dotpos = workname.LastIndexOf('.');
|
||||
auto dotpos = workname.LastIndexOf('.');
|
||||
if (dotpos < 0) break;
|
||||
workname.Truncate(dotpos);
|
||||
}
|
||||
|
|
|
@ -635,7 +635,7 @@ void M_ScreenShot (const char *filename)
|
|||
|
||||
if (!screenshot_quiet)
|
||||
{
|
||||
int slash = -1;
|
||||
ptrdiff_t slash = -1;
|
||||
if (!longsavemessages) slash = autoname.LastIndexOfAny(":/\\");
|
||||
Printf ("Captured %s\n", autoname.GetChars()+slash+1);
|
||||
}
|
||||
|
|
|
@ -1001,13 +1001,13 @@ static FString CreateCacheName(MapData *map, bool create)
|
|||
{
|
||||
FString path = M_GetCachePath(create);
|
||||
FString lumpname = fileSystem.GetFileFullPath(map->lumpnum);
|
||||
int separator = lumpname.IndexOf(':');
|
||||
auto separator = lumpname.IndexOf(':');
|
||||
path << '/' << lumpname.Left(separator);
|
||||
if (create) CreatePath(path);
|
||||
|
||||
lumpname.ReplaceChars('/', '%');
|
||||
lumpname.ReplaceChars(':', '$');
|
||||
path << '/' << lumpname.Right(lumpname.Len() - separator - 1) << ".gzc";
|
||||
path << '/' << lumpname.Right((ptrdiff_t)lumpname.Len() - separator - 1) << ".gzc";
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "gameconfigfile.h"
|
||||
#include "d_player.h"
|
||||
#include "teaminfo.h"
|
||||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
|
||||
EXTERN_CVAR(Int, cl_gfxlocalization)
|
||||
EXTERN_CVAR(Bool, m_quickexit)
|
||||
|
@ -295,6 +296,7 @@ CCMD (menu_quit)
|
|||
{ // F10
|
||||
if (m_quickexit)
|
||||
{
|
||||
CleanSWDrawer();
|
||||
ST_Endoom();
|
||||
}
|
||||
|
||||
|
@ -326,6 +328,7 @@ CCMD (menu_quit)
|
|||
I_WaitVBL(105);
|
||||
}
|
||||
}
|
||||
CleanSWDrawer();
|
||||
ST_Endoom();
|
||||
});
|
||||
|
||||
|
@ -568,8 +571,21 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
|
|||
if (y < topy) topy = y;
|
||||
}
|
||||
|
||||
int spacing = ld->mLinespacing;
|
||||
for (unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||
{
|
||||
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||
if (AllEpisodes[i].mEpisodeName.IsEmpty() || OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
||||
continue;
|
||||
}
|
||||
if ((gameinfo.gametype & GAME_DoomStrifeChex) && spacing == 16) spacing = 18;
|
||||
break;
|
||||
}
|
||||
|
||||
// center the menu on the screen if the top space is larger than the bottom space
|
||||
int totalheight = posy + AllEpisodes.Size() * ld->mLinespacing - topy;
|
||||
int totalheight = posy + AllEpisodes.Size() * spacing - topy;
|
||||
|
||||
if (totalheight < 190 || AllEpisodes.Size() == 1)
|
||||
{
|
||||
|
@ -610,15 +626,15 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
|
|||
{
|
||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||
if (AllEpisodes[i].mEpisodeName.IsEmpty() || OkForLocalization(tex, AllEpisodes[i].mEpisodeName))
|
||||
it = CreateListMenuItemPatch(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
|
||||
it = CreateListMenuItemPatch(posx, posy, spacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i);
|
||||
}
|
||||
if (it == nullptr)
|
||||
{
|
||||
it = CreateListMenuItemText(posx, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
|
||||
it = CreateListMenuItemText(posx, posy, spacing, AllEpisodes[i].mShortcut,
|
||||
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
|
||||
}
|
||||
ld->mItems.Push(it);
|
||||
posy += ld->mLinespacing;
|
||||
posy += spacing;
|
||||
}
|
||||
if (AllEpisodes.Size() == 1)
|
||||
{
|
||||
|
@ -1070,9 +1086,10 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
|
|||
}
|
||||
}
|
||||
|
||||
if (done != restart)
|
||||
int spacing = ld->mLinespacing;
|
||||
//if (done != restart)
|
||||
{
|
||||
done = restart;
|
||||
//done = restart;
|
||||
ld->mSelectedItem = ld->mItems.Size() + defindex;
|
||||
|
||||
int posy = y;
|
||||
|
@ -1085,8 +1102,20 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
|
|||
if (y < topy) topy = y;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < MenuSkills.Size(); i++)
|
||||
{
|
||||
if (MenuSkills[i]->PicName.IsNotEmpty())
|
||||
{
|
||||
FTextureID tex = GetMenuTexture(MenuSkills[i]->PicName);
|
||||
if (MenuSkills[i]->MenuName.IsEmpty() || OkForLocalization(tex, MenuSkills[i]->MenuName))
|
||||
continue;
|
||||
}
|
||||
if ((gameinfo.gametype & GAME_DoomStrifeChex) && spacing == 16) spacing = 18;
|
||||
break;
|
||||
}
|
||||
|
||||
// center the menu on the screen if the top space is larger than the bottom space
|
||||
int totalheight = posy + MenuSkills.Size() * ld->mLinespacing - topy;
|
||||
int totalheight = posy + MenuSkills.Size() * spacing - topy;
|
||||
|
||||
if (totalheight < 190 || MenuSkills.Size() == 1)
|
||||
{
|
||||
|
@ -1154,16 +1183,16 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
|
|||
{
|
||||
FTextureID tex = GetMenuTexture(skill.PicName);
|
||||
if (skill.MenuName.IsEmpty() || OkForLocalization(tex, skill.MenuName))
|
||||
li = CreateListMenuItemPatch(posx, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i]);
|
||||
li = CreateListMenuItemPatch(posx, y, spacing, skill.Shortcut, tex, action, SkillIndices[i]);
|
||||
}
|
||||
if (li == nullptr)
|
||||
{
|
||||
li = CreateListMenuItemText(posx, y, ld->mLinespacing, skill.Shortcut,
|
||||
li = CreateListMenuItemText(posx, y, spacing, skill.Shortcut,
|
||||
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);
|
||||
}
|
||||
ld->mItems.Push(li);
|
||||
GC::WriteBarrier(*desc, li);
|
||||
y += ld->mLinespacing;
|
||||
y += spacing;
|
||||
}
|
||||
if (AllEpisodes[gs->Episode].mNoSkill || MenuSkills.Size() == 1)
|
||||
{
|
||||
|
|
|
@ -175,22 +175,6 @@ void P_Ticker (void)
|
|||
{
|
||||
P_UpdateSpecials(Level);
|
||||
}
|
||||
it = Level->GetThinkerIterator<AActor>();
|
||||
|
||||
// Set dynamic lights at the end of the tick, so that this catches all changes being made through the last frame.
|
||||
while ((ac = it.Next()))
|
||||
{
|
||||
if (ac->flags8 & MF8_RECREATELIGHTS)
|
||||
{
|
||||
ac->flags8 &= ~MF8_RECREATELIGHTS;
|
||||
ac->SetDynamicLights();
|
||||
}
|
||||
// This was merged from P_RunEffects to eliminate the costly duplicate ThinkerIterator loop.
|
||||
if ((ac->effects || ac->fountaincolor) && !Level->isFrozen())
|
||||
{
|
||||
P_RunEffect(ac, ac->effects);
|
||||
}
|
||||
}
|
||||
|
||||
// for par times
|
||||
Level->time++;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "v_text.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "a_dynlight.h"
|
||||
#include "v_video.h"
|
||||
|
||||
|
||||
static int ThinkCount;
|
||||
|
@ -106,6 +107,25 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
|||
|
||||
ThinkCycles.Clock();
|
||||
|
||||
auto recreateLights = [=]() {
|
||||
auto it = Level->GetThinkerIterator<AActor>();
|
||||
|
||||
// Set dynamic lights at the end of the tick, so that this catches all changes being made through the last frame.
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
if (ac->flags8 & MF8_RECREATELIGHTS)
|
||||
{
|
||||
ac->flags8 &= ~MF8_RECREATELIGHTS;
|
||||
ac->SetDynamicLights();
|
||||
}
|
||||
// This was merged from P_RunEffects to eliminate the costly duplicate ThinkerIterator loop.
|
||||
if ((ac->effects || ac->fountaincolor) && !Level->isFrozen())
|
||||
{
|
||||
P_RunEffect(ac, ac->effects);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!profilethinkers)
|
||||
{
|
||||
// Tick every thinker left from last time
|
||||
|
@ -124,11 +144,15 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
|||
}
|
||||
} while (count != 0);
|
||||
|
||||
for (auto light = Level->lights; light;)
|
||||
if (Level->HasDynamicLights)
|
||||
{
|
||||
auto next = light->next;
|
||||
light->Tick();
|
||||
light = next;
|
||||
recreateLights();
|
||||
for (auto light = Level->lights; light;)
|
||||
{
|
||||
auto next = light->next;
|
||||
light->Tick();
|
||||
light = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -150,8 +174,9 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
|
|||
}
|
||||
} while (count != 0);
|
||||
|
||||
if (Level->lights)
|
||||
if (Level->lights && Level->HasDynamicLights)
|
||||
{
|
||||
recreateLights();
|
||||
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
|
||||
auto &prof = Profiles[NAME_InternalDynamicLight];
|
||||
prof.timer.Clock();
|
||||
|
|
|
@ -648,7 +648,7 @@ bool FLevelLocals::EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, d
|
|||
floor->m_Instant = false;
|
||||
|
||||
floor->m_Crush = (usespecials & DFloor::stairCrush) ? 10 : -1; //jff 2/27/98 fix uninitialized crush field
|
||||
floor->m_Hexencrush = false;
|
||||
floor->m_Hexencrush = true;
|
||||
|
||||
floor->m_Speed = speed;
|
||||
height = sec->CenterFloor() + stairstep;
|
||||
|
|
|
@ -910,13 +910,13 @@ FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *l, int _minx, int _miny
|
|||
Reset();
|
||||
}
|
||||
|
||||
void FBlockThingsIterator::init(const FBoundingBox &box)
|
||||
void FBlockThingsIterator::init(const FBoundingBox &box, bool clearhash)
|
||||
{
|
||||
maxy = Level->blockmap.GetBlockY(box.Top());
|
||||
miny = Level->blockmap.GetBlockY(box.Bottom());
|
||||
maxx = Level->blockmap.GetBlockX(box.Right());
|
||||
minx = Level->blockmap.GetBlockX(box.Left());
|
||||
ClearHash();
|
||||
if (clearhash) ClearHash();
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ void FMultiBlockThingsIterator::startIteratorForGroup(int group)
|
|||
offset.X += checkpoint.X;
|
||||
offset.Y += checkpoint.Y;
|
||||
bbox.setBox(offset.X, offset.Y, checkpoint.Z);
|
||||
blockIterator.init(bbox);
|
||||
blockIterator.init(bbox, false);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1153,6 +1153,7 @@ void FMultiBlockThingsIterator::Reset()
|
|||
index = -1;
|
||||
portalflags = 0;
|
||||
startIteratorForGroup(basegroup);
|
||||
blockIterator.ClearHash();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1847,6 +1848,7 @@ AActor *P_RoughMonsterSearch(AActor *mo, int distance, bool onlyseekable, bool f
|
|||
{
|
||||
BlockCheckInfo info;
|
||||
info.onlyseekable = onlyseekable;
|
||||
info.fov = fov;
|
||||
if ((info.frontonly = frontonly))
|
||||
{
|
||||
info.frontline.x = mo->X();
|
||||
|
|
|
@ -319,7 +319,7 @@ public:
|
|||
Level = l;
|
||||
init(box);
|
||||
}
|
||||
void init(const FBoundingBox &box);
|
||||
void init(const FBoundingBox &box, bool clearhash = true);
|
||||
AActor *Next(bool centeronly = false);
|
||||
void Reset() { StartBlock(minx, miny); }
|
||||
};
|
||||
|
|
|
@ -183,7 +183,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
|
|||
void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float ofsY)
|
||||
{
|
||||
AActor * playermo = players[consoleplayer].camera;
|
||||
FSpriteModelFrame *smf = FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
|
||||
// [BB] No model found for this sprite, so we can't render anything.
|
||||
if (smf == nullptr)
|
||||
|
@ -216,7 +216,7 @@ void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float o
|
|||
renderer->BeginDrawHUDModel(playermo->RenderStyle, objectToWorldMatrix, orientation < 0);
|
||||
uint32_t trans = psp->GetTranslation() != 0 ? psp->GetTranslation() : 0;
|
||||
if ((psp->Flags & PSPF_PLAYERTRANSLATED)) trans = psp->Owner->mo->Translation;
|
||||
RenderFrameModels(renderer, playermo->Level, smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), trans);
|
||||
RenderFrameModels(renderer, playermo->Level, smf, psp->GetState(), psp->GetTics(), psp->Caller->GetClass(), trans);
|
||||
renderer->EndDrawHUDModel(playermo->RenderStyle);
|
||||
}
|
||||
|
||||
|
@ -777,15 +777,14 @@ FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, boo
|
|||
|
||||
bool IsHUDModelForPlayerAvailable (player_t * player)
|
||||
{
|
||||
if (player == nullptr || player->ReadyWeapon == nullptr)
|
||||
if (player == nullptr || player->psprites == nullptr)
|
||||
return false;
|
||||
|
||||
DPSprite *psp = player->FindPSprite(PSP_WEAPON);
|
||||
|
||||
if (psp == nullptr)
|
||||
return false;
|
||||
|
||||
FSpriteModelFrame *smf = FindModelFrame(player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
return ( smf != nullptr );
|
||||
// [MK] check that at least one psprite uses models
|
||||
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
if ( smf != nullptr ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "a_dynlight.h"
|
||||
#include "hw_dynlightdata.h"
|
||||
#include"hw_cvars.h"
|
||||
#include "v_video.h"
|
||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||
|
||||
// If we want to share the array to avoid constant allocations it needs to be thread local unless it'd be littered with expensive synchronization.
|
||||
|
@ -107,7 +108,7 @@ void AddLightToList(FDynLightData &dld, int group, FDynamicLight * light, bool f
|
|||
}
|
||||
|
||||
float shadowIndex;
|
||||
if (gl_light_shadowmap) // note: with gl_light_shadowmap switched off, we cannot rely on properly set indices anymore.
|
||||
if (screen->mShadowMap.Enabled()) // note: with shadowmaps switched off, we cannot rely on properly set indices anymore.
|
||||
{
|
||||
shadowIndex = light->mShadowmapIndex + 1.0f;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "flatvertices.h"
|
||||
#include "v_palette.h"
|
||||
#include "d_main.h"
|
||||
#include "g_cvars.h"
|
||||
|
||||
#include "hw_lightbuffer.h"
|
||||
#include "hw_cvars.h"
|
||||
|
@ -107,7 +108,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
|
||||
R_SetupFrame(mainvp, r_viewwindow, camera);
|
||||
|
||||
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && gl_light_shadowmap && screen->mPipelineType == 0 && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
|
||||
if (mainview && toscreen && !(camera->Level->flags3 & LEVEL3_NOSHADOWMAP) && camera->Level->HasDynamicLights && gl_light_shadowmap && screen->mPipelineType == 0 && (screen->hwcaps & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
screen->SetAABBTree(camera->Level->aabbTree);
|
||||
screen->mShadowMap.SetCollectLights([=] {
|
||||
|
|
|
@ -614,7 +614,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
|||
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
if (!psp->GetState()) continue;
|
||||
FSpriteModelFrame *smf = playermo->player->ReadyWeapon ? FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false) : nullptr;
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
// This is an 'either-or' proposition. This maybe needs some work to allow overlays with weapon models but as originally implemented this just won't work.
|
||||
if (smf && !hudModelStep) continue;
|
||||
if (!smf && hudModelStep) continue;
|
||||
|
|
|
@ -808,12 +808,12 @@ FxMultiNameState::FxMultiNameState(const char *_statestring, const FScriptPositi
|
|||
{
|
||||
FName scopename = NAME_None;
|
||||
FString statestring = _statestring;
|
||||
int scopeindex = statestring.IndexOf("::");
|
||||
auto scopeindex = statestring.IndexOf("::");
|
||||
|
||||
if (scopeindex >= 0)
|
||||
{
|
||||
scopename = FName(statestring, scopeindex, false);
|
||||
statestring = statestring.Right(statestring.Len() - scopeindex - 2);
|
||||
statestring = statestring.Right((ptrdiff_t)statestring.Len() - scopeindex - 2);
|
||||
}
|
||||
names = MakeStateNameList(statestring);
|
||||
names.Insert(0, scopename);
|
||||
|
|
BIN
wadsrc/static/fonts/indexfont/0030.png
Normal file
BIN
wadsrc/static/fonts/indexfont/0030.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 230 B |
2
wadsrc/static/fonts/indexfont/font.inf
Normal file
2
wadsrc/static/fonts/indexfont/font.inf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CellSize 4, 6 // This implies font sheets
|
||||
|
Binary file not shown.
|
@ -209,6 +209,7 @@ ListMenu "EpisodeMenu"
|
|||
{
|
||||
Position 48, 63
|
||||
StaticPatch 54, 38, "M_EPISOD", 0 , "$MNU_EPISODE"
|
||||
linespacing 16
|
||||
}
|
||||
IfGame(Strife)
|
||||
{
|
||||
|
@ -234,6 +235,7 @@ ListMenu "SkillMenu"
|
|||
IfGame(Doom, Chex)
|
||||
{
|
||||
StaticPatch 96, 14, "M_NEWG", 0, "$MNU_NEWGAME"
|
||||
linespacing 16
|
||||
}
|
||||
IfGame(Strife)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ class ExplosiveBarrel : Actor
|
|||
BEXP A 5 BRIGHT;
|
||||
BEXP B 5 BRIGHT A_Scream;
|
||||
BEXP C 5 BRIGHT;
|
||||
BEXP D 5 BRIGHT A_Explode;
|
||||
BEXP D 10 BRIGHT A_Explode;
|
||||
BEXP E 10 BRIGHT;
|
||||
TNT1 A 1050 BRIGHT A_BarrelDestroy;
|
||||
TNT1 A 5 A_Respawn;
|
||||
|
|
|
@ -456,6 +456,7 @@ class PlayerPawn : Actor
|
|||
virtual void CheckWeaponChange ()
|
||||
{
|
||||
let player = self.player;
|
||||
if (!player) return;
|
||||
if ((player.WeaponState & WF_DISABLESWITCH) || // Weapon changing has been disabled.
|
||||
player.morphTics != 0) // Morphed classes cannot change weapons.
|
||||
{ // ...so throw away any pending weapon requests.
|
||||
|
|
|
@ -412,7 +412,6 @@ struct Screen native
|
|||
native static Color PaletteColor(int index);
|
||||
native static int GetWidth();
|
||||
native static int GetHeight();
|
||||
//native static Vector2 GetTextScreenSize();
|
||||
native static void Clear(int left, int top, int right, int bottom, Color color, int palcolor = -1);
|
||||
native static void Dim(Color col, double amount, int x, int y, int w, int h);
|
||||
|
||||
|
|
|
@ -328,6 +328,36 @@ class ListMenu : Menu
|
|||
{
|
||||
mFocusControl = NULL;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void ChangeLineSpacing(int newspace)
|
||||
{
|
||||
double top = -32767;
|
||||
|
||||
for (int i = 0; i < mDesc.mItems.Size(); i++)
|
||||
{
|
||||
let selitem = ListMenuItemSelectable(mDesc.mItems[i]);
|
||||
if (selitem)
|
||||
{
|
||||
let y = mDesc.mItems[i].GetY();
|
||||
if (top == -32767)
|
||||
{
|
||||
top = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
let newy = top + (y - top) / mDesc.mLineSpacing * newspace;
|
||||
mDesc.mItems[i].SetY(newy);
|
||||
}
|
||||
}
|
||||
}
|
||||
mDesc.mLineSpacing = newspace;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class MenuItemBase : Object native ui version("2.4")
|
|||
double GetY() { return mYpos; }
|
||||
double GetX() { return mXpos; }
|
||||
void SetX(double x) { mXpos = x; }
|
||||
void SetY(double x) { mYpos = x; }
|
||||
virtual void OnMenuCreated() {}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class DoomStatusBar : BaseStatusBar
|
|||
|
||||
if (CPlayer.mo.InvSel != null && !Level.NoInventoryBar)
|
||||
{
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198), DI_DIMDEPLETED);
|
||||
if (CPlayer.mo.InvSel.Amount > 1)
|
||||
{
|
||||
DrawString(mAmountFont, FormatNumber(CPlayer.mo.InvSel.Amount), (175, 198-mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);
|
||||
|
@ -169,7 +169,7 @@ class DoomStatusBar : BaseStatusBar
|
|||
}
|
||||
if (!isInventoryBarVisible() && !Level.NoInventoryBar && CPlayer.mo.InvSel != null)
|
||||
{
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-14, invY + 17), DI_DIMDEPLETED);
|
||||
DrawString(mHUDFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-30, invY), DI_TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
if (deathmatch)
|
||||
|
|
|
@ -127,7 +127,7 @@ class HereticStatusBar : BaseStatusBar
|
|||
//inventory box
|
||||
if (CPlayer.mo.InvSel != null)
|
||||
{
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (194, 175), DI_ARTIFLASH|DI_ITEM_CENTER, boxsize:(28, 28));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (194, 175), DI_ARTIFLASH|DI_ITEM_CENTER|DI_DIMDEPLETED, boxsize:(28, 28));
|
||||
if (CPlayer.mo.InvSel.Amount > 1)
|
||||
{
|
||||
DrawString(mIndexFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (209, 182), DI_TEXT_ALIGN_RIGHT);
|
||||
|
@ -205,7 +205,7 @@ class HereticStatusBar : BaseStatusBar
|
|||
// This code was changed to always fit the item into the box, regardless of alignment or sprite size.
|
||||
// Heretic's ARTIBOX is 30x30 pixels.
|
||||
DrawImage("ARTIBOX", (-46, -1), 0, HX_SHADOW);
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-46, -15), DI_ARTIFLASH|DI_ITEM_CENTER, boxsize:(28, 28));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-46, -15), DI_ARTIFLASH|DI_ITEM_CENTER|DI_DIMDEPLETED, boxsize:(28, 28));
|
||||
if (CPlayer.mo.InvSel.Amount > 1)
|
||||
{
|
||||
DrawString(mIndexFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-32, -2 - mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT);
|
||||
|
|
|
@ -83,7 +83,7 @@ class HexenStatusBar : BaseStatusBar
|
|||
// This code was changed to always fit the item into the box, regardless of alignment or sprite size.
|
||||
// Heretic's ARTIBOX is 30x30 pixels.
|
||||
DrawImage("ARTIBOX", (-66, -1), 0, HX_SHADOW);
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-66, -15), DI_ARTIFLASH|DI_ITEM_CENTER, boxsize:(28, 28));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (-66, -15), DI_ARTIFLASH|DI_ITEM_CENTER|DI_DIMDEPLETED, boxsize:(28, 28));
|
||||
if (CPlayer.mo.InvSel.Amount > 1)
|
||||
{
|
||||
DrawString(mIndexFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (-52, -2 - mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT);
|
||||
|
@ -146,7 +146,7 @@ class HexenStatusBar : BaseStatusBar
|
|||
//inventory box
|
||||
if (CPlayer.mo.InvSel != null)
|
||||
{
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (159.5, 177), DI_ARTIFLASH|DI_ITEM_CENTER, boxsize:(28, 28));
|
||||
DrawInventoryIcon(CPlayer.mo.InvSel, (159.5, 177), DI_ARTIFLASH|DI_ITEM_CENTER|DI_DIMDEPLETED, boxsize:(28, 28));
|
||||
if (CPlayer.mo.InvSel.Amount > 1)
|
||||
{
|
||||
DrawString(mIndexFont, FormatNumber(CPlayer.mo.InvSel.Amount, 3), (174, 184), DI_TEXT_ALIGN_RIGHT);
|
||||
|
|
|
@ -981,7 +981,7 @@ class BaseStatusBar : StatusBarCore native
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawInventoryIcon(item, itempos + (boxsize.X * i, 0), flags | DI_ITEM_CENTER );
|
||||
DrawInventoryIcon(item, itempos + (boxsize.X * i, 0), flags | DI_ITEM_CENTER | DI_DIMDEPLETED );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue