diff --git a/GameVersion.cpp b/GameVersion.cpp index 1ccb797a..9d35f5e5 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8529 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8529 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8529 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8529 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8529 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8529 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8529 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.8528 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8529 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 18.02.25" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 18.02.27" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Laptop/Intelmarket.cpp b/Laptop/Intelmarket.cpp new file mode 100644 index 00000000..6cb40877 --- /dev/null +++ b/Laptop/Intelmarket.cpp @@ -0,0 +1,740 @@ +/** +* @file +* @author Flugente (bears-pit.com) +*/ + +#ifdef PRECOMPILEDHEADERS +#include "Laptop All.h" +#else +#include "laptop.h" +#include "insurance.h" +#include "insurance Contract.h" +#include "WCheck.h" +#include "Utilities.h" +#include "WordWrap.h" +#include "Cursors.h" +#include "Line.h" +#include "Insurance Text.h" +#include "Encrypted File.h" +#include "Text.h" +#include "Multi Language Graphic Utils.h" +#include "Intelmarket.h" +#include "random.h" +#include "Interface.h" +#include "Soldier Add.h" +#include "Soldier Profile.h" +#include "DropDown.h" +#include "Overhead.h" +#include "Map Screen Interface.h" +#include "DynamicDialogue.h" +#include "Assignments.h" +#include "Town Militia.h" +#include "Game Clock.h" +#include "LuaInitNPCs.h" +#include "Game Event Hook.h" +#endif + +#define MERCOMP_FONT_COLOR 2 +#define CAMPHIS_FONT_COLOR_RED FONT_MCOLOR_RED +#define CAMPHIS_FONT_BIG FONT14ARIAL +#define CAMPHIS_FONT_MED FONT12ARIAL +#define CAMPHIS_FONT_SMALL FONT10ARIAL + +#define MERCOMP_FONT_SHADOW FONT_MCOLOR_WHITE + +#define CAMPAIGN_HISTORY_LINK_START_X LAPTOP_SCREEN_UL_X +#define CAMPAIGN_HISTORY_LINK_START_Y LAPTOP_SCREEN_WEB_UL_Y + 5 +#define CAMPAIGN_HISTORY_LINK_TEXT_WIDTH 130 +#define CAMPAIGN_HISTORY_LINK_STEP_Y 14 + +#define BACKGROUND_WIDTH 125 +#define CAMPAIGN_HISTORY_BACKGROUND_HEIGHT 100 + +#define CAMPAIGN_HISTORY_BIG_TITLE_X LAPTOP_SCREEN_UL_X + CAMPAIGN_HISTORY_LINK_TEXT_WIDTH + 10 +#define CAMPAIGN_HISTORY_BIG_TITLE_Y 10 + LAPTOP_SCREEN_WEB_UL_Y + +#define CAMPAIGN_HISTORY_SUBTITLE_X CAMPAIGN_HISTORY_BIG_TITLE_X +#define CAMPAIGN_HISTORY_SUBTITLE_Y CAMPAIGN_HISTORY_BIG_TITLE_Y + 20 + +#define NUM_LINKS 3 +#define MCA_START_CONTENT_Y (LAPTOP_SCREEN_WEB_UL_Y + NUM_LINKS * 17) + + +extern UINT32 guiInsuranceBackGround; +extern UINT32 guiInsuranceSmallTitleImage; +extern UINT32 guiInsuranceBigRedLineImage; +extern UINT32 guiMercCompareBulletImage; +extern UINT32 guiMercCompareLogoImage; + +//link to the various pages +MOUSE_REGION gMercCompareLinkRegion_IM[NUM_LINKS]; + +void SelectLinkRegionCallBack_IM( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if ( iReason & MSYS_CALLBACK_REASON_INIT ) + { + } + else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT32 uiLink = MSYS_GetRegionUserData( pRegion, 0 ); + + if ( uiLink == 0 ) + guiCurrentLaptopMode = LAPTOP_MODE_INTELMARKET_BUYINFO; + else if ( uiLink == 1 ) + guiCurrentLaptopMode = LAPTOP_MODE_INTELMARKET_SELLINFO; + else if ( uiLink == 2 ) + guiCurrentLaptopMode = LAPTOP_MODE_INTELMARKET_ABOUT; + } + else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + } +} + +void InitDefaults_IM() +{ + VOBJECT_DESC VObjectDesc; + + // load the Insurance bullet graphic and add it + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "LAPTOP\\bullet.sti", VObjectDesc.ImageFile ); + CHECKV( AddVideoObject( &VObjectDesc, &guiMercCompareBulletImage ) ); + + // load the Flower Account Box graphic and add it + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "LAPTOP\\BackGroundTile.sti", VObjectDesc.ImageFile ); + CHECKV( AddVideoObject( &VObjectDesc, &guiInsuranceBackGround ) ); + + // load the red bar on the side of the page and add it + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "LAPTOP\\LargeBar.sti", VObjectDesc.ImageFile ); + CHECKV( AddVideoObject( &VObjectDesc, &guiInsuranceBigRedLineImage ) ); + + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "LAPTOP\\PressLogos.sti", VObjectDesc.ImageFile ); + CHECKV( AddVideoObject( &VObjectDesc, &guiMercCompareLogoImage ) ); + + UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X; + UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y; + for ( int i = 0; i void DropDownTemplate::SetRefresh() { fIntelRedraw = TRUE; } + +CHAR16 gIntelBuyMapPartNamesStr[16][64]; + +INT32 gIntelBuyButton[2] = { -1, -1 }; +BOOLEAN gIntelBuyButtonCreated[2] = { FALSE, FALSE }; + +void BuyLinkRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if ( iReason & MSYS_CALLBACK_REASON_INIT ) + { + } + else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + INT32 intelinfo = MSYS_GetRegionUserData( pRegion, 0 ); + INT32 intelcost = MSYS_GetRegionUserData( pRegion, 1 ); + + if ( intelinfo > -1 && GetIntel() >= intelcost ) + { + BuyIntelInfo( intelinfo ); + AddIntel( -intelcost, TRUE ); + + GetIntelInfoOfferings( sIntelInfo ); + + fIntelRedraw = TRUE; + } + } + else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + } +} + +void IntelBuyButtonCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= ( BUTTON_CLICKED_ON ); + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if ( btn->uiFlags & BUTTON_CLICKED_ON ) + { + btn->uiFlags &= ~( BUTTON_CLICKED_ON ); + + INT16 mapregion = DropDownTemplate::getInstance().GetSelectedEntryKey(); + + int intelcost = 50; + if ( btn->IDNum == gIntelBuyButton[1] ) + intelcost = 70; + + if ( GetIntel() >= intelcost ) + { + AddIntel( -intelcost, TRUE ); + + LaptopSaveInfo.usMapIntelFlags |= 1 << mapregion; + + // if we buy an advanced scan, also add seond flag + if ( btn->IDNum == gIntelBuyButton[1] ) + LaptopSaveInfo.usMapIntelFlags |= 1 << ( 16 + mapregion ); + + fIntelRedraw = TRUE; + } + } + } +} + +void EnterIntelmarket() +{ + InitDefaults_IM(); + + BuildIntelInfoArray(); + GetIntelInfoOfferings( sIntelInfo ); + + fIntelRedraw = TRUE; + + HandleIntelmarket(); +} + +void ExitIntelmarket() +{ + RemoveDefaults_IM(); + + for ( int i = 0; i < INTELINFO_MAXNUMBER; ++i ) + { + if ( gIntelmarketbuyLinkRegion_Exists[i] ) + MSYS_RemoveRegion( &gIntelmarketbuyLinkRegion[i] ); + + gIntelmarketbuyLinkRegion_Exists[i] = FALSE; + } + + for ( int i = 0; i < 3; ++i ) + { + if ( gIntelBuyButtonCreated[i] ) + { + RemoveButton( gIntelBuyButton[i] ); + + gIntelBuyButtonCreated[i] = FALSE; + } + } + + DropDownTemplate::getInstance().Destroy(); +} + +void HandleIntelmarket() +{ + if ( fIntelRedraw ) + { + UINT8 count = 0; + std::vector > dropdownvector; + + for ( INT16 i = 0; i < 16; ++i ) + { + if ( !( LaptopSaveInfo.usMapIntelFlags & ( 1 << i ) ) ) + { + swprintf( gIntelBuyMapPartNamesStr[i], szIntelWebsiteText[TEXT_INTEL_MAPREGION_1 + i] ); + gIntelBuyMapPartNamesStr[i][63] = '/0'; + + dropdownvector.push_back( std::make_pair( i, gIntelBuyMapPartNamesStr[i] ) ); + } + } + + if ( !dropdownvector.empty() ) + { + DropDownTemplate::getInstance().SetEntries( dropdownvector ); + DropDownTemplate::getInstance().SetHelpText( szIntelWebsiteText[TEXT_INTEL_DROPDOWN_HELPTEXT] ); + DropDownTemplate::getInstance().Create( LAPTOP_SCREEN_UL_X, MCA_START_CONTENT_Y + 40 ); + DropDownTemplate::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); + DropDownTemplate::getInstance().SetColorMarked( Get16BPPColor( FROMRGB( 137, 16, 231 ) ) ); + } + else + { + DropDownTemplate::getInstance().ClearEntries(); + } + + RenderIntelmarket(); + + fIntelRedraw = FALSE; + } +} + +void RenderIntelmarket() +{ + CHAR16 sText[800]; + swprintf( sText, L"" ); + UINT16 usPosX, usPosY; + HVOBJECT hPixHandle; + + //Get the bullet + GetVideoObject( &hPixHandle, guiMercCompareBulletImage ); + + for ( int i = 0; i < INTELINFO_MAXNUMBER; ++i ) + { + if ( gIntelmarketbuyLinkRegion_Exists[i] ) + MSYS_RemoveRegion( &gIntelmarketbuyLinkRegion[i] ); + + gIntelmarketbuyLinkRegion_Exists[i] = FALSE; + } + + for ( int i = 0; i < 3; ++i ) + { + if ( gIntelBuyButtonCreated[i] ) + { + RemoveButton( gIntelBuyButton[i] ); + + gIntelBuyButtonCreated[i] = FALSE; + } + } + + DisplayDefaults_IM(); + + SetFontShadow( MERCOMP_FONT_SHADOW ); + + usPosX = LAPTOP_SCREEN_UL_X; + usPosY = MCA_START_CONTENT_Y; + + FLOAT budget = GetIntel(); + + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_BUDGET], (int)(budget) ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + + if ( DropDownTemplate::getInstance().HasEntries() ) + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_AIRREGION], ( (1 + GetWorldHour() / 8) * 8 ) ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + + DropDownTemplate::getInstance().Display(); + + SetFontShadow( MERCOMP_FONT_SHADOW ); + + gIntelBuyButton[0] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_AIRREGION_BUY1], CAMPHIS_FONT_MED, ( 50 <= budget ? FONT_BLACK : FONT_RED ), FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX + 140, usPosY, 150, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelBuyButtonCallback ); + gIntelBuyButtonCreated[0] = TRUE; + + gIntelBuyButton[1] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_AIRREGION_BUY2], CAMPHIS_FONT_MED, ( 70 <= budget ? FONT_BLACK : FONT_RED ), FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX + 300, usPosY, 150, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelBuyButtonCallback ); + gIntelBuyButtonCreated[1] = TRUE; + } + + usPosX = LAPTOP_SCREEN_UL_X; + usPosY = MCA_START_CONTENT_Y + 200; + + BOOLEAN anyfound = FALSE; + + for ( int cnt = 0; cnt < INTELINFO_MAXNUMBER; ++cnt ) + { + CHAR16 sIntelText[800]; + int intelcost; + + GetIntelInfoTextAndPrice( sIntelInfo[cnt], sIntelText, intelcost ); + + if ( sIntelInfo[cnt] > -2 ) + { + if ( !anyfound ) + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_TEXT_1] ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 20; + + anyfound = TRUE; + } + + // display bullet + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL ); + + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_OFFER_1], intelcost, sIntelText ); + UINT16 yoffset = DisplayWrappedString( usPosX + 25, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X - 25, 2, + CAMPHIS_FONT_MED, ( sIntelInfo[cnt] > -1 ) ? ( intelcost <= budget ? FONT_BLACK : FONT_RED ) : FONT_GRAY4, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + + if ( sIntelInfo[cnt] > -1 ) + { + MSYS_DefineRegion( &gIntelmarketbuyLinkRegion[cnt], usPosX + 25, usPosY, (UINT16)( usPosX + 25 + StringPixLength( sText, CAMPHIS_FONT_MED ) ), usPosY + yoffset, + MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, BuyLinkRegionCallBack ); + MSYS_AddRegion( &gIntelmarketbuyLinkRegion[cnt] ); + MSYS_SetRegionUserData( &gIntelmarketbuyLinkRegion[cnt], 0, sIntelInfo[cnt] ); + MSYS_SetRegionUserData( &gIntelmarketbuyLinkRegion[cnt], 1, intelcost ); + gIntelmarketbuyLinkRegion_Exists[cnt] = TRUE; + } + + usPosY += yoffset; + usPosY += 20; + } + } + + if ( !anyfound ) + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_TEXT_2] ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 20; + } + + SetFontShadow( DEFAULT_SHADOW ); + + MarkButtonsDirty(); + RenderWWWProgramTitleBar(); + InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y ); +} +////////////////////////// INTELMARKET Sell intel for stuff //////////////////////////////// + + +////////////////////////// INTELMARKET About us //////////////////////////////// +void EnterIntelmarket_About() +{ + InitDefaults_IM(); + + RenderIntelmarket_About(); +} + +void ExitIntelmarket_About() +{ + RemoveDefaults_IM(); +} + +void HandleIntelmarket_About() +{ + +} + +void RenderIntelmarket_About() +{ + CHAR16 sText[800]; + swprintf( sText, L"" ); + UINT16 usPosX, usPosY; + HVOBJECT hPixHandle; + + //Get the bullet + GetVideoObject( &hPixHandle, guiMercCompareBulletImage ); + + DisplayDefaults_IM(); + + SetFontShadow( MERCOMP_FONT_SHADOW ); + + usPosX = LAPTOP_SCREEN_UL_X; + usPosY = MCA_START_CONTENT_Y; + + for ( int i = TEXT_INTEL_ABOUTUS_1; i < TEXT_INTEL_ABOUTUS_MAX; ++i ) + { + // display bullet + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL ); + + swprintf( sText, szIntelWebsiteText[i] ); + usPosY += DisplayWrappedString( usPosX + 25, usPosY, LAPTOP_SCREEN_LR_X - ( LAPTOP_SCREEN_UL_X + 25 ), 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 4; + } + + SetFontShadow( DEFAULT_SHADOW ); + + MarkButtonsDirty(); + RenderWWWProgramTitleBar(); + InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y ); +} +////////////////////////// INTELMARKET About us //////////////////////////////// + +////////////////////////// INTELMARKET SELL //////////////////////////////// +CHAR16 gIntelPhotoTakenTextChar16[256][1000]; +CHAR16 gIntelPhotoVerifiedTextChar16[256][1000]; + +std::vector > gPhotoFactsTakenVector; +std::vector > gPhotoFactsVerifiedVector; + +INT16 gPhotoFactsCurrentTaken = -1; +INT16 gPhotoFactsCurrentVerified = -1; + +INT32 gIntelSellButton[5] = { -1, -1, -1, -1, -1 }; +BOOLEAN gIntelSellButtonCreated[5] = { FALSE, FALSE, FALSE, FALSE, FALSE }; + +void IntelSellButtonCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= ( BUTTON_CLICKED_ON ); + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if ( btn->uiFlags & BUTTON_CLICKED_ON ) + { + btn->uiFlags &= ~( BUTTON_CLICKED_ON ); + + if ( btn->IDNum == gIntelSellButton[0] ) + { + gPhotoFactsCurrentTaken -= 1; + if ( gPhotoFactsCurrentTaken < 0 ) + gPhotoFactsCurrentTaken = gPhotoFactsTakenVector.size() - 1; + } + else if ( btn->IDNum == gIntelSellButton[1] ) + { + gPhotoFactsCurrentTaken += 1; + if ( gPhotoFactsCurrentTaken >= gPhotoFactsTakenVector.size() ) + gPhotoFactsCurrentTaken = 0; + } + else if ( btn->IDNum == gIntelSellButton[2] ) + { + INT16 factid = gPhotoFactsTakenVector[gPhotoFactsCurrentTaken].first; + + if ( factid >= 0 ) + { + LuaSetPhotoState( factid, PHOTOFACT_UPLOADED ); + + AddStrategicEvent( EVENT_INTEL_PHOTOFACT_VERIFY, GetWorldTotalMin() + ( ( 2 + Random( 3 ) ) * 60 ), (UINT32)factid ); + } + } + else if ( btn->IDNum == gIntelSellButton[3] ) + { + gPhotoFactsCurrentVerified -= 1; + if ( gPhotoFactsCurrentVerified < 0 ) + gPhotoFactsCurrentVerified = gPhotoFactsVerifiedVector.size() - 1; + } + else if ( btn->IDNum == gIntelSellButton[4] ) + { + gPhotoFactsCurrentVerified += 1; + if ( gPhotoFactsCurrentVerified >= gPhotoFactsVerifiedVector.size() ) + gPhotoFactsCurrentVerified = 0; + } + + fIntelRedraw = TRUE; + } + } +} + +void AddPhotoFactTaken(UINT8 aType, INT16 asIndex, STR16 aText) +{ + switch ( aType ) + { + case PHOTOFACT_TAKEN: + { + swprintf( gIntelPhotoTakenTextChar16[asIndex], L"%s", aText ); + + gPhotoFactsTakenVector.push_back( std::make_pair( asIndex, gIntelPhotoTakenTextChar16[asIndex] ) ); + } + break; + + case PHOTOFACT_VERIFIED: + { + swprintf( gIntelPhotoVerifiedTextChar16[asIndex], L"%s", aText ); + + gPhotoFactsVerifiedVector.push_back( std::make_pair( asIndex, gIntelPhotoVerifiedTextChar16[asIndex] ) ); + } + break; + + default: + break; + } +} + +void EnterIntelmarket_Sell() +{ + InitDefaults_IM(); + + fIntelRedraw = TRUE; + + HandleIntelmarket_Sell(); +} + +void ExitIntelmarket_Sell() +{ + RemoveDefaults_IM(); + + for ( int i = 0; i < 5; ++i ) + { + if ( gIntelSellButtonCreated[i] ) + { + RemoveButton( gIntelSellButton[i] ); + gIntelSellButton[i] = -1; + gIntelSellButtonCreated[i] = FALSE; + } + } +} + +void HandleIntelmarket_Sell() +{ + if ( fIntelRedraw ) + { + // fill dropdowns + gPhotoFactsTakenVector.clear(); + gPhotoFactsVerifiedVector.clear(); + + // fill vector with list of all uploadable facts + LuaGetPhotoData( PHOTOFACT_TAKEN ); + + // fill vector with list of all verified facts + LuaGetPhotoData( PHOTOFACT_VERIFIED ); + + gPhotoFactsCurrentTaken = gPhotoFactsTakenVector.empty() ? -1 : min( gPhotoFactsCurrentTaken, gPhotoFactsTakenVector.size() - 1); + gPhotoFactsCurrentVerified = gPhotoFactsVerifiedVector.empty() ? -1 : min( gPhotoFactsCurrentVerified, gPhotoFactsVerifiedVector.size() - 1 ); + + RenderIntelmarket_Sell(); + + fIntelRedraw = FALSE; + } +} + +void RenderIntelmarket_Sell() +{ + CHAR16 sText[800]; + swprintf( sText, L"" ); + UINT16 usPosX, usPosY; + HVOBJECT hPixHandle; + + for ( int i = 0; i < 5; ++i ) + { + if ( gIntelSellButtonCreated[i] ) + { + RemoveButton( gIntelSellButton[i] ); + gIntelSellButton[i] = -1; + gIntelSellButtonCreated[i] = FALSE; + } + } + + //Get the bullet + GetVideoObject( &hPixHandle, guiMercCompareBulletImage ); + + DisplayDefaults_IM(); + + SetFontShadow( MERCOMP_FONT_SHADOW ); + + usPosX = LAPTOP_SCREEN_UL_X; + usPosY = MCA_START_CONTENT_Y; + + FLOAT budget = GetIntel(); + + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_BUDGET], (int)( budget ) ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + + if ( gPhotoFactsCurrentTaken >= 0 && !gPhotoFactsTakenVector.empty() ) + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_SELL_1] ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - usPosX, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + + gIntelSellButton[0] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_SELL_BUTTON_1], CAMPHIS_FONT_MED, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX, usPosY, 80, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelSellButtonCallback ); + gIntelSellButtonCreated[0] = TRUE; + + gIntelSellButton[1] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_SELL_BUTTON_2], CAMPHIS_FONT_MED, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX, usPosY + 20, 80, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelSellButtonCallback ); + gIntelSellButtonCreated[1] = TRUE; + + gIntelSellButton[2] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_SELL_BUTTON_3], CAMPHIS_FONT_MED, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX, usPosY + 40, 80, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelSellButtonCallback ); + gIntelSellButtonCreated[2] = TRUE; + + swprintf( sText, gPhotoFactsTakenVector[gPhotoFactsCurrentTaken].second ); + usPosY += DisplayWrappedString( usPosX + 100, usPosY, LAPTOP_SCREEN_LR_X - (usPosX + 100), 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 150; + } + else + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_SELL_NOTHING_1] ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - usPosX, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + } + + if ( gPhotoFactsCurrentVerified >= 0 && !gPhotoFactsVerifiedVector.empty() ) + { + swprintf( sText, szIntelWebsiteText[TEXT_INTEL_SELL_ALREADYGOT_1] ); + usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - usPosX, 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + + gIntelSellButton[3] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_SELL_BUTTON_1], CAMPHIS_FONT_MED, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX, usPosY, 80, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelSellButtonCallback ); + gIntelSellButtonCreated[3] = TRUE; + + gIntelSellButton[4] = CreateTextButton( szIntelWebsiteText[TEXT_INTEL_SELL_BUTTON_2], CAMPHIS_FONT_MED, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + usPosX, usPosY + 20, 80, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, IntelSellButtonCallback ); + gIntelSellButtonCreated[4] = TRUE; + + swprintf( sText, gPhotoFactsVerifiedVector[gPhotoFactsCurrentVerified].second ); + usPosY += DisplayWrappedString( usPosX + 100, usPosY, LAPTOP_SCREEN_LR_X - (usPosX + 100), 2, CAMPHIS_FONT_MED, FONT_BLACK, sText, FONT_MCOLOR_BLACK, FALSE, 0 ); + usPosY += 12; + } + + SetFontShadow( DEFAULT_SHADOW ); + + MarkButtonsDirty(); + RenderWWWProgramTitleBar(); + InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y ); +} +////////////////////////// INTELMARKET SELL //////////////////////////////// diff --git a/Laptop/Intelmarket.h b/Laptop/Intelmarket.h new file mode 100644 index 00000000..d2c5bf11 --- /dev/null +++ b/Laptop/Intelmarket.h @@ -0,0 +1,33 @@ +#ifndef __INTELMARKET_H +#define __INTELMARKET_H + +/** +* @file +* @author Flugente (bears-pit.com) +*/ + +// displays a few quotes of customers +void EnterIntelmarket(); +void ExitIntelmarket(); +void HandleIntelmarket(); +void RenderIntelmarket(); + +void EnterIntelmarket_About(); +void ExitIntelmarket_About(); +void HandleIntelmarket_About(); +void RenderIntelmarket_About(); + +void EnterIntelmarket_Sell(); +void ExitIntelmarket_Sell(); +void HandleIntelmarket_Sell(); +void RenderIntelmarket_Sell(); + +enum +{ + PHOTOFACT_NONE = 0, + PHOTOFACT_TAKEN, + PHOTOFACT_UPLOADED, + PHOTOFACT_VERIFIED, +}; + +#endif //__INTELMARKET_H diff --git a/Utils/Text.h b/Utils/Text.h index 9020d4f6..0f990a5f 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -3056,6 +3056,7 @@ enum TEXT_INTEL_SELL_BUTTON_3, TEXT_INTEL_SELL_ALREADYGOT_1, + TEXT_INTEL_SELL_NOTHING_1, }; extern STR16 szIntelWebsiteText[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index f2d2aa65..cc5bc863 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -11353,7 +11353,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 2024e2bc..4d716a74 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -11371,7 +11371,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index ba695c82..d65091cb 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11355,7 +11355,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index a25498f4..6fbb18f1 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -11353,7 +11353,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index b49f6f72..e0e3fa6e 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -11183,7 +11183,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 9527dc57..8ca16e26 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -11362,7 +11362,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 5574356b..cba1fee3 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -11375,7 +11375,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 1b15692a..c6752e37 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -11355,7 +11355,8 @@ STR16 szIntelWebsiteText[] = L"Next", L"Upload", - L"You have already received compensation for the following:" + L"You have already received compensation for the following:", + L"You have nothing to upload.", }; STR16 szIntelText[] =