mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- the status bars work as objects.
# Conflicts: # source/common/menu/menudef.cpp
This commit is contained in:
parent
3b7ce26c86
commit
7de6528a1f
19 changed files with 630 additions and 307 deletions
|
@ -627,6 +627,7 @@ file( GLOB HEADER_FILES
|
|||
common/utility/*.h
|
||||
common/engine/*.h
|
||||
common/menu/*.h
|
||||
common/statusbar/*.h
|
||||
common/fonts/*.h
|
||||
common/objects/*.h
|
||||
common/filesystem/*.h
|
||||
|
@ -806,7 +807,6 @@ set (PCH_SOURCES
|
|||
core/raze_sound.cpp
|
||||
core/palette.cpp
|
||||
core/zcompile.cpp
|
||||
core/statusbar.cpp
|
||||
core/statusbar2.cpp
|
||||
core/gi.cpp
|
||||
|
||||
|
@ -943,6 +943,7 @@ set (PCH_SOURCES
|
|||
common/menu/resolutionmenu.cpp
|
||||
common/menu/menudef.cpp
|
||||
common/menu/savegamemanager.cpp
|
||||
common/statusbar/base_sbar.cpp
|
||||
|
||||
common/rendering/v_framebuffer.cpp
|
||||
common/rendering/v_video.cpp
|
||||
|
@ -1109,6 +1110,7 @@ include_directories(
|
|||
common/console
|
||||
common/engine
|
||||
common/menu
|
||||
common/statusbar
|
||||
common/fonts
|
||||
common/objects
|
||||
common/rendering
|
||||
|
|
|
@ -108,8 +108,9 @@ struct POWERUPDISPLAY
|
|||
|
||||
|
||||
|
||||
class DBloodStatusBar : public DStatusBarCore
|
||||
class DBloodStatusBar : public DBaseStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DBloodStatusBar, DBaseStatusBar)
|
||||
enum NewRSFlags
|
||||
{
|
||||
RS_CENTERBOTTOM = 16384,
|
||||
|
@ -241,7 +242,7 @@ private:
|
|||
stats.spacing = 6;
|
||||
}
|
||||
if (hud_size <= Hud_StbarOverlay) stats.screenbottomspace = 56;
|
||||
DStatusBarCore::PrintAutomapInfo(stats, textfont);
|
||||
DBaseStatusBar::PrintAutomapInfo(stats, textfont);
|
||||
}
|
||||
if (automapMode == am_off && hud_stats)
|
||||
{
|
||||
|
@ -253,7 +254,7 @@ private:
|
|||
stats.secrets = gSecretMgr.Founds + gSecretMgr.Super;
|
||||
stats.maxsecrets = gSecretMgr.Total;
|
||||
|
||||
DStatusBarCore::PrintLevelStats(stats);
|
||||
DBaseStatusBar::PrintLevelStats(stats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,6 +847,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBloodStatusBar, false, false)
|
||||
|
||||
|
||||
static void UpdateFrame(void)
|
||||
{
|
||||
|
@ -864,14 +867,12 @@ static void UpdateFrame(void)
|
|||
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
DBloodStatusBar sbar;
|
||||
|
||||
if (automapMode == am_off && hud_size <= Hud_Stbar)
|
||||
{
|
||||
UpdateFrame();
|
||||
}
|
||||
|
||||
sbar.UpdateStatusBar();
|
||||
StatusBar->UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "vm.h"
|
||||
#include "printf.h"
|
||||
|
||||
|
||||
int ListGetInt(VMVa_List &tags);
|
||||
|
||||
|
||||
|
|
|
@ -556,6 +556,8 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
|||
ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");
|
||||
ALC.SOFT_HRTF = !!alcIsExtensionPresent(Device, "ALC_SOFT_HRTF");
|
||||
ALC.SOFT_pause_device = !!alcIsExtensionPresent(Device, "ALC_SOFT_pause_device");
|
||||
ALC.SOFT_pause_device = !!alcIsExtensionPresent(Device, "ALC_SOFT_pause_device");
|
||||
ALC.SOFT_output_limiter = !!alcIsExtensionPresent(Device, "ALC_SOFT_output_limiter");
|
||||
|
||||
const ALCchar *current = NULL;
|
||||
if(alcIsExtensionPresent(Device, "ALC_ENUMERATE_ALL_EXT"))
|
||||
|
@ -592,6 +594,11 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
|||
else
|
||||
attribs.Push(ALC_DONT_CARE_SOFT);
|
||||
}
|
||||
if (ALC.SOFT_output_limiter)
|
||||
{
|
||||
attribs.Push(ALC_OUTPUT_LIMITER_SOFT);
|
||||
attribs.Push(ALC_TRUE /* or ALC_FALSE or ALC_DONT_CARE_SOFT */);
|
||||
}
|
||||
// Other attribs..?
|
||||
attribs.Push(0);
|
||||
|
||||
|
|
|
@ -48,6 +48,262 @@
|
|||
#include "printf.h"
|
||||
#include "s_music.h"
|
||||
#include "i_interface.h"
|
||||
#include "base_sbar.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// status bar exports
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static double StatusbarToRealCoords(DStatusBarCore* self, double x, double y, double w, double h, double* py, double* pw, double* ph)
|
||||
{
|
||||
self->StatusbarToRealCoords(x, y, w, h);
|
||||
*py = y;
|
||||
*pw = w;
|
||||
*ph = h;
|
||||
return x;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, StatusbarToRealCoords, StatusbarToRealCoords)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
self->StatusbarToRealCoords(x, y, w, h);
|
||||
if (numret > 0) ret[0].SetFloat(x);
|
||||
if (numret > 1) ret[1].SetFloat(y);
|
||||
if (numret > 2) ret[2].SetFloat(w);
|
||||
if (numret > 3) ret[3].SetFloat(h);
|
||||
return MIN(4, numret);
|
||||
}
|
||||
|
||||
void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY)
|
||||
{
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
self->DrawGraphic(FSetTextureID(texid), x, y, flags, alpha, w, h, scaleX, scaleY);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_INT(texid);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_INT(flags);
|
||||
PARAM_FLOAT(alpha);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(scaleX);
|
||||
PARAM_FLOAT(scaleY);
|
||||
SBar_DrawTexture(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SBar_DrawImage(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY)
|
||||
{
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_STRING(texid);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_INT(flags);
|
||||
PARAM_FLOAT(alpha);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(scaleX);
|
||||
PARAM_FLOAT(scaleY);
|
||||
SBar_DrawImage(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY);
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_POINTER_NOT_NULL(font, DHUDFont);
|
||||
PARAM_STRING(string);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_INT(flags);
|
||||
PARAM_INT(trans);
|
||||
PARAM_FLOAT(alpha);
|
||||
PARAM_INT(wrapwidth);
|
||||
PARAM_INT(linespacing);
|
||||
PARAM_FLOAT(scaleX);
|
||||
PARAM_FLOAT(scaleY);
|
||||
SBar_DrawString(self, font, string, x, y, flags, trans, alpha, wrapwidth, linespacing, scaleX, scaleY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static double SBar_TransformRect(DStatusBarCore* self, double x, double y, double w, double h, int flags, double* py, double* pw, double* ph)
|
||||
{
|
||||
self->TransformRect(x, y, w, h, flags);
|
||||
*py = y;
|
||||
*pw = w;
|
||||
*ph = h;
|
||||
return x;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, TransformRect, SBar_TransformRect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_INT(flags);
|
||||
self->TransformRect(x, y, w, h, flags);
|
||||
if (numret > 0) ret[0].SetFloat(x);
|
||||
if (numret > 1) ret[1].SetFloat(y);
|
||||
if (numret > 2) ret[2].SetFloat(w);
|
||||
if (numret > 3) ret[3].SetFloat(h);
|
||||
return MIN(4, numret);
|
||||
}
|
||||
|
||||
static void SBar_Fill(DStatusBarCore* self, int color, double x, double y, double w, double h, int flags)
|
||||
{
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
self->Fill(color, x, y, w, h, flags);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, Fill, SBar_Fill)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_COLOR(color);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_INT(flags);
|
||||
SBar_Fill(self, color, x, y, w, h, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SBar_SetClipRect(DStatusBarCore* self, double x, double y, double w, double h, int flags)
|
||||
{
|
||||
self->SetClipRect(x, y, w, h, flags);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, SetClipRect, SBar_SetClipRect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(w);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_INT(flags);
|
||||
self->SetClipRect(x, y, w, h, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FormatNumber(int number, int minsize, int maxsize, int flags, const FString& prefix, FString* result);
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, FormatNumber, FormatNumber)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(number);
|
||||
PARAM_INT(minsize);
|
||||
PARAM_INT(maxsize);
|
||||
PARAM_INT(flags);
|
||||
PARAM_STRING(prefix);
|
||||
FString fmt;
|
||||
FormatNumber(number, minsize, maxsize, flags, prefix, &fmt);
|
||||
ACTION_RETURN_STRING(fmt);
|
||||
}
|
||||
|
||||
static void SBar_SetSize(DStatusBarCore* self, int rt, int vw, int vh, int hvw, int hvh)
|
||||
{
|
||||
self->SetSize(rt, vw, vh, hvw, hvh);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, SetSize, SBar_SetSize)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_INT(rt);
|
||||
PARAM_INT(vw);
|
||||
PARAM_INT(vh);
|
||||
PARAM_INT(hvw);
|
||||
PARAM_INT(hvh);
|
||||
self->SetSize(rt, vw, vh, hvw, hvh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SBar_GetHUDScale(DStatusBarCore* self, DVector2* result)
|
||||
{
|
||||
*result = self->GetHUDScale();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, GetHUDScale, SBar_GetHUDScale)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
ACTION_RETURN_VEC2(self->GetHUDScale());
|
||||
}
|
||||
|
||||
static void BeginStatusBar(DStatusBarCore* self, bool fs, int w, int h, int r)
|
||||
{
|
||||
self->BeginStatusBar(w, h, r, fs);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, BeginStatusBar, BeginStatusBar)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_BOOL(fs);
|
||||
PARAM_INT(w);
|
||||
PARAM_INT(h);
|
||||
PARAM_INT(r);
|
||||
self->BeginStatusBar(w, h, r, fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void BeginHUD(DStatusBarCore* self, double a, bool fs, int w, int h)
|
||||
{
|
||||
self->BeginHUD(w, h, a, fs);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, BeginHUD, BeginHUD)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStatusBarCore);
|
||||
PARAM_FLOAT(a);
|
||||
PARAM_BOOL(fs);
|
||||
PARAM_INT(w);
|
||||
PARAM_INT(h);
|
||||
self->BeginHUD(w, h, a, fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=====================================================================================
|
||||
|
||||
DHUDFont* CreateHudFont(FFont* fnt, int spac, int mono, int sx, int sy)
|
||||
{
|
||||
return nullptr;// (Create<DHUDFont>(fnt, spac, EMonospacing(mono), sy, sy));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DHUDFont, Create, CreateHudFont)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_POINTER(fnt, FFont);
|
||||
PARAM_INT(spac);
|
||||
PARAM_INT(mono);
|
||||
PARAM_INT(sx);
|
||||
PARAM_INT(sy);
|
||||
ACTION_RETURN_POINTER(CreateHudFont(fnt, spac, mono, sy, sy));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
@ -662,3 +918,14 @@ DEFINE_GLOBAL_NAMED(PClass::AllClasses, AllClasses)
|
|||
DEFINE_GLOBAL(Bindings)
|
||||
DEFINE_GLOBAL(AutomapBindings)
|
||||
DEFINE_GLOBAL(generic_ui)
|
||||
|
||||
DEFINE_FIELD(DStatusBarCore, RelTop);
|
||||
DEFINE_FIELD(DStatusBarCore, HorizontalResolution);
|
||||
DEFINE_FIELD(DStatusBarCore, VerticalResolution);
|
||||
DEFINE_FIELD(DStatusBarCore, CompleteBorder);
|
||||
DEFINE_FIELD(DStatusBarCore, Alpha);
|
||||
DEFINE_FIELD(DStatusBarCore, drawOffset);
|
||||
DEFINE_FIELD(DStatusBarCore, drawClip);
|
||||
DEFINE_FIELD(DStatusBarCore, fullscreenOffsets);
|
||||
DEFINE_FIELD(DStatusBarCore, defaultScale);
|
||||
DEFINE_FIELD(DHUDFont, mFont);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
** shared_sbar.cpp
|
||||
** base_sbar.cpp
|
||||
** Base status bar implementation
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2006 Randy Heit
|
||||
** Copyright 2017 Christoph Oelckers
|
||||
** Copyright 1998-2016 Randy Heit
|
||||
** Copyright 2017-2020 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -35,36 +35,26 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "build.h"
|
||||
#include "templates.h"
|
||||
#include "statusbar.h"
|
||||
#include "c_cvars.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "c_console.h"
|
||||
#include "v_video.h"
|
||||
#include "filesystem.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "serializer.h"
|
||||
#include "serialize_obj.h"
|
||||
#include "base_sbar.h"
|
||||
#include "printf.h"
|
||||
#include "v_draw.h"
|
||||
#include "cmdlib.h"
|
||||
#include "vm.h"
|
||||
#include "gstrings.h"
|
||||
#include "utf8.h"
|
||||
#include "texturemanager.h"
|
||||
#include "cmdlib.h"
|
||||
#include "v_draw.h"
|
||||
#include "c_cvars.h"
|
||||
#include "v_font.h"
|
||||
#include "v_draw.h"
|
||||
#include "gamecvars.h"
|
||||
#include "m_fixed.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "gamestruct.h"
|
||||
#include "razemenu.h"
|
||||
#include "mapinfo.h"
|
||||
#include "utf8.h"
|
||||
#include "v_text.h"
|
||||
#include "vm.h"
|
||||
|
||||
FGameTexture* CrosshairImage;
|
||||
static int CrosshairNum;
|
||||
|
||||
|
||||
IMPLEMENT_CLASS(DStatusBarCore, true, false)
|
||||
//IMPLEMENT_CLASS(DHUDFont, true, false);
|
||||
|
||||
|
||||
CVAR(Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE);
|
||||
CVAR(Int, crosshairhealth, 2, CVAR_ARCHIVE);
|
||||
CVAR(Float, crosshairscale, 1.0, CVAR_ARCHIVE);
|
194
source/common/statusbar/base_sbar.h
Normal file
194
source/common/statusbar/base_sbar.h
Normal file
|
@ -0,0 +1,194 @@
|
|||
#pragma once
|
||||
|
||||
#include "dobject.h"
|
||||
#include "textureid.h"
|
||||
#include "zstring.h"
|
||||
#include "v_draw.h"
|
||||
|
||||
class FGameTexture;
|
||||
class FFont;
|
||||
extern FGameTexture* CrosshairImage;
|
||||
void ST_LoadCrosshair(int num, bool alwaysload);
|
||||
void ST_UnloadCrosshair();
|
||||
void ST_DrawCrosshair(int phealth, double xpos, double ypos, double scale);
|
||||
|
||||
|
||||
enum DI_Flags
|
||||
{
|
||||
DI_SKIPICON = 0x1,
|
||||
DI_SKIPALTICON = 0x2,
|
||||
DI_SKIPSPAWN = 0x4,
|
||||
DI_SKIPREADY = 0x8,
|
||||
DI_ALTICONFIRST = 0x10,
|
||||
|
||||
|
||||
DI_TRANSLATABLE = 0x20,
|
||||
DI_FORCESCALE = 0x40,
|
||||
DI_DIM = 0x80,
|
||||
DI_DRAWCURSORFIRST = 0x100, // only for DrawInventoryBar.
|
||||
DI_ALWAYSSHOWCOUNT = 0x200, // only for DrawInventoryBar.
|
||||
DI_DIMDEPLETED = 0x400,
|
||||
DI_DONTANIMATE = 0x800, // do not animate the texture
|
||||
DI_MIRROR = 0x1000, // flip the texture horizontally, like a mirror
|
||||
DI_ITEM_RELCENTER = 0x2000,
|
||||
DI_MIRRORY = 0x40000000,
|
||||
|
||||
DI_SCREEN_AUTO = 0, // decide based on given offsets.
|
||||
DI_SCREEN_MANUAL_ALIGN = 0x4000, // If this is on, the following flags will have an effect
|
||||
|
||||
DI_SCREEN_TOP = DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VCENTER = 0x8000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_BOTTOM = 0x10000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VOFFSET = 0x18000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VMASK = 0x18000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
|
||||
DI_SCREEN_LEFT = DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HCENTER = 0x20000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_RIGHT = 0x40000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HOFFSET = 0x60000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HMASK = 0x60000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
|
||||
DI_SCREEN_LEFT_TOP = DI_SCREEN_TOP | DI_SCREEN_LEFT,
|
||||
DI_SCREEN_RIGHT_TOP = DI_SCREEN_TOP | DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_LEFT_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_LEFT,
|
||||
DI_SCREEN_LEFT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_LEFT,
|
||||
DI_SCREEN_RIGHT_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_RIGHT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_CENTER_TOP = DI_SCREEN_TOP | DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_CENTER_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_OFFSETS = DI_SCREEN_HOFFSET | DI_SCREEN_VOFFSET,
|
||||
|
||||
DI_ITEM_AUTO = 0, // equivalent with bottom center, which is the default alignment.
|
||||
|
||||
DI_ITEM_TOP = 0x80000,
|
||||
DI_ITEM_VCENTER = 0x100000,
|
||||
DI_ITEM_BOTTOM = 0, // this is the default vertical alignment
|
||||
DI_ITEM_VOFFSET = 0x180000,
|
||||
DI_ITEM_VMASK = 0x180000,
|
||||
|
||||
DI_ITEM_LEFT = 0x200000,
|
||||
DI_ITEM_HCENTER = 0, // this is the deafault horizontal alignment
|
||||
DI_ITEM_RIGHT = 0x400000,
|
||||
DI_ITEM_HOFFSET = 0x600000,
|
||||
DI_ITEM_HMASK = 0x600000,
|
||||
|
||||
DI_ITEM_LEFT_TOP = DI_ITEM_TOP | DI_ITEM_LEFT,
|
||||
DI_ITEM_RIGHT_TOP = DI_ITEM_TOP | DI_ITEM_RIGHT,
|
||||
DI_ITEM_LEFT_BOTTOM = DI_ITEM_BOTTOM | DI_ITEM_LEFT,
|
||||
DI_ITEM_RIGHT_BOTTOM = DI_ITEM_BOTTOM | DI_ITEM_RIGHT,
|
||||
DI_ITEM_CENTER = DI_ITEM_VCENTER | DI_ITEM_HCENTER,
|
||||
DI_ITEM_CENTER_BOTTOM = DI_ITEM_BOTTOM | DI_ITEM_HCENTER,
|
||||
DI_ITEM_OFFSETS = DI_ITEM_HOFFSET | DI_ITEM_VOFFSET,
|
||||
|
||||
DI_TEXT_ALIGN_LEFT = 0,
|
||||
DI_TEXT_ALIGN_RIGHT = 0x800000,
|
||||
DI_TEXT_ALIGN_CENTER = 0x1000000,
|
||||
DI_TEXT_ALIGN = 0x1800000,
|
||||
|
||||
DI_ALPHAMAPPED = 0x2000000,
|
||||
DI_NOSHADOW = 0x4000000,
|
||||
DI_ALWAYSSHOWCOUNTERS = 0x8000000,
|
||||
DI_ARTIFLASH = 0x10000000,
|
||||
DI_FORCEFILL = 0x20000000,
|
||||
|
||||
// These 2 flags are only used by SBARINFO so these duplicate other flags not used by SBARINFO
|
||||
DI_DRAWINBOX = DI_TEXT_ALIGN_RIGHT,
|
||||
DI_ALTERNATEONFAIL = DI_TEXT_ALIGN_CENTER,
|
||||
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// encapsulates all settings a HUD font may need
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
class DHUDFont //: public DObject - need to keep it POD for now.
|
||||
{
|
||||
// this blocks CreateNew on this class which is the intent here.
|
||||
//DECLARE_ABSTRACT_CLASS(DHUDFont, DObject);
|
||||
|
||||
public:
|
||||
FFont* mFont;
|
||||
int mSpacing;
|
||||
EMonospacing mMonospacing;
|
||||
int mShadowX;
|
||||
int mShadowY;
|
||||
|
||||
DHUDFont() = default;
|
||||
|
||||
DHUDFont(FFont* f, int sp, EMonospacing ms, int sx, int sy)
|
||||
: mFont(f), mSpacing(sp), mMonospacing(ms), mShadowX(sx), mShadowY(sy)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class DStatusBarCore : public DObject
|
||||
{
|
||||
DECLARE_CLASS(DStatusBarCore, DObject)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
enum EAlign
|
||||
{
|
||||
TOP = 0,
|
||||
VCENTER = 1,
|
||||
BOTTOM = 2,
|
||||
VOFFSET = 3,
|
||||
VMASK = 3,
|
||||
|
||||
LEFT = 0,
|
||||
HCENTER = 4,
|
||||
RIGHT = 8,
|
||||
HOFFSET = 12,
|
||||
HMASK = 12,
|
||||
|
||||
CENTER = VCENTER | HCENTER,
|
||||
CENTER_BOTTOM = BOTTOM | HCENTER
|
||||
};
|
||||
|
||||
int ST_X;
|
||||
int ST_Y;
|
||||
int SBarTop;
|
||||
int RelTop;
|
||||
int HorizontalResolution, VerticalResolution;
|
||||
double Alpha = 1.;
|
||||
DVector2 SBarScale;
|
||||
DVector2 drawOffset = { 0,0 }; // can be set by subclasses to offset drawing operations
|
||||
DVector2 defaultScale; // factor for clean fully scaled display.
|
||||
double drawClip[4] = { 0,0,0,0 }; // defines a clipping rectangle (not used yet)
|
||||
bool fullscreenOffsets = false; // current screen is displayed with fullscreen behavior.
|
||||
bool ForcedScale = false;
|
||||
bool CompleteBorder = false;
|
||||
|
||||
int BaseRelTop;
|
||||
int BaseSBarHorizontalResolution;
|
||||
int BaseSBarVerticalResolution;
|
||||
int BaseHUDHorizontalResolution;
|
||||
int BaseHUDVerticalResolution;
|
||||
|
||||
|
||||
void BeginStatusBar(int resW, int resH, int relTop, bool forceScaled = false);
|
||||
void BeginHUD(int resW, int resH, double Alpha, bool forceScaled = false);
|
||||
void SetSize(int reltop = 32, int hres = 320, int vres = 200, int hhres = -1, int hvres = -1);
|
||||
virtual DVector2 GetHUDScale() const;
|
||||
virtual uint32_t GetTranslation() const { return 0; }
|
||||
void SetDrawSize(int reltop, int hres, int vres);
|
||||
virtual void SetScale();
|
||||
void ValidateResolution(int& hres, int& vres) const;
|
||||
void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const;
|
||||
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY);
|
||||
void TransformRect(double& x, double& y, double& w, double& h, int flags = 0);
|
||||
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
||||
void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
||||
|
||||
};
|
|
@ -132,6 +132,8 @@ void LoadScripts();
|
|||
void MainLoop();
|
||||
void SetConsoleNotifyBuffer();
|
||||
|
||||
DBaseStatusBar* StatusBar;
|
||||
|
||||
|
||||
bool AppActive = true;
|
||||
|
||||
|
@ -536,6 +538,8 @@ int GameMain()
|
|||
}
|
||||
DeleteScreenJob();
|
||||
DeinitMenus();
|
||||
if (StatusBar) StatusBar->Destroy();
|
||||
StatusBar = nullptr;
|
||||
if (gi)
|
||||
{
|
||||
gi->FreeGameData(); // Must be done before taking down any subsystems.
|
||||
|
@ -745,6 +749,7 @@ static TArray<GrpEntry> SetupGame()
|
|||
|
||||
currentGame = LumpFilter;
|
||||
currentGame.Truncate(currentGame.IndexOf("."));
|
||||
PClass::StaticInit();
|
||||
CheckFrontend(g_gameType);
|
||||
gameinfo.gametype = g_gameType;
|
||||
return usedgroups;
|
||||
|
@ -761,6 +766,36 @@ void InitLanguages()
|
|||
GStrings.LoadStrings(language);
|
||||
}
|
||||
|
||||
|
||||
void CreateStatusBar()
|
||||
{
|
||||
int flags = g_gameType;
|
||||
PClass* stbarclass = nullptr;
|
||||
|
||||
if (flags & GAMEFLAG_BLOOD)
|
||||
{
|
||||
stbarclass = PClass::FindClass("BloodStatusBar");
|
||||
}
|
||||
else if (flags & GAMEFLAG_SW)
|
||||
{
|
||||
stbarclass = PClass::FindClass("SWStatusBar");
|
||||
}
|
||||
else if (flags & GAMEFLAG_PSEXHUMED)
|
||||
{
|
||||
stbarclass = PClass::FindClass("ExhumedStatusBar");
|
||||
}
|
||||
else
|
||||
{
|
||||
stbarclass = PClass::FindClass(isRR() ? "RedneckStatusBar" : "DukeStatusBar");
|
||||
}
|
||||
if (!stbarclass)
|
||||
{
|
||||
I_FatalError("No status bar defined");
|
||||
}
|
||||
StatusBar = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
GC::AddMarkerFunc([]() { GC::Mark(StatusBar); });
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -871,6 +906,7 @@ int RunGame()
|
|||
SetupGameButtons();
|
||||
gameinfo.mBackButton = "engine/graphics/m_back.png";
|
||||
gi->app_init();
|
||||
CreateStatusBar();
|
||||
SetDefaultMenuColors();
|
||||
M_Init();
|
||||
BuildGameMenus();
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
#include "dobject.h"
|
||||
#include "v_text.h"
|
||||
#include "renderstyle.h"
|
||||
#include "base_sbar.h"
|
||||
|
||||
class player_t;
|
||||
struct FRemapTable;
|
||||
|
||||
#if 0
|
||||
|
@ -89,265 +89,52 @@ struct FLevelStats
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
class DHUDFont //: public DObject
|
||||
class DBaseStatusBar : public DStatusBarCore
|
||||
{
|
||||
// this blocks CreateNew on this class which is the intent here.
|
||||
//DECLARE_ABSTRACT_CLASS(DHUDFont, DObject);
|
||||
DECLARE_ABSTRACT_CLASS (DBaseStatusBar, DStatusBarCore)
|
||||
|
||||
public:
|
||||
FFont *mFont;
|
||||
int mSpacing;
|
||||
EMonospacing mMonospacing;
|
||||
int mShadowX;
|
||||
int mShadowY;
|
||||
|
||||
DHUDFont() = default;
|
||||
DHUDFont(FFont *f, int sp, EMonospacing ms, int sx, int sy)
|
||||
: mFont(f), mSpacing(sp), mMonospacing(ms), mShadowX(sx), mShadowY(sy)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
class DStatusBarCore //: public DObject
|
||||
{
|
||||
//DECLARE_CLASS (DStatusBarCore, DObject)
|
||||
//HAS_OBJECT_POINTERS
|
||||
public:
|
||||
// Popup screens for Strife's status bar
|
||||
enum
|
||||
{
|
||||
POP_NoChange = -1,
|
||||
POP_None,
|
||||
POP_Log,
|
||||
POP_Keys,
|
||||
POP_Status
|
||||
};
|
||||
|
||||
// Status face stuff
|
||||
enum
|
||||
{
|
||||
ST_NUMPAINFACES = 5,
|
||||
ST_NUMSTRAIGHTFACES = 3,
|
||||
ST_NUMTURNFACES = 2,
|
||||
ST_NUMSPECIALFACES = 3,
|
||||
ST_NUMEXTRAFACES = 2,
|
||||
ST_FACESTRIDE = ST_NUMSTRAIGHTFACES+ST_NUMTURNFACES+ST_NUMSPECIALFACES,
|
||||
ST_NUMFACES = ST_FACESTRIDE*ST_NUMPAINFACES+ST_NUMEXTRAFACES,
|
||||
|
||||
ST_TURNOFFSET = ST_NUMSTRAIGHTFACES,
|
||||
ST_OUCHOFFSET = ST_TURNOFFSET + ST_NUMTURNFACES,
|
||||
ST_EVILGRINOFFSET = ST_OUCHOFFSET + 1,
|
||||
ST_RAMPAGEOFFSET = ST_EVILGRINOFFSET + 1,
|
||||
ST_GODFACE = ST_NUMPAINFACES*ST_FACESTRIDE,
|
||||
ST_DEADFACE = ST_GODFACE + 1
|
||||
};
|
||||
|
||||
|
||||
enum EAlign
|
||||
{
|
||||
TOP = 0,
|
||||
VCENTER = 1,
|
||||
BOTTOM = 2,
|
||||
VOFFSET = 3,
|
||||
VMASK = 3,
|
||||
|
||||
LEFT = 0,
|
||||
HCENTER = 4,
|
||||
RIGHT = 8,
|
||||
HOFFSET = 12,
|
||||
HMASK = 12,
|
||||
|
||||
CENTER = VCENTER | HCENTER,
|
||||
CENTER_BOTTOM = BOTTOM | HCENTER
|
||||
};
|
||||
|
||||
DStatusBarCore ();
|
||||
virtual ~DStatusBarCore() = default;
|
||||
void SetSize(int reltop = 32, int hres = 320, int vres = 200, int hhres = -1, int hvres = -1);
|
||||
|
||||
void ShowPlayerName ();
|
||||
double GetDisplacement() { return Displacement; }
|
||||
int GetPlayer ();
|
||||
|
||||
static void AddBlend (float r, float g, float b, float a, float v_blend[4]);
|
||||
DBaseStatusBar ();
|
||||
virtual ~DBaseStatusBar() = default;
|
||||
|
||||
// do not make this a DObject Serialize function because it's not used like one!
|
||||
void SerializeMessages(FSerializer &arc);
|
||||
//void SerializeMessages(FSerializer &arc);
|
||||
|
||||
void SetScale();
|
||||
virtual void Tick ();
|
||||
void AttachToPlayer(player_t *player);
|
||||
DVector2 GetHUDScale() const;
|
||||
void NewGame ();
|
||||
int GetTranslation() { return 0; }
|
||||
|
||||
void DrawGraphic(FGameTexture *texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY);
|
||||
void TransformRect(double &x, double &y, double &w, double &h, int flags = 0);
|
||||
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
||||
void ValidateResolution(int& hres, int& vres) const;
|
||||
|
||||
void BeginStatusBar(int resW, int resH, int relTop, bool forceScaled = false);
|
||||
void BeginHUD(int resW, int resH, double Alpha, bool forceScaled = false);
|
||||
void StatusbarToRealCoords(double &x, double &y, double &w, double &h) const;
|
||||
void PrintLevelStats(FLevelStats& stats);
|
||||
void PrintAutomapInfo(FLevelStats& stats, bool forcetextfont = false);
|
||||
int GetTopOfStatusbar() const
|
||||
{
|
||||
return SBarTop;
|
||||
}
|
||||
void DoDrawAutomapHUD(int crdefault, int highlight);
|
||||
short CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading);
|
||||
void Set43ClipRect();
|
||||
|
||||
void SetClipRect(double x, double y, double w, double h, int flags);
|
||||
|
||||
//protected:
|
||||
void DrawPowerups ();
|
||||
|
||||
virtual void UpdateStatusBar() = 0;
|
||||
|
||||
void RefreshBackground () const;
|
||||
void RefreshViewBorder ();
|
||||
|
||||
private:
|
||||
DObject *AltHud = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
void DrawCrosshair ();
|
||||
|
||||
// Sizing info for ths status bar.
|
||||
int ST_X;
|
||||
int ST_Y;
|
||||
int SBarTop;
|
||||
DVector2 SBarScale;
|
||||
int RelTop;
|
||||
int HorizontalResolution, VerticalResolution;
|
||||
bool Scaled; // This needs to go away.
|
||||
|
||||
bool Centering;
|
||||
bool FixedOrigin;
|
||||
bool CompleteBorder;
|
||||
double CrosshairSize;
|
||||
double Displacement;
|
||||
bool ShowLog;
|
||||
bool ForcedScale = false;
|
||||
|
||||
double Alpha = 1.;
|
||||
DVector2 drawOffset = { 0,0 }; // can be set by subclasses to offset drawing operations
|
||||
double drawClip[4] = { 0,0,0,0 }; // defines a clipping rectangle (not used yet)
|
||||
bool fullscreenOffsets = false; // current screen is displayed with fullscreen behavior.
|
||||
DVector2 defaultScale; // factor for clean fully scaled display.
|
||||
|
||||
private:
|
||||
void SetDrawSize(int reltop, int hres, int vres);
|
||||
|
||||
int BaseRelTop;
|
||||
int BaseSBarHorizontalResolution;
|
||||
int BaseSBarVerticalResolution;
|
||||
int BaseHUDHorizontalResolution;
|
||||
int BaseHUDVerticalResolution;
|
||||
|
||||
};
|
||||
|
||||
extern DStatusBarCore *StatusBar;
|
||||
extern DBaseStatusBar *StatusBar;
|
||||
|
||||
// Status bar factories -----------------------------------------------------
|
||||
|
||||
DStatusBarCore *CreateCustomStatusBar(int script=0);
|
||||
|
||||
// Crosshair stuff ----------------------------------------------------------
|
||||
|
||||
void ST_Clear();
|
||||
void ST_CreateStatusBar(bool bTitleLevel);
|
||||
extern FGameTexture *CrosshairImage;
|
||||
|
||||
int GetInventoryIcon(AActor *item, uint32_t flags, int *applyscale = nullptr);
|
||||
|
||||
|
||||
enum DI_Flags
|
||||
{
|
||||
DI_SKIPICON = 0x1,
|
||||
DI_SKIPALTICON = 0x2,
|
||||
DI_SKIPSPAWN = 0x4,
|
||||
DI_SKIPREADY = 0x8,
|
||||
DI_ALTICONFIRST = 0x10,
|
||||
DI_TRANSLATABLE = 0x20,
|
||||
DI_FORCESCALE = 0x40,
|
||||
DI_DIM = 0x80,
|
||||
DI_DRAWCURSORFIRST = 0x100, // only for DrawInventoryBar.
|
||||
DI_ALWAYSSHOWCOUNT = 0x200, // only for DrawInventoryBar.
|
||||
DI_DIMDEPLETED = 0x400,
|
||||
DI_DONTANIMATE = 0x800, // do not animate the texture
|
||||
DI_MIRROR = 0x1000, // flip the texture horizontally, like a mirror
|
||||
DI_ITEM_RELCENTER = 0x2000,
|
||||
DI_MIRRORY = 0x40000000,
|
||||
|
||||
DI_SCREEN_AUTO = 0, // decide based on given offsets.
|
||||
DI_SCREEN_MANUAL_ALIGN = 0x4000, // If this is on, the following flags will have an effect
|
||||
|
||||
DI_SCREEN_TOP = DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VCENTER = 0x8000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_BOTTOM = 0x10000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VOFFSET = 0x18000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_VMASK = 0x18000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
|
||||
DI_SCREEN_LEFT = DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HCENTER = 0x20000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_RIGHT = 0x40000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HOFFSET = 0x60000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
DI_SCREEN_HMASK = 0x60000 | DI_SCREEN_MANUAL_ALIGN,
|
||||
|
||||
DI_SCREEN_LEFT_TOP = DI_SCREEN_TOP|DI_SCREEN_LEFT,
|
||||
DI_SCREEN_RIGHT_TOP = DI_SCREEN_TOP|DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_LEFT_BOTTOM = DI_SCREEN_BOTTOM|DI_SCREEN_LEFT,
|
||||
DI_SCREEN_LEFT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_LEFT,
|
||||
DI_SCREEN_RIGHT_BOTTOM = DI_SCREEN_BOTTOM|DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_RIGHT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_RIGHT,
|
||||
DI_SCREEN_CENTER = DI_SCREEN_VCENTER|DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_CENTER_TOP = DI_SCREEN_TOP | DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_CENTER_BOTTOM = DI_SCREEN_BOTTOM|DI_SCREEN_HCENTER,
|
||||
DI_SCREEN_OFFSETS = DI_SCREEN_HOFFSET|DI_SCREEN_VOFFSET,
|
||||
|
||||
DI_ITEM_AUTO = 0, // equivalent with bottom center, which is the default alignment.
|
||||
|
||||
DI_ITEM_TOP = 0x80000,
|
||||
DI_ITEM_VCENTER = 0x100000,
|
||||
DI_ITEM_BOTTOM = 0, // this is the default vertical alignment
|
||||
DI_ITEM_VOFFSET = 0x180000,
|
||||
DI_ITEM_VMASK = 0x180000,
|
||||
|
||||
DI_ITEM_LEFT = 0x200000,
|
||||
DI_ITEM_HCENTER = 0, // this is the deafault horizontal alignment
|
||||
DI_ITEM_RIGHT = 0x400000,
|
||||
DI_ITEM_HOFFSET = 0x600000,
|
||||
DI_ITEM_HMASK = 0x600000,
|
||||
|
||||
DI_ITEM_LEFT_TOP = DI_ITEM_TOP|DI_ITEM_LEFT,
|
||||
DI_ITEM_RIGHT_TOP = DI_ITEM_TOP|DI_ITEM_RIGHT,
|
||||
DI_ITEM_LEFT_BOTTOM = DI_ITEM_BOTTOM|DI_ITEM_LEFT,
|
||||
DI_ITEM_RIGHT_BOTTOM = DI_ITEM_BOTTOM|DI_ITEM_RIGHT,
|
||||
DI_ITEM_CENTER = DI_ITEM_VCENTER|DI_ITEM_HCENTER,
|
||||
DI_ITEM_CENTER_BOTTOM = DI_ITEM_BOTTOM|DI_ITEM_HCENTER,
|
||||
DI_ITEM_OFFSETS = DI_ITEM_HOFFSET|DI_ITEM_VOFFSET,
|
||||
|
||||
DI_TEXT_ALIGN_LEFT = 0,
|
||||
DI_TEXT_ALIGN_RIGHT = 0x800000,
|
||||
DI_TEXT_ALIGN_CENTER = 0x1000000,
|
||||
DI_TEXT_ALIGN = 0x1800000,
|
||||
|
||||
DI_ALPHAMAPPED = 0x2000000,
|
||||
DI_NOSHADOW = 0x4000000,
|
||||
DI_ALWAYSSHOWCOUNTERS = 0x8000000,
|
||||
DI_ARTIFLASH = 0x10000000,
|
||||
DI_FORCEFILL = 0x20000000,
|
||||
|
||||
// These 2 flags are only used by SBARINFO so these duplicate other flags not used by SBARINFO
|
||||
DI_DRAWINBOX = DI_TEXT_ALIGN_RIGHT,
|
||||
DI_ALTERNATEONFAIL = DI_TEXT_ALIGN_CENTER,
|
||||
|
||||
};
|
||||
|
||||
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY);
|
||||
void setViewport(int viewSize);
|
||||
|
|
|
@ -78,11 +78,11 @@ EXTERN_CVAR (Bool, noisedebug)
|
|||
EXTERN_CVAR(Bool, vid_fps)
|
||||
EXTERN_CVAR(Bool, inter_subtitles)
|
||||
|
||||
extern DStatusBarCore *StatusBar;
|
||||
//extern DBaseStatusBar *StatusBar;
|
||||
|
||||
extern int setblocks;
|
||||
|
||||
|
||||
IMPLEMENT_CLASS(DBaseStatusBar, true, false)
|
||||
//---------------------------------------------------------------------------
|
||||
// ST_Clear
|
||||
//
|
||||
|
@ -104,14 +104,11 @@ void ST_Clear()
|
|||
// Constructor
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
DStatusBarCore::DStatusBarCore ()
|
||||
DBaseStatusBar::DBaseStatusBar ()
|
||||
{
|
||||
CompleteBorder = false;
|
||||
Centering = false;
|
||||
FixedOrigin = false;
|
||||
CrosshairSize = 1.;
|
||||
Displacement = 0;
|
||||
ShowLog = false;
|
||||
SetSize(0);
|
||||
}
|
||||
|
||||
|
@ -121,7 +118,7 @@ DStatusBarCore::DStatusBarCore ()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DStatusBarCore::Tick ()
|
||||
void DBaseStatusBar::Tick ()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -139,7 +136,7 @@ static DObject *InitObject(PClass *type, int paramnum, VM_ARGS)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::PrintLevelStats(FLevelStats &stats)
|
||||
void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||
{
|
||||
double y;
|
||||
double scale = stats.fontscale * hud_statscale;
|
||||
|
@ -212,7 +209,7 @@ void DStatusBarCore::PrintLevelStats(FLevelStats &stats)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::PrintAutomapInfo(FLevelStats& stats, bool forcetextfont)
|
||||
void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats, bool forcetextfont)
|
||||
{
|
||||
auto lev = currentLevel;
|
||||
FString mapname;
|
||||
|
@ -256,7 +253,7 @@ void DStatusBarCore::PrintAutomapInfo(FLevelStats& stats, bool forcetextfont)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
short DStatusBarCore::CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading)
|
||||
short DBaseStatusBar::CalcMagazineAmount(short ammo_remaining, short clip_capacity, bool reloading)
|
||||
{
|
||||
// Determine amount in clip.
|
||||
short clip_amount = ammo_remaining % clip_capacity;
|
||||
|
@ -274,7 +271,7 @@ short DStatusBarCore::CalcMagazineAmount(short ammo_remaining, short clip_capaci
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::Set43ClipRect()
|
||||
void DBaseStatusBar::Set43ClipRect()
|
||||
{
|
||||
auto GetWidth = [=]() { return twod->GetWidth(); };
|
||||
auto GetHeight = [=]() {return twod->GetHeight(); };
|
||||
|
|
|
@ -512,8 +512,10 @@ void MoveStatus()
|
|||
}
|
||||
|
||||
|
||||
class DExhumedStatusBar : public DStatusBarCore
|
||||
class DExhumedStatusBar : public DBaseStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DExhumedStatusBar, DBaseStatusBar)
|
||||
|
||||
DHUDFont textfont, numberFont;
|
||||
|
||||
public:
|
||||
|
@ -938,7 +940,7 @@ private:
|
|||
|
||||
if (automapMode == am_full)
|
||||
{
|
||||
DStatusBarCore::PrintAutomapInfo(stats, true);
|
||||
DBaseStatusBar::PrintAutomapInfo(stats, true);
|
||||
}
|
||||
else if (hud_stats)
|
||||
{
|
||||
|
@ -950,7 +952,7 @@ private:
|
|||
stats.secrets = 0;
|
||||
stats.maxsecrets = 0;
|
||||
|
||||
DStatusBarCore::PrintLevelStats(stats);
|
||||
DBaseStatusBar::PrintLevelStats(stats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -958,7 +960,7 @@ private:
|
|||
|
||||
|
||||
public:
|
||||
void Draw()
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
if (hud_size <= Hud_full)
|
||||
{
|
||||
|
@ -968,6 +970,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DExhumedStatusBar, false, false)
|
||||
|
||||
|
||||
void UpdateFrame()
|
||||
{
|
||||
auto tex = tileGetTexture(nBackgroundPic);
|
||||
|
@ -1000,8 +1005,7 @@ void DrawStatusBar()
|
|||
{
|
||||
UpdateFrame();
|
||||
}
|
||||
DExhumedStatusBar sbar;
|
||||
sbar.Draw();
|
||||
StatusBar->UpdateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -208,8 +208,6 @@ void OffMotorcycle(player_struct *pl);
|
|||
void OnBoat(player_struct *pl, int snum);
|
||||
void OffBoat(player_struct *pl);
|
||||
|
||||
void drawstatusbar_d(int snum);
|
||||
void drawstatusbar_r(int snum);
|
||||
void cameratext(int i);
|
||||
void dobonus(int bonusonly, const CompletionFunc& completion);
|
||||
void dobonus_d(int bonusonly, const CompletionFunc& completion);
|
||||
|
|
|
@ -295,8 +295,8 @@ void drawoverlays(double smoothratio)
|
|||
}
|
||||
|
||||
DrawBorder();
|
||||
if (isRR()) drawstatusbar_r(screenpeek);
|
||||
else drawstatusbar_d(screenpeek);
|
||||
|
||||
StatusBar->UpdateStatusBar();
|
||||
|
||||
if (ps[myconnectindex].newowner == -1 && ud.camerasprite == -1)
|
||||
{
|
||||
|
@ -307,6 +307,9 @@ void drawoverlays(double smoothratio)
|
|||
fi.PrintPaused();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -44,6 +44,7 @@ source as it is released.
|
|||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
IMPLEMENT_CLASS(DDukeCommonStatusBar, true, false)
|
||||
//==========================================================================
|
||||
//
|
||||
// very much a dummy to access the methods.
|
||||
|
@ -211,7 +212,7 @@ void DDukeCommonStatusBar::PrintLevelStats(int bottomy)
|
|||
else stats.spacing = stats.font->GetHeight() + 1;
|
||||
stats.standardColor = (isNamWW2GI() && am_textfont)? CR_ORANGE : CR_UNTRANSLATED;
|
||||
stats.letterColor = CR_GOLD;
|
||||
DStatusBarCore::PrintAutomapInfo(stats, textfont);
|
||||
DBaseStatusBar::PrintAutomapInfo(stats, textfont);
|
||||
}
|
||||
else if (hud_stats)
|
||||
{
|
||||
|
@ -242,7 +243,7 @@ void DDukeCommonStatusBar::PrintLevelStats(int bottomy)
|
|||
stats.standardColor =
|
||||
stats.completeColor = CR_UNTRANSLATED;
|
||||
}
|
||||
DStatusBarCore::PrintLevelStats(stats);
|
||||
DBaseStatusBar::PrintLevelStats(stats);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
BEGIN_DUKE_NS
|
||||
|
||||
|
||||
class DDukeCommonStatusBar : public DStatusBarCore
|
||||
class DDukeCommonStatusBar : public DBaseStatusBar
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DDukeCommonStatusBar, DBaseStatusBar)
|
||||
|
||||
protected:
|
||||
DHUDFont numberFont;
|
||||
DHUDFont indexFont;
|
||||
|
|
|
@ -54,6 +54,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
class DDukeStatusBar : public DDukeCommonStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DDukeStatusBar, DDukeCommonStatusBar)
|
||||
public:
|
||||
DDukeStatusBar()
|
||||
{
|
||||
|
@ -438,21 +439,20 @@ public:
|
|||
PrintLevelStats(-1);
|
||||
}
|
||||
|
||||
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
if (hud_size >= Hud_Mini)
|
||||
{
|
||||
DrawHud(screenpeek, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Statusbar(screenpeek);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DDukeStatusBar, false, false)
|
||||
|
||||
void drawstatusbar_d(int snum)
|
||||
{
|
||||
DDukeStatusBar dsb;
|
||||
if (hud_size >= Hud_Mini)
|
||||
{
|
||||
dsb.DrawHud(snum, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsb.Statusbar(snum);
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -46,6 +46,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
class DRedneckStatusBar : public DDukeCommonStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DRedneckStatusBar, DDukeCommonStatusBar)
|
||||
|
||||
public:
|
||||
DRedneckStatusBar()
|
||||
|
@ -448,21 +449,22 @@ public:
|
|||
}
|
||||
PrintLevelStats(-1);
|
||||
}
|
||||
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
if (hud_size >= Hud_Mini)
|
||||
{
|
||||
DrawHud(screenpeek, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Statusbar(screenpeek);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void PrintLevelName_r(double alpha);
|
||||
IMPLEMENT_CLASS(DRedneckStatusBar, false, false)
|
||||
|
||||
void drawstatusbar_r(int snum)
|
||||
{
|
||||
DRedneckStatusBar dsb;
|
||||
if (hud_size >= Hud_Mini)
|
||||
{
|
||||
dsb.DrawHud(snum, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsb.Statusbar(snum);
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -67,8 +67,10 @@ static const short icons[] = {
|
|||
ID_PanelCaltrops,
|
||||
};
|
||||
|
||||
class DSWStatusBar : public DStatusBarCore
|
||||
class DSWStatusBar : public DBaseStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DSWStatusBar, DBaseStatusBar)
|
||||
|
||||
DHUDFont miniFont, numberFont;
|
||||
|
||||
enum
|
||||
|
@ -967,7 +969,7 @@ private:
|
|||
stats.spacing = 6;
|
||||
}
|
||||
else stats.spacing = SmallFont->GetHeight() + 1;
|
||||
DStatusBarCore::PrintAutomapInfo(stats, textfont);
|
||||
DBaseStatusBar::PrintAutomapInfo(stats, textfont);
|
||||
}
|
||||
// JBF 20040124: display level stats in screen corner
|
||||
else if (hud_stats && !(CommEnabled || numplayers > 1))
|
||||
|
@ -984,7 +986,7 @@ private:
|
|||
stats.standardColor = CR_TAN;
|
||||
stats.completeColor = CR_FIRE;
|
||||
|
||||
DStatusBarCore::PrintLevelStats(stats);
|
||||
DBaseStatusBar::PrintLevelStats(stats);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1034,6 +1036,8 @@ public:
|
|||
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSWStatusBar, false, false)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -1080,7 +1084,7 @@ void UpdateStatusBar()
|
|||
UpdateFrame();
|
||||
}
|
||||
|
||||
sbar.UpdateStatusBar();
|
||||
StatusBar->UpdateStatusBar();
|
||||
PLAYERp pp = &Player[screenpeek];
|
||||
if (pp->cookieTime > 0)
|
||||
{
|
||||
|
|
|
@ -53,3 +53,30 @@ class RazeMenuDelegate : MenuDelegateBase
|
|||
native override void MenuDismissed();
|
||||
|
||||
}
|
||||
|
||||
// dummy definitions for the status bar. We need them to create the class descriptors
|
||||
|
||||
class StatusBarCore native ui
|
||||
{}
|
||||
|
||||
class BaseStatusBar : StatusBarCore native
|
||||
{}
|
||||
|
||||
|
||||
class BloodStatusBar : BaseStatusBar native
|
||||
{}
|
||||
|
||||
class DukeCommonStatusBar : BaseStatusBar native
|
||||
{}
|
||||
|
||||
class DukeStatusBar : DukeCommonStatusBar native
|
||||
{}
|
||||
|
||||
class RedneckStatusBar : DukeCommonStatusBar native
|
||||
{}
|
||||
|
||||
class ExhumedStatusBar : BaseStatusBar native
|
||||
{}
|
||||
|
||||
class SWStatusBar : BaseStatusBar native
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue