From 57ec4e7fa1c8c2cd19d4059693f81e8ac345b1d3 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 16 Jul 2016 12:21:22 +0000 Subject: [PATCH] Due to erroneous code, the encyclopedia feature has been deactivated. for more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23090&goto=345928&#msg_345928 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8273 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/AimMembers.cpp | 5 + Laptop/BobbyRGuns.cpp | 2 + Laptop/BriefingRoom_Data.cpp | 190 +++++++++--------- Laptop/BriefingRoom_Data.h | 1 - Laptop/Encyclopedia_Data_new.cpp | 6 + Laptop/Encyclopedia_Data_new.h | 3 + Laptop/Encyclopedia_new.cpp | 8 +- Laptop/Encyclopedia_new.h | 13 +- Laptop/laptop.cpp | 48 +++-- Laptop/mercs Files.cpp | 4 + SaveLoadGame.cpp | 2 + .../Map Screen Interface Map Inventory.cpp | 8 +- Tactical/Interface Items.cpp | 2 + Tactical/ShopKeeper Interface.cpp | 2 + Tactical/SoldierTooltips.cpp | 21 ++ 15 files changed, 194 insertions(+), 121 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index f224b947..09749c66 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -1655,8 +1655,11 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID) { PosX += WEAPONBOX_SIZE_X_NSGI; } + +#ifdef ENCYCLOPEDIA_WORKS //Moa: update encyclopedia item visibility when item gets displayed EncyclopediaSetItemAsVisible( usItem, ENC_ITEM_DISCOVERED_NOT_INSPECTABLE ); +#endif } } } @@ -1725,8 +1728,10 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID) PosX += WEAPONBOX_SIZE_X; +#ifdef ENCYCLOPEDIA_WORKS //Moa: update encyclopedia item visibility when item gets displayed EncyclopediaSetItemAsVisible( usItem, ENC_ITEM_DISCOVERED_NOT_INSPECTABLE ); +#endif } } } diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 9504f402..e0a4008e 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -2446,8 +2446,10 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, LoadBRDesc(usIndex,sText); DisplayWrappedString(BOBBYR_ITEM_DESC_START_X, usPosY, BOBBYR_ITEM_DESC_START_WIDTH, 2, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +#ifdef ENCYCLOPEDIA_WORKS //Moa: update encyclopedia item visibility when item gets displayed EncyclopediaSetItemAsVisible( usIndex, ENC_ITEM_DISCOVERED_NOT_INSPECTABLE ); +#endif } /* diff --git a/Laptop/BriefingRoom_Data.cpp b/Laptop/BriefingRoom_Data.cpp index be230af2..3fe739a9 100644 --- a/Laptop/BriefingRoom_Data.cpp +++ b/Laptop/BriefingRoom_Data.cpp @@ -18,11 +18,6 @@ #endif - - - - - #define MAX_FILTR_LOCATION_BUTTONS 11 #define FILTR_INVENTORY_BUTTONS 5 #define FILTR_BUTTONS_CHARACTER 8 @@ -31,11 +26,15 @@ UINT32 gFiltrBox = -1; + +#ifdef ENCYCLOPEDIA_WORKS INT32 guiEncyclopediaLocationPageButton[3] = { -1,-1,-1 }; INT32 guiEncyclopediaLocationPageButtonImage = -1; INT32 guiEncyclopediaPageButton[3] = { -1,-1,-1 }; INT32 guiEncyclopediaiPageButtonImage = -1; UINT32 guiEncyclopediaPopUp; +#endif + INT32 ID = 0; INT32 IDimage = 0; INT32 MaxImages = 1; @@ -74,8 +73,12 @@ void InitData ( BOOLEAN bInit ); #define ENCYCLOPEDIA_IMAGE_X LAPTOP_SCREEN_UL_X #define ENCYCLOPEDIA_IMAGE_Y iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y #define ENCYCLOPEDIA_FILTR_BUTTON_GAP 16 + +#ifdef ENCYCLOPEDIA_WORKS void SelectEncyclopediaLocationPageRegionCallBack(GUI_BUTTON * btn, INT32 reason ); void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ); +#endif + void SelectFiltrButtonsRegionCallBack(GUI_BUTTON * btn, INT32 reason ); //void BtnEncyclopediaTogglesCallback( GUI_BUTTON *btn, INT32 reason ); @@ -91,8 +94,9 @@ void UnLoadMenuButtons (); #define MAX_NUMBER_OF_OPTION_TOGGLES 5 -//UINT32 guiEncyclopediaToggles[ MAX_NUMBER_OF_OPTION_TOGGLES ]; +#ifdef ENCYCLOPEDIA_WORKS MOUSE_REGION gSelectedEncyclopediaTextRegion[ MAX_FILTR_LOCATION_BUTTONS ]; +#endif BOOLEAN bBriefingRoom = FALSE; BOOLEAN bBriefingRoomSpecialMission = FALSE; @@ -197,56 +201,13 @@ BOOLEAN DisplayEncyclopediaLocationText() return(TRUE); } -void GameInitEncyclopediaLocation() -{/* - UINT32 typeSize = 0,total = 0; - CHAR buffer[150]; - - typeSize = sizeof (BRIEFINGROOM_M_DATA); - //backup data - total += sizeof(gEncyclopediaLocationDataBackup); - total += sizeof(gEncyclopediaProfilesDataBackup); - total += sizeof(gEncyclopediaInventoryDataBackup); - total += sizeof(gEncyclopediaOldProfilesDataBackup); - total += sizeof(gEncyclopediaQuestsDataBackup); - //actual data - total += sizeof(gEncyclopediaLocationData); - total += sizeof(gEncyclopediaProfilesData); - total += sizeof(gEncyclopediaInventoryData); - total += sizeof(gEncyclopediaOldProfilesData); - total += sizeof(gEncyclopediaQuestsData); - //save data - total += sizeof(saveEncyclopediaLocationData); - total += sizeof(saveEncyclopediaProfilesData); - total += sizeof(saveEncyclopediaInventoryData); - total += sizeof(saveEncyclopediaOldProfilesData); - total += sizeof(saveEncyclopediaQuestsData); - //working data - total += sizeof(gbriefingRoomDataTemp); - total /= 1024*1024; - sprintf(buffer,"Memory usage by Encyclopedia: %d MegaBytes\n",total); - OutputDebugString( buffer ); - int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - - // Turn on leak-checking bit. - tmpFlag |= _CRTDBG_LEAK_CHECK_DF; - - // Turn off CRT block checking bit. - tmpFlag &= ~_CRTDBG_CHECK_CRT_DF; - - // Set flag to the new value. - _CrtSetDbgFlag( tmpFlag ); - - DumpMemoryInfoIntoFile( "ExtremeMemoryDump.txt", FALSE );*/ -} - void ResetTemp() { #ifdef ENABLE_BRIEFINGROOM -UINT32 i,NUM_TEMP; + UINT32 i,NUM_TEMP; - NUM_TEMP = NUM_MISSION; + NUM_TEMP = NUM_MISSION; for(i=0; i 1 ) @@ -811,8 +788,9 @@ void RenderEncyclopediaLocation( BOOLEAN bHidden ) //Reset if ( ResetVal == TRUE ) - DisableButton( guiEncyclopediaPageButton[1] ); - + DisableButton( guiEncyclopediaPageButton[1] ); +#endif + if ( gbriefingRoomDataTemp[LocationID].CheckMission == MISSIONSTART || gbriefingRoomDataTemp[LocationID].CheckMission == MISSIONEND ) DisableButton ( guiSoundButtons[1] ); else if ( gbriefingRoomDataTemp[LocationID].CheckMission == MISSIONNOSTARTED ) @@ -844,9 +822,11 @@ void SelectEncyclopediaLocationPageRegionCallBack(GUI_BUTTON * btn, INT32 reason { ID++; +#ifdef ENCYCLOPEDIA_WORKS if ( ID == ENCYCLOPEDIA_PAGE || ID > ENCYCLOPEDIA_PAGE ) DisableButton( guiEncyclopediaPageButton[2] ); if ( ID > 0 ) EnableButton( guiEncyclopediaPageButton[0] ); - +#endif + RenderEncyclopediaLocation(FALSE); RenderMap(); } @@ -854,8 +834,11 @@ void SelectEncyclopediaLocationPageRegionCallBack(GUI_BUTTON * btn, INT32 reason { ID--; //if ( ID < 0 ) ID = 0; + +#ifdef ENCYCLOPEDIA_WORKS if ( ID == 0 ) DisableButton( guiEncyclopediaPageButton[0] ); if ( ID < ENCYCLOPEDIA_PAGE ) EnableButton( guiEncyclopediaPageButton[2] ); +#endif RenderEncyclopediaLocation(FALSE); RenderMap(); } @@ -898,9 +881,11 @@ void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ) LocationID = IDNewLocation; +#ifdef ENCYCLOPEDIA_WORKS if ( IDNewLocation == MaxLocation - 1 || IDNewLocation == -1 ) DisableButton( guiEncyclopediaLocationPageButton[2] ); if ( IDNewLocation > 0 ) EnableButton( guiEncyclopediaLocationPageButton[0] ); - +#endif + IDimage = 0; RenderEncyclopediaLocation(FALSE); @@ -909,11 +894,13 @@ void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ) if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) RenderButtonDisabled4(); +#ifdef ENCYCLOPEDIA_WORKS if ( MaxImages == -1 || MaxImages == 0 || MaxImages == 1 ) DisableButton( guiEncyclopediaPageButton[1] ); else EnableButton( guiEncyclopediaPageButton[1] ); - +#endif + if( uiSoundSampleBR!=NO_SAMPLE ) { SoundStop( uiSoundSampleBR ); @@ -930,26 +917,30 @@ void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ) LocationID = IDNewLocation; +#ifdef ENCYCLOPEDIA_WORKS if ( IDNewLocation == 0 || IDNewLocation == -1 ) DisableButton( guiEncyclopediaLocationPageButton[0] ); if ( IDNewLocation < MaxLocation-1) EnableButton( guiEncyclopediaLocationPageButton[2] ); - +#endif + IDimage = 0; RenderEncyclopediaLocation(FALSE); RenderButtonDisabled2(); - if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) - RenderButtonDisabled4(); - - if ( MaxImages == -1 || MaxImages == 0 || MaxImages == 1 ) - DisableButton( guiEncyclopediaPageButton[1] ); - else - EnableButton( guiEncyclopediaPageButton[1] ); - - if( uiSoundSampleBR!=NO_SAMPLE ) - { - SoundStop( uiSoundSampleBR ); - } + if ( ENCYCLOPEDIA_PAGE == -1 || ENCYCLOPEDIA_PAGE == 0 ) + RenderButtonDisabled4(); + +#ifdef ENCYCLOPEDIA_WORKS + if ( MaxImages == -1 || MaxImages == 0 || MaxImages == 1 ) + DisableButton( guiEncyclopediaPageButton[1] ); + else + EnableButton( guiEncyclopediaPageButton[1] ); +#endif + + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } RenderMap(); @@ -958,27 +949,28 @@ void SelectEncyclopediaLocationRegionCallBack(GUI_BUTTON * btn, INT32 reason ) { //ExitEncyclopediaLocation(); - if( uiSoundSampleBR!=NO_SAMPLE ) - { - SoundStop( uiSoundSampleBR ); - } + if( uiSoundSampleBR!=NO_SAMPLE ) + { + SoundStop( uiSoundSampleBR ); + } if ( bBriefingRoom == TRUE || bBriefingRoomSpecialMission == TRUE ) { if(!fFirstTimeInEncyclopediaLocation) guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; } +#ifdef ENCYCLOPEDIA_WORKS else { if(!fFirstTimeInEncyclopediaLocation) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; } +#endif } - } } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - } #endif // ENABLE_BRIEFINGROOM } diff --git a/Laptop/BriefingRoom_Data.h b/Laptop/BriefingRoom_Data.h index 4cef5bbe..ee329922 100644 --- a/Laptop/BriefingRoom_Data.h +++ b/Laptop/BriefingRoom_Data.h @@ -3,7 +3,6 @@ #include "Quests.h" -void GameInitEncyclopediaLocation(); BOOLEAN EnterEncyclopediaLocation(); void ExitEncyclopediaLocation(); void HandleEncyclopediaLocation(); diff --git a/Laptop/Encyclopedia_Data_new.cpp b/Laptop/Encyclopedia_Data_new.cpp index b29860c1..dfe28a5b 100644 --- a/Laptop/Encyclopedia_Data_new.cpp +++ b/Laptop/Encyclopedia_Data_new.cpp @@ -32,6 +32,7 @@ #include "Quests.h" #endif +#ifdef ENCYCLOPEDIA_WORKS /** @ingroup ENCYCLOPEDIA * @file * Encyclopedia data page in laptop. @@ -65,8 +66,11 @@ struct ENC_DATA_ENTRY_T { UINT8 uiTextPage; ///< Current text page. Number of pages is currently 2 as there is no use for more at the moment. To define different pages modify \ref CreateData() and \ref BtnEncyclopedia_Data_NextPreviousTextBtnCallBack() accordingly. } gstEncyclopediaDataEntry; ///< Current data. +#endif + UINT8 gbEncyclopediaData_ItemVisible[MAXITEMS];///< Visibility of items. If an item should be visible the value is not 0. Gets loaded from savegame, updated by \ref EncyclopediaSetItemAsVisible() and reset by \ref EncyclopediaInitItemsVisibility(). +#ifdef ENCYCLOPEDIA_WORKS /// Various filters for locations. Only filtered locations are shown. Subfilters, if any, are handled by callback function. enum ENC_DATA_FILTER_LOCATION { ENC_DATA_FILTER_L_ALL = 0, ///< All locations visible @@ -1728,3 +1732,5 @@ void RenderEncyclopediaData_NEW( ) } /** @} */ + +#endif diff --git a/Laptop/Encyclopedia_Data_new.h b/Laptop/Encyclopedia_Data_new.h index 5bb63ccf..b525e0ea 100644 --- a/Laptop/Encyclopedia_Data_new.h +++ b/Laptop/Encyclopedia_Data_new.h @@ -3,6 +3,7 @@ #include "Item Types.h" +#ifdef ENCYCLOPEDIA_WORKS #define ENC_NUM_DATAPAGES MAXITEMS @@ -13,3 +14,5 @@ extern BOOLEAN EnterEncyclopediaData_NEW( ); extern BOOLEAN ExitEncyclopediaData_NEW( ); #endif + +#endif diff --git a/Laptop/Encyclopedia_new.cpp b/Laptop/Encyclopedia_new.cpp index a21e2739..983d56b9 100644 --- a/Laptop/Encyclopedia_new.cpp +++ b/Laptop/Encyclopedia_new.cpp @@ -53,9 +53,10 @@ //#include "Campaign Types.h" //#include "Quests.h" //#include "Tactical Save.h" - //#include "Encyclopedia_Data_new.h" + #include "Encyclopedia_Data_new.h" #endif +#ifdef ENCYCLOPEDIA_WORKS /** @defgroup ENCYCLOPEDIA Encyclopedia * Encyclopedia shows discovered places, characters, known items and quests. */ @@ -352,6 +353,8 @@ void EncyclopediaInitItemsVisibility() memset( gbEncyclopediaData_ItemVisible, ENC_ITEM_NOT_DISCOVERED, MAXITEMS*sizeof(UINT8) ); } +#endif + /** * @brief Saves Item visibility array to file. * @@ -381,6 +384,7 @@ BOOLEAN LoadEncyclopediaItemVisibility( HWFILE hFile ) } ///@} +#ifdef ENCYCLOPEDIA_WORKS /** * @brief Prepares a change to a different subpage. * Subpages currently available: Loactions, Characters, Items, Quests. @@ -460,3 +464,5 @@ void BtnEncyclopedia_newSelectDataPageRegionCallBack( MOUSE_REGION * pRegion, IN } } #endif + +#endif diff --git a/Laptop/Encyclopedia_new.h b/Laptop/Encyclopedia_new.h index 4a5e3119..14ee931d 100644 --- a/Laptop/Encyclopedia_new.h +++ b/Laptop/Encyclopedia_new.h @@ -1,6 +1,8 @@ #ifndef __Encyclopedia_new_H #define __Encyclopedia_new_H +#ifdef ENCYCLOPEDIA_WORKS + /// For switching between data sub pages. enum ENC_SUBPAGE_T { ENC_MAINPAGE = 0, @@ -20,18 +22,23 @@ ENC_ITEM_DISCOVERED_NOT_INSPECTABLE, ///< item is visible in encyclopedia if ext ENC_ITEM_DISCOVERED_INSPECTABLE, ///< item is visible in encyclopedia if external option allows inspectable items to be added as discovered. Item is potentially reachable and can be inspected. example: discovering from a dealers inventory, discovering from sector stash. ENC_ITEM_DISCOVERED ///< item is visible in encyclopedia. Item can be fully inspected. example: item is in merc inventory. }; -extern UINT8 gbEncyclopediaData_ItemVisible[]; + extern void EncyclopediaInitItemsVisibility(); extern void EncyclopediaSetItemAsVisible( UINT16 itemIndex, ENC_ITEM_VISIBILITY_T visibility ); -extern BOOLEAN LoadEncyclopediaItemVisibility( HWFILE hFile ); -extern BOOLEAN SaveEncyclopediaItemVisibility( HWFILE hFile ); +#endif +extern UINT8 gbEncyclopediaData_ItemVisible[]; +BOOLEAN LoadEncyclopediaItemVisibility( HWFILE hFile ); +BOOLEAN SaveEncyclopediaItemVisibility( HWFILE hFile ); + +#ifdef ENCYCLOPEDIA_WORKS extern void GameInitEncyclopedia_NEW( ); extern void HandleEncyclopedia_NEW( ); extern void RenderEncyclopedia_NEW( ); extern BOOLEAN EnterEncyclopedia_NEW( ); extern BOOLEAN ExitEncyclopedia_NEW( ); +#endif #endif diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index eacddc13..39efc43f 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -788,11 +788,14 @@ UINT32 LaptopScreenInit() GameInitFiles(); GameInitPersonnel(); +#ifdef ENCYCLOPEDIA_WORKS //legion /* GameInitEncyclopedia(); GameInitEncyclopediaLocation();*/ GameInitEncyclopedia_NEW(); GameInitEncyclopediaData_NEW(); +#endif + GameInitBriefingRoom(); GameInitBriefingRoomEnter(); @@ -1046,8 +1049,10 @@ INT32 EnterLaptop() { SetBookMark( AIM_BOOKMARK ); +#ifdef ENCYCLOPEDIA_WORKS if ( gGameExternalOptions.gEncyclopedia ) SetBookMark( ENCYCLOPEDIA_BOOKMARK ); +#endif if ( gGameExternalOptions.gBriefingRoom ) SetBookMark( BRIEFING_ROOM_BOOKMARK ); @@ -1258,9 +1263,10 @@ void RenderLaptop() switch( guiCurrentLaptopMode ) { case( LAPTOP_MODE_NONE ): - DrawDeskTopBackground( ); - break; + DrawDeskTopBackground( ); + break; +#ifdef ENCYCLOPEDIA_WORKS case LAPTOP_MODE_ENCYCLOPEDIA: //LEGION // RenderEncyclopedia(); RenderEncyclopedia_NEW(); @@ -1270,6 +1276,7 @@ void RenderLaptop() // RenderEncyclopediaLocation(FALSE); RenderEncyclopediaData_NEW(); break; +#endif case LAPTOP_MODE_BRIEFING_ROOM_PAGE: RenderBriefingRoom(); @@ -1638,14 +1645,16 @@ void EnterNewLaptopMode() if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_MINIMIZED ) { - if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_DATA || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) - { - guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; - } - else if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) + if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) { guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; } +#ifdef ENCYCLOPEDIA_WORKS + else if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_DATA || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) + { + guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; + } +#endif // minized, maximized if( fMaximizingProgram == FALSE ) @@ -1733,6 +1742,7 @@ void EnterNewLaptopMode() //Initialize the new mode. switch( guiCurrentLaptopMode ) { +#ifdef ENCYCLOPEDIA_WORKS //legion case LAPTOP_MODE_ENCYCLOPEDIA: // EnterEncyclopedia(); @@ -1743,6 +1753,7 @@ void EnterNewLaptopMode() // EnterEncyclopediaLocation(); EnterEncyclopediaData_NEW(); break; +#endif case LAPTOP_MODE_BRIEFING_ROOM_PAGE: EnterBriefingRoom(); @@ -1999,6 +2010,7 @@ void HandleLapTopHandles() switch( guiCurrentLaptopMode ) { +#ifdef ENCYCLOPEDIA_WORKS //legion case LAPTOP_MODE_ENCYCLOPEDIA: // HandleEncyclopedia(); @@ -2009,6 +2021,7 @@ void HandleLapTopHandles() // HandleEncyclopediaLocation(); HandleEncyclopediaData_NEW(); break; +#endif case LAPTOP_MODE_BRIEFING_ROOM_PAGE: HandleBriefingRoom(); @@ -2587,7 +2600,7 @@ UINT32 ExitLaptopMode(UINT32 uiMode) switch( uiMode ) { - +#ifdef ENCYCLOPEDIA_WORKS case LAPTOP_MODE_ENCYCLOPEDIA: ExitEncyclopedia_NEW(); // ExitEncyclopedia(); @@ -2598,7 +2611,8 @@ UINT32 ExitLaptopMode(UINT32 uiMode) // ExitEncyclopediaLocation(); ExitEncyclopediaData_NEW(); break; - +#endif + case LAPTOP_MODE_BRIEFING_ROOM_PAGE: ExitBriefingRoom(); break; @@ -4195,6 +4209,7 @@ void GoToWebPage(INT32 iPageId ) //LEGION case ENCYCLOPEDIA_BOOKMARK: +#ifdef ENCYCLOPEDIA_WORKS guiCurrentWWWMode=LAPTOP_MODE_ENCYCLOPEDIA; guiCurrentLaptopMode=LAPTOP_MODE_ENCYCLOPEDIA; @@ -4211,6 +4226,7 @@ void GoToWebPage(INT32 iPageId ) fLoadPendingFlag = TRUE; fFastLoadFlag = TRUE; } +#endif break; case BRIEFING_ROOM_BOOKMARK: @@ -5920,16 +5936,16 @@ void SetCurrentToLastProgramOpened( void ) break; case( LAPTOP_PROGRAM_WEB_BROWSER ): // last www mode - if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_DATA || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) - { - guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; - } - else if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) + if ( guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentLaptopMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) { guiCurrentLaptopMode = LAPTOP_MODE_BRIEFING_ROOM_ENTER; } - //else if( guiCurrentWWWMode != 0 && ( guiCurrentWWWMode == LAPTOP_MODE_ENCYCLOPEDIA_LOCATION || guiCurrentWWWMode == LAPTOP_MODE_ENCYCLOPEDIA || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM_PAGE || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM || guiCurrentWWWMode == LAPTOP_MODE_BRIEFING_ROOM_ENTER ) ) - +#ifdef ENCYCLOPEDIA_WORKS + else if ( guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA_DATA || guiCurrentLaptopMode == LAPTOP_MODE_ENCYCLOPEDIA ) + { + guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA; + } +#endif else if( guiCurrentWWWMode >= LAPTOP_MODE_FINANCES && guiCurrentWWWMode <= LAPTOP_MODE_BOBBYR_SHIPMENTS ) { guiCurrentLaptopMode = guiCurrentWWWMode; diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 1386bf49..864180cd 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1691,10 +1691,14 @@ BOOLEAN DisplayMERCMercsInventory(UINT8 ubMercID) { PosX += MERC_WEAPONBOX_SIZE_X_NSGI; } + +#ifdef ENCYCLOPEDIA_WORKS //Moa: update encyclopedia item visibility when item gets displayed EncyclopediaSetItemAsVisible( usItem, ENC_ITEM_DISCOVERED_NOT_INSPECTABLE ); +#endif } } + return(TRUE); } //JMich_MMG: Creating the mouseregion for tooltips diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index d40ea273..bdabd2e8 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -6085,8 +6085,10 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) LoadGameFilePosition( FileGetPos( hFile), "Encyclopedia item visibility" ); #endif } +#ifdef ENCYCLOPEDIA_WORKS else EncyclopediaInitItemsVisibility(); +#endif if( guiCurrentSaveGameVersion >= CAMPAIGNSTATS ) { diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 3f0c244c..dff90d6d 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -635,15 +635,21 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) ) ) { //Shade the item, but only if it is an active item! - if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true) { + if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true) + { DrawHatchOnInventory( guiSAVEBUFFER, sX, sY, MAP_INVEN_SLOT_WIDTH, MAP_INVEN_SLOT_IMAGE_HEIGHT ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: set encyclopedia item visibility (not reachable) EncyclopediaSetItemAsVisible( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } } +#ifdef ENCYCLOPEDIA_WORKS //Moa: set encyclopedia item visibility (reachable) else if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true ) EncyclopediaSetItemAsVisible( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.usItem, ENC_ITEM_DISCOVERED_NOT_INSPECTABLE ); +#endif // Flugente: militia equipment if( gGameExternalOptions.fMilitiaUseSectorInventory && ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].usFlags & WORLD_ITEM_TABOO_FOR_MILITIA_EQ_ALL ) ) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 86e263cd..c8cdeda0 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -3748,8 +3748,10 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec RestoreExternBackgroundRect( sX, sY, sWidth, sHeight ); } +#ifdef ENCYCLOPEDIA_WORKS //Moa: set encyclopedia item visibility EncyclopediaSetItemAsVisible( pItem->uiIndex, ENC_ITEM_DISCOVERED ); +#endif } SetFont( ITEM_FONT ); diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 0024d822..2f97e0d8 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -2830,8 +2830,10 @@ UINT32 DisplayInvSlot( UINT16 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT //blt the item BltVideoObjectOutlineFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), g_bUsePngItemImages ? 0 : pItem->ubGraphicNum, sCenX, sCenY, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), fHighlighted ); +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility EncyclopediaSetItemAsVisible( usItemIndex, ENC_ITEM_DISCOVERED_INSPECTABLE ); +#endif //Display the status of the item DrawItemUIBarEx( pItemObject, 0, (INT16)(usPosX+2), (INT16)(usPosY+2+20), 2, 20, Get16BPPColor( FROMRGB( 140, 136, 119 ) ), Get16BPPColor( FROMRGB( 140, 136, 119 ) ), TRUE, guiRENDERBUFFER );//guiSAVEBUFFER diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index e7703b8c..76baa4b0 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -311,23 +311,32 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) if ( gGameExternalOptions.fEnableSoldierTooltipHelmet ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_HELMET], pStrInfo, pSoldier->inv[HELMETPOS].usItem ? ItemNames[ pSoldier->inv[HELMETPOS].usItem ] : gzTooltipStrings[STR_TT_NO_HELMET] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[HELMETPOS].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[HELMETPOS].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } if ( gGameExternalOptions.fEnableSoldierTooltipVest ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_VEST], pStrInfo, pSoldier->inv[VESTPOS].usItem ? ItemNames[ pSoldier->inv[VESTPOS].usItem ] : gzTooltipStrings[STR_TT_NO_VEST] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[VESTPOS].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[VESTPOS].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } if ( gGameExternalOptions.fEnableSoldierTooltipLeggings ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_LEGGINGS], pStrInfo, pSoldier->inv[LEGPOS].usItem ? ItemNames[ pSoldier->inv[LEGPOS].usItem ] : gzTooltipStrings[STR_TT_NO_LEGGING] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[LEGPOS].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[LEGPOS].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } } else @@ -380,9 +389,12 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_NVG], pStrInfo, iNVG ? ItemNames[ pSoldier->inv[ iNVG ].usItem ] : gzTooltipStrings[STR_TT_NO_NVG] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( iNVG ) EncyclopediaSetItemAsVisible( pSoldier->inv[ iNVG ].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } else { @@ -397,16 +409,22 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) if ( gGameExternalOptions.fEnableSoldierTooltipHeadItem1 ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_HEAD_POS_1], pStrInfo, ItemNames[ pSoldier->inv[HEAD1POS].usItem ] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[HEAD1POS].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[ HEAD1POS ].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } if ( gGameExternalOptions.fEnableSoldierTooltipHeadItem2 ) { swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_HEAD_POS_2], pStrInfo, ItemNames[ pSoldier->inv[HEAD2POS].usItem ] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[HEAD2POS].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[ HEAD2POS ].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } } // head slots info code block end @@ -529,9 +547,12 @@ void DisplayWeaponInfo( SOLDIERTYPE* pSoldier, CHAR16* pStrInfo, UINT8 ubSlot, U // display exact weapon model swprintf( pStrInfo, gzTooltipStrings[STR_TT_CAT_WEAPON], pStrInfo, WeaponInHand( pSoldier ) ? ItemNames[ pSoldier->inv[ubSlot].usItem ] : gzTooltipStrings[STR_TT_NO_WEAPON] ); + +#ifdef ENCYCLOPEDIA_WORKS //Moa: encyclopedia item visibility if ( pSoldier->inv[ubSlot].usItem ) EncyclopediaSetItemAsVisible( pSoldier->inv[ ubSlot ].usItem, ENC_ITEM_DISCOVERED_NOT_REACHABLE ); +#endif } else {