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 21, 2023
1 parent 3f67907 commit d826e70
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 121 deletions.
32 changes: 13 additions & 19 deletions SamTFE/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 @@ -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
4 changes: 2 additions & 2 deletions SamTFE/Sources/GameMP/Console.cpp
Original file line number Diff line number Diff line change
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
106 changes: 6 additions & 100 deletions SamTFE/Sources/GameMP/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3196,35 +3196,6 @@ void TiledTextureSE( PIXaabbox2D &_boxScreen, FLOAT fStretch, const MEX2D &vScre

void CGame::LCDInit(void)
{
try {
_toBcgClouds.SetData_t(CTFILENAME("Textures\\General\\Background6.tex"));
#ifdef FIRST_ENCOUNTER
_toPointer.SetData_t(CTFILENAME("Textures\\General\\Pointer.tex"));
_toBcgGrid.SetData_t(CTFILENAME("Textures\\General\\Grid16x16-dot.tex"));
#else
_toPointer.SetData_t(CTFILENAME("TexturesMP\\General\\Pointer.tex"));
_toBcgGrid.SetData_t(CTFILENAME("TexturesMP\\General\\grid.tex"));
_toBackdrop.SetData_t(CTFILENAME("TexturesMP\\General\\MenuBack.tex"));
// thoses are not in original TFE datas and must be added externaly (with SE1_10.gro or a minimal versio of it)
_toSamU.SetData_t(CTFILENAME("TexturesMP\\General\\SamU.tex"));
_toSamD.SetData_t(CTFILENAME("TexturesMP\\General\\SamD.tex"));
_toLeftU.SetData_t(CTFILENAME("TexturesMP\\General\\LeftU.tex"));
_toLeftD.SetData_t(CTFILENAME("TexturesMP\\General\\LeftD.tex"));
// force constant textures
((CTextureData*)_toBackdrop .GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toSamU .GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toSamD .GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toLeftU .GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toLeftD .GetData())->Force(TEX_CONSTANT);
#endif
((CTextureData*)_toBcgClouds.GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toPointer .GetData())->Force(TEX_CONSTANT);
((CTextureData*)_toBcgGrid .GetData())->Force(TEX_CONSTANT);


} catch (const char *strError) {
FatalError("%s\n", strError);
}
::_LCDInit();
}
void CGame::LCDEnd(void)
Expand All @@ -3233,73 +3204,35 @@ void CGame::LCDEnd(void)
}
void CGame::LCDPrepare(FLOAT fFade)
{
// get current time and alpha value
_tmNow_SE = (FLOAT)_pTimer->GetHighPrecisionTimer().GetSeconds();
_ulA_SE = NormFloatToByte(fFade);

::_LCDPrepare(fFade);
}
void CGame::LCDSetDrawport(CDrawPort *pdp)
{
_pdp_SE = pdp;
_pixSizeI_SE = _pdp_SE->GetWidth();
_pixSizeJ_SE = _pdp_SE->GetHeight();
_boxScreen_SE = PIXaabbox2D ( PIX2D(0,0), PIX2D(_pixSizeI_SE, _pixSizeJ_SE));

if (pdp->dp_SizeIOverRasterSizeI==1.0f) {
_bPopup = FALSE;
} else {
_bPopup = TRUE;
}

::_LCDSetDrawport(pdp);
}
void CGame::LCDDrawBox(PIX pixUL, PIX pixDR, const PIXaabbox2D &box, COLOR col)
{
#ifdef FIRST_ENCOUNTER // First Encounter
col = SE_COL_GREEN_NEUTRAL|255;
#else // Second Encounter
col = SE_COL_BLUE_NEUTRAL|255;
#endif

::_LCDDrawBox(pixUL, pixDR, box, col);
}
void CGame::LCDScreenBox(COLOR col)
{
#ifdef FIRST_ENCOUNTER // First Encounter
col = SE_COL_GREEN_NEUTRAL|255;
#else // Second Encounter
col = SE_COL_BLUE_NEUTRAL|255;
#endif

::_LCDScreenBox(col);
}
void CGame::LCDScreenBoxOpenLeft(COLOR col)
{
#ifdef FIRST_ENCOUNTER // First Encounter
col = SE_COL_GREEN_NEUTRAL|255;
#else // Second Encounter
col = SE_COL_BLUE_NEUTRAL|255;
#endif

::_LCDScreenBoxOpenLeft(col);
}
void CGame::LCDScreenBoxOpenRight(COLOR col)
{
#ifdef FIRST_ENCOUNTER // First Encounter
col = SE_COL_GREEN_NEUTRAL|255;
#else // Second Encounter
col = SE_COL_BLUE_NEUTRAL|255;
#endif

::_LCDScreenBoxOpenRight(col);
}
void CGame::LCDRenderClouds1(void)
{

#ifdef FIRST_ENCOUNTER
LCDRenderCloudsForComp();
LCDRenderCompGrid();
//LCDRenderCloudsForComp();
//LCDRenderCompGrid();
::_LCDRenderClouds1();
#else
_pdp_SE->PutTexture(&_toBackdrop, _boxScreen_SE, C_WHITE|255);

Expand Down Expand Up @@ -3379,42 +3312,15 @@ void CGame::LCDRenderCloudsForComp(void)
}
void CGame::LCDRenderClouds2(void)
{
NOTHING;
::_LCDRenderClouds2();
}
void CGame::LCDRenderGrid(void)
{
NOTHING;
}
void CGame::LCDRenderCompGrid(void)
{
MEXaabbox2D boxBcgGrid;
TiledTextureSE(_boxScreen_SE, 0.5f*_pdp_SE->GetWidth()/(_pdp_SE->dp_SizeIOverRasterSizeI*640.0f), MEX2D(0,0), boxBcgGrid);
#ifdef FIRST_ENCOUNTER // First Encounter
_pdp_SE->PutTexture(&_toBcgGrid, _boxScreen_SE, boxBcgGrid, SE_COL_GREEN_NEUTRAL|_ulA_SE>>1);
#else // Second Encounter
_pdp_SE->PutTexture(&_toBcgGrid, _boxScreen_SE, boxBcgGrid, SE_COL_BLUE_NEUTRAL|_ulA_SE>>1);
#endif
::_LCDRenderGrid();
}
void CGame::LCDDrawPointer(PIX pixI, PIX pixJ)
{
CDisplayMode dmCurrent;
_pGfx->GetCurrentDisplayMode(dmCurrent);
if (dmCurrent.IsFullScreen()) {
while (ShowCursor(FALSE) >= 0);
} else {
if (!_pInput->IsInputEnabled()) {
while (ShowCursor(TRUE) < 0);
}
return;
}
PIX pixSizeI = _toPointer.GetWidth();
PIX pixSizeJ = _toPointer.GetHeight();
pixI-=1;
pixJ-=1;
_pdp_SE->PutTexture( &_toPointer, PIXaabbox2D( PIX2D(pixI, pixJ), PIX2D(pixI+pixSizeI, pixJ+pixSizeJ)),
LCDFadedColor(C_WHITE|255));

//::_LCDDrawPointer(pixI, pixJ);
::_LCDDrawPointer(pixI, pixJ);
}
COLOR CGame::LCDGetColor(COLOR colDefault, const char *strName)
{
Expand Down

0 comments on commit d826e70

Please sign in to comment.