mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- major cleanup and consolidation of the screen/hud resizing code.
This is now being handled by the backend, except for the processing of the key bindings which cannot be done yet.
This commit is contained in:
parent
5cf54033ed
commit
ef78e8602a
36 changed files with 195 additions and 757 deletions
|
@ -530,7 +530,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
|
||||||
M_ClearMenus();
|
M_ClearMenus();
|
||||||
// viewSetMessage("");
|
// viewSetMessage("");
|
||||||
viewSetErrorMessage("");
|
viewSetErrorMessage("");
|
||||||
viewResizeView(gViewSize);
|
|
||||||
netWaitForEveryone(0);
|
netWaitForEveryone(0);
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
paused = 0;
|
paused = 0;
|
||||||
|
@ -676,7 +675,6 @@ void ProcessFrame(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gEndGameMgr.Setup();
|
gEndGameMgr.Setup();
|
||||||
viewResizeView(gViewSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,7 +778,6 @@ static void app_init()
|
||||||
Printf("Initializing network users\n");
|
Printf("Initializing network users\n");
|
||||||
netInitialize(true);
|
netInitialize(true);
|
||||||
videoInit();
|
videoInit();
|
||||||
hud_size.Callback();
|
|
||||||
Printf("Initializing sound system\n");
|
Printf("Initializing sound system\n");
|
||||||
sndInit();
|
sndInit();
|
||||||
registerosdcommands();
|
registerosdcommands();
|
||||||
|
@ -1309,9 +1306,14 @@ void GameInterface::FreeGameData()
|
||||||
netDeinitialize();
|
netDeinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::UpdateScreenSize()
|
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||||
{
|
{
|
||||||
viewResizeView(gViewSize);
|
int top = 0;
|
||||||
|
if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3)
|
||||||
|
{
|
||||||
|
top = (tilesiz[2229].y * ((gNetPlayers + 3) / 4));
|
||||||
|
}
|
||||||
|
return { top, 25 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,8 @@ struct GameInterface : ::GameInterface
|
||||||
{
|
{
|
||||||
const char* Name() override { return "Blood"; }
|
const char* Name() override { return "Blood"; }
|
||||||
int app_main() override;
|
int app_main() override;
|
||||||
void UpdateScreenSize() override;
|
|
||||||
bool GenerateSavePic() override;
|
bool GenerateSavePic() override;
|
||||||
void FreeGameData() override;
|
void FreeGameData() override;
|
||||||
void set_hud_layout(int size) override;
|
|
||||||
FString statFPS() override;
|
FString statFPS() override;
|
||||||
FSavegameInfo GetSaveSig() override;
|
FSavegameInfo GetSaveSig() override;
|
||||||
void MenuOpened() override;
|
void MenuOpened() override;
|
||||||
|
@ -126,6 +124,7 @@ struct GameInterface : ::GameInterface
|
||||||
void QuitToTitle() override;
|
void QuitToTitle() override;
|
||||||
FString GetCoordString() override;
|
FString GetCoordString() override;
|
||||||
void clearlocalinputstate() override;
|
void clearlocalinputstate() override;
|
||||||
|
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||||
|
|
||||||
GameStats getStats() override;
|
GameStats getStats() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,13 +63,6 @@ int32_t GetTime(void)
|
||||||
return (int32_t)totalclock;
|
return (int32_t)totalclock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::set_hud_layout(int layout)
|
|
||||||
{
|
|
||||||
layout = clamp(7 - layout, 0, 7); // need to reverse the order because menu sliders always have low values to the left.
|
|
||||||
viewResizeView(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fix16_t gViewLook, gViewAngle;
|
fix16_t gViewLook, gViewAngle;
|
||||||
float gViewAngleAdjust;
|
float gViewAngleAdjust;
|
||||||
float gViewLookAdjust;
|
float gViewLookAdjust;
|
||||||
|
@ -125,8 +118,9 @@ void LocalKeys(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gPlayerMsg.Set(*CombatMacros[fk]);
|
// todo: Open chat editor with the specified text
|
||||||
gPlayerMsg.Send();
|
//gPlayerMsg.Set(*CombatMacros[fk]);
|
||||||
|
//gPlayerMsg.Send();
|
||||||
}
|
}
|
||||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "v_2ddrawer.h"
|
#include "v_2ddrawer.h"
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
|
@ -191,10 +192,9 @@ void CViewMap::sub_25C74(void)
|
||||||
if (!bActive)
|
if (!bActive)
|
||||||
return;
|
return;
|
||||||
char tm = 0;
|
char tm = 0;
|
||||||
int viewSize = gViewSize;
|
if (windowxy1.x > 0)
|
||||||
if (gViewSize > 3)
|
|
||||||
{
|
{
|
||||||
viewResizeView(3);
|
setViewport(Hud_Stbar);
|
||||||
tm = 1;
|
tm = 1;
|
||||||
}
|
}
|
||||||
// only clear the actual window.
|
// only clear the actual window.
|
||||||
|
@ -207,12 +207,17 @@ void CViewMap::sub_25C74(void)
|
||||||
sprintf(pBuffer, "%s: %s", pFilename, pTitle);
|
sprintf(pBuffer, "%s: %s", pFilename, pTitle);
|
||||||
else
|
else
|
||||||
sprintf(pBuffer, "%s", pFilename);
|
sprintf(pBuffer, "%s", pFilename);
|
||||||
|
#if 0
|
||||||
int nViewY;
|
int nViewY;
|
||||||
if (gViewSize > 3)
|
if (g ViewSize > 3)
|
||||||
nViewY = gViewY1S-16;
|
nViewY = gViewY1S-16;
|
||||||
else
|
else
|
||||||
nViewY = gViewY0S+1;
|
nViewY = gViewY0S+1;
|
||||||
viewDrawText(3, pBuffer, gViewX1S /2, nViewY, -128, 0, 2, 0, 256);
|
viewDrawText(3, pBuffer, gViewX1S /2, nViewY, -128, 0, 2, 0, 256);
|
||||||
|
#else
|
||||||
|
// This needs fixing across games, so for the time being just print the text into the upper left corner
|
||||||
|
viewDrawText(3, pBuffer, 3, 3, -128, 0, 0, 0, 256);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0 // needs to be generalized
|
#if 0 // needs to be generalized
|
||||||
if (gViewMap.bFollowMode)
|
if (gViewMap.bFollowMode)
|
||||||
|
@ -221,7 +226,7 @@ void CViewMap::sub_25C74(void)
|
||||||
Printf(PRINT_NOTIFY, "MAP SCROLL MODE\n");
|
Printf(PRINT_NOTIFY, "MAP SCROLL MODE\n");
|
||||||
#endif
|
#endif
|
||||||
if (tm)
|
if (tm)
|
||||||
viewResizeView(viewSize);
|
setViewport(hud_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CViewMap::sub_25DB0(spritetype *pSprite)
|
void CViewMap::sub_25DB0(spritetype *pSprite)
|
||||||
|
|
|
@ -41,8 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
CPlayerMsg gPlayerMsg;
|
|
||||||
|
|
||||||
void sub_5A928(void)
|
void sub_5A928(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buttonMap.NumButtons(); i++)
|
for (int i = 0; i < buttonMap.NumButtons(); i++)
|
||||||
|
@ -277,89 +275,6 @@ void LevelWarp(int nEpisode, int nLevel)
|
||||||
levelSetupOptions(nEpisode, nLevel);
|
levelSetupOptions(nEpisode, nLevel);
|
||||||
StartLevel(&gGameOptions);
|
StartLevel(&gGameOptions);
|
||||||
levelTryPlayMusicOrNothing(nEpisode, nLevel);
|
levelTryPlayMusicOrNothing(nEpisode, nLevel);
|
||||||
viewResizeView(gViewSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::Clear(void)
|
|
||||||
{
|
|
||||||
text[0] = 0;
|
|
||||||
at0 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::Term(void)
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::Draw(void)
|
|
||||||
{
|
|
||||||
char buffer[44];
|
|
||||||
strcpy(buffer, text);
|
|
||||||
if ((int)totalclock & 16)
|
|
||||||
strcat(buffer, "_");
|
|
||||||
int x = gViewMode == 3 ? gViewX0S : 0;
|
|
||||||
int y = gViewMode == 3 ? gViewY0S : 0;
|
|
||||||
if (gViewSize >= 1)
|
|
||||||
y += tilesiz[2229].y*((gNetPlayers+3)/4);
|
|
||||||
viewDrawText(0, buffer, x+1,y+1, -128, 0, 0, false, 256);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CPlayerMsg::AddChar(char ch)
|
|
||||||
{
|
|
||||||
if (at0 < 40)
|
|
||||||
{
|
|
||||||
text[at0++] = ch;
|
|
||||||
text[at0] = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::DelChar(void)
|
|
||||||
{
|
|
||||||
if (at0 > 0)
|
|
||||||
text[--at0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::Set(const char * pzString)
|
|
||||||
{
|
|
||||||
strncpy(text, pzString, 40);
|
|
||||||
at0 = ClipHigh(strlen(pzString), 40);
|
|
||||||
text[at0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::Send(void)
|
|
||||||
{
|
|
||||||
if (VanillaMode() || !IsWhitespaceOnly(text))
|
|
||||||
{
|
|
||||||
//netBroadcastMessage(myconnectindex, text);
|
|
||||||
if (!VanillaMode())
|
|
||||||
{
|
|
||||||
char *myName = gProfile[myconnectindex].name;
|
|
||||||
char szTemp[128];
|
|
||||||
sprintf(szTemp, "%s: %s", myName, text);
|
|
||||||
viewSetMessage(szTemp, 10); // 10: dark blue
|
|
||||||
}
|
|
||||||
else
|
|
||||||
viewSetMessage(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
Term();
|
|
||||||
inputState.keyFlushScans();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerMsg::ProcessKeys(void)
|
|
||||||
{
|
|
||||||
if (inputState.GetKeyStatus(sc_Escape)) Term();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CPlayerMsg::IsWhitespaceOnly(const char * const pzString)
|
|
||||||
{
|
|
||||||
const char *p = pzString;
|
|
||||||
while (*p != 0)
|
|
||||||
if (*p++ > 32)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bPlayerCheated = false;
|
bool bPlayerCheated = false;
|
||||||
|
|
|
@ -39,24 +39,6 @@ enum MESSAGE_PRIORITY {
|
||||||
MESSAGE_PRIORITY_SYSTEM = 100
|
MESSAGE_PRIORITY_SYSTEM = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPlayerMsg
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int at0;
|
|
||||||
char text[41];
|
|
||||||
CPlayerMsg() { at0 = 0; text[0] = 0; }
|
|
||||||
void Clear(void);
|
|
||||||
void Term(void);
|
|
||||||
void Draw(void);
|
|
||||||
bool AddChar(char);
|
|
||||||
void DelChar(void);
|
|
||||||
void Set(const char *pzString);
|
|
||||||
void Send(void);
|
|
||||||
void ProcessKeys(void);
|
|
||||||
private:
|
|
||||||
bool IsWhitespaceOnly(const char* const pzString);
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CHEATCODE
|
enum CHEATCODE
|
||||||
{
|
{
|
||||||
kCheatNone = 0,
|
kCheatNone = 0,
|
||||||
|
@ -103,8 +85,6 @@ enum CHEATCODE
|
||||||
extern bool bPlayerCheated;
|
extern bool bPlayerCheated;
|
||||||
void cheatReset(void);
|
void cheatReset(void);
|
||||||
|
|
||||||
extern CPlayerMsg gPlayerMsg;
|
|
||||||
|
|
||||||
void SetAmmo(bool stat);
|
void SetAmmo(bool stat);
|
||||||
void SetWeapons(bool stat);
|
void SetWeapons(bool stat);
|
||||||
void SetToys(bool stat);
|
void SetToys(bool stat);
|
||||||
|
|
|
@ -81,7 +81,6 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
||||||
}
|
}
|
||||||
levelSetupOptions(gGameOptions.nEpisode, gGameOptions.nLevel);
|
levelSetupOptions(gGameOptions.nEpisode, gGameOptions.nLevel);
|
||||||
StartLevel(&gGameOptions);
|
StartLevel(&gGameOptions);
|
||||||
viewResizeView(gViewSize);
|
|
||||||
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,7 @@ private:
|
||||||
|
|
||||||
void viewDrawCtfHud(ClockTicks arg)
|
void viewDrawCtfHud(ClockTicks arg)
|
||||||
{
|
{
|
||||||
if (0 == gViewSize)
|
if (hud_size == Hud_Nothing)
|
||||||
{
|
{
|
||||||
flashTeamScore(arg, 0, false);
|
flashTeamScore(arg, 0, false);
|
||||||
flashTeamScore(arg, 1, false);
|
flashTeamScore(arg, 1, false);
|
||||||
|
@ -748,13 +748,11 @@ private:
|
||||||
nPalette = 10;
|
nPalette = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gViewSize < 0) return;
|
if (hud_size == Hud_full)
|
||||||
|
|
||||||
if (gViewSize == 1)
|
|
||||||
{
|
{
|
||||||
DrawHUD2();
|
DrawHUD2();
|
||||||
}
|
}
|
||||||
else if (gViewSize <= 2)
|
else if (hud_size > Hud_Stbar)
|
||||||
{
|
{
|
||||||
BeginStatusBar(320, 200, 28);
|
BeginStatusBar(320, 200, 28);
|
||||||
if (pPlayer->throwPower)
|
if (pPlayer->throwPower)
|
||||||
|
@ -762,11 +760,11 @@ private:
|
||||||
else
|
else
|
||||||
drawInventory(pPlayer, 166, 200 - tilesiz[2201].y / 2);
|
drawInventory(pPlayer, 166, 200 - tilesiz[2201].y / 2);
|
||||||
}
|
}
|
||||||
if (gViewSize == 2)
|
if (hud_size == Hud_Mini)
|
||||||
{
|
{
|
||||||
DrawHUD1(nPalette);
|
DrawHUD1(nPalette);
|
||||||
}
|
}
|
||||||
else if (gViewSize > 2)
|
else if (hud_size <= Hud_StbarOverlay)
|
||||||
{
|
{
|
||||||
DrawStatusBar(nPalette);
|
DrawStatusBar(nPalette);
|
||||||
}
|
}
|
||||||
|
@ -802,22 +800,22 @@ static void UpdateFrame(void)
|
||||||
{
|
{
|
||||||
auto tex = tileGetTexture(kBackTile);
|
auto tex = tileGetTexture(kBackTile);
|
||||||
|
|
||||||
twod->AddFlatFill(0, 0, xdim, gViewY0 - 3, tex);
|
twod->AddFlatFill(0, 0, xdim, windowxy1.y - 3, tex);
|
||||||
twod->AddFlatFill(0, gViewY1 + 4, xdim, ydim, tex);
|
twod->AddFlatFill(0, windowxy2.y + 4, xdim, ydim, tex);
|
||||||
twod->AddFlatFill(0, gViewY0 - 3, gViewX0 - 3, gViewY1 + 4, tex);
|
twod->AddFlatFill(0, windowxy1.y - 3, windowxy1.x - 3, windowxy2.y + 4, tex);
|
||||||
twod->AddFlatFill(gViewX1 + 4, gViewY0 - 3, xdim, gViewY1 + 4, tex);
|
twod->AddFlatFill(windowxy2.x + 4, windowxy1.y - 3, xdim, windowxy2.y + 4, tex);
|
||||||
|
|
||||||
twod->AddFlatFill(gViewX0 - 3, gViewY0 - 3, gViewX0, gViewY1 + 1, tex, 0, 1, 0xff545454);
|
twod->AddFlatFill(windowxy1.x - 3, windowxy1.y - 3, windowxy1.x, windowxy2.y + 1, tex, 0, 1, 0xff545454);
|
||||||
twod->AddFlatFill(gViewX0, gViewY0 - 3, gViewX1 + 4, gViewY0, tex, 0, 1, 0xff545454);
|
twod->AddFlatFill(windowxy1.x, windowxy1.y - 3, windowxy2.x + 4, windowxy1.y, tex, 0, 1, 0xff545454);
|
||||||
twod->AddFlatFill(gViewX1 + 1, gViewY0, gViewX1 + 4, gViewY1 + 4, tex, 0, 1, 0xff2a2a2a);
|
twod->AddFlatFill(windowxy2.x + 1, windowxy1.y, windowxy2.x + 4, windowxy2.y + 4, tex, 0, 1, 0xff2a2a2a);
|
||||||
twod->AddFlatFill(gViewX0 - 3, gViewY1 + 1, gViewX1 + 1, gViewY1 + 4, tex, 0, 1, 0xff2a2a2a);
|
twod->AddFlatFill(windowxy1.x - 3, windowxy2.y + 1, windowxy2.x + 1, windowxy2.y + 4, tex, 0, 1, 0xff2a2a2a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateStatusBar(ClockTicks arg)
|
void UpdateStatusBar(ClockTicks arg)
|
||||||
{
|
{
|
||||||
DBloodStatusBar sbar;
|
DBloodStatusBar sbar;
|
||||||
|
|
||||||
if (gViewMode == 3 && gViewSize > 2)
|
if (gViewMode == 3 && hud_size <= Hud_Stbar)
|
||||||
{
|
{
|
||||||
UpdateFrame();
|
UpdateFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ struct INTERPOLATE {
|
||||||
};
|
};
|
||||||
|
|
||||||
int gViewMode = 3;
|
int gViewMode = 3;
|
||||||
int gViewSize = 2;
|
|
||||||
|
|
||||||
double gInterpolate;
|
double gInterpolate;
|
||||||
int nInterpolations;
|
int nInterpolations;
|
||||||
|
@ -74,11 +73,6 @@ char gInterpolateSector[(kMaxSectors+7)>>3];
|
||||||
|
|
||||||
INTERPOLATE gInterpolation[kMaxInterpolations];
|
INTERPOLATE gInterpolation[kMaxInterpolations];
|
||||||
|
|
||||||
int gViewXCenter, gViewYCenter;
|
|
||||||
int gViewX0, gViewY0, gViewX1, gViewY1;
|
|
||||||
int gViewX0S, gViewY0S, gViewX1S, gViewY1S;
|
|
||||||
int xscale, yscale, xstep, ystep;
|
|
||||||
|
|
||||||
int gScreenTilt;
|
int gScreenTilt;
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +110,6 @@ void viewToggle(int viewMode)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gViewMode = 3;
|
gViewMode = 3;
|
||||||
viewResizeView(gViewSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,60 +358,6 @@ void viewInit(void)
|
||||||
gViewMap.sub_25C38(0, 0, gZoom, 0, gFollowMap);
|
gViewMap.sub_25C38(0, 0, gZoom, 0, gFollowMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewResizeView(int size)
|
|
||||||
{
|
|
||||||
int xdimcorrect = ClipHigh(scale(ydim, 4, 3), xdim);
|
|
||||||
gViewXCenter = xdim-xdim/2;
|
|
||||||
gViewYCenter = ydim-ydim/2;
|
|
||||||
xscale = divscale16(xdim, 320);
|
|
||||||
int xscalecorrect = divscale16(xdimcorrect, 320);
|
|
||||||
yscale = divscale16(ydim, 200);
|
|
||||||
xstep = divscale16(320, xdim);
|
|
||||||
ystep = divscale16(200, ydim);
|
|
||||||
gViewSize = ClipRange(size, 0, 7);
|
|
||||||
if (gViewSize <= 2)
|
|
||||||
{
|
|
||||||
gViewX0 = 0;
|
|
||||||
gViewX1 = xdim-1;
|
|
||||||
gViewY0 = 0;
|
|
||||||
gViewY1 = ydim-1;
|
|
||||||
if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3)
|
|
||||||
{
|
|
||||||
gViewY0 = (tilesiz[2229].y*ydim*((gNetPlayers+3)/4))/200;
|
|
||||||
}
|
|
||||||
gViewX0S = divscale16(gViewX0, xscalecorrect);
|
|
||||||
gViewY0S = divscale16(gViewY0, yscale);
|
|
||||||
gViewX1S = divscale16(gViewX1, xscalecorrect);
|
|
||||||
gViewY1S = divscale16(gViewY1, yscale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gViewX0 = 0;
|
|
||||||
gViewY0 = 0;
|
|
||||||
gViewX1 = xdim-1;
|
|
||||||
int gy1 = (25 * ydim) / 200;
|
|
||||||
if (gViewSize == 3) // full status bar must scale the bottom to the actual display height.
|
|
||||||
gy1 = Scale(gy1, hud_scale, 100);
|
|
||||||
gViewY1 = ydim-1- gy1;
|
|
||||||
if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3)
|
|
||||||
{
|
|
||||||
gViewY0 = (tilesiz[2229].y*ydim*((gNetPlayers+3)/4))/200;
|
|
||||||
}
|
|
||||||
|
|
||||||
int height = gViewY1-gViewY0;
|
|
||||||
gViewX0 += mulscale16(xdim*(gViewSize-3),4096);
|
|
||||||
gViewX1 -= mulscale16(xdim*(gViewSize-3),4096);
|
|
||||||
gViewY0 += mulscale16(height*(gViewSize-3),4096);
|
|
||||||
gViewY1 -= mulscale16(height*(gViewSize-3),4096);
|
|
||||||
gViewX0S = divscale16(gViewX0, xscalecorrect);
|
|
||||||
gViewY0S = divscale16(gViewY0, yscale);
|
|
||||||
gViewX1S = divscale16(gViewX1, xscalecorrect);
|
|
||||||
gViewY1S = divscale16(gViewY1, yscale);
|
|
||||||
}
|
|
||||||
videoSetViewableArea(gViewX0, gViewY0, gViewX1, gViewY1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void viewDrawInterface(ClockTicks arg)
|
void viewDrawInterface(ClockTicks arg)
|
||||||
{
|
{
|
||||||
UpdateStatusBar(arg);
|
UpdateStatusBar(arg);
|
||||||
|
|
|
@ -140,10 +140,7 @@ extern char gInterpolateSprite[];
|
||||||
extern char gInterpolateWall[];
|
extern char gInterpolateWall[];
|
||||||
extern char gInterpolateSector[];
|
extern char gInterpolateSector[];
|
||||||
extern LOCATION gPrevSpriteLoc[kMaxSprites];
|
extern LOCATION gPrevSpriteLoc[kMaxSprites];
|
||||||
extern int gViewSize, gViewMode;
|
extern int gViewMode;
|
||||||
extern int gViewXCenter, gViewYCenter;
|
|
||||||
extern int gViewX0, gViewY0, gViewX1, gViewY1;
|
|
||||||
extern int gViewX0S, gViewY0S, gViewX1S, gViewY1S;
|
|
||||||
extern int gLastPal;
|
extern int gLastPal;
|
||||||
extern double gInterpolate;
|
extern double gInterpolate;
|
||||||
|
|
||||||
|
@ -162,7 +159,6 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
|
||||||
void InitStatusBar(void);
|
void InitStatusBar(void);
|
||||||
void UpdateStatusBar(ClockTicks arg);
|
void UpdateStatusBar(ClockTicks arg);
|
||||||
void viewInit(void);
|
void viewInit(void);
|
||||||
void viewResizeView(int size);
|
|
||||||
void viewDrawInterface(ClockTicks arg);
|
void viewDrawInterface(ClockTicks arg);
|
||||||
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
|
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
|
||||||
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);
|
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, int zm);
|
||||||
|
|
|
@ -67,6 +67,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "mapinfo.h"
|
#include "mapinfo.h"
|
||||||
#include "menustate.h"
|
#include "menustate.h"
|
||||||
#include "screenjob.h"
|
#include "screenjob.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
@ -770,21 +771,12 @@ int RunGame()
|
||||||
if (g_gameType & GAMEFLAG_BLOOD)
|
if (g_gameType & GAMEFLAG_BLOOD)
|
||||||
{
|
{
|
||||||
mus_redbook.SetGenericRepDefault(false, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on.
|
mus_redbook.SetGenericRepDefault(false, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on.
|
||||||
hud_size.SetGenericRepDefault(6, CVAR_Int);
|
|
||||||
hud_size_max = 7;
|
|
||||||
}
|
}
|
||||||
if (g_gameType & GAMEFLAG_SW)
|
if (g_gameType & GAMEFLAG_SW)
|
||||||
{
|
{
|
||||||
hud_size.SetGenericRepDefault(8, CVAR_Int);
|
|
||||||
hud_size_max = 9;
|
|
||||||
cl_weaponswitch.SetGenericRepDefault(1, CVAR_Int);
|
cl_weaponswitch.SetGenericRepDefault(1, CVAR_Int);
|
||||||
if (cl_weaponswitch > 1) cl_weaponswitch = 1;
|
if (cl_weaponswitch > 1) cl_weaponswitch = 1;
|
||||||
}
|
}
|
||||||
if (g_gameType & GAMEFLAG_PSEXHUMED)
|
|
||||||
{
|
|
||||||
hud_size.SetGenericRepDefault(7, CVAR_Int);
|
|
||||||
hud_size_max = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_ReadConfig(currentGame);
|
G_ReadConfig(currentGame);
|
||||||
|
|
||||||
|
@ -872,6 +864,7 @@ void videoInit()
|
||||||
GLInterface.Init(screen->GetWidth());
|
GLInterface.Init(screen->GetWidth());
|
||||||
GLInterface.InitGLState(4, 4/*glmultisample*/);
|
GLInterface.InitGLState(4, 4/*glmultisample*/);
|
||||||
screen->SetTextureFilterMode();
|
screen->SetTextureFilterMode();
|
||||||
|
setViewport(hud_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_FatalEngineError(void)
|
void G_FatalEngineError(void)
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "quotemgr.h"
|
#include "quotemgr.h"
|
||||||
#include "gamestruct.h"
|
#include "gamestruct.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
#define CVAR_FRONTEND_BLOOD 0
|
#define CVAR_FRONTEND_BLOOD 0
|
||||||
#define CVAR_FRONTEND_DUKELIKE 0
|
#define CVAR_FRONTEND_DUKELIKE 0
|
||||||
|
@ -162,16 +163,11 @@ CUSTOM_CVARD(Int, snd_speech, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disabl
|
||||||
|
|
||||||
// HUD
|
// HUD
|
||||||
|
|
||||||
int hud_size_max = 11; // The maximum is different for each game
|
CUSTOM_CVARD(Int, hud_size, Hud_Stbar, CVAR_ARCHIVE | CVAR_NOINITCALL, "Defines the HUD size and style")
|
||||||
|
|
||||||
CUSTOM_CVARD(Int, hud_size, 9, CVAR_ARCHIVE | CVAR_NOINITCALL, "Defines the HUD size and style")
|
|
||||||
{
|
{
|
||||||
if (self < 0) self = 0;
|
if (self < 0) self = 0;
|
||||||
else if (self > hud_size_max) self = hud_size_max;
|
else if (self > Hud_Nothing) self = Hud_Nothing;
|
||||||
else
|
else setViewport(self);
|
||||||
{
|
|
||||||
gi->set_hud_layout(self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is for game code to change the size, so that the range checks remain isolated here.
|
// This is for game code to change the size, so that the range checks remain isolated here.
|
||||||
|
@ -182,7 +178,7 @@ bool G_ChangeHudLayout(int direction)
|
||||||
hud_size = hud_size - 1;
|
hud_size = hud_size - 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (direction > 0 && hud_size < hud_size_max)
|
else if (direction > 0 && hud_size < Hud_Nothing)
|
||||||
{
|
{
|
||||||
hud_size = hud_size + 1;
|
hud_size = hud_size + 1;
|
||||||
return true;
|
return true;
|
||||||
|
@ -204,7 +200,7 @@ CUSTOM_CVARD(Int, hud_scale, 100, CVAR_ARCHIVE | CVAR_NOINITCALL, "changes the h
|
||||||
{
|
{
|
||||||
if (self < 36) self = 36;
|
if (self < 36) self = 36;
|
||||||
else if (self > 100) self = 100;
|
else if (self > 100) self = 100;
|
||||||
else gi->UpdateScreenSize();
|
else setViewport(hud_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMD(scaleup)
|
CCMD(scaleup)
|
||||||
|
|
|
@ -119,3 +119,19 @@ bool G_ChangeHudLayout(int direction);
|
||||||
bool G_CheckAutorun(bool button);
|
bool G_CheckAutorun(bool button);
|
||||||
inline int G_FPSLimit(void) { return 1; }
|
inline int G_FPSLimit(void) { return 1; }
|
||||||
bool G_AllowAutoload();
|
bool G_AllowAutoload();
|
||||||
|
|
||||||
|
enum EHudSize
|
||||||
|
{
|
||||||
|
Hud_Current = -1,
|
||||||
|
Hud_Frame50 = 0,
|
||||||
|
Hud_Frame60,
|
||||||
|
Hud_Frame70,
|
||||||
|
Hud_Frame80,
|
||||||
|
Hud_Frame90,
|
||||||
|
Hud_Stbar,
|
||||||
|
Hud_StbarOverlay,
|
||||||
|
Hud_Mini,
|
||||||
|
Hud_full,
|
||||||
|
Hud_Nothing,
|
||||||
|
Hud_MAX
|
||||||
|
};
|
||||||
|
|
|
@ -45,6 +45,11 @@ struct FSaveGameNode
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ReservedSpace
|
||||||
|
{
|
||||||
|
int top;
|
||||||
|
int statusbar;
|
||||||
|
};
|
||||||
|
|
||||||
enum EMenuSounds : int;
|
enum EMenuSounds : int;
|
||||||
|
|
||||||
|
@ -57,7 +62,6 @@ struct GameInterface
|
||||||
virtual void clearlocalinputstate() {}
|
virtual void clearlocalinputstate() {}
|
||||||
virtual void UpdateScreenSize() {}
|
virtual void UpdateScreenSize() {}
|
||||||
virtual void FreeGameData() {}
|
virtual void FreeGameData() {}
|
||||||
virtual void set_hud_layout(int size) = 0;
|
|
||||||
virtual bool automapActive() { return false; }
|
virtual bool automapActive() { return false; }
|
||||||
virtual void PlayHudSound() {}
|
virtual void PlayHudSound() {}
|
||||||
virtual FString statFPS() { return "FPS display not available"; }
|
virtual FString statFPS() { return "FPS display not available"; }
|
||||||
|
@ -85,6 +89,7 @@ struct GameInterface
|
||||||
virtual FString GetCoordString() { return "'stat coord' not implemented"; }
|
virtual FString GetCoordString() { return "'stat coord' not implemented"; }
|
||||||
virtual bool CheatAllowed(bool printmsg) { return true; }
|
virtual bool CheatAllowed(bool printmsg) { return true; }
|
||||||
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
||||||
|
virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -161,7 +162,7 @@ int32_t handleevents(void)
|
||||||
if (setsizeneeded)
|
if (setsizeneeded)
|
||||||
{
|
{
|
||||||
videoSetGameMode(vid_fullscreen, SCREENWIDTH, SCREENHEIGHT, 32, 1);
|
videoSetGameMode(vid_fullscreen, SCREENWIDTH, SCREENHEIGHT, 32, 1);
|
||||||
if (gi) gi->UpdateScreenSize();
|
setViewport(hud_size);
|
||||||
setsizeneeded = false;
|
setsizeneeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "build.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
@ -55,6 +56,8 @@
|
||||||
#include "v_font.h"
|
#include "v_font.h"
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
|
#include "m_fixed.h"
|
||||||
|
#include "gamestruct.h"
|
||||||
|
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
|
|
||||||
|
@ -662,7 +665,11 @@ static DObject *InitObject(PClass *type, int paramnum, VM_ARGS)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
enum ENumFlags
|
enum ENumFlags
|
||||||
{
|
{
|
||||||
|
@ -689,6 +696,12 @@ void FormatNumber(int number, int minsize, int maxsize, int flags, const FString
|
||||||
else fmt.Format("%s%*d", prefix.GetChars(), minsize, number);
|
else fmt.Format("%s%*d", prefix.GetChars(), minsize, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||||
{
|
{
|
||||||
double y;
|
double y;
|
||||||
|
@ -730,4 +743,49 @@ void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
||||||
|
|
||||||
text.Format(TEXTCOLOR_ESCAPESTR "%cT: " TEXTCOLOR_ESCAPESTR "%c%d:%02d", stats.letterColor+'A', stats.standardColor + 'A', stats.time / 60000, (stats.time % 60000) / 1000);
|
text.Format(TEXTCOLOR_ESCAPESTR "%cT: " TEXTCOLOR_ESCAPESTR "%c%d:%02d", stats.letterColor+'A', stats.standardColor + 'A', stats.time / 60000, (stats.time % 60000) / 1000);
|
||||||
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
DrawText(twod, stats.font, CR_UNTRANSLATED, 2 * hud_statscale, y, text, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
void setViewport(int viewSize)
|
||||||
|
{
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
if (screen == nullptr) return;
|
||||||
|
int xdim = screen->GetWidth();
|
||||||
|
int ydim = screen->GetHeight();
|
||||||
|
if (xdim == 0 || ydim == 0) return;
|
||||||
|
auto reserved = gi->GetReservedScreenSpace(viewSize);
|
||||||
|
reserved.top = (reserved.top * hud_scale * ydim) / 20000;
|
||||||
|
reserved.statusbar = (reserved.statusbar * hud_scale * ydim) / 20000;
|
||||||
|
|
||||||
|
int xdimcorrect = std::min(Scale(ydim, 4, 3), xdim);
|
||||||
|
if (viewSize > Hud_Stbar)
|
||||||
|
{
|
||||||
|
x0 = 0;
|
||||||
|
x1 = xdim - 1;
|
||||||
|
y0 = reserved.top;
|
||||||
|
y1 = ydim - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x0 = 0;
|
||||||
|
y0 = reserved.top;
|
||||||
|
x1 = xdim - 1;
|
||||||
|
y1 = ydim - 1 - reserved.statusbar;
|
||||||
|
|
||||||
|
int height = y1 - y0;
|
||||||
|
int frameheight = (height * (5 - viewSize) / 20);
|
||||||
|
int framewidth = Scale(frameheight, xdim, y1+1);
|
||||||
|
x0 += framewidth;
|
||||||
|
x1 -= framewidth;
|
||||||
|
y0 += frameheight;
|
||||||
|
y1 -= frameheight;
|
||||||
|
}
|
||||||
|
videoSetViewableArea(x0, y0, x1, y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
class player_t;
|
class player_t;
|
||||||
struct FRemapTable;
|
struct FRemapTable;
|
||||||
|
|
||||||
|
#if 0
|
||||||
enum EHudState
|
enum EHudState
|
||||||
{
|
{
|
||||||
HUD_StatusBar,
|
HUD_StatusBar,
|
||||||
|
@ -50,6 +51,7 @@ enum EHudState
|
||||||
|
|
||||||
HUD_AltHud // Used for passing through popups to the alt hud
|
HUD_AltHud // Used for passing through popups to the alt hud
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
enum EMonospacing : int;
|
enum EMonospacing : int;
|
||||||
|
|
||||||
|
@ -339,5 +341,6 @@ enum DI_Flags
|
||||||
};
|
};
|
||||||
|
|
||||||
void SBar_DrawString(DBaseStatusBar* 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 SBar_DrawString(DBaseStatusBar* 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);
|
||||||
|
|
||||||
#endif /* __SBAR_H__ */
|
#endif /* __SBAR_H__ */
|
||||||
|
|
|
@ -968,25 +968,6 @@ static const char *safeStrtok(char *s, const char *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameInterface::set_hud_layout(int layout)
|
|
||||||
{
|
|
||||||
if (layout == 8)
|
|
||||||
{
|
|
||||||
if (!bFullScreen)
|
|
||||||
{
|
|
||||||
bFullScreen = true;
|
|
||||||
screensize = 0;
|
|
||||||
UnMaskStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
screensize = (7 - clamp(layout, 0, 7)) * 2;
|
|
||||||
bFullScreen = false;
|
|
||||||
UpdateScreenSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckKeys()
|
void CheckKeys()
|
||||||
{
|
{
|
||||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||||
|
@ -3248,10 +3229,26 @@ bool GameInterface::CanSave()
|
||||||
return !bRecord && !bPlayback && !paused && !bInDemo && nTotalPlayers == 1;
|
return !bRecord && !bPlayback && !paused && !bInDemo && nTotalPlayers == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void GameInterface::UpdateScreenSize()
|
void GameInterface::UpdateScreenSize()
|
||||||
{
|
{
|
||||||
Powerslave::UpdateScreenSize();
|
if (hud_size == 8)
|
||||||
|
{
|
||||||
|
if (!bFullScreen)
|
||||||
|
{
|
||||||
|
bFullScreen = true;
|
||||||
|
screensize = 0;
|
||||||
|
UnMaskStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screensize = (7 - clamp(*hud_size, 0, 7)) * 2;
|
||||||
|
bFullScreen = false;
|
||||||
|
Powerslave::UpdateScreenSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
::GameInterface* CreateInterface()
|
::GameInterface* CreateInterface()
|
||||||
|
|
|
@ -336,9 +336,7 @@ struct GameInterface : ::GameInterface
|
||||||
{
|
{
|
||||||
const char* Name() override { return "Exhumed"; }
|
const char* Name() override { return "Exhumed"; }
|
||||||
int app_main() override;
|
int app_main() override;
|
||||||
void UpdateScreenSize() override;
|
|
||||||
bool GenerateSavePic() override;
|
bool GenerateSavePic() override;
|
||||||
void set_hud_layout(int size) override;
|
|
||||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
||||||
void MenuOpened() override;
|
void MenuOpened() override;
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
|
|
|
@ -31,14 +31,12 @@ BEGIN_DUKE_NS
|
||||||
extern FFont* IndexFont;
|
extern FFont* IndexFont;
|
||||||
extern FFont* DigiFont;
|
extern FFont* DigiFont;
|
||||||
|
|
||||||
struct GameInterface : ::GameInterface
|
struct GameInterface : public ::GameInterface
|
||||||
{
|
{
|
||||||
const char* Name() override { return "Duke"; }
|
const char* Name() override { return "Duke"; }
|
||||||
int app_main() override;
|
int app_main() override;
|
||||||
void clearlocalinputstate() override;
|
void clearlocalinputstate() override;
|
||||||
void UpdateScreenSize() override;
|
|
||||||
bool GenerateSavePic() override;
|
bool GenerateSavePic() override;
|
||||||
void set_hud_layout(int size) override;
|
|
||||||
void PlayHudSound() override;
|
void PlayHudSound() override;
|
||||||
bool automapActive() override;
|
bool automapActive() override;
|
||||||
FString statFPS() override;
|
FString statFPS() override;
|
||||||
|
@ -58,6 +56,7 @@ struct GameInterface : ::GameInterface
|
||||||
FString GetCoordString() override;
|
FString GetCoordString() override;
|
||||||
bool CheatAllowed(bool printmsg) override;
|
bool CheatAllowed(bool printmsg) override;
|
||||||
void ExitFromMenu() override;
|
void ExitFromMenu() override;
|
||||||
|
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Dispatcher
|
struct Dispatcher
|
||||||
|
|
|
@ -242,7 +242,6 @@ void setinterpolation(int* posptr);
|
||||||
void stopinterpolation(int* posptr);
|
void stopinterpolation(int* posptr);
|
||||||
void dointerpolations(int smoothratio);
|
void dointerpolations(int smoothratio);
|
||||||
int* animateptr(int i);
|
int* animateptr(int i);
|
||||||
void updateviewport(void);
|
|
||||||
|
|
||||||
void backuppos(player_struct* p, bool noclipping = false);
|
void backuppos(player_struct* p, bool noclipping = false);
|
||||||
void backuplook(player_struct* p);
|
void backuplook(player_struct* p);
|
||||||
|
|
|
@ -429,7 +429,6 @@ int GameInterface::app_main()
|
||||||
Startup();
|
Startup();
|
||||||
enginePostInit();
|
enginePostInit();
|
||||||
videoInit();
|
videoInit();
|
||||||
updateviewport();
|
|
||||||
app_loop();
|
app_loop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,7 +655,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
|
||||||
if (/*textret == 0 &&*/ ud.overhead_on == 2)
|
if (/*textret == 0 &&*/ ud.overhead_on == 2)
|
||||||
{
|
{
|
||||||
double scale = isRR() ? 0.5 : 1.;
|
double scale = isRR() ? 0.5 : 1.;
|
||||||
int top = isRR() ? 0 : (hud_size < 11 ? 147 : 179);
|
int top = isRR() ? 0 : (hud_size != Hud_Nothing ? 147 : 179);
|
||||||
if (!(currentLevel->flags & MI_USERMAP))
|
if (!(currentLevel->flags & MI_USERMAP))
|
||||||
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top+6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
|
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top+6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
|
||||||
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||||
|
@ -733,6 +733,16 @@ int startrts(int lumpNum, int localPlayer)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||||
|
{
|
||||||
|
// todo: factor in the frag bar: tilesiz[TILE_FRAGBAR].y
|
||||||
|
int sbar = tilesiz[TILE_BOTTOMSTATUSBAR].y;
|
||||||
|
if (isRR())
|
||||||
|
{
|
||||||
|
sbar >>= 1;
|
||||||
|
}
|
||||||
|
return { 0, sbar };
|
||||||
|
}
|
||||||
|
|
||||||
bool GameInterface::automapActive()
|
bool GameInterface::automapActive()
|
||||||
{
|
{
|
||||||
|
|
|
@ -268,81 +268,16 @@ void DrawBorder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// calculate size of 3D viewport.
|
|
||||||
// Fixme: this needs to be adjusted to the new status bar code,
|
|
||||||
// once the status bar is a persistent queriable object
|
|
||||||
// (it should also be moved out of the game code then.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void updateviewport(void)
|
|
||||||
{
|
|
||||||
static const uint8_t size_vals[] = { 60, 54, 48, 40, 32, 24, 16, 8, 8, 4, 4, 0 };
|
|
||||||
static const uint8_t size_vals_rr[] = { 56, 48, 40, 32, 24, 16, 12, 8, 8, 4, 4, 0 };
|
|
||||||
int ss = isRR() ? size_vals_rr[hud_size] : size_vals[hud_size];
|
|
||||||
|
|
||||||
ss = std::max(ss - 8, 0);
|
|
||||||
|
|
||||||
int x1 = scale(ss, xdim, 160);
|
|
||||||
int x2 = xdim - x1;
|
|
||||||
|
|
||||||
int y1 = scale(ss, (200 * 100) - ((tilesiz[TILE_BOTTOMSTATUSBAR].y >> (isRR() ? 1 : 0)) * hud_scale), 200 - tilesiz[TILE_BOTTOMSTATUSBAR].y);
|
|
||||||
int y2 = 200 * 100 - y1;
|
|
||||||
|
|
||||||
if (isRR() && hud_size > 6)
|
|
||||||
{
|
|
||||||
x1 = 0;
|
|
||||||
x2 = xdim;
|
|
||||||
y1 = 0;
|
|
||||||
if (hud_size >= 8)
|
|
||||||
y2 = 200 * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fbh = 0;
|
|
||||||
if (hud_size < 11 && ud.coop != 1 && ud.multimode > 1)
|
|
||||||
{
|
|
||||||
int j = 0;
|
|
||||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
|
||||||
if (i > j) j = i;
|
|
||||||
|
|
||||||
if (j >= 1) fbh += 8;
|
|
||||||
if (j >= 4) fbh += 8;
|
|
||||||
if (j >= 8) fbh += 8;
|
|
||||||
if (j >= 12) fbh += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
y1 += fbh * 100;
|
|
||||||
if (hud_size <= 7)
|
|
||||||
y2 -= (tilesiz[TILE_BOTTOMSTATUSBAR].y >> (isRR() ? 1 : 0)) * hud_scale;
|
|
||||||
y1 = scale(y1, ydim, 200 * 100);
|
|
||||||
y2 = scale(y2, ydim, 200 * 100);
|
|
||||||
|
|
||||||
videoSetViewableArea(x1, y1, x2 - 1, y2 - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// view sizing game interface
|
// view sizing game interface
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void GameInterface::set_hud_layout(int layout)
|
|
||||||
{
|
|
||||||
if (xdim > 0 && ydim > 0) updateviewport();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameInterface::PlayHudSound()
|
void GameInterface::PlayHudSound()
|
||||||
{
|
{
|
||||||
S_PlaySound(isRR() ? 341 : THUD, CHAN_AUTO, CHANF_UI);
|
S_PlaySound(isRR() ? 341 : THUD, CHAN_AUTO, CHANF_UI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::UpdateScreenSize()
|
|
||||||
{
|
|
||||||
updateviewport();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -432,9 +432,9 @@ void PrintLevelName_d(double alpha);
|
||||||
void drawstatusbar_d(int snum)
|
void drawstatusbar_d(int snum)
|
||||||
{
|
{
|
||||||
DDukeStatusBar dsb;
|
DDukeStatusBar dsb;
|
||||||
if (hud_size >= 9)
|
if (hud_size >= Hud_Mini)
|
||||||
{
|
{
|
||||||
dsb.DrawHud(snum, hud_size == 11 ? 0 : hud_size == 10 ? 1 : 2);
|
dsb.DrawHud(snum, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -321,7 +321,7 @@ public:
|
||||||
BeginStatusBar(320, 200, h);
|
BeginStatusBar(320, 200, h);
|
||||||
DrawInventory(p, 160, 154, 0);
|
DrawInventory(p, 160, 154, 0);
|
||||||
|
|
||||||
if (hud_size < 7)
|
if (hud_size < Hud_Stbar)
|
||||||
DrawWeaponBar(p, top);
|
DrawWeaponBar(p, top);
|
||||||
|
|
||||||
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale);
|
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale);
|
||||||
|
@ -422,9 +422,9 @@ void PrintLevelName_r(double alpha);
|
||||||
void drawstatusbar_r(int snum)
|
void drawstatusbar_r(int snum)
|
||||||
{
|
{
|
||||||
DRedneckStatusBar dsb;
|
DRedneckStatusBar dsb;
|
||||||
if (hud_size >= 9)
|
if (hud_size >= Hud_Mini)
|
||||||
{
|
{
|
||||||
dsb.DrawHud(snum, hud_size == 11 ? 0 : hud_size == 10 ? 1 : 2);
|
dsb.DrawHud(snum, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@ set( PCH_SOURCES
|
||||||
src/2d.cpp
|
src/2d.cpp
|
||||||
src/actor.cpp
|
src/actor.cpp
|
||||||
src/ai.cpp
|
src/ai.cpp
|
||||||
src/border.cpp
|
|
||||||
src/break.cpp
|
src/break.cpp
|
||||||
src/bunny.cpp
|
src/bunny.cpp
|
||||||
src/cache.cpp
|
src/cache.cpp
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
||||||
|
|
||||||
This file is part of Shadow Warrior version 1.2
|
|
||||||
|
|
||||||
Shadow Warrior is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
||||||
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
#include "ns.h"
|
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
|
|
||||||
#include "names2.h"
|
|
||||||
#include "panel.h"
|
|
||||||
#include "lists.h"
|
|
||||||
#include "game.h"
|
|
||||||
#include "network.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "menus.h"
|
|
||||||
|
|
||||||
BEGIN_SW_NS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BAR_HEIGHT 48
|
|
||||||
#define XDIM 320
|
|
||||||
#define YDIM 200
|
|
||||||
|
|
||||||
short DebugBorderShade = 0;
|
|
||||||
|
|
||||||
#define f_320 FIXED(320,0)
|
|
||||||
#define f_200 FIXED(200,0)
|
|
||||||
|
|
||||||
#define X_TO_FIXED(val) (x_aspect_mul*(val))
|
|
||||||
#define Y_TO_FIXED(val) (y_aspect_mul*(val))
|
|
||||||
|
|
||||||
BORDER_INFO BorderInfoValues[] =
|
|
||||||
{
|
|
||||||
// x,y,screensize
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, BAR_HEIGHT, 0},
|
|
||||||
|
|
||||||
{0, BAR_HEIGHT, (1 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (2 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (3 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (4 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (5 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (6 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (7 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (8 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (9 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (10 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (11 * 16)},
|
|
||||||
{0, BAR_HEIGHT, (12 * 16)}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize)
|
|
||||||
{
|
|
||||||
int x, x2, y, y2;
|
|
||||||
const BORDER_INFO *b = &BorderInfoValues[gs.BorderNum];
|
|
||||||
int f_xdim, f_ydim, x_pix_size, y_pix_size, x_aspect_mul, y_aspect_mul;
|
|
||||||
|
|
||||||
f_xdim = FIXED(xdim, 0);
|
|
||||||
f_ydim = FIXED(ydim, 0);
|
|
||||||
|
|
||||||
x_pix_size = (f_320 / xdim);
|
|
||||||
y_pix_size = (f_200 / ydim);
|
|
||||||
|
|
||||||
x_aspect_mul = (f_xdim / 320);
|
|
||||||
y_aspect_mul = (f_ydim / 200);
|
|
||||||
|
|
||||||
|
|
||||||
// figure out the viewing window x and y dimensions
|
|
||||||
*Xdim = MSW(f_xdim - X_TO_FIXED(b->Xdim));
|
|
||||||
*Ydim = MSW(f_ydim - Y_TO_FIXED(b->Ydim));
|
|
||||||
*ScreenSize = MSW(f_xdim - X_TO_FIXED(b->ScreenSize));
|
|
||||||
|
|
||||||
// figure out the viewing window x and y coordinates
|
|
||||||
x = DIV2(*Xdim) - DIV2(*ScreenSize);
|
|
||||||
x2 = x + *ScreenSize - 1;
|
|
||||||
y = DIV2(*Ydim) - DIV2((*ScreenSize **Ydim) / *Xdim);
|
|
||||||
y2 = y + ((*ScreenSize **Ydim) / *Xdim) - 1;
|
|
||||||
|
|
||||||
// avoid a one-pixel tall HOM
|
|
||||||
if (gs.BorderNum == BORDER_BAR)
|
|
||||||
++y2;
|
|
||||||
|
|
||||||
// global windowxy1, windowxy2 coords set here
|
|
||||||
videoSetViewableArea(x, y, x2, y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Redraw the whole screen
|
|
||||||
//
|
|
||||||
|
|
||||||
void SetBorder(PLAYERp pp)
|
|
||||||
{
|
|
||||||
int Xdim, Ydim, ScreenSize;
|
|
||||||
|
|
||||||
if (pp != Player + myconnectindex)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (xdim == 0) return; // game not set up yet.
|
|
||||||
|
|
||||||
BorderSetView(pp, &Xdim, &Ydim, &ScreenSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
END_SW_NS
|
|
|
@ -1083,13 +1083,27 @@ ResizeView(PLAYERp pp)
|
||||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) // &&
|
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) // &&
|
||||||
{
|
{
|
||||||
buttonMap.ClearButton(gamefunc_Shrink_Screen);
|
buttonMap.ClearButton(gamefunc_Shrink_Screen);
|
||||||
G_ChangeHudLayout(-1);
|
if (!SHIFTS_IS_PRESSED)
|
||||||
|
{
|
||||||
|
G_ChangeHudLayout(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hud_scale = hud_scale - 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) // &&
|
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) // &&
|
||||||
{
|
{
|
||||||
buttonMap.ClearButton(gamefunc_Enlarge_Screen);
|
buttonMap.ClearButton(gamefunc_Enlarge_Screen);
|
||||||
G_ChangeHudLayout(1);
|
if (!SHIFTS_IS_PRESSED)
|
||||||
|
{
|
||||||
|
G_ChangeHudLayout(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hud_scale = hud_scale + 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1828,11 +1842,6 @@ drawscreen(PLAYERp pp)
|
||||||
|
|
||||||
DrawScreen = TRUE;
|
DrawScreen = TRUE;
|
||||||
PreDraw();
|
PreDraw();
|
||||||
// part of new border refresh method
|
|
||||||
if (!ScreenSavePic)
|
|
||||||
{
|
|
||||||
SetBorder(pp);
|
|
||||||
}
|
|
||||||
|
|
||||||
PreUpdatePanel();
|
PreUpdatePanel();
|
||||||
|
|
||||||
|
|
|
@ -177,8 +177,6 @@ uint8_t AutoColor;
|
||||||
|
|
||||||
const GAME_SET gs_defaults =
|
const GAME_SET gs_defaults =
|
||||||
{
|
{
|
||||||
2, // border
|
|
||||||
0, // border tile
|
|
||||||
// Network game settings
|
// Network game settings
|
||||||
0, // GameType
|
0, // GameType
|
||||||
0, // Level
|
0, // Level
|
||||||
|
@ -394,6 +392,7 @@ bool InitGame()
|
||||||
|
|
||||||
engineInit();
|
engineInit();
|
||||||
|
|
||||||
|
|
||||||
InitAutoNet();
|
InitAutoNet();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1394,8 +1393,6 @@ int32_t GameInterface::app_main()
|
||||||
|
|
||||||
gs = gs_defaults;
|
gs = gs_defaults;
|
||||||
|
|
||||||
hud_size.Callback();
|
|
||||||
|
|
||||||
if (!DetectShareware())
|
if (!DetectShareware())
|
||||||
{
|
{
|
||||||
if (SW_SHAREWARE) Printf("Detected shareware GRP\n");
|
if (SW_SHAREWARE) Printf("Detected shareware GRP\n");
|
||||||
|
@ -2112,7 +2109,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
|
||||||
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
|
renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200));
|
||||||
|
|
||||||
// draw location text
|
// draw location text
|
||||||
if (gs.BorderNum <= BORDER_BAR-1)
|
if (hud_size == Hud_Nothing)
|
||||||
{
|
{
|
||||||
txt_x = 7;
|
txt_x = 7;
|
||||||
txt_y = 168;
|
txt_y = 168;
|
||||||
|
@ -2510,12 +2507,12 @@ void Saveable_Init_Dynamic()
|
||||||
saveable_build.numdata = NUM_SAVEABLE_ITEMS(saveable_build_data);
|
saveable_build.numdata = NUM_SAVEABLE_ITEMS(saveable_build_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::set_hud_layout(int requested_size)
|
ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize)
|
||||||
{
|
{
|
||||||
gs.BorderNum = 9 - requested_size;
|
return { 0, 48 };
|
||||||
SetBorder(Player + myconnectindex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
::GameInterface* CreateInterface()
|
::GameInterface* CreateInterface()
|
||||||
{
|
{
|
||||||
return new GameInterface;
|
return new GameInterface;
|
||||||
|
@ -2533,10 +2530,4 @@ void GameInterface::FreeGameData()
|
||||||
TerminateLevel();
|
TerminateLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::UpdateScreenSize()
|
|
||||||
{
|
|
||||||
// Fixme. The underlying code here is too broken and must be refactored first.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
|
@ -1614,12 +1614,6 @@ typedef struct
|
||||||
|
|
||||||
extern USERp User[MAXSPRITES];
|
extern USERp User[MAXSPRITES];
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
short Xdim, Ydim, ScreenSize;
|
|
||||||
} BORDER_INFO,*BORDER_INFOp;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short high;
|
short high;
|
||||||
|
@ -2027,7 +2021,6 @@ extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
|
||||||
|
|
||||||
ANIMATOR NullAnimator;
|
ANIMATOR NullAnimator;
|
||||||
|
|
||||||
void SetBorder(PLAYERp pp);
|
|
||||||
int Distance(int x1, int y1, int x2, int y2);
|
int Distance(int x1, int y1, int x2, int y2);
|
||||||
short GetDeltaAngle(short, short);
|
short GetDeltaAngle(short, short);
|
||||||
fix16_t GetDeltaQ16Angle(fix16_t, fix16_t);
|
fix16_t GetDeltaQ16Angle(fix16_t, fix16_t);
|
||||||
|
@ -2380,10 +2373,8 @@ struct GameInterface : ::GameInterface
|
||||||
{
|
{
|
||||||
const char* Name() override { return "ShadowWarrior"; }
|
const char* Name() override { return "ShadowWarrior"; }
|
||||||
int app_main() override;
|
int app_main() override;
|
||||||
void UpdateScreenSize() override;
|
|
||||||
void FreeGameData() override;
|
void FreeGameData() override;
|
||||||
bool GenerateSavePic() override;
|
bool GenerateSavePic() override;
|
||||||
void set_hud_layout(int size) override;
|
|
||||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
||||||
void MenuOpened() override;
|
void MenuOpened() override;
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
|
@ -2397,6 +2388,7 @@ struct GameInterface : ::GameInterface
|
||||||
bool SaveGame(FSaveGameNode* sv) override;
|
bool SaveGame(FSaveGameNode* sv) override;
|
||||||
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
||||||
FString GetCoordString() override;
|
FString GetCoordString() override;
|
||||||
|
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||||
|
|
||||||
FString statFPS() override;
|
FString statFPS() override;
|
||||||
GameStats getStats() override;
|
GameStats getStats() override;
|
||||||
|
|
|
@ -92,247 +92,6 @@ void MNU_DrawStringLarge(int x, int y, const char* string, int shade = 0, int al
|
||||||
extern SWBOOL LoadGameOutsideMoveLoop;
|
extern SWBOOL LoadGameOutsideMoveLoop;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
ct_mainmenu, ct_savemenu, ct_loadmenu, ct_soundmenu, ct_optionmenu, ct_quickloadmenu,
|
|
||||||
ct_quitmenu, ct_ordermenu, ct_episodemenu, ct_max
|
|
||||||
} CTLType;
|
|
||||||
|
|
||||||
extern int SENSITIVITY;
|
|
||||||
extern CTLType ControlPanelType;
|
|
||||||
extern int16_t MenuTextShade;
|
|
||||||
extern int16_t MenuTextPalette;
|
|
||||||
|
|
||||||
// Prototypes
|
|
||||||
//void MNU_DoMenu( CTLType type, PLAYERp pp );
|
|
||||||
void MNU_InitMenus(void);
|
|
||||||
//void (*CustomRefresh)(void);
|
|
||||||
//void MNU_Refresh( void );
|
|
||||||
void MNU_DrawMenu(void); // This is used in drawscreen to refresh menus in
|
|
||||||
// multiplay situations.
|
|
||||||
void MNU_CheckForMenus(void);
|
|
||||||
void MNU_CheckForMenusAnyKey(void);
|
|
||||||
|
|
||||||
// Functions from my other engine
|
|
||||||
//void Get_Palette (unsigned char *pal);
|
|
||||||
//void Set_Palette(unsigned char *buff);
|
|
||||||
//void Fade_Timer(int clicks);
|
|
||||||
void FadeIn(unsigned char targetcolor, unsigned int clicks);
|
|
||||||
void FadeOut(unsigned char targetcolor, unsigned int clicks);
|
|
||||||
void ResetPalette(PLAYERp pp);
|
|
||||||
|
|
||||||
void ExitMenus(void);
|
|
||||||
void ResetMenuInput(void);
|
|
||||||
|
|
||||||
extern SWBOOL BorderAdjust;
|
|
||||||
|
|
||||||
// Make memcpy an intrinsic function for an easy frame rate boost
|
|
||||||
//#pragma intrinsic( memcpy );
|
|
||||||
|
|
||||||
// L O C A L V A R I A B L E S ////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Default menu pic brightness
|
|
||||||
|
|
||||||
#define FLASHTIME 60 // One second per icon flash
|
|
||||||
|
|
||||||
// Defines for permanentwritesprite clipping box
|
|
||||||
#define M_CX1 0
|
|
||||||
#define M_CY1 0
|
|
||||||
#define M_CX2 319
|
|
||||||
#define M_CY2 199
|
|
||||||
|
|
||||||
#define asc_Esc 27
|
|
||||||
#define asc_Enter 13
|
|
||||||
#define asc_Space 32
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This is the current values set with all slider bar functions
|
|
||||||
#define SENSE_DEFAULT 10 // Default mouse sensitivity ** should be 5!!!
|
|
||||||
#define FXVOL_DEFAULT 8 // Default sound fx volume
|
|
||||||
#define MUSIC_DEFAULT 8 // Default music volume
|
|
||||||
#define SCRSIZE_DEFAULT 9 // Default screen size, max is 10
|
|
||||||
#define BRIGHTNESS_DEFAULT 0 // Default is no gamma-correction
|
|
||||||
#define BORDERTILE_DEFAULT 0 // Default is no gamma-correction
|
|
||||||
#define GAMETYPE_DEFAULT 0 // Regular DeathMatch
|
|
||||||
#define NETLEVEL_DEFAULT 0 // Default is level 1 (0)
|
|
||||||
#define MONSTERS_DEFAULT 0 // No Monsters
|
|
||||||
#define KILLLIMIT_DEFAULT 0 // No kill limit
|
|
||||||
#define TIMELIMIT_DEFAULT 0 // None
|
|
||||||
#define PLAYERCOLOR_DEFAULT 0
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
sldr_none,
|
|
||||||
sldr_mouse, sldr_sndfxvolume, sldr_musicvolume, sldr_scrsize, sldr_brightness,
|
|
||||||
sldr_bordertile, sldr_gametype, sldr_netlevel, sldr_monsters, sldr_killlimit,
|
|
||||||
sldr_timelimit, sldr_playercolor, sldr_videores, sldr_videobpp,
|
|
||||||
sldr_mousescalex, sldr_mousescaley,
|
|
||||||
sldr_joyaxisscale, sldr_joyaxisanalog, sldr_joyaxisdead, sldr_joyaxissatur,
|
|
||||||
sldr_max
|
|
||||||
} SLDRType;
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SLDR_WIDTH 16 // maximum size of slider before x is compressed
|
|
||||||
|
|
||||||
#define SLDR_MOUSESENSEMAX 20
|
|
||||||
#define SLDR_SNDFXVOLMAX 16
|
|
||||||
#define SLDR_MUSICVOLMAX 16
|
|
||||||
#define SLDR_SCRSIZEMAX 14
|
|
||||||
#define SLDR_BRIGHTNESSMAX 8
|
|
||||||
#define SLDR_BORDERTILEMAX (isShareware ? 21 : 38) // counted from border.c
|
|
||||||
#define SLDR_GAMETYPEMAX 3
|
|
||||||
|
|
||||||
#define SLDR_NETLEVELMAX_REG 28
|
|
||||||
#define SLDR_NETLEVELMAX_SW 4
|
|
||||||
#define SLDR_NETLEVELMAX (isShareware ? SLDR_NETLEVELMAX_SW : SLDR_NETLEVELMAX_REG)
|
|
||||||
|
|
||||||
#define SLDR_MONSTERSMAX 5 // Skill Levels
|
|
||||||
#define SLDR_KILLLIMITMAX 11 // Increments of 10 up to 100, 1 is no limit
|
|
||||||
#define SLDR_TIMELIMITMAX 9
|
|
||||||
#define SLDR_PLAYERCOLORMAX 8 // Up to 8 players different colors
|
|
||||||
|
|
||||||
|
|
||||||
#define MOUSE_SENS_MAX_VALUE (1<<16)
|
|
||||||
#define MUSIC_VOL_MAX_VALUE 255
|
|
||||||
#define FX_VOL_MAX_VALUE 255
|
|
||||||
|
|
||||||
// These are all the toggle button settings
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
btn_none, btn_auto_run, btn_crosshair, btn_auto_aim,
|
|
||||||
btn_mouse_aim, btn_messages, btn_mouse_invert, btn_bobbing, btn_shadows,
|
|
||||||
btn_sound, btn_music, btn_talking, btn_ambience, btn_flipstereo,
|
|
||||||
btn_res0, btn_res1, btn_res2, btn_res3, btn_res4, btn_res5, btn_res6,
|
|
||||||
btn_markers, btn_teamplay, btn_friendlyfire,btn_parental,btn_nuke,
|
|
||||||
btn_voxels, btn_stats, btn_playcd,
|
|
||||||
btn_videofs,
|
|
||||||
btn_darts,
|
|
||||||
btn_autoswitch,
|
|
||||||
btn_max
|
|
||||||
} BTNType;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
mf_normal = BIT(0),
|
|
||||||
mf_pushed = BIT(1),
|
|
||||||
mf_selected = BIT(2),
|
|
||||||
mf_disabled = BIT(3),
|
|
||||||
mf_separated = BIT(4)
|
|
||||||
};
|
|
||||||
typedef int MenuFlags;
|
|
||||||
|
|
||||||
#define MenuSelectFlags (mf_pushed | mf_selected | mf_disabled)
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
mt_none,
|
|
||||||
mt_inert, mt_slider, mt_button, mt_option, mt_layer
|
|
||||||
} MenuTag;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
uc_setup, uc_draw, uc_touchup, uc_hit
|
|
||||||
} UserCall;
|
|
||||||
|
|
||||||
struct MenuGroup;
|
|
||||||
|
|
||||||
typedef struct MENU_ITEM
|
|
||||||
{
|
|
||||||
MenuTag type; // What kind of item is this on the
|
|
||||||
// menu?
|
|
||||||
MenuFlags flags; // Menu item flags
|
|
||||||
SLDRType slider; // Slider type, if any
|
|
||||||
BTNType button; // Button state, if any
|
|
||||||
unsigned char hotkey; // First letter of item
|
|
||||||
const char *text; // Text appearing in item, if any.
|
|
||||||
MenuGroup *child; // Should be menugroup, used to spawn
|
|
||||||
// sub-groups from items.
|
|
||||||
int x, y; // x,y position on screen.
|
|
||||||
short pic; // Startpic to use
|
|
||||||
char shade; // Shade of pic
|
|
||||||
int tics; // Ticcount for item
|
|
||||||
SWBOOL(*custom)(void); // Work function on item select
|
|
||||||
|
|
||||||
SWBOOL (*preprocess)(struct MENU_ITEM *);
|
|
||||||
SWBOOL (*postprocess)(struct MENU_ITEM *); // Can do things on items select
|
|
||||||
} MenuItem, *MenuItem_p;
|
|
||||||
|
|
||||||
typedef struct MenuGroup
|
|
||||||
{
|
|
||||||
int x, y; // Menu x,y position on screen.
|
|
||||||
const char *text;
|
|
||||||
MenuItem_p items; // Array of menu items for this menu.
|
|
||||||
short titlepic; // Used to draw title on menu with.
|
|
||||||
short cursorpic; // Pic used for menu cursor, 1st in
|
|
||||||
// anim sequence if animated.
|
|
||||||
char shade; // Title pic shade
|
|
||||||
|
|
||||||
SWBOOL(*draw_custom)(UserCall, MenuItem *); // Custom routine
|
|
||||||
SWBOOL(*move_custom)(UserCall, MenuItem *); // Custom routine
|
|
||||||
|
|
||||||
short cursor; // This is the current menu item the
|
|
||||||
// cursor is resting on.
|
|
||||||
} *MenuGroup_p;
|
|
||||||
|
|
||||||
// Custom Routine Prototypes ////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
SWBOOL MNU_QuitCustom(UserCall call, MenuItem *item);
|
|
||||||
SWBOOL MNU_LoadSaveTouchupCustom(UserCall call, MenuItem *item);
|
|
||||||
SWBOOL MNU_OrderCustom(UserCall call, MenuItem *item);
|
|
||||||
SWBOOL MNU_DoEpisodeSelect(UserCall call, MenuItem *item);
|
|
||||||
|
|
||||||
SWBOOL MNU_MusicFxCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_MusicCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_FxCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_MouseCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_JoystickCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_BorderCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_ShareWareCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_MenuLevelCheck(MenuItem_p item);
|
|
||||||
SWBOOL MNU_ShareWareMessage(MenuItem_p item);
|
|
||||||
|
|
||||||
// Custom MenuItem Routines /////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
SWBOOL MNU_StartGame(void);
|
|
||||||
SWBOOL MNU_StartNetGame(void);
|
|
||||||
SWBOOL MNU_EpisodeCustom(void);
|
|
||||||
SWBOOL MNU_GetDescripCustom(void);
|
|
||||||
SWBOOL MNU_LoadGameCustom(void);
|
|
||||||
SWBOOL MNU_SaveGameCustom(void);
|
|
||||||
SWBOOL MNU_GetLoadCustom(void);
|
|
||||||
SWBOOL MNU_GetSaveCustom(void);
|
|
||||||
SWBOOL MNU_ParentalCustom(void);
|
|
||||||
SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item);
|
|
||||||
SWBOOL MNU_LoadModernDefaults(void);
|
|
||||||
SWBOOL MNU_LoadClassicDefaults(void);
|
|
||||||
|
|
||||||
// Menu Definitions /////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#define DefInert(key,text) mt_inert,mf_normal,sldr_none,btn_none,key,text,NULL
|
|
||||||
#define DefSlider(slider,key,text) mt_slider,mf_normal,slider,btn_none,key,text,NULL
|
|
||||||
#define DefOption(key,text) mt_option,mf_normal,sldr_none,btn_none,key,text,NULL
|
|
||||||
#define DefButton(button,key,text) mt_button,mf_normal,sldr_none,button,key,text,NULL
|
|
||||||
#define DefLayer(key,text,child) mt_layer,mf_normal,sldr_none,btn_none,key,text,child
|
|
||||||
|
|
||||||
#define DefDisabled(key,text,child) mt_layer,mf_disabled,sldr_none,btn_none,key,text,child
|
|
||||||
#define DefNone mt_none,(MenuFlags)0,(SLDRType)0,(BTNType)0,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL
|
|
||||||
|
|
||||||
#define OPT_XS 30
|
|
||||||
#define OPT_YS 30
|
|
||||||
#define OPT_XSIDE (OPT_XS + 120)
|
|
||||||
#define OPT_YINC 10
|
|
||||||
#define OPT_LINE(line) (OPT_YS + (OPT_YINC * (line)))
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
} VMODE;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1132,7 +1132,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hud_size.Callback();
|
|
||||||
LoadGameOutsideMoveLoop = TRUE;
|
LoadGameOutsideMoveLoop = TRUE;
|
||||||
if (!InMenuLevel)
|
if (!InMenuLevel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -376,9 +376,6 @@ private:
|
||||||
WeaponNum = DamageData[WeaponNum].with_weapon;
|
WeaponNum = DamageData[WeaponNum].with_weapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
|
|
||||||
return;
|
|
||||||
|
|
||||||
static short wsum_xoff[3] = { 0,36,66 };
|
static short wsum_xoff[3] = { 0,36,66 };
|
||||||
static const char* wsum_fmt2[3] = { "%3d/%-3d", "%2d/%-2d", "%2d/%-2d" };
|
static const char* wsum_fmt2[3] = { "%3d/%-3d", "%2d/%-2d", "%2d/%-2d" };
|
||||||
|
|
||||||
|
@ -721,7 +718,7 @@ private:
|
||||||
INVENTORY_DATAp id;
|
INVENTORY_DATAp id;
|
||||||
|
|
||||||
x = MINI_BAR_HEALTH_BOX_X;
|
x = MINI_BAR_HEALTH_BOX_X;
|
||||||
y = 200 - 26;
|
y = -26;
|
||||||
|
|
||||||
DrawGraphic(tileGetTexture(MINI_BAR_HEALTH_BOX_PIC), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
|
DrawGraphic(tileGetTexture(MINI_BAR_HEALTH_BOX_PIC), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
|
||||||
|
|
||||||
|
@ -843,22 +840,21 @@ public:
|
||||||
double inv_x, inv_y;
|
double inv_x, inv_y;
|
||||||
int align;
|
int align;
|
||||||
|
|
||||||
if (gs.BorderNum <= BORDER_NONE)
|
if (hud_size == Hud_Nothing)
|
||||||
{
|
{
|
||||||
align = DI_SCREEN_RIGHT_BOTTOM;
|
align = DI_SCREEN_RIGHT_BOTTOM;
|
||||||
inv_x = -210 * hud_scale / 100.;
|
inv_x = -210 * hud_scale / 100.;
|
||||||
inv_y = -28 * hud_scale / 100.;
|
inv_y = -28 * hud_scale / 100.;
|
||||||
PrintLevelStats(2);
|
PrintLevelStats(2);
|
||||||
}
|
}
|
||||||
/*else if (gs.BorderNum == BORDER_HUD)
|
else if (hud_size == Hud_full)
|
||||||
{
|
{
|
||||||
align = DI_SCREEN_CENTER_TOP;
|
align = DI_SCREEN_CENTER_TOP;
|
||||||
inv_x = -80 * hud_scale / 100.;
|
inv_x = -80 * hud_scale / 100.;
|
||||||
inv_y = -70 * hud_scale / 100.;
|
inv_y = -70 * hud_scale / 100.;
|
||||||
DrawHUD2();
|
DrawHUD1(); // todo: Implement a proper view for this
|
||||||
}
|
}
|
||||||
*/
|
else if (hud_size == Hud_Mini)
|
||||||
else if (gs.BorderNum == BORDER_MINI_BAR)
|
|
||||||
{
|
{
|
||||||
align = DI_SCREEN_RIGHT_BOTTOM;
|
align = DI_SCREEN_RIGHT_BOTTOM;
|
||||||
inv_x = -210 * hud_scale / 100.;
|
inv_x = -210 * hud_scale / 100.;
|
||||||
|
@ -924,7 +920,7 @@ void UpdateStatusBar(ClockTicks arg)
|
||||||
{
|
{
|
||||||
DSWStatusBar sbar;
|
DSWStatusBar sbar;
|
||||||
|
|
||||||
if (gs.BorderNum >= BORDER_BAR)
|
if (hud_size <= Hud_Stbar)
|
||||||
{
|
{
|
||||||
UpdateFrame();
|
UpdateFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ BEGIN_SW_NS
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int8_t BorderNum;
|
|
||||||
int8_t BorderTile; // Network only - disabled
|
|
||||||
// Net Options from Menus
|
// Net Options from Menus
|
||||||
uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn]
|
uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn]
|
||||||
uint8_t NetLevel; // 1-28
|
uint8_t NetLevel; // 1-28
|
||||||
|
|
|
@ -1016,22 +1016,7 @@ OptionMenu "HUDOptions" //protected
|
||||||
{
|
{
|
||||||
Title "$OPTMNU_HUD"
|
Title "$OPTMNU_HUD"
|
||||||
|
|
||||||
ifgame(duke, nam, ww2gi, redneck, redneckrides)
|
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1
|
||||||
{
|
|
||||||
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 11.0, 1.0, -1
|
|
||||||
}
|
|
||||||
ifgame(blood)
|
|
||||||
{
|
|
||||||
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 7.0, 1.0, -1
|
|
||||||
}
|
|
||||||
ifgame(shadowwarrior)
|
|
||||||
{
|
|
||||||
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1
|
|
||||||
}
|
|
||||||
ifgame(exhumed)
|
|
||||||
{
|
|
||||||
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 8.0, 1.0, -1
|
|
||||||
}
|
|
||||||
Slider "$DSPLYMNU_SBSCALE", "hud_scale", 36, 100, 4, 2
|
Slider "$DSPLYMNU_SBSCALE", "hud_scale", 36, 100, 4, 2
|
||||||
StaticText ""
|
StaticText ""
|
||||||
Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff"
|
Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff"
|
||||||
|
|
Loading…
Reference in a new issue