Skip to content

Commit

Permalink
Restored the original menu design as in TFE (grid, clouds and so on)
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Oct 22, 2023
1 parent 9a38fc4 commit 03aafbf
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 575 deletions.
34 changes: 21 additions & 13 deletions Sources/Entities/Common/HUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define TOP_HEALTH 100

#ifdef PLATFORM_UNIX
extern "C" __attribute__ ((visibility("default"))) FLOAT _fArmorHeightAdjuster = 1.0f;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fFragScorerHeightAdjuster = 1.0f;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fArmorHeightAdjuster;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fFragScorerHeightAdjuster;
#else
extern __declspec(dllimport) FLOAT _fArmorHeightAdjuster;
extern __declspec(dllimport) FLOAT _fFragScorerHeightAdjuster;
Expand All @@ -26,6 +26,7 @@ extern __declspec(dllimport) FLOAT _fFragScorerHeightAdjuster;
//
extern INDEX hud_bShowPing;
extern INDEX hud_bShowKills;
extern INDEX hud_bShowScore;

// cheats
extern INDEX cht_bEnable;
Expand All @@ -44,6 +45,7 @@ extern INDEX hud_iSortPlayers;
extern FLOAT hud_fOpacity;
extern FLOAT hud_fScaling;
extern FLOAT hud_tmWeaponsOnScreen;
extern INDEX hud_bWeaponsIconScale; // HUD weapons icons scale: 0 - small, 1 - big


// player statistics sorting keys
Expand Down Expand Up @@ -815,7 +817,11 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
if( ptoWantedWeapon == _awiWeapons[i].wi_ptoWeapon) colIcon = C_WHITE;
_fCustomScalingAdjustment = 1.0f;
HUD_DrawBorder( fCol, fRow, fOneUnit, fOneUnit, colIcon);
_fCustomScalingAdjustment = 0.5f;
if (hud_bWeaponsIconScale) {
_fCustomScalingAdjustment = 0.75f;
} else {
_fCustomScalingAdjustment = 0.5f;
}
HUD_DrawIcon( fCol, fRow, *_awiWeapons[i].wi_ptoWeapon, colIcon, 1.0f, FALSE);
// advance to next position
fCol += fAdvUnit;
Expand Down Expand Up @@ -1047,15 +1053,17 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
iScore = iScoreSum;
}

// prepare and draw score or frags info
strValue.PrintF( "%d", iScore);
fRow = pixTopBound +fHalfUnit;
fCol = pixLeftBound +fHalfUnit;
fAdv = fAdvUnit+ fChrUnit*fWidthAdj/2 -fHalfUnit;
HUD_DrawBorder( fCol, fRow, fOneUnit, fOneUnit, colBorder);
HUD_DrawBorder( fCol+fAdv, fRow, fChrUnit*fWidthAdj, fOneUnit, colBorder);
HUD_DrawText( fCol+fAdv, fRow, strValue, colScore, 1.0f);
HUD_DrawIcon( fCol, fRow, _toFrags, colScore, 1.0f, FALSE);
if( hud_bShowScore ) {
// prepare and draw score or frags info
strValue.PrintF( "%d", iScore);
fRow = pixTopBound +fHalfUnit;
fCol = pixLeftBound +fHalfUnit;
fAdv = fAdvUnit+ fChrUnit*fWidthAdj/2 -fHalfUnit;
HUD_DrawBorder( fCol, fRow, fOneUnit, fOneUnit, colBorder);
HUD_DrawBorder( fCol+fAdv, fRow, fChrUnit*fWidthAdj, fOneUnit, colBorder);
HUD_DrawText( fCol+fAdv, fRow, strValue, colScore, 1.0f);
HUD_DrawIcon( fCol, fRow, _toFrags, colScore, 1.0f, FALSE);
}

// eventually draw mana info
if( bScoreMatch || bFragMatch) {
Expand All @@ -1070,7 +1078,7 @@ extern void DrawHUD( const CPlayer *penPlayerCurrent, CDrawPort *pdpCurrent, BOO
}

// if single player or cooperative mode
if( bSinglePlay || bCooperative)
if( (bSinglePlay || bCooperative) && hud_bShowScore)
{
// prepare and draw hiscore info
strValue.PrintF( "%d", Max(_penPlayer->m_iHighScore, _penPlayer->m_psGameStats.ps_iScore));
Expand Down
14 changes: 9 additions & 5 deletions Sources/Entities/Player.es
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@
#include "Entities/WorldSettingsController.h"

#ifdef PLATFORM_UNIX
extern "C" __attribute__ ((visibility("default"))) FLOAT _fWeaponFOVAdjuster = 1.0f;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fPlayerFOVAdjuster = 1.0f;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fWeaponFOVAdjuster;
extern "C" __attribute__ ((visibility("default"))) FLOAT _fPlayerFOVAdjuster;
#else
extern __declspec(dllimport) FLOAT _fWeaponFOVAdjusterf;
extern __declspec(dllimport) FLOAT _fWeaponFOVAdjuster;
extern __declspec(dllimport) FLOAT _fPlayerFOVAdjuster;
#endif

extern INDEX hud_bShowPing = TRUE;
extern INDEX hud_bShowKills = TRUE;
INDEX hud_bShowPing = FALSE;
INDEX hud_bShowKills = FALSE;
INDEX hud_bShowScore = TRUE;

extern void JumpFromBouncer(CEntity *penToBounce, CEntity *penBouncer);
// from game
Expand Down Expand Up @@ -333,6 +334,7 @@ FLOAT hud_fOpacity = 0.9f;
FLOAT hud_fScaling = 1.0f;
FLOAT hud_tmWeaponsOnScreen = 3.0f;
FLOAT hud_tmLatencySnapshot = 1.0f;
INDEX hud_bWeaponsIconScale = 0; // HUD weapons icons scale: 0 - small, 1 - big

FLOAT plr_fBreathingStrength = 0.0f;
extern FLOAT plr_tmSnoopingTime;
Expand Down Expand Up @@ -625,6 +627,7 @@ void CPlayer_OnInitClass(void)
// declare player control variables
_pShell->DeclareSymbol("persistent user INDEX hud_bShowPing;", &hud_bShowPing);
_pShell->DeclareSymbol("persistent user INDEX hud_bShowKills;", &hud_bShowKills);
_pShell->DeclareSymbol("persistent user INDEX hud_bShowScore;", &hud_bShowScore);

_pShell->DeclareSymbol("user INDEX ctl_bMoveForward;", &pctlCurrent.bMoveForward);
_pShell->DeclareSymbol("user INDEX ctl_bMoveBackward;", &pctlCurrent.bMoveBackward);
Expand Down Expand Up @@ -694,6 +697,7 @@ void CPlayer_OnInitClass(void)
_pShell->DeclareSymbol("INDEX cht_bDumpFinalBossData;", &cht_bDumpFinalBossData);
_pShell->DeclareSymbol("INDEX cht_bDebugFinalBossAnimations;", &cht_bDebugFinalBossAnimations);
_pShell->DeclareSymbol("INDEX cht_bDumpPlayerShading;", &cht_bDumpPlayerShading);
_pShell->DeclareSymbol("persistent user INDEX hud_bWeaponsIconScale;", (void *) &hud_bWeaponsIconScale);

_pShell->DeclareSymbol("persistent user FLOAT wpn_fRecoilSpeed[17];", &wpn_fRecoilSpeed);
_pShell->DeclareSymbol("persistent user FLOAT wpn_fRecoilLimit[17];", &wpn_fRecoilLimit);
Expand Down
39 changes: 17 additions & 22 deletions Sources/GameMP/Computer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void PrintButton(CDrawPort *pdp, INDEX iButton)
return;
}
_pGame->LCDSetDrawport(&dpButton);
_pGame->LCDRenderCompGrid();
_pGame->LCDRenderGrid();
_pGame->LCDRenderClouds2();
_pGame->LCDScreenBoxOpenLeft(_colBoxes);

Expand Down Expand Up @@ -755,7 +755,7 @@ void RenderMessageStats(CDrawPort *pdp)
{
CSessionProperties *psp = (CSessionProperties *)_pNetwork->GetSessionProperties();
ULONG ulLevelMask = psp->sp_ulLevelsMask;
//INDEX iLevel = -1;
INDEX iLevel = -1;
if (psp->sp_bCooperative) {
extern void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi);
if (pdp->Lock()) {
Expand Down Expand Up @@ -793,7 +793,7 @@ void RenderMessageImage(CDrawPort *pdp)
CCompMessage &cm = _acmMessages[_iActiveMessage];

if (cm.cm_itImage == CCompMessage::IT_STATISTICS) {
_pGame->LCDRenderCompGrid();
_pGame->LCDRenderGrid();
}
_pGame->LCDRenderClouds2();
_pGame->LCDScreenBox(_colBoxes);
Expand Down Expand Up @@ -1166,10 +1166,10 @@ void CGame::ComputerRender(CDrawPort *pdp)
fComputerFadeValue = 0.0f;
_pGame->gm_csComputerState = CS_OFF;
ComputerOff();

#ifdef PLATFORM_UNIX
if (_pInput != NULL) // rcg02042003 hack for SDL vs. Win32.
_pInput->ClearRelativeMouseMotion();

#endif
cmp_ppenPlayer = NULL;
// exit computer
return;
Expand Down Expand Up @@ -1244,22 +1244,16 @@ void CGame::ComputerRender(CDrawPort *pdp)
MarkCurrentRead();

// get current time and alpha value
//FLOAT tmNow = (FLOAT)tvNow.GetSeconds();
//ULONG ulA = NormFloatToByte(fComputerFadeValue);
FLOAT tmNow = (FLOAT)tvNow.GetSeconds();
ULONG ulA = NormFloatToByte(fComputerFadeValue);

_colLight = LCDFadedColor(C_WHITE|255);
#ifdef FIRST_ENCOUNTER // First Encounter
_colMedium = LCDFadedColor(SE_COL_GREEN_LIGHT|255);
_colDark = LCDFadedColor(LerpColor(SE_COL_GREEN_DARK, SE_COL_GREEN_LIGHT, 0.5f)|255);
_colBoxes = LCDFadedColor(LerpColor(SE_COL_GREEN_DARK, SE_COL_GREEN_LIGHT, 0.5f)|255);
#else // Second Encounter
_colMedium = LCDFadedColor(SE_COL_BLUE_LIGHT|255);
_colDark = LCDFadedColor(LerpColor(SE_COL_BLUE_DARK, SE_COL_BLUE_LIGHT, 0.5f)|255);
_colBoxes = LCDFadedColor(LerpColor(SE_COL_BLUE_DARK, SE_COL_BLUE_LIGHT, 0.5f)|255);
#endif
_colMedium = LCDFadedColor(C_GREEN|255);
_colDark = LCDFadedColor(LerpColor(C_dGREEN, C_GREEN, 0.5f)|255);
_colBoxes = LCDFadedColor(LerpColor(C_dGREEN, C_GREEN, 0.5f)|255);

// background
LCDRenderCloudsForComp();
LCDRenderClouds1();
// dpComp.DrawLine( 0, pixSizeJ-1, pixSizeI, pixSizeJ-1, C_GREEN|ulA);

// all done
Expand All @@ -1269,7 +1263,7 @@ void CGame::ComputerRender(CDrawPort *pdp)
CDrawPort dpTitle(&dpComp, _boxTitle);
if (dpTitle.Lock()) {
LCDSetDrawport(&dpTitle);
LCDRenderCompGrid();
LCDRenderGrid();
LCDRenderClouds2();
LCDScreenBoxOpenLeft(_colBoxes);
PrintTitle(&dpTitle);
Expand All @@ -1280,7 +1274,7 @@ void CGame::ComputerRender(CDrawPort *pdp)
CDrawPort dpExit(&dpComp, _boxExit);
if (dpExit.Lock()) {
LCDSetDrawport(&dpExit);
LCDRenderCompGrid();
LCDRenderGrid();
LCDRenderClouds2();
LCDScreenBoxOpenRight(_colBoxes);
PrintExit(&dpExit);
Expand All @@ -1295,7 +1289,7 @@ void CGame::ComputerRender(CDrawPort *pdp)
CDrawPort dpMsgList(&dpComp, _boxMsgList);
if (dpMsgList.Lock()) {
LCDSetDrawport(&dpMsgList);
LCDRenderCompGrid();
LCDRenderGrid();
LCDRenderClouds2();
LCDScreenBox(_colBoxes);
PrintMessageList(&dpMsgList);
Expand All @@ -1305,7 +1299,7 @@ void CGame::ComputerRender(CDrawPort *pdp)
CDrawPort dpMsgText(&dpComp, _boxMsgText);
if (dpMsgText.Lock()) {
LCDSetDrawport(&dpMsgText);
LCDRenderCompGrid();
LCDRenderGrid();
LCDRenderClouds2();
LCDScreenBox(_colBoxes);
PrintMessageText(&dpMsgText);
Expand Down Expand Up @@ -1339,8 +1333,9 @@ void CGame::ComputerForceOff()
_pGame->gm_csComputerState = CS_OFF;
fComputerFadeValue = 0.0f;
_ppenPlayer = NULL;

#ifdef PLATFORM_UNIX
if (_pInput != NULL) // rcg02042003 hack for SDL vs. Win32.
_pInput->ClearRelativeMouseMotion();
#endif
}

10 changes: 5 additions & 5 deletions Sources/GameMP/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ void CGame::ConsoleRender(CDrawPort *pdp)
// stop
fConsoleFadeValue = 0.0f;
_pGame->gm_csConsoleState = CS_OFF;

#ifdef PLATFORM_UNIX
if (_pInput != NULL) // rcg02042003 hack for SDL vs. Win32.
_pInput->ClearRelativeMouseMotion();

#endif
// if not in network
if (!_pNetwork->IsNetworkEnabled()) {
// don't show last lines on screen after exiting console
Expand Down Expand Up @@ -163,8 +163,8 @@ void CGame::ConsoleRender(CDrawPort *pdp)
if( iBackwardLine>1) Swap( colLight, colDark);
PIX pixLineSpacing = _pfdConsoleFont->fd_pixCharHeight + _pfdConsoleFont->fd_pixLineSpacing;

LCDRenderCloudsForComp();
//LCDRenderGrid();
LCDRenderClouds1();
LCDRenderGrid();
LCDRenderClouds2();
#ifdef FIRST_ENCOUNTER // First Encounter
dpConsole.DrawLine( 0, pixSizeJ-1, pixSizeI, pixSizeJ-1, LCDFadedColor(SE_COL_GREEN_NEUTRAL|255));
Expand Down Expand Up @@ -553,7 +553,7 @@ void CGame::ConsoleKeyDown( MSG msg)
case VK_BACK: Key_Backspace(bShift, FALSE); break;
case VK_DELETE: Key_Backspace(bShift, TRUE); break;
case VK_LEFT: if( iCursorPos > 0) iCursorPos--; break;
case VK_RIGHT: if( iCursorPos < strlen(strEditingLine)) iCursorPos++; break;
case VK_RIGHT: if( iCursorPos < static_cast<INDEX>(strlen(strEditingLine))) iCursorPos++; break;
case VK_HOME: iCursorPos = 0; break;
case VK_END: iCursorPos = strlen(strEditingLine); break;
}
Expand Down
Loading

0 comments on commit 03aafbf

Please sign in to comment.