mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- widescreen asset setup and consolidation of .def file loading.
This commit is contained in:
parent
234fae011e
commit
6776508239
17 changed files with 85 additions and 65 deletions
|
@ -417,16 +417,8 @@ void GameInterface::app_init()
|
|||
I_FatalError("TILES###.ART files not found");
|
||||
|
||||
levelLoadDefaults();
|
||||
LoadDefinitions();
|
||||
|
||||
loaddefinitionsfile(BLOODWIDESCREENDEF);
|
||||
|
||||
const char* defsfile = G_DefFile();
|
||||
uint32_t stime = I_msTime();
|
||||
if (!loaddefinitionsfile(defsfile))
|
||||
{
|
||||
uint32_t etime = I_msTime();
|
||||
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime);
|
||||
}
|
||||
TileFiles.SetBackup();
|
||||
powerupInit();
|
||||
Printf(PRINT_NONOTIFY, "Loading cosine table\n");
|
||||
|
|
|
@ -950,7 +950,7 @@ int32_t md_definehud (int32_t modelid, int32_t tilex, vec3f_t add,
|
|||
int32_t md_undefinetile(int32_t tile);
|
||||
int32_t md_undefinemodel(int32_t modelid);
|
||||
|
||||
int32_t loaddefinitionsfile(const char *fn);
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds = false);
|
||||
|
||||
// if loadboard() fails with -2 return, try loadoldboard(). if it fails with
|
||||
// -2, board is dodgy
|
||||
|
|
|
@ -3204,7 +3204,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
}
|
||||
|
||||
|
||||
int32_t loaddefinitionsfile(const char *fn)
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds)
|
||||
{
|
||||
scriptfile *script;
|
||||
|
||||
|
@ -3217,7 +3217,7 @@ int32_t loaddefinitionsfile(const char *fn)
|
|||
defsparser(script);
|
||||
}
|
||||
|
||||
if (userConfig.AddDefs) for (auto& m : *userConfig.AddDefs)
|
||||
if (userConfig.AddDefs && loadadds) for (auto& m : *userConfig.AddDefs)
|
||||
{
|
||||
Printf("Loading module \"%s\"\n",m.GetChars());
|
||||
defsparser_include(m, NULL, NULL); // Q: should we let the external script see our symbol table?
|
||||
|
|
|
@ -335,7 +335,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
|
|||
}
|
||||
|
||||
|
||||
static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcwidth, double srcheight, int oautoaspect, DoubleRect &rect)
|
||||
void CalcFullscreenScale(DrawParms *parms, double srcwidth, double srcheight, int oautoaspect, DoubleRect &rect)
|
||||
{
|
||||
auto GetWidth = [=]() { return parms->viewport.width; };
|
||||
auto GetHeight = [=]() {return parms->viewport.height; };
|
||||
|
@ -475,7 +475,7 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do
|
|||
{
|
||||
// First calculate the destination rect for an image of the given size and then reposition this object in it.
|
||||
DoubleRect rect;
|
||||
CalcFullscreenScale(drawer, parms, parms->virtWidth, parms->virtHeight, parms->fsscalemode, rect);
|
||||
CalcFullscreenScale(parms, parms->virtWidth, parms->virtHeight, parms->fsscalemode, rect);
|
||||
double adder = parms->keepratio < 0 ? 0 : parms->keepratio == 0 ? rect.left : 2 * rect.left;
|
||||
parms->x = parms->viewport.left + adder + parms->x * rect.width / parms->virtWidth;
|
||||
parms->y = parms->viewport.top + rect.top + parms->y * rect.height / parms->virtHeight;
|
||||
|
@ -489,7 +489,7 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do
|
|||
case DTA_FullscreenEx:
|
||||
{
|
||||
DoubleRect rect;
|
||||
CalcFullscreenScale(drawer, parms, parms->texwidth, parms->texheight, parms->fsscalemode, rect);
|
||||
CalcFullscreenScale(parms, parms->texwidth, parms->texheight, parms->fsscalemode, rect);
|
||||
parms->keepratio = -1;
|
||||
parms->x = parms->viewport.left + rect.left;
|
||||
parms->y = parms->viewport.top + rect.top;
|
||||
|
|
|
@ -1415,3 +1415,34 @@ void DrawCrosshair(int deftile, int health, double xdelta, double scale, PalEntr
|
|||
DrawGenericCrosshair(crosshair == 0 ? 2 : *crosshair, health, xdelta);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void LoadDefinitions()
|
||||
{
|
||||
loaddefinitionsfile("engine/engine.def"); // Internal stuff that is required.
|
||||
|
||||
const char* defsfile = G_DefFile();
|
||||
|
||||
cycle_t deftimer;
|
||||
deftimer.Reset();
|
||||
deftimer.Clock();
|
||||
if (!loaddefinitionsfile(defsfile, true))
|
||||
{
|
||||
deftimer.Unclock();
|
||||
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS());
|
||||
}
|
||||
userConfig.AddDefs.reset();
|
||||
|
||||
// load the widescreen replacements last so that they do not clobber the CRC for the original items so that mod-side replacement are picked up.
|
||||
if (fileSystem.FindFile("engine/widescreen.def") >= 0 && !Args->CheckParm("-nowidescreen"))
|
||||
{
|
||||
loaddefinitionsfile("engine/widescreen.def");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ struct GrpEntry
|
|||
extern int g_gameType;
|
||||
const char* G_DefaultDefFile(void);
|
||||
const char* G_DefFile(void);
|
||||
void LoadDefinitions();
|
||||
|
||||
// game check shortcuts
|
||||
inline bool isNam()
|
||||
|
|
|
@ -821,6 +821,25 @@ short DBaseStatusBar::CalcMagazineAmount(short ammo_remaining, short clip_capaci
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DBaseStatusBar::Set43ClipRect()
|
||||
{
|
||||
auto GetWidth = [=]() { return twod->GetWidth(); };
|
||||
auto GetHeight = [=]() {return twod->GetHeight(); };
|
||||
|
||||
auto screenratio = ActiveRatio(GetWidth(), GetHeight());
|
||||
if (screenratio < 1.34) return;
|
||||
|
||||
int width = xs_CRoundToInt(GetWidth() * 1.333 / screenratio);
|
||||
int left = (GetWidth() - width) / 2;
|
||||
twod->SetClipRect(left, 0, width, GetHeight());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void setViewport(int viewSize)
|
||||
{
|
||||
int x0, y0, x1, y1;
|
||||
|
|
|
@ -197,6 +197,7 @@ public:
|
|||
}
|
||||
void DoDrawAutomapHUD(int crdefault, int highlight);
|
||||
short CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading);
|
||||
void Set43ClipRect();
|
||||
|
||||
//protected:
|
||||
void DrawPowerups ();
|
||||
|
|
|
@ -521,14 +521,8 @@ void GameInterface::app_init()
|
|||
|
||||
// temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut
|
||||
InstallEngine();
|
||||
LoadDefinitions();
|
||||
|
||||
const char* defsfile = G_DefFile();
|
||||
uint32_t stime = I_msTime();
|
||||
if (!loaddefinitionsfile(defsfile))
|
||||
{
|
||||
uint32_t etime = I_msTime();
|
||||
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime);
|
||||
}
|
||||
TileFiles.SetBackup();
|
||||
|
||||
InitView();
|
||||
|
|
|
@ -854,7 +854,9 @@ private:
|
|||
{
|
||||
// draw the main bar itself
|
||||
BeginStatusBar(320, 200, 40);
|
||||
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
|
||||
DrawGraphic(tileGetTexture(kTileStatusBar), 160, 200, DI_ITEM_CENTER_BOTTOM, 1, -1, -1, 1, 1);
|
||||
twod->ClearClipRect();
|
||||
}
|
||||
else if (hud_size == Hud_Mini)
|
||||
{
|
||||
|
|
|
@ -228,34 +228,6 @@ static void setupbackdrop()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void loaddefs()
|
||||
{
|
||||
const char* defsfile = G_DefFile();
|
||||
cycle_t deftimer;
|
||||
deftimer.Reset();
|
||||
deftimer.Clock();
|
||||
if (!loaddefinitionsfile(defsfile))
|
||||
{
|
||||
deftimer.Unclock();
|
||||
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS());
|
||||
}
|
||||
TileFiles.SetBackup();
|
||||
userConfig.AddDefs.reset();
|
||||
|
||||
// load the internal replacements last so that they do not clobber the CRC for the original items so that mod-side replacement are picked up.
|
||||
if (fileSystem.FindFile("engine/duke-widescreen.def") >= 0)
|
||||
{
|
||||
loaddefinitionsfile("engine/duke-widescreen.def");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void initTiles()
|
||||
{
|
||||
if (TileFiles.artLoadFiles("tiles%03i.art") < 0)
|
||||
|
@ -340,7 +312,8 @@ void GameInterface::app_init()
|
|||
ps[j].auto_aim = 0;
|
||||
}
|
||||
|
||||
loaddefs();
|
||||
LoadDefinitions();
|
||||
TileFiles.SetBackup();
|
||||
|
||||
if (ud.multimode > 1)
|
||||
{
|
||||
|
|
|
@ -75,10 +75,10 @@ void displaymasks_r(int snum, double smoothratio)
|
|||
|
||||
if (ps[snum].scuba_on)
|
||||
{
|
||||
int pin = 0;
|
||||
//int pin = 0;
|
||||
// to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value.
|
||||
double interpclock = ud.levelclock + (TICSPERFRAME/65536.) * smoothratio;
|
||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH;
|
||||
int pin = RS_STRETCH;
|
||||
hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (calcSinTableValue(interpclock) / 1024.)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x), (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);
|
||||
hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin);
|
||||
|
@ -422,7 +422,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
|
||||
auto displaycrossbow = [&]
|
||||
{
|
||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
//if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
|
||||
if (kb_frames[*kb] == 2 || kb_frames[*kb] == 3)
|
||||
{
|
||||
|
@ -449,7 +449,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
|
||||
auto displaychicken = [&]
|
||||
{
|
||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
//if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
if (*kb)
|
||||
{
|
||||
static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 };
|
||||
|
@ -760,7 +760,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
dy = 20;
|
||||
if ((*kb) < 20)
|
||||
{
|
||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
//if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
static const int8_t remote_frames[] = { 1,1,1,1,1,2,2,2,2,3,3,3,4,4,4,5,5,5,5,5,6,6,6 };
|
||||
|
||||
if (*kb)
|
||||
|
@ -811,7 +811,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
|
||||
auto displayblaster = [&]
|
||||
{
|
||||
if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
//if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_ALIGN_R;
|
||||
if ((*kb))
|
||||
{
|
||||
char cat_frames[] = { 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||
|
|
|
@ -380,14 +380,15 @@ public:
|
|||
|
||||
void Statusbar(int snum)
|
||||
{
|
||||
int tile = hud_size < Hud_StbarOverlay ? TILE_BOTTOMSTATUSBAR : BOTTOMSTATUSBAR; // always use the narrow version for the overlay.
|
||||
auto p = &ps[snum];
|
||||
int h = tilesiz[tile].y;
|
||||
int h = tilesiz[BOTTOMSTATUSBAR].y;
|
||||
int top = 200 - h;
|
||||
int left = (320 - tilesiz[tile].x) / 2;
|
||||
int left = (320 - tilesiz[BOTTOMSTATUSBAR].x) / 2;
|
||||
BeginStatusBar(320, 200, h);
|
||||
DrawInventory(p, 160, 154, 0);
|
||||
DrawGraphic(tileGetTexture(tile), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
|
||||
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
|
||||
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
|
||||
twod->ClearClipRect();
|
||||
|
||||
FString format;
|
||||
|
||||
|
|
|
@ -343,6 +343,7 @@ public:
|
|||
double h = tilesiz[BOTTOMSTATUSBAR].y * scale;
|
||||
double wh = 0;
|
||||
if (hud_size < Hud_Stbar) wh = tilesiz[WEAPONBAR].y * scale;
|
||||
double left = (320 - tilesiz[BOTTOMSTATUSBAR].x * scale) / 2;
|
||||
|
||||
double top = 200 - h;
|
||||
BeginStatusBar(320, 200, wh + h);
|
||||
|
@ -351,7 +352,9 @@ public:
|
|||
if (hud_size < Hud_Stbar)
|
||||
DrawWeaponBar(p, top);
|
||||
|
||||
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale);
|
||||
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
|
||||
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale);
|
||||
twod->ClearClipRect();
|
||||
|
||||
FString format;
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void GameInterface::app_init()
|
|||
if (!SW_SHAREWARE)
|
||||
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
|
||||
|
||||
if (!loaddefinitionsfile(G_DefFile())) Printf(PRINT_NONOTIFY, "Definitions file loaded.\n");
|
||||
LoadDefinitions();
|
||||
TileFiles.SetBackup();
|
||||
userConfig.AddDefs.reset();
|
||||
InitFX();
|
||||
|
|
|
@ -665,7 +665,10 @@ private:
|
|||
USERp u = User[pp->PlayerSprite];
|
||||
BeginStatusBar(320, 200, tileHeight(STATUS_BAR));
|
||||
|
||||
DrawGraphic(tileGetTexture(STATUS_BAR), 0, 200, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1);
|
||||
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
|
||||
int left = (320 - tilesiz[STATUS_BAR].x) / 2;
|
||||
DrawGraphic(tileGetTexture(STATUS_BAR), left, 200, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1);
|
||||
twod->ClearClipRect();
|
||||
DisplayPanelNumber(PANEL_HEALTH_BOX_X + PANEL_HEALTH_XOFF, PANEL_BOX_Y + PANEL_HEALTH_YOFF, u->Health);
|
||||
DisplayPanelNumber(PANEL_ARMOR_BOX_X + PANEL_ARMOR_XOFF, PANEL_BOX_Y + PANEL_ARMOR_YOFF, pp->Armor);
|
||||
if (u->WeaponNum != WPN_FIST && u->WeaponNum != WPN_SWORD)
|
||||
|
|
BIN
wadsrc/static/filter/duke/tiles/duke3d/2462.PNG
Normal file
BIN
wadsrc/static/filter/duke/tiles/duke3d/2462.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Loading…
Reference in a new issue