mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- let kopenFileReader have a look into demolition.pk3 if nothing else is found.
This should help as long as the old resource management is still in place.
This commit is contained in:
parent
60fc828a89
commit
5cf5c74695
3 changed files with 25 additions and 65 deletions
|
@ -145,12 +145,13 @@ public:
|
|||
|
||||
};
|
||||
|
||||
FileReader openFromBaseResource(const char* name);
|
||||
// Wrappers for the handle based API to get rid of the direct calls without any actual changes to the implementation.
|
||||
inline FileReader kopenFileReader(const char* name, int where)
|
||||
{
|
||||
int handle = where == 0 ? kopen4loadfrommod(name, 0) : kopen4load(name, where);
|
||||
KFileReaderInterface *fri = handle == buildvfs_kfd_invalid? nullptr : new KFileReaderInterface(handle);
|
||||
return FileReader(fri);
|
||||
if (handle != buildvfs_kfd_invalid) FileReader(new KFileReaderInterface(handle));
|
||||
return openFromBaseResource(name);
|
||||
}
|
||||
|
||||
// This is only here to mark a file as not being part of the game assets (e.g. savegames)
|
||||
|
|
|
@ -65,15 +65,28 @@ void InitBaseRes()
|
|||
}
|
||||
}
|
||||
|
||||
FileReader GetBaseResource(const char* fn)
|
||||
extern FString currentGame;
|
||||
FileReader openFromBaseResource(const char* fn)
|
||||
{
|
||||
auto lump = engine_res->FindLump(fn);
|
||||
if (!lump)
|
||||
if (lump) return lump->NewReader();
|
||||
// Also look in game filtered directories.
|
||||
FStringf filtername("filter/%s/%s", currentGame.GetChars(), fn);
|
||||
lump = engine_res->FindLump(fn);
|
||||
if (lump) return lump->NewReader();
|
||||
return FileReader(nullptr);
|
||||
|
||||
}
|
||||
|
||||
FileReader GetResource(const char* fn)
|
||||
{
|
||||
auto fr = kopenFileReader(fn, 0);
|
||||
if (!fr.isOpen())
|
||||
{
|
||||
wm_msgbox("Fatal error", "Base resource '%s' not found", fn);
|
||||
exit(-1);
|
||||
}
|
||||
return lump->NewReader();
|
||||
return fr;
|
||||
}
|
||||
|
||||
GLInstance GLInterface;
|
||||
|
@ -122,9 +135,9 @@ void GLInstance::Init()
|
|||
|
||||
void GLInstance::LoadPolymostShader()
|
||||
{
|
||||
auto fr1 = GetBaseResource("demolition/shaders/glsl/polymost.vp");
|
||||
auto fr1 = GetResource("demolition/shaders/glsl/polymost.vp");
|
||||
TArray<uint8_t> Vert = fr1.Read();
|
||||
fr1 = GetBaseResource("demolition/shaders/glsl/polymost.fp");
|
||||
fr1 = GetResource("demolition/shaders/glsl/polymost.fp");
|
||||
TArray<uint8_t> Frag = fr1.Read();
|
||||
// Zero-terminate both strings.
|
||||
Vert.Push(0);
|
||||
|
@ -136,9 +149,9 @@ void GLInstance::LoadPolymostShader()
|
|||
|
||||
void GLInstance::LoadVPXShader()
|
||||
{
|
||||
auto fr1 = GetBaseResource("demolition/shaders/glsl/animvpx.vp");
|
||||
auto fr1 = GetResource("demolition/shaders/glsl/animvpx.vp");
|
||||
TArray<uint8_t> Vert = fr1.Read();
|
||||
fr1 = GetBaseResource("demolition/shaders/glsl/animvpx.fp");
|
||||
fr1 = GetResource("demolition/shaders/glsl/animvpx.fp");
|
||||
TArray<uint8_t> Frag = fr1.Read();
|
||||
// Zero-terminate both strings.
|
||||
Vert.Push(0);
|
||||
|
@ -149,9 +162,9 @@ void GLInstance::LoadVPXShader()
|
|||
|
||||
void GLInstance::LoadSurfaceShader()
|
||||
{
|
||||
auto fr1 = GetBaseResource("demolition/shaders/glsl/glsurface.vp");
|
||||
auto fr1 = GetResource("demolition/shaders/glsl/glsurface.vp");
|
||||
TArray<uint8_t> Vert = fr1.Read();
|
||||
fr1 = GetBaseResource("demolition/shaders/glsl/glsurface.fp");
|
||||
fr1 = GetResource("demolition/shaders/glsl/glsurface.fp");
|
||||
TArray<uint8_t> Frag = fr1.Read();
|
||||
// Zero-terminate both strings.
|
||||
Vert.Push(0);
|
||||
|
|
|
@ -263,60 +263,6 @@ static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] =
|
|||
};
|
||||
|
||||
#if defined(GEKKO)
|
||||
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"Open", // A
|
||||
"Fire", // B
|
||||
"Run", // 1
|
||||
"Map", // 2
|
||||
"Previous_Weapon", // -
|
||||
"Next_Weapon", // +
|
||||
"", // Home
|
||||
"Jump", // Z
|
||||
"Crouch", // C
|
||||
"Map", // X
|
||||
"Run", // Y
|
||||
"Jump", // L
|
||||
"Quick_Kick", // R
|
||||
"Crouch", // ZL
|
||||
"Fire", // ZR
|
||||
"Quick_Kick", // D-Pad Up
|
||||
"Inventory_Right", // D-Pad Right
|
||||
"Inventory", // D-Pad Down
|
||||
"Inventory_Left", // D-Pad Left
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Inventory",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickanalogdefaults[MAXJOYAXES] =
|
||||
{
|
||||
"analog_strafing",
|
||||
"analog_moving",
|
||||
"analog_turning",
|
||||
"analog_lookingupanddown",
|
||||
};
|
||||
|
||||
|
||||
static const char * joystickdigitaldefaults[MAXJOYDIGITAL] =
|
||||
{
|
||||
};
|
||||
#else
|
||||
static const char * joystickdefaults[MAXJOYBUTTONSANDHATS] =
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue