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

This commit is contained in:
Major Cooke 2019-11-26 09:36:50 -06:00
commit 775a94a5d2
14 changed files with 199 additions and 36 deletions

View file

@ -106,6 +106,7 @@
EXTERN_CVAR(Bool, hud_althud)
EXTERN_CVAR(Int, vr_mode)
EXTERN_CVAR(Bool, cl_customizeinvulmap)
void DrawHUD();
void D_DoAnonStats();
void I_DetectOS();
@ -2752,6 +2753,10 @@ static int D_DoomMain_Internal (void)
C_RunDelayedCommands();
gamestate = GS_STARTUP;
// enable custom invulnerability map here
if (cl_customizeinvulmap)
R_InitColormaps(true);
if (!restart)
{
// start the apropriate game based on parms

View file

@ -434,6 +434,8 @@ public:
virtual void SetMugShotState (const char *state_name, bool wait_till_done=false, bool reset=false);
void DrawLog();
uint32_t GetTranslation() const;
void CreateAltHUD();
void DrawAltHUD();
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY);

View file

@ -93,6 +93,65 @@ CVAR (Int, hudcolor_stats, CR_GREEN, CVAR_ARCHIVE) // For the stats values the
CVAR(Bool, map_point_coordinates, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // show player or map coordinates?
//---------------------------------------------------------------------------
//
// Create Alternative HUD
//
//---------------------------------------------------------------------------
CUSTOM_CVAR(Bool, hud_althud_forceinternal, false, CVAR_ARCHIVE | CVAR_NOINITCALL)
{
if (StatusBar)
StatusBar->CreateAltHUD();
}
static DObject* DoCreateAltHUD(const FName classname)
{
if (classname == NAME_None)
return nullptr;
const auto cls = PClass::FindClass(classname);
if (!cls)
{
Printf(TEXTCOLOR_RED "Unknown alternative HUD class \"%s\"\n", classname.GetChars());
return nullptr;
}
if (!cls->IsDescendantOf(NAME_AltHud))
{
Printf(TEXTCOLOR_RED "Alternative HUD class \"%s\" is not derived from AltHud\n", classname.GetChars());
return nullptr;
}
const auto althud = cls->CreateNew();
IFVIRTUALPTRNAME(althud, NAME_AltHud, Init)
{
VMValue params[] = { althud };
VMCall(func, params, countof(params), nullptr, 0);
}
return althud;
}
void DBaseStatusBar::CreateAltHUD()
{
if (AltHud)
{
AltHud->Destroy();
AltHud = nullptr;
}
if (!hud_althud_forceinternal)
AltHud = DoCreateAltHUD(gameinfo.althudclass);
if (!AltHud)
AltHud = DoCreateAltHUD(NAME_AltHud);
assert(AltHud);
}
//---------------------------------------------------------------------------
//
// draw the HUD

View file

@ -334,7 +334,6 @@ void ST_CreateStatusBar(bool bTitleLevel)
// Constructor
//
//---------------------------------------------------------------------------
DBaseStatusBar::DBaseStatusBar ()
{
CompleteBorder = false;
@ -347,20 +346,7 @@ DBaseStatusBar::DBaseStatusBar ()
ShowLog = false;
defaultScale = { (double)CleanXfac, (double)CleanYfac };
// Create the AltHud object. Todo: Make class type configurable.
FName classname = "AltHud";
auto cls = PClass::FindClass(classname);
if (cls)
{
AltHud = cls->CreateNew();
VMFunction * func = PClass::FindFunction(classname, "Init");
if (func != nullptr)
{
VMValue params[] = { AltHud };
VMCall(func, params, countof(params), nullptr, 0);
}
}
CreateAltHUD();
}
static void ValidateResolution(int &hres, int &vres)

View file

@ -390,6 +390,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRING(backpacktype, "backpacktype")
GAMEINFOKEY_STRING_STAMPED(statusbar, "statusbar", statusbarfile)
GAMEINFOKEY_STRING_STAMPED(statusbarclass, "statusbarclass", statusbarclassfile)
GAMEINFOKEY_STRING(althudclass, "althudclass")
GAMEINFOKEY_MUSIC(intermissionMusic, intermissionOrder, "intermissionMusic")
GAMEINFOKEY_STRING(CursorPic, "CursorPic")
GAMEINFOKEY_STRING(MessageBoxClass, "MessageBoxClass")

View file

@ -158,6 +158,7 @@ struct gameinfo_t
FString statusbar;
int statusbarfile = -1;
FName statusbarclass;
FName althudclass;
int statusbarclassfile = -1;
FName MessageBoxClass;
FName backpacktype;

View file

@ -371,6 +371,12 @@ int FWadCollection::GetNumLumps () const
return NumLumps;
}
DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(Wads.GetNumLumps());
}
//==========================================================================
//
// GetNumFiles
@ -1220,6 +1226,15 @@ void FWadCollection::GetLumpName(FString &to, int lump) const
}
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
FString lumpname;
Wads.GetLumpName(lumpname, lump);
ACTION_RETURN_STRING(lumpname);
}
//==========================================================================
//
// FWadCollection :: GetLumpFullName
@ -1238,6 +1253,13 @@ const char *FWadCollection::GetLumpFullName (int lump) const
return LumpInfo[lump].lump->Name;
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_STRING(Wads.GetLumpFullName(lump));
}
//==========================================================================
//
// FWadCollection :: GetLumpFullPath
@ -1271,6 +1293,13 @@ int FWadCollection::GetLumpNamespace (int lump) const
return LumpInfo[lump].lump->Namespace;
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_INT(Wads.GetLumpNamespace(lump));
}
//==========================================================================
//
// FWadCollection :: GetLumpIndexNum

View file

@ -44,6 +44,22 @@
#include "colormaps.h"
#include "templates.h"
CUSTOM_CVAR(Bool, cl_customizeinvulmap, false, CVAR_ARCHIVE|CVAR_NOINITCALL)
{
R_InitColormaps(true);
}
CUSTOM_CVAR(Color, cl_custominvulmapcolor1, 0x00001a, CVAR_ARCHIVE|CVAR_NOINITCALL)
{
if (cl_customizeinvulmap)
R_InitColormaps(true);
}
CUSTOM_CVAR(Color, cl_custominvulmapcolor2, 0xa6a67a, CVAR_ARCHIVE|CVAR_NOINITCALL)
{
if (cl_customizeinvulmap)
R_InitColormaps(true);
}
TArray<FakeCmap> fakecmaps;
TArray<FSpecialColormap> SpecialColormaps;
@ -164,7 +180,7 @@ void R_DeinitColormaps ()
//
//==========================================================================
void R_InitColormaps ()
void R_InitColormaps (bool allowCustomColormap)
{
// [RH] Try and convert BOOM colormaps into blending values.
// This is a really rough hack, but it's better than
@ -242,6 +258,25 @@ void R_InitColormaps ()
}
}
// some of us really don't like Doom's idea of an invulnerability sphere colormap
// this hack will override that
if (allowCustomColormap && cl_customizeinvulmap)
{
uint32_t color1 = cl_custominvulmapcolor1;
uint32_t color2 = cl_custominvulmapcolor2;
float r1 = (float)((color1 & 0xff0000) >> 16) / 128.f;
float g1 = (float)((color1 & 0x00ff00) >> 8) / 128.f;
float b1 = (float)((color1 & 0x0000ff) >> 0) / 128.f;
float r2 = (float)((color2 & 0xff0000) >> 16) / 128.f;
float g2 = (float)((color2 & 0x00ff00) >> 8) / 128.f;
float b2 = (float)((color2 & 0x0000ff) >> 0) / 128.f;
SpecialColormapParms[0] = {{r1, g1, b1}, {r2, g2, b2}};
}
else
{
SpecialColormapParms[0] = {{1.0, 1.0, 1.0}, {0.0, 0.0, 0.0}};
}
// build default special maps (e.g. invulnerability)
for (unsigned i = 0; i < countof(SpecialColormapParms); ++i)

View file

@ -5,7 +5,7 @@
struct lightlist_t;
void R_InitColormaps ();
void R_InitColormaps (bool allowCustomColormap = false);
void R_DeinitColormaps ();
uint32_t R_ColormapNumForName(const char *name); // killough 4/4/98

View file

@ -1091,3 +1091,4 @@ xx(PlayerTeam)
xx(PlayerColors)
xx(PlayerSkin)
xx(NewPlayerMenu)
xx(AltHud)

View file

@ -925,6 +925,9 @@ OptionMenu "VideoOptions" protected
Slider "$DSPLYMNU_CONTRAST", "vid_contrast", 0.1, 3.0, 0.1
Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25, 2
StaticText " "
Option "$DSPLYMNU_CUSTOMINVERTMAP", "cl_customizeinvulmap", "OnOff"
ColorPicker "$DSPLYMNU_CUSTOMINVERTC1", "cl_custominvulmapcolor1"
ColorPicker "$DSPLYMNU_CUSTOMINVERTC2", "cl_custominvulmapcolor2"
Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes"
Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness"
Option "$DSPLYMNU_OLDTRANS", "r_vanillatrans", "VanillaTrans"

View file

@ -873,6 +873,11 @@ struct Wads
native static int CheckNumForFullName(string name);
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace);
native static string ReadLump(int lump);
native static int GetNumLumps();
native static string GetLumpName(int lump);
native static string GetLumpFullName(int lump);
native static int GetLumpNamespace(int lump);
}
struct TerrainDef native

View file

@ -1478,6 +1478,15 @@ class LevelCompatibility : LevelPostProcessor
break;
}
case '25E178C981BAC28BA586B3B0A2A0FD72': // swan fox doom v2.4.wad map13
{
//Actors with no game mode will now appear
SetThingFlags(0, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
for(int i = 2; i < 452; i++)
SetThingFlags(i, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
break;
}
case 'FDFB3D209CC0F3706AAF3E51646003D5': // swan fox doom v2.4.wad map23
{
//Fix the exit portal to allow walking into it instead of shooting it
@ -1486,6 +1495,24 @@ class LevelCompatibility : LevelPostProcessor
ClearLineSpecial(2010);
break;
}
case 'BC969ED0191CCD9B69B316864362B0D7': // swan fox doom v2.4.wad map24
{
//Actors with no game mode will now appear
for(int i = 1; i < 88; i++)
SetThingFlags(i, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
break;
}
case 'ED740248422026326650F6A4BC1C0A5A': // swan fox doom v2.4.wad map25
{
//Actors with no game mode will now appear
for(int i = 0; i < 8; i++)
SetThingFlags(i, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
for(int i = 9; i < 26; i++)
SetThingFlags(i, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
break;
}
case '52F532F95E2D5862E56F7214FA5C5C59': // Toon Doom II (toon2b.wad) map10
{
@ -1661,6 +1688,15 @@ class LevelCompatibility : LevelPostProcessor
OffsetSectorPlane(65, Sector.ceiling, 8);
break;
}
case '75E2685CA8AB29108DBF1AC98C5450AC': // Ancient Beliefs (beliefs.wad) map01
{
//Actors with no game mode will now appear
SetThingFlags(0, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
for(int i = 2; i < 7; i++)
SetThingFlags(i, MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH);
break;
}
}
}
}

View file

@ -44,7 +44,7 @@ class AltHud ui
const POWERUPICONSIZE = 32;
void Init()
virtual void Init()
{
switch (gameinfo.gametype)
{
@ -131,7 +131,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawHudNumber(Font fnt, int color, int num, int x, int y, double trans = 0.75)
void DrawHudNumber(Font fnt, int color, int num, int x, int y, double trans = 0.75)
{
DrawHudText(fnt, color, String.Format("%d", num), x, y, trans);
}
@ -142,7 +142,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawTimeString(Font fnt, int color, int timer, int x, int y, double trans = 0.75)
virtual void DrawTimeString(Font fnt, int color, int timer, int x, int y, double trans = 0.75)
{
let seconds = Thinker.Tics2Seconds(timer);
String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
@ -156,7 +156,7 @@ class AltHud ui
//
//===========================================================================
void DrawStatLine(int x, in out int y, String prefix, String text)
virtual void DrawStatLine(int x, in out int y, String prefix, String text)
{
y -= SmallFont.GetHeight()-1;
screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix,
@ -168,7 +168,7 @@ class AltHud ui
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
}
void DrawStatus(PlayerInfo CPlayer, int x, int y)
virtual void DrawStatus(PlayerInfo CPlayer, int x, int y)
{
let mo = CPlayer.mo;
if (hud_showscore)
@ -209,7 +209,7 @@ class AltHud ui
//
//===========================================================================
void DrawHealth(PlayerInfo CPlayer, int x, int y)
virtual void DrawHealth(PlayerInfo CPlayer, int x, int y)
{
int health = CPlayer.health;
@ -235,7 +235,7 @@ class AltHud ui
//
//===========================================================================
void DrawArmor(BasicArmor barmor, HexenArmor harmor, int x, int y)
virtual void DrawArmor(BasicArmor barmor, HexenArmor harmor, int x, int y)
{
int ap = 0;
int bestslot = 4;
@ -304,7 +304,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
bool DrawOneKey(int xo, int x, int y, in out int c, Key inv)
virtual bool DrawOneKey(int xo, int x, int y, in out int c, Key inv)
{
TextureID icon;
@ -340,7 +340,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
int DrawKeys(PlayerInfo CPlayer, int x, int y)
virtual int DrawKeys(PlayerInfo CPlayer, int x, int y)
{
int yo = y;
int xo = x;
@ -445,7 +445,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
int DrawAmmo(PlayerInfo CPlayer, int x, int y)
virtual int DrawAmmo(PlayerInfo CPlayer, int x, int y)
{
int i,j,k;
@ -558,7 +558,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawOneWeapon(PlayerInfo CPlayer, int x, in out int y, Weapon weapon)
virtual void DrawOneWeapon(PlayerInfo CPlayer, int x, in out int y, Weapon weapon)
{
double trans;
@ -594,7 +594,7 @@ class AltHud ui
}
void DrawWeapons(PlayerInfo CPlayer, int x, int y)
virtual void DrawWeapons(PlayerInfo CPlayer, int x, int y)
{
int k,j;
Inventory inv;
@ -631,7 +631,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawInventory(PlayerInfo CPlayer, int x,int y)
virtual void DrawInventory(PlayerInfo CPlayer, int x,int y)
{
Inventory rover;
int numitems = (hudwidth - 2*x) / 32;
@ -690,7 +690,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawFrags(PlayerInfo CPlayer, int x, int y)
virtual void DrawFrags(PlayerInfo CPlayer, int x, int y)
{
DrawImageToBox(fragpic, x, y, 31, 17);
DrawHudNumber(HudFont, Font.CR_GRAY, CPlayer.fragcount, x + 33, y + 17);
@ -709,7 +709,7 @@ class AltHud ui
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
}
void DrawCoordinates(PlayerInfo CPlayer, bool withmapname)
virtual void DrawCoordinates(PlayerInfo CPlayer, bool withmapname)
{
Vector3 pos;
String coordstr;
@ -772,7 +772,7 @@ class AltHud ui
//---------------------------------------------------------------------------
private native static int GetRealTime();
bool DrawTime(int y)
virtual bool DrawTime(int y)
{
if (hud_showtime > 0 && hud_showtime <= 9)
{
@ -833,7 +833,7 @@ class AltHud ui
//---------------------------------------------------------------------------
native static int, int, int GetLatency();
bool DrawLatency(int y)
virtual bool DrawLatency(int y)
{
if ((hud_showlag == 1 && netgame) || hud_showlag == 2)
{
@ -858,7 +858,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void DrawPowerups(PlayerInfo CPlayer, int y)
virtual void DrawPowerups(PlayerInfo CPlayer, int y)
{
// Each icon gets a 32x32 block to draw itself in.
int x, y;
@ -969,7 +969,7 @@ class AltHud ui
//
//---------------------------------------------------------------------------
void Draw(PlayerInfo CPlayer, int w, int h)
virtual void Draw(PlayerInfo CPlayer, int w, int h)
{
hudwidth = w;
hudheight = h;