Merge remote-tracking branch 'gzdoom/master' into merge-gzdoom

This commit is contained in:
Magnus Norddahl 2023-10-19 21:05:17 +02:00
commit e75e5a387b
600 changed files with 40006 additions and 59374 deletions

View file

@ -104,13 +104,11 @@ void R_InitColormaps (bool allowCustomColormap)
for (uint32_t i = 0; i < NumLumps; i++)
{
if (fileSystem.GetFileNamespace(i) == ns_colormaps)
if (fileSystem.GetFileNamespace(i) == FileSys::ns_colormaps)
{
char name[9];
name[8] = 0;
fileSystem.GetFileShortName (name, i);
auto name = fileSystem.GetFileShortName(i);
if (fileSystem.CheckNumForName (name, ns_colormaps) == (int)i)
if (fileSystem.CheckNumForName (name, FileSys::ns_colormaps) == (int)i)
{
strncpy(cm.name, name, 8);
cm.blend = 0;

View file

@ -76,7 +76,7 @@ static void do_uniform_set(float value, ExtraUniformCVARData* data)
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{
PostProcessShader& shader = PostProcessShaders[i];
if (strcmp(shader.Name, data->Shader) == 0)
if (strcmp(shader.Name.GetChars(), data->Shader.GetChars()) == 0)
{
data->vec4 = shader.Uniforms[data->Uniform].Values;
}
@ -154,7 +154,7 @@ static void ParseVavoomSkybox()
sb->SetSize();
if (!error)
{
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
TexMan.AddGameTexture(MakeGameTexture(sb, s.GetChars(), ETextureType::Override));
}
}
}
@ -1014,7 +1014,7 @@ class GLDefsParser
break;
case LIGHTTAG_LIGHT:
ParseString(sc);
AddLightAssociation(name, frameName, sc.String);
AddLightAssociation(name.GetChars(), frameName.GetChars(), sc.String);
break;
default:
sc.ScriptError("Unknown tag: %s\n", sc.String);
@ -1089,7 +1089,7 @@ class GLDefsParser
sc.MustGetString();
FString s = sc.String;
FSkyBox * sb = new FSkyBox(s);
FSkyBox * sb = new FSkyBox(s.GetChars());
if (sc.CheckString("fliptop"))
{
sb->fliptop = true;
@ -1109,7 +1109,7 @@ class GLDefsParser
sc.ScriptError("%s: Skybox definition requires either 3 or 6 faces", s.GetChars());
}
sb->SetSize();
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
TexMan.AddGameTexture(MakeGameTexture(sb, s.GetChars(), ETextureType::Override));
}
//===========================================================================
@ -1611,7 +1611,7 @@ class GLDefsParser
if (is_cvar)
{
addedcvars = true;
if (!shaderdesc.Name.GetChars())
if (shaderdesc.Name.IsEmpty())
sc.ScriptError("Shader must have a name to use cvar uniforms");
ECVarType cvartype = CVAR_Dummy;
@ -1635,7 +1635,7 @@ class GLDefsParser
}
sc.MustGetString();
cvarname = sc.String;
cvar = FindCVar(cvarname, NULL);
cvar = FindCVar(cvarname.GetChars(), NULL);
UCVarValue oldval;
UCVarValue val;
@ -1653,7 +1653,7 @@ class GLDefsParser
{
if (!cvar)
{
cvar = C_CreateCVar(cvarname, cvartype, cvarflags);
cvar = C_CreateCVar(cvarname.GetChars(), cvartype, cvarflags);
}
else if (cvar && (((cvar->GetFlags()) & CVAR_MOD) == CVAR_MOD))
{
@ -1673,7 +1673,7 @@ class GLDefsParser
{
oldval.Float = cvar->GetGenericRep(CVAR_Float).Float;
delete cvar;
cvar = C_CreateCVar(cvarname, cvartype, cvarflags);
cvar = C_CreateCVar(cvarname.GetChars(), cvartype, cvarflags);
oldextra = (ExtraUniformCVARData*)cvar->GetExtraDataPointer();
}
@ -1954,7 +1954,7 @@ public:
if (!sc.GetToken ())
{
if (addedcvars)
GameConfig->DoModSetup (gameinfo.ConfigName);
GameConfig->DoModSetup (gameinfo.ConfigName.GetChars());
return;
}
type = sc.MatchString(CoreKeywords);

View file

@ -948,6 +948,10 @@ static void ParseModelDefLump(int Lump)
{
smf.flags |= MDL_CORRECTPIXELSTRETCH;
}
else if (sc.Compare("forcecullbackfaces"))
{
smf.flags |= MDL_FORCECULLBACKFACES;
}
else
{
sc.ScriptMessage("Unrecognized string \"%s\"", sc.String);

View file

@ -45,20 +45,21 @@ enum
{
// [BB] Color translations for the model skin are ignored. This is
// useful if the skin texture is not using the game palette.
MDL_IGNORETRANSLATION = 1,
MDL_PITCHFROMMOMENTUM = 2,
MDL_ROTATING = 4,
MDL_INTERPOLATEDOUBLEDFRAMES = 8,
MDL_NOINTERPOLATION = 16,
MDL_USEACTORPITCH = 32,
MDL_USEACTORROLL = 64,
MDL_BADROTATION = 128,
MDL_DONTCULLBACKFACES = 256,
MDL_USEROTATIONCENTER = 512,
MDL_NOPERPIXELLIGHTING = 1024, // forces a model to not use per-pixel lighting. useful for voxel-converted-to-model objects.
MDL_SCALEWEAPONFOV = 2048, // scale weapon view model with higher user FOVs
MDL_MODELSAREATTACHMENTS = 4096, // any model index after 0 is treated as an attachment, and therefore will use the bone results of index 0
MDL_CORRECTPIXELSTRETCH = 8192, // ensure model does not distort with pixel stretch when pitch/roll is applied
MDL_IGNORETRANSLATION = 1<<0,
MDL_PITCHFROMMOMENTUM = 1<<1,
MDL_ROTATING = 1<<2,
MDL_INTERPOLATEDOUBLEDFRAMES = 1<<3,
MDL_NOINTERPOLATION = 1<<4,
MDL_USEACTORPITCH = 1<<5,
MDL_USEACTORROLL = 1<<6,
MDL_BADROTATION = 1<<7,
MDL_DONTCULLBACKFACES = 1<<8,
MDL_USEROTATIONCENTER = 1<<9,
MDL_NOPERPIXELLIGHTING = 1<<10, // forces a model to not use per-pixel lighting. useful for voxel-converted-to-model objects.
MDL_SCALEWEAPONFOV = 1<<11, // scale weapon view model with higher user FOVs
MDL_MODELSAREATTACHMENTS = 1<<12, // any model index after 0 is treated as an attachment, and therefore will use the bone results of index 0
MDL_CORRECTPIXELSTRETCH = 1<<13, // ensure model does not distort with pixel stretch when pitch/roll is applied
MDL_FORCECULLBACKFACES = 1<<14,
};
FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped);

View file

@ -98,7 +98,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, double fov)
void SetCameraToTexture(AActor *viewpoint, const FString &texturename, double fov)
{
FTextureID textureid = TexMan.CheckForTexture(texturename, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FTextureID textureid = TexMan.CheckForTexture(texturename.GetChars(), ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
if (textureid.isValid())
{
// Only proceed if the texture actually has a canvas.

View file

@ -430,8 +430,8 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
}
else
{
FileData translump = fileSystem.ReadFile(colorset->Lump);
const uint8_t *trans = (const uint8_t *)translump.GetMem();
auto translump = fileSystem.ReadFile(colorset->Lump);
auto trans = translump.GetBytes();
for (i = start; i <= end; ++i)
{
table->Remap[i] = GPalette.Remap[trans[i]];
@ -614,7 +614,7 @@ DEFINE_ACTION_FUNCTION(_Translation, SetPlayerTranslation)
if (cls != nullptr)
{
PlayerSkin = R_FindSkin(Skins[PlayerSkin].Name, int(cls - &PlayerClasses[0]));
PlayerSkin = R_FindSkin(Skins[PlayerSkin].Name.GetChars(), int(cls - &PlayerClasses[0]));
FRemapTable remap;
R_GetPlayerTranslation(PlayerColor, GetColorSet(cls->Type, PlayerColorset),
&Skins[PlayerSkin], &remap);
@ -727,7 +727,7 @@ void R_ParseTrnslate()
do
{
sc.MustGetToken(TK_StringConst);
int pallump = fileSystem.CheckNumForFullName(sc.String, true, ns_global);
int pallump = fileSystem.CheckNumForFullName(sc.String, true, FileSys::ns_global);
if (pallump >= 0) //
{
int start = 0;

View file

@ -335,7 +335,7 @@ void R_InitSpriteDefs ()
for (i = 0; i < smax; ++i)
{
auto tex = TexMan.GameByIndex(i);
if (tex->GetUseType() == ETextureType::Sprite && strlen(tex->GetName()) >= 6)
if (tex->GetUseType() == ETextureType::Sprite && strlen(tex->GetName().GetChars()) >= 6)
{
size_t bucket = TEX_DWNAME(tex) % smax;
hashes[i].Next = hashes[bucket].Head;
@ -349,15 +349,13 @@ void R_InitSpriteDefs ()
memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
for (i = 0; i < vmax; ++i)
{
if (fileSystem.GetFileNamespace(i) == ns_voxels)
if (fileSystem.GetFileNamespace(i) == FileSys::ns_voxels)
{
char name[9];
size_t namelen;
int spin;
int sign;
fileSystem.GetFileShortName(name, i);
name[8] = 0;
const char* name = fileSystem.GetFileShortName(i);
namelen = strlen(name);
if (namelen < 4)
{ // name is too short
@ -717,17 +715,17 @@ void R_InitSkins (void)
int lump = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (lump == -1)
{
lump = fileSystem.CheckNumForFullName (sc.String, true, ns_sounds);
lump = fileSystem.CheckNumForFullName (sc.String, true, FileSys::ns_sounds);
}
if (lump != -1)
{
if (stricmp (key, "*pain") == 0)
{ // Replace all pain sounds in one go
aliasid = S_AddPlayerSound (Skins[i].Name, Skins[i].gender,
aliasid = S_AddPlayerSound (Skins[i].Name.GetChars(), Skins[i].gender,
playersoundrefs[0], lump, true);
for (int l = 3; l > 0; --l)
{
S_AddPlayerSoundExisting (Skins[i].Name, Skins[i].gender,
S_AddPlayerSoundExisting (Skins[i].Name.GetChars(), Skins[i].gender,
playersoundrefs[l], aliasid, true);
}
}
@ -736,7 +734,7 @@ void R_InitSkins (void)
auto sndref = soundEngine->FindSoundNoHash (key);
if (sndref.isvalid())
{
S_AddPlayerSound (Skins[i].Name, Skins[i].gender, sndref, lump, true);
S_AddPlayerSound (Skins[i].Name.GetChars(), Skins[i].gender, sndref, lump, true);
}
}
}
@ -750,7 +748,7 @@ void R_InitSkins (void)
sndlumps[j] = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (sndlumps[j] == -1)
{ // Replacement not found, try finding it in the global namespace
sndlumps[j] = fileSystem.CheckNumForFullName (sc.String, true, ns_sounds);
sndlumps[j] = fileSystem.CheckNumForFullName (sc.String, true, FileSys::ns_sounds);
}
}
}
@ -812,9 +810,7 @@ void R_InitSkins (void)
// specified, use whatever immediately follows the specifier lump.
if (intname == 0)
{
char name[9];
fileSystem.GetFileShortName (name, base+1);
memcpy(&intname, name, 4);
memcpy(&intname, fileSystem.GetFileShortName(base + 1), 4);
}
int basens = fileSystem.GetFileNamespace(base);
@ -845,9 +841,8 @@ void R_InitSkins (void)
for (k = base + 1; fileSystem.GetFileNamespace(k) == basens; k++)
{
char lname[9];
const char* lname = fileSystem.GetFileShortName(k);
uint32_t lnameint;
fileSystem.GetFileShortName (lname, k);
memcpy(&lnameint, lname, 4);
if (lnameint == intname)
{
@ -866,7 +861,7 @@ void R_InitSkins (void)
break;
}
fileSystem.GetFileShortName (temp.name, base+1);
memcpy(temp.name, fileSystem.GetFileShortName (base+1), 4);
temp.name[4] = 0;
int sprno = (int)sprites.Push (temp);
if (spr==0) Skins[i].sprite = sprno;
@ -893,12 +888,12 @@ void R_InitSkins (void)
{
if (j == 0 || sndlumps[j] != sndlumps[j-1])
{
aliasid = S_AddPlayerSound (Skins[i].Name, Skins[i].gender,
aliasid = S_AddPlayerSound (Skins[i].Name.GetChars(), Skins[i].gender,
playersoundrefs[j], sndlumps[j], true);
}
else
{
S_AddPlayerSoundExisting (Skins[i].Name, Skins[i].gender,
S_AddPlayerSoundExisting (Skins[i].Name.GetChars(), Skins[i].gender,
playersoundrefs[j], aliasid, true);
}
}
@ -951,8 +946,8 @@ CCMD (skins)
static void R_CreateSkinTranslation (const char *palname)
{
FileData lump = fileSystem.ReadFile (palname);
const uint8_t *otherPal = (uint8_t *)lump.GetMem();
auto lump = fileSystem.ReadFile (palname);
auto otherPal = lump.GetBytes();
for (int i = 0; i < 256; ++i)
{
@ -1021,7 +1016,7 @@ void R_InitSprites ()
Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
Skins[i].Scale = basetype->Scale;
Skins[i].sprite = basetype->SpawnState->sprite;
Skins[i].namespc = ns_global;
Skins[i].namespc = FileSys::ns_global;
PlayerClasses[i].Skins.Push (i);

View file

@ -44,6 +44,8 @@
#include "m_png.h"
#include "v_colortables.h"
using namespace FileSys;
/* Current color blending values */
int BlendR, BlendG, BlendB, BlendA;
@ -63,7 +65,7 @@ void InitPalette ()
if (lump != -1)
{
FileData cmap = fileSystem.ReadFile(lump);
const unsigned char* cmapdata = (const unsigned char*)cmap.GetMem();
auto cmapdata = cmap.GetBytes();
GPalette.GenerateGlobalBrightmapFromColormap(cmapdata, 32);
MakeGoodRemap((uint32_t*)GPalette.BaseColors, GPalette.Remap, cmapdata + 7936); // last entry in colormap
}

View file

@ -50,6 +50,8 @@
#include "g_level.h"
#include "r_data/sprites.h"
using namespace FileSys;
struct VoxelOptions
{
int DroppedSpin = 0;