diff --git a/Sources/Entities/Common/HUD.cpp b/Sources/Entities/Common/HUD.cpp index 25e3fda..78f8cf0 100644 --- a/Sources/Entities/Common/HUD.cpp +++ b/Sources/Entities/Common/HUD.cpp @@ -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; @@ -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; @@ -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 @@ -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; @@ -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) { @@ -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)); diff --git a/Sources/Entities/Player.es b/Sources/Entities/Player.es index f1f3eae..348ebf9 100644 --- a/Sources/Entities/Player.es +++ b/Sources/Entities/Player.es @@ -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 @@ -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; @@ -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); @@ -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); diff --git a/Sources/GameMP/Computer.cpp b/Sources/GameMP/Computer.cpp index 02d7913..08f228b 100644 --- a/Sources/GameMP/Computer.cpp +++ b/Sources/GameMP/Computer.cpp @@ -535,7 +535,7 @@ void PrintButton(CDrawPort *pdp, INDEX iButton) return; } _pGame->LCDSetDrawport(&dpButton); - _pGame->LCDRenderCompGrid(); + _pGame->LCDRenderGrid(); _pGame->LCDRenderClouds2(); _pGame->LCDScreenBoxOpenLeft(_colBoxes); @@ -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()) { @@ -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); @@ -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; @@ -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 @@ -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); @@ -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); @@ -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); @@ -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); @@ -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 } diff --git a/Sources/GameMP/Console.cpp b/Sources/GameMP/Console.cpp index c5ba5b0..bc93466 100644 --- a/Sources/GameMP/Console.cpp +++ b/Sources/GameMP/Console.cpp @@ -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 @@ -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)); @@ -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(strlen(strEditingLine))) iCursorPos++; break; case VK_HOME: iCursorPos = 0; break; case VK_END: iCursorPos = strlen(strEditingLine); break; } diff --git a/Sources/GameMP/Game.cpp b/Sources/GameMP/Game.cpp index c8b6f7f..b9ea90a 100644 --- a/Sources/GameMP/Game.cpp +++ b/Sources/GameMP/Game.cpp @@ -170,6 +170,12 @@ static FLOAT gam_fChatSoundVolume = 0.25f; BOOL map_bIsFirstEncounter = FALSE; BOOL _bUserBreakEnabled = FALSE; +// Fix illuminations bug metod +// 0 - none +// 1 - fix textrure settings +// 2 - create additional lighting (better) +INDEX gam_bFixIlluminationsMetod = 2; + // make sure that console doesn't show last lines if not playing in network void MaybeDiscardLastLines(void) { @@ -1048,6 +1054,12 @@ void CGame::InitInternal( void) _pShell->DeclareSymbol("user void StopSound(INDEX);", (void *)&StopScriptSound); _pShell->DeclareSymbol("user INDEX IsSoundPlaying(INDEX);", (void *)&IsScriptSoundPlaying); + // Fix illuminations bug metod: + // 0 - none + // 1 - fix textrure settings fix + // 2 - create additional lighting (better) + _pShell->DeclareSymbol("persistent user INDEX gam_bFixIlluminationsMetod;", (void *)&gam_bFixIlluminationsMetod); + CAM_Init(); // load persistent symbols @@ -1058,9 +1070,9 @@ void CGame::InitInternal( void) _pShell->Execute(CTString("include \"")+fnmStartupScript+"\";"); // check the size and pointer of player control variables that are local to each player - if (ctl_slPlayerControlsSize<=0 - ||ctl_slPlayerControlsSize>sizeof(((CLocalPlayer*)NULL)->lp_ubPlayerControlsState) - ||ctl_pvPlayerControls==NULL) { + if (ctl_slPlayerControlsSize <= 0 + || static_cast(ctl_slPlayerControlsSize) > sizeof(((CLocalPlayer*)NULL)->lp_ubPlayerControlsState) + || ctl_pvPlayerControls == NULL) { FatalError(TRANS("Current player controls are invalid.")); } @@ -1488,6 +1500,7 @@ SLONG CGame::PackHighScoreTable(void) UBYTE *pub = _aubHighScoreBuffer; // for each entry for (INDEX i=0; iPutText( strFPS, 0, 40, C_WHITE|CT_OPAQUE); pdpDrawPort->PutText( strReport, 4, 65, C_GREEN|CT_OPAQUE); } - else STAT_Enable(FALSE); + else { +#ifdef PLATFORM_UNIX + STAT_Enable(FALSE); +#endif + } } @@ -2243,7 +2294,7 @@ void CGame::GameRedrawView( CDrawPort *pdpDrawPort, ULONG ulFlags) // timer must not occur during prescanning { #if defined(PLATFORM_UNIX) && !defined(SINGLE_THREADED) - #warning "This seems to cause Race Condition, so disabled" + //#warning "This seems to cause Race Condition, so disabled" #else CTSingleLock csTimer(&_pTimer->tm_csHooks, TRUE); #endif @@ -2660,6 +2711,11 @@ INDEX FixQuicksaveDir(const CTFileName &fnmDir, INDEX ctMax) } // sort the list +#ifdef _MSC_VER +#ifndef _offsetof +#define _offsetof offsetof +#endif +#endif lh.Sort(qsort_CompareQuickSaves_FileUp, _offsetof(QuickSave, qs_lnNode)); INDEX ctCount = lh.Count(); @@ -2853,35 +2909,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) @@ -2890,25 +2917,10 @@ 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) @@ -2955,8 +2967,9 @@ void CGame::LCDRenderClouds1(void) { #ifdef FIRST_ENCOUNTER - LCDRenderCloudsForComp(); - LCDRenderCompGrid(); + //LCDRenderCloudsForComp(); + //LCDRenderCompGrid(); + ::_LCDRenderClouds1(); #else _pdp_SE->PutTexture(&_toBackdrop, _boxScreen_SE, C_WHITE|255); @@ -3036,42 +3049,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) { diff --git a/Sources/GameMP/LoadingHook.cpp b/Sources/GameMP/LoadingHook.cpp index 489e100..0dfa90b 100644 --- a/Sources/GameMP/LoadingHook.cpp +++ b/Sources/GameMP/LoadingHook.cpp @@ -27,32 +27,10 @@ extern CGame *_pGame; #endif static CDrawPort *_pdpLoadingHook = NULL; // drawport for loading hook extern BOOL _bUserBreakEnabled; -extern BOOL map_bIsFirstEncounter; #define REFRESHTIME (0.2f) -void RemapLevelNames(INDEX &iLevel) -{ - switch( iLevel) { - case 10: iLevel = 1; break; - case 11: iLevel = 2; break; - case 12: iLevel = 3; break; - case 13: iLevel = 4; break; - case 14: iLevel = 5; break; - case 15: iLevel = 6; break; - case 21: iLevel = 7; break; - case 22: iLevel = 8; break; - case 23: iLevel = 9; break; - case 24: iLevel = 10; break; - case 31: iLevel = 11; break; - case 32: iLevel = 12; break; - case 33: iLevel = 13; break; - default: iLevel = -1; break; - } -} - - static void LoadingHook_t(CProgressHookInfo *pphi) { // if user presses escape @@ -93,7 +71,10 @@ static void LoadingHook_t(CProgressHookInfo *pphi) CDrawPort *pdp = _pdpLoadingHook; ASSERT(pdp!=NULL); CDrawPort dpHook(pdp, TRUE); - if( !dpHook.Lock()) return; + if(!dpHook.Lock()) { + // do nothing + return; + } // clear screen dpHook.Fill(C_BLACK|255); @@ -101,35 +82,14 @@ static void LoadingHook_t(CProgressHookInfo *pphi) // get session properties currently loading CSessionProperties *psp = (CSessionProperties *)_pNetwork->GetSessionProperties(); ULONG ulLevelMask = psp->sp_ulLevelsMask; + INDEX iLevel = -1; if (psp->sp_bCooperative) { INDEX iLevel = -1; INDEX iLevelNext = -1; CTString strLevelName = _pNetwork->ga_fnmWorld.FileName(); CTString strNextLevelName = _pNetwork->ga_fnmNextLevel.FileName(); - - // second encounter - INDEX u, v; - u = v = -1; - strLevelName.ScanF("%01d_%01d_", &u, &v); - iLevel = u*10+v; - RemapLevelNames(iLevel); - u = v = -1; - strNextLevelName.ScanF("%01d_%01d_", &u, &v); - iLevelNext = u*10+v; - RemapLevelNames(iLevelNext); - - // first encounter - if(iLevel == -1) { - strLevelName.ScanF("%02d_", &iLevel); - strNextLevelName.ScanF("%02d_", &iLevelNext); - - if(iLevel != -1) { - map_bIsFirstEncounter = TRUE; - } - } else { - map_bIsFirstEncounter = FALSE; - } - + strLevelName.ScanF("%02d_", &iLevel); + strNextLevelName.ScanF("%02d_", &iLevelNext); if (iLevel>0) { ulLevelMask|=1<<(iLevel-1); } diff --git a/Sources/GameMP/Map.cpp b/Sources/GameMP/Map.cpp index 84c56af..40202d6 100644 --- a/Sources/GameMP/Map.cpp +++ b/Sources/GameMP/Map.cpp @@ -16,41 +16,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "StdAfx.h" #include "LCDDrawing.h" -extern BOOL map_bIsFirstEncounter; - -static CTextureObject atoIconsSE[13]; -static CTextureObject atoIconsFE[15]; - +static CTextureObject atoIcons[15]; static CTextureObject _toPathDot; +static CTextureObject _toMapBcgLD; +static CTextureObject _toMapBcgLU; +static CTextureObject _toMapBcgRD; +static CTextureObject _toMapBcgRU; -static CTextureObject _toMapBcgLDFE; -static CTextureObject _toMapBcgLUFE; -static CTextureObject _toMapBcgRDFE; -static CTextureObject _toMapBcgRUFE; - -static CTextureObject _toMapBcgLDSE; -static CTextureObject _toMapBcgLUSE; -static CTextureObject _toMapBcgRDSE; -static CTextureObject _toMapBcgRUSE; - -PIX aIconCoordsSE[][2] = -{ - {0, 0}, // 00: Last Episode - {168, 351}, // 01: Palenque 01 - {42, 345}, // 02: Palenque 02 - {41, 263}, // 03: Teotihuacan 01 - {113, 300}, // 04: Teotihuacan 02 - {334, 328}, // 05: Teotihuacan 03 - {371, 187}, // 06: Ziggurat - {265, 111}, // 07: Atrium - {119, 172}, // 08: Gilgamesh - {0, 145}, // 09: Babel - {90, 30}, // 10: Citadel - {171, 11}, // 11: Land of Damned - {376, 0}, // 12: Cathedral -}; - -PIX aIconCoordsFE[][2] = +PIX aIconCoords[][2] = { {175,404}, // 00: Hatshepsut {60,381}, // 01: Sand Canyon @@ -69,20 +42,6 @@ PIX aIconCoordsFE[][2] = {185,0}, // 14: Pyramid }; -#define LASTEPISODE_BIT 0 -#define PALENQUE01_BIT 1 -#define PALENQUE02_BIT 2 -#define TEOTIHUACAN01_BIT 3 -#define TEOTIHUACAN02_BIT 4 -#define TEOTIHUACAN03_BIT 5 -#define ZIGGURAT_BIT 6 -#define ATRIUM_BIT 7 -#define GILGAMESH_BIT 8 -#define BABEL_BIT 9 -#define CITADEL_BIT 10 -#define LOD_BIT 11 -#define CATHEDRAL_BIT 12 - #define HATSHEPSUT_BIT 0 #define SAND_BIT 1 #define RAMSES_BIT 2 @@ -99,23 +58,7 @@ PIX aIconCoordsFE[][2] = #define SACRED_BIT 13 #define PYRAMID_BIT 14 -INDEX aPathPrevNextLevelsSE[][2] = -{ - {LASTEPISODE_BIT, PALENQUE01_BIT}, // 00 - {PALENQUE01_BIT, PALENQUE02_BIT}, // 01 - {PALENQUE02_BIT, TEOTIHUACAN01_BIT }, // 02 - {TEOTIHUACAN01_BIT, TEOTIHUACAN02_BIT}, // 03 - {TEOTIHUACAN02_BIT, TEOTIHUACAN03_BIT}, // 04 - {TEOTIHUACAN03_BIT, ZIGGURAT_BIT}, // 05 - {ZIGGURAT_BIT, ATRIUM_BIT}, // 06 - {ATRIUM_BIT, GILGAMESH_BIT}, // 07 - {GILGAMESH_BIT, BABEL_BIT}, // 08 - {BABEL_BIT, CITADEL_BIT}, // 09 - {CITADEL_BIT, LOD_BIT}, // 10 - {LOD_BIT, CATHEDRAL_BIT}, // 11 -}; - -INDEX aPathPrevNextLevelsFE[][2] = +INDEX aPathPrevNextLevels[][2] = { {HATSHEPSUT_BIT, SAND_BIT}, // 00 {SAND_BIT, RAMSES_BIT}, // 01 @@ -135,119 +78,7 @@ INDEX aPathPrevNextLevelsFE[][2] = {LUXOR_BIT, PYRAMID_BIT}, // 15 }; -PIX aPathDotsSE[][10][2] = -{ - // 00: Palenque01 - Palenque02 - { - {-1,-1}, - }, - - // 01: Palenque01 - Palenque02 - { - {211,440}, - {193,447}, - {175,444}, - {163,434}, - {152,423}, - {139,418}, - {-1,-1}, - }, - - // 02: Palenque02 - Teotihuacan01 - { - {100,372}, - {102,363}, - {108,354}, - {113,345}, - {106,338}, - {-1,-1}, - }, - - // 03: Teotihuacan01 - Teotihuacan02 - { - {153,337}, - {166,341}, - {180,346}, - {194,342}, - {207,337}, - {-1,-1}, - }, - - // 04: Teotihuacan02 - Teotihuacan03 - { - {279,339}, - {287,347}, - {296,352}, - {307,365}, - {321,367}, - {335,362}, - {-1,-1}, - }, - - // 05: Teotihuacan03 - Ziggurat - { - {-1,-1}, - }, - - // 06: Ziggurat - Atrium - { - {412,285}, - {396,282}, - {383,273}, - {368,266}, - {354,264}, - {-1,-1}, - }, - - // 07: Atrium - Gilgamesh - { - {276,255}, - {262,258}, - {248,253}, - {235,245}, - {222,240}, - {-1,-1}, - }, - - // 08: Gilgamesh - Babel - { - {152,245}, - {136,248}, - {118,253}, - {100,251}, - {85,246}, - {69,243}, - {-1,-1}, - }, - - // 09: Babel - Citadel - { - {-1,-1}, - }, - - // 10: Citadel - Lod - { - {190,130}, - {204,126}, - {215,119}, - {232,116}, - {241,107}, - {-1,-1}, - }, - - // 11: Lod - Cathedral - { - {330,108}, - {341,117}, - {353,126}, - {364,136}, - {377,146}, - {395,147}, - {-1,-1}, - }, -}; - -PIX aPathDotsFE[][10][2] = +PIX aPathDots[][10][2] = { // 00: Hatshepsut - Sand { @@ -427,92 +258,50 @@ PIX aPathDotsFE[][10][2] = BOOL ObtainMapData(void) { try { -#ifndef FIRST_ENCOUNTER - // the second encounter - atoIconsSE[ 0].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Book.tex")); - atoIconsSE[ 1].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level00.tex")); - atoIconsSE[ 2].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level01.tex")); - atoIconsSE[ 3].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level02.tex")); - atoIconsSE[ 4].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level03.tex")); - atoIconsSE[ 5].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level04.tex")); - atoIconsSE[ 6].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level05.tex")); - atoIconsSE[ 7].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level06.tex")); - atoIconsSE[ 8].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level07.tex")); - atoIconsSE[ 9].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level08.tex")); - atoIconsSE[10].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level09.tex")); - atoIconsSE[11].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level10.tex")); - atoIconsSE[12].SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\Level11.tex")); - _toPathDot .SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\PathDot.tex")); - _toMapBcgLDSE .SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\MapBcgLD.tex")); - _toMapBcgLUSE .SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\MapBcgLU.tex")); - _toMapBcgRDSE .SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\MapBcgRD.tex")); - _toMapBcgRUSE .SetData_t(CTFILENAME("TexturesMP\\Computer\\Map\\MapBcgRU.tex")); - // force constant textures - ((CTextureData*)atoIconsSE[ 0].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 1].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 2].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 3].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 4].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 5].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 6].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 7].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 8].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[ 9].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[10].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[11].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsSE[12].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toPathDot .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgLDSE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgLUSE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgRDSE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgRUSE .GetData())->Force(TEX_CONSTANT); -#else - // the first encounter - atoIconsFE[ 0].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level00.tex")); - atoIconsFE[ 1].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level01.tex")); - atoIconsFE[ 2].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level02.tex")); - atoIconsFE[ 3].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level03.tex")); - atoIconsFE[ 4].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level04.tex")); - atoIconsFE[ 5].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level05.tex")); - atoIconsFE[ 6].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level06.tex")); - atoIconsFE[ 7].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level07.tex")); - atoIconsFE[ 8].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level08.tex")); - atoIconsFE[ 9].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level09.tex")); - atoIconsFE[10].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level10.tex")); - atoIconsFE[11].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level11.tex")); - atoIconsFE[12].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level12.tex")); - atoIconsFE[13].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level13.tex")); - atoIconsFE[14].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level14.tex")); - _toPathDot .SetData_t(CTFILENAME("Textures\\Computer\\Map\\PathDot.tex")); - _toMapBcgLDFE .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgLD.tex")); - _toMapBcgLUFE .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgLU.tex")); - _toMapBcgRDFE .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgRD.tex")); - _toMapBcgRUFE .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgRU.tex")); + atoIcons[ 0].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level00.tex")); + atoIcons[ 1].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level01.tex")); + atoIcons[ 2].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level02.tex")); + atoIcons[ 3].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level03.tex")); + atoIcons[ 4].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level04.tex")); + atoIcons[ 5].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level05.tex")); + atoIcons[ 6].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level06.tex")); + atoIcons[ 7].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level07.tex")); + atoIcons[ 8].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level08.tex")); + atoIcons[ 9].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level09.tex")); + atoIcons[10].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level10.tex")); + atoIcons[11].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level11.tex")); + atoIcons[12].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level12.tex")); + atoIcons[13].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level13.tex")); + atoIcons[14].SetData_t(CTFILENAME("Textures\\Computer\\Map\\Level14.tex")); + _toPathDot .SetData_t(CTFILENAME("Textures\\Computer\\Map\\PathDot.tex")); + _toMapBcgLD .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgLD.tex")); + _toMapBcgLU .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgLU.tex")); + _toMapBcgRD .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgRD.tex")); + _toMapBcgRU .SetData_t(CTFILENAME("Textures\\Computer\\Map\\MapBcgRU.tex")); // force constant textures - ((CTextureData*)atoIconsFE[ 0].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 1].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 2].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 3].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 4].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 5].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 6].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 7].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 8].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[ 9].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[10].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[11].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[12].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[13].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)atoIconsFE[14].GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toPathDot .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgLDFE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgLUFE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgRDFE .GetData())->Force(TEX_CONSTANT); - ((CTextureData*)_toMapBcgRUFE .GetData())->Force(TEX_CONSTANT); -#endif - } - catch (const char *strError) { - CPrintF("%s\n", (const char *)strError); + ((CTextureData*)atoIcons[ 0].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 1].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 2].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 3].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 4].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 5].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 6].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 7].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 8].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[ 9].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[10].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[11].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[12].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[13].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)atoIcons[14].GetData())->Force(TEX_CONSTANT); + ((CTextureData*)_toPathDot .GetData())->Force(TEX_CONSTANT); + ((CTextureData*)_toMapBcgLD .GetData())->Force(TEX_CONSTANT); + ((CTextureData*)_toMapBcgLU .GetData())->Force(TEX_CONSTANT); + ((CTextureData*)_toMapBcgRD .GetData())->Force(TEX_CONSTANT); + ((CTextureData*)_toMapBcgRU .GetData())->Force(TEX_CONSTANT); + } + catch (char *strError) { + CPrintF("%s\n", strError); return FALSE; } return TRUE; @@ -520,43 +309,26 @@ BOOL ObtainMapData(void) void ReleaseMapData(void) { - atoIconsSE[0].SetData(NULL); - atoIconsSE[1].SetData(NULL); - atoIconsSE[2].SetData(NULL); - atoIconsSE[3].SetData(NULL); - atoIconsSE[4].SetData(NULL); - atoIconsSE[5].SetData(NULL); - atoIconsSE[6].SetData(NULL); - atoIconsSE[7].SetData(NULL); - atoIconsSE[8].SetData(NULL); - atoIconsSE[9].SetData(NULL); - atoIconsSE[10].SetData(NULL); - atoIconsSE[11].SetData(NULL); - atoIconsSE[12].SetData(NULL); - atoIconsFE[0].SetData(NULL); - atoIconsFE[1].SetData(NULL); - atoIconsFE[2].SetData(NULL); - atoIconsFE[3].SetData(NULL); - atoIconsFE[4].SetData(NULL); - atoIconsFE[5].SetData(NULL); - atoIconsFE[6].SetData(NULL); - atoIconsFE[7].SetData(NULL); - atoIconsFE[8].SetData(NULL); - atoIconsFE[9].SetData(NULL); - atoIconsFE[10].SetData(NULL); - atoIconsFE[11].SetData(NULL); - atoIconsFE[12].SetData(NULL); - atoIconsFE[13].SetData(NULL); - atoIconsFE[14].SetData(NULL); + atoIcons[0].SetData(NULL); + atoIcons[1].SetData(NULL); + atoIcons[2].SetData(NULL); + atoIcons[3].SetData(NULL); + atoIcons[4].SetData(NULL); + atoIcons[5].SetData(NULL); + atoIcons[6].SetData(NULL); + atoIcons[7].SetData(NULL); + atoIcons[8].SetData(NULL); + atoIcons[9].SetData(NULL); + atoIcons[10].SetData(NULL); + atoIcons[11].SetData(NULL); + atoIcons[12].SetData(NULL); + atoIcons[13].SetData(NULL); + atoIcons[14].SetData(NULL); _toPathDot.SetData(NULL); - _toMapBcgLDSE.SetData(NULL); - _toMapBcgLUSE.SetData(NULL); - _toMapBcgRDSE.SetData(NULL); - _toMapBcgRUSE.SetData(NULL); - _toMapBcgLDFE.SetData(NULL); - _toMapBcgLUFE.SetData(NULL); - _toMapBcgRDFE.SetData(NULL); - _toMapBcgRUFE.SetData(NULL); + _toMapBcgLD.SetData(NULL); + _toMapBcgLU.SetData(NULL); + _toMapBcgRD.SetData(NULL); + _toMapBcgRU.SetData(NULL); } void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi) @@ -567,25 +339,6 @@ void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi) return; } - PIX(*aIconCoords)[2] = map_bIsFirstEncounter ? aIconCoordsFE : aIconCoordsSE; - CTextureObject* atoIcons = map_bIsFirstEncounter ? atoIconsFE : atoIconsSE; - INDEX(*aPathPrevNextLevels)[2] = map_bIsFirstEncounter ? aPathPrevNextLevelsFE : aPathPrevNextLevelsSE; - PIX(*aPathDots)[10][2] = map_bIsFirstEncounter ? aPathDotsFE : aPathDotsSE; - - INDEX ctLevels = map_bIsFirstEncounter ? ARRAYCOUNT(aIconCoordsFE) : ARRAYCOUNT(aIconCoordsSE); - - CTextureObject* _toMapBcgLD = &_toMapBcgLDSE; - CTextureObject* _toMapBcgLU = &_toMapBcgLUSE; - CTextureObject* _toMapBcgRD = &_toMapBcgRDSE; - CTextureObject* _toMapBcgRU = &_toMapBcgRUSE; - - if(map_bIsFirstEncounter) { - _toMapBcgLD = &_toMapBcgLDFE; - _toMapBcgLU = &_toMapBcgLUFE; - _toMapBcgRD = &_toMapBcgRDFE; - _toMapBcgRU = &_toMapBcgRUFE; - } - PIX pixdpw = (PIX) pdp->GetWidth(); PIX pixdph = (PIX) pdp->GetHeight(); PIX imgw = 512; @@ -605,8 +358,9 @@ void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi) PIX pixSX = (PIX) ((pixdpw-imgw*fStretch)/2); PIX pixSY = Max( PIX((pixdph-imgh*fStretch)/2), PIX(0)); - PIX pixC1S = pixSX; // column 1 start pixel - PIX pixR1S = pixSY; // raw 1 start pixel + // render pale map bcg + PIX pixC1S = pixSX; // column 1 start pixel + PIX pixR1S = pixSY; // raw 1 start pixel PIX pixC1E = (PIX) (pixSX+256*fStretch); // column 1 end pixel PIX pixR1E = (PIX) (pixSY+256*fStretch); // raw 1 end pixel PIX pixC2S = (PIX) (pixC1E-fStretch); // column 2 start pixel @@ -614,41 +368,29 @@ void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi) PIX pixC2E = (PIX) (pixC2S+256*fStretch); // column 2 end pixel PIX pixR2E = (PIX) (pixR2S+256*fStretch); // raw 2 end pixel - if (ulLevelMask == 0x00000001 && !map_bIsFirstEncounter) { - - // render the book - //PIX pixX = (PIX) (aIconCoords[0][0]*fStretch+pixC1S); - //PIX pixY = (PIX) (aIconCoords[0][1]*fStretch+pixR1S); - CTextureObject *pto = &atoIcons[0]; - // FIXME: DG: or was the line below supposed to use pixX and pixY? - pdp->PutTexture( pto, PIXaabbox2D( PIX2D(pixC1S,pixR1S), PIX2D(pixC2E,pixR2E)), C_WHITE|255); - - } else { - - // render pale map bcg - pdp->PutTexture( _toMapBcgLU, PIXaabbox2D( PIX2D(pixC1S,pixR1S), PIX2D(pixC1E,pixR1E)), C_WHITE|255); - pdp->PutTexture( _toMapBcgRU, PIXaabbox2D( PIX2D(pixC2S,pixR1S), PIX2D(pixC2E,pixR1E)), C_WHITE|255); - pdp->PutTexture( _toMapBcgLD, PIXaabbox2D( PIX2D(pixC1S,pixR2S), PIX2D(pixC1E,pixR2E)), C_WHITE|255); - pdp->PutTexture( _toMapBcgRD, PIXaabbox2D( PIX2D(pixC2S,pixR2S), PIX2D(pixC2E,pixR2E)), C_WHITE|255); + // render pale map bcg + pdp->PutTexture( &_toMapBcgLU, PIXaabbox2D( PIX2D(pixC1S,pixR1S), PIX2D(pixC1E,pixR1E)), C_WHITE|255); + pdp->PutTexture( &_toMapBcgRU, PIXaabbox2D( PIX2D(pixC2S,pixR1S), PIX2D(pixC2E,pixR1E)), C_WHITE|255); + pdp->PutTexture( &_toMapBcgLD, PIXaabbox2D( PIX2D(pixC1S,pixR2S), PIX2D(pixC1E,pixR2E)), C_WHITE|255); + pdp->PutTexture( &_toMapBcgRD, PIXaabbox2D( PIX2D(pixC2S,pixR2S), PIX2D(pixC2E,pixR2E)), C_WHITE|255); - // render icons - for( INDEX iIcon=(!map_bIsFirstEncounter); iIconGetData())->GetPixWidth()*fStretch); - PIX pixImgH = (PIX) (((CTextureData *)pto->GetData())->GetPixHeight()*fStretch); - pdp->PutTexture( pto, PIXaabbox2D( PIX2D(pixX, pixY), PIX2D(pixX+pixImgW, pixY+pixImgH)), C_WHITE|255); - } + PIX pixX = (PIX) (aIconCoords[iIcon][0]*fStretch+pixC1S); + PIX pixY = (PIX) (aIconCoords[iIcon][1]*fStretch+pixR1S); + CTextureObject *pto = &atoIcons[iIcon]; + PIX pixImgW = (PIX) (((CTextureData *)pto->GetData())->GetPixWidth()*fStretch); + PIX pixImgH = (PIX) (((CTextureData *)pto->GetData())->GetPixHeight()*fStretch); + pdp->PutTexture( pto, PIXaabbox2D( PIX2D(pixX, pixY), PIX2D(pixX+pixImgW, pixY+pixImgH)), C_WHITE|255); } } // render paths - for( INDEX iPath=0; iPathPutTexture( &_toPathDot, PIXaabbox2D( PIX2D(pixDotX, pixDotY), PIX2D(pixDotX+8*fStretch, pixDotY+8*fStretch)), - (map_bIsFirstEncounter ? C_WHITE : C_BLACK)|255); + C_WHITE|255); } } } @@ -676,63 +418,24 @@ void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi) pdp->SetFont( _pfdDisplayFont); pdp->SetTextScaling( fStretch); pdp->SetTextAspect( 1.0f); - - INDEX iPosX, iPosY; - COLOR colText = RGBToColor(200,128,56)|CT_OPAQUE; - - if(!map_bIsFirstEncounter) { - // set coordinates and dot colors - if (ulLevelMask == 0x00000001) { - iPosX = 200; - iPosY = 330; - colText = 0x5c6a9aff; - } else { - iPosX = 395; - iPosY = 403; - colText = 0xc87832ff; - } - } - else // DG: make sure iPosX/Y is initialized - { - // no idea if 0 makes sense, but at least it's deterministic - iPosX = 0; - iPosY = 0; - } - - PIX pixhtcx = (PIX) (pixC1S+iPosX*fStretch); - PIX pixhtcy = (PIX) (pixR1S+iPosY*fStretch); - - if(map_bIsFirstEncounter) { - pixhtcx = pixC1S+116*fStretch; - pixhtcy = pixR1S+220*fStretch; - } + // set coordinates + PIX pixhtcx = (PIX) (pixC1S+116*fStretch); // hook text center x + PIX pixhtcy = (PIX) (pixR1S+220*fStretch); // hook text center y + COLOR colText = RGBToColor(200,128,56)|CT_OPAQUE; pdp->PutTextC( pphi->phi_strDescription, pixhtcx, pixhtcy, colText); for( INDEX iProgresDot=0; iProgresDot<16; iProgresDot+=1) { - if(map_bIsFirstEncounter) { - PIX pixDotX=(PIX) (pixC1S+(48+iProgresDot*8)*fStretch); - PIX pixDotY=(PIX) (pixR1S+249*fStretch); - - COLOR colDot = C_WHITE|255; - if(iProgresDot>pphi->phi_fCompleted*16) { - colDot = C_WHITE|64; - } - pdp->PutTexture( &_toPathDot, PIXaabbox2D( PIX2D(pixDotX, pixDotY), - PIX2D(pixDotX+8*fStretch, pixDotY+8*fStretch)), colDot); - } else { - PIX pixDotX=(PIX) (pixC1S+((iPosX-68)+iProgresDot*8)*fStretch); - PIX pixDotY=(PIX) (pixR1S+(iPosY+19)*fStretch); - - COLOR colDot = colText|255; - if(iProgresDot>pphi->phi_fCompleted*16) { - colDot = C_BLACK|64; - } - pdp->PutTexture( &_toPathDot, PIXaabbox2D( PIX2D(pixDotX, pixDotY), - PIX2D(pixDotX+2+8*fStretch, pixDotY+2+8*fStretch)), C_BLACK|255); - pdp->PutTexture( &_toPathDot, PIXaabbox2D( PIX2D(pixDotX, pixDotY), - PIX2D(pixDotX+8*fStretch, pixDotY+8*fStretch)), colDot); + PIX pixDotX = (PIX) (pixC1S+(48+iProgresDot*8)*fStretch); + PIX pixDotY = (PIX) (pixR1S+249*fStretch); + + COLOR colDot = C_WHITE|255; + if(iProgresDot>pphi->phi_fCompleted*16) + { + colDot = C_WHITE|64; } + pdp->PutTexture( &_toPathDot, PIXaabbox2D( PIX2D(pixDotX, pixDotY), + PIX2D(pixDotX+8*fStretch, pixDotY+8*fStretch)), colDot); } }