New Feature: a private military company allows hiring of advanced militia. For more info, see http://www.ja-galaxy-forum.com/ubbthreads.php/topics/335279#Post335279

Does not break savegame compatibility.

Requires GameDir revision >= r2130.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7457 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-08-30 17:34:25 +00:00
parent 5fc358f70c
commit e00897b91b
40 changed files with 1613 additions and 67 deletions
+7
View File
@@ -103,6 +103,8 @@ enum definedDropDowns
DROPDOWNNR_MERCCOMPARE1,
DROPDOWNNR_MERCCOMPARE2,
DROPDOWNNR_MERCCOMPARE_SQUADSELECTION,
DROPDOWNNR_PMC_LOCATION,
};
/*
@@ -210,6 +212,11 @@ public:
*/
BOOLEAN HasEntries( ) { return !mEntryVector.empty(); }
/*
* Remove all entries
*/
void ClearEntries( ) { mSelectedEntry = 0; mEntryVector.clear( ); }
// call to open/close the drop down
void OpenDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
void CloseDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
+8
View File
@@ -650,6 +650,10 @@
RelativePath=".\personnel.h"
>
</File>
<File
RelativePath=".\PMC.h"
>
</File>
<File
RelativePath=".\PostalService.h"
>
@@ -968,6 +972,10 @@
RelativePath=".\personnel.cpp"
>
</File>
<File
RelativePath=".\PMC.cpp"
>
</File>
<File
RelativePath=".\PostalService.cpp"
>
+8
View File
@@ -650,6 +650,10 @@
RelativePath="personnel.h"
>
</File>
<File
RelativePath=".\PMC.h"
>
</File>
<File
RelativePath=".\PostalService.h"
>
@@ -970,6 +974,10 @@
RelativePath="personnel.cpp"
>
</File>
<File
RelativePath=".\PMC.cpp"
>
</File>
<File
RelativePath=".\PostalService.cpp"
>
+2
View File
@@ -101,6 +101,7 @@
<ClInclude Include="mercs No Account.h" />
<ClInclude Include="mercs.h" />
<ClInclude Include="personnel.h" />
<ClInclude Include="PMC.h" />
<ClInclude Include="PostalService.h" />
<ClInclude Include="sirtech.h" />
<ClInclude Include="Speck Quotes.h" />
@@ -182,6 +183,7 @@
<ClCompile Include="mercs No Account.cpp" />
<ClCompile Include="mercs.cpp" />
<ClCompile Include="personnel.cpp" />
<ClCompile Include="PMC.cpp" />
<ClCompile Include="PostalService.cpp" />
<ClCompile Include="sirtech.cpp" />
<ClCompile Include="Store Inventory.cpp" />
+6
View File
@@ -201,6 +201,9 @@
<ClInclude Include="personnel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PMC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PostalService.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -443,6 +446,9 @@
<ClCompile Include="personnel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PMC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PostalService.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+3 -1
View File
@@ -101,6 +101,7 @@
<ClInclude Include="mercs No Account.h" />
<ClInclude Include="mercs.h" />
<ClInclude Include="personnel.h" />
<ClInclude Include="PMC.h" />
<ClInclude Include="PostalService.h" />
<ClInclude Include="sirtech.h" />
<ClInclude Include="Speck Quotes.h" />
@@ -182,6 +183,7 @@
<ClCompile Include="mercs No Account.cpp" />
<ClCompile Include="mercs.cpp" />
<ClCompile Include="personnel.cpp" />
<ClCompile Include="PMC.cpp" />
<ClCompile Include="PostalService.cpp" />
<ClCompile Include="sirtech.cpp" />
<ClCompile Include="Store Inventory.cpp" />
@@ -194,7 +196,7 @@
<ClCompile Include="XML_Email.cpp" />
<ClCompile Include="XML_EmailMercAvailable.cpp" />
<ClCompile Include="XML_EmailMercLevelUp.cpp" />
<ClCompile Include="XML_History.cpp" />
<ClCompile Include="XML_History.cpp" />
<ClCompile Include="XML_IMPPortraits.cpp" />
<ClCompile Include="XML_OldAIMArchive.cpp" />
<ClCompile Include="XML_ShippingDestinations.cpp" />
+7 -1
View File
@@ -258,6 +258,9 @@
<ClInclude Include="WHO.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PMC.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="aim.cpp">
@@ -527,7 +530,10 @@
<ClCompile Include="WHO.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_History.cpp">
<ClCompile Include="XML_History.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PMC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
+834
View File
@@ -0,0 +1,834 @@
/**
* @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 "PMC.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 "Quests.h"
#include "finances.h"
#include "Game Clock.h"
#include "Animation Data.h"
#include "SaveLoadGame.h"
#include "GameVersion.h"
#include "message.h"
#include "Game Event Hook.h"
#include "militia control.h"
#include "Town Militia.h"
#endif
extern INT32 ReadFieldByField( HWFILE hFile, PTR pDest, UINT32 uiFieldSize, UINT32 uiElementSize, UINT32 uiCurByteCount );
std::vector<PMCReinforcesHireEvent> gPMCHiringEvents;
PMCGlobalData gPMCData;
#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 107
#define CAMPAIGN_HISTORY_LINK_STEP_Y 14
#define BACKGROUND_WIDTH 125
#define CAMPAIGN_HISTORY_BACKGROUND_HEIGHT 100
#define CAMPAIGN_HISTORY_BIG_TITLE_X 115 + LAPTOP_SCREEN_UL_X
#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 gLinkRegion_PMC[NUM_LINKS];
void SelectLinkRegionCallBack_PMC( 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_PMC_MAIN;
else if ( uiLink == 1 )
guiCurrentLaptopMode = LAPTOP_MODE_PMC_CONTRACT_MILITIA;
else if ( uiLink == 2 )
guiCurrentLaptopMode = LAPTOP_MODE_BROKEN_LINK;
}
else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP )
{
}
}
void InitDefaults_PMC( )
{
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<NUM_LINKS; ++i )
{
MSYS_DefineRegion( &gLinkRegion_PMC[i], usPosX, usPosY, (UINT16)(usPosX + CAMPAIGN_HISTORY_LINK_TEXT_WIDTH), usPosY + CAMPAIGN_HISTORY_LINK_STEP_Y, MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinkRegionCallBack_PMC );
MSYS_AddRegion( &gLinkRegion_PMC[i] );
MSYS_SetRegionUserData( &gLinkRegion_PMC[i], 0, i );
usPosY += CAMPAIGN_HISTORY_LINK_STEP_Y;
}
}
void DisplayDefaults_PMC( )
{
HVOBJECT hPixHandle;
GetVideoObject( &hPixHandle, guiMercCompareLogoImage );
SetFontShadow( MERCOMP_FONT_SHADOW );
CHAR16 sText[800];
UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X;
UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
WebPageTileBackground( 4, 4, BACKGROUND_WIDTH, CAMPAIGN_HISTORY_BACKGROUND_HEIGHT, guiInsuranceBackGround );
//Display the title slogan
swprintf( sText, szPMCWebSite[TEXT_PMC_WEBSITENAME] );
DrawTextToScreen( sText, CAMPAIGN_HISTORY_BIG_TITLE_X, CAMPAIGN_HISTORY_BIG_TITLE_Y, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, CAMPHIS_FONT_BIG, MERCOMP_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, 0 );
//Display the subtitle slogan
swprintf( sText, szPMCWebSite[TEXT_PMC_SLOGAN] );
DrawTextToScreen( sText, CAMPAIGN_HISTORY_SUBTITLE_X, CAMPAIGN_HISTORY_SUBTITLE_Y, 0, CAMPHIS_FONT_BIG, MERCOMP_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosX = CAMPAIGN_HISTORY_LINK_START_X;
usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
for ( int i = 0; i<NUM_LINKS; ++i )
{
swprintf( sText, szPMCWebSite[TEXT_PMC_SUBSITE1 + i] );
DisplayWrappedString( usPosX, usPosY, CAMPAIGN_HISTORY_LINK_TEXT_WIDTH, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosY += CAMPAIGN_HISTORY_LINK_STEP_Y;
//Display the red bar under the link at the bottom. and the text
DisplaySmallColouredLineWithShadow( usPosX, usPosY - 2, LAPTOP_SCREEN_UL_X + CAMPAIGN_HISTORY_LINK_TEXT_WIDTH, usPosY - 2, FROMRGB( 240, 240, 20 ) );
}
// closing line that separates header from individual page
DisplaySmallColouredLineWithShadow( usPosX, usPosY - 2, LAPTOP_SCREEN_LR_X, usPosY - 2, FROMRGB( 240, 240, 20 ) );
usPosX = LAPTOP_SCREEN_LR_X - 110;
usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
BltVideoObject( FRAME_BUFFER, hPixHandle, 3, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
SetFontShadow( DEFAULT_SHADOW );
}
void RemoveDefaults_PMC( )
{
DeleteVideoObjectFromIndex( guiInsuranceBackGround );
DeleteVideoObjectFromIndex( guiInsuranceBigRedLineImage );
DeleteVideoObjectFromIndex( guiMercCompareBulletImage );
DeleteVideoObjectFromIndex( guiMercCompareLogoImage );
for ( int i = 0; i<NUM_LINKS; ++i )
MSYS_RemoveRegion( &gLinkRegion_PMC[i] );
}
////////////////////////// MAIN PAGE ////////////////////////////////
BOOLEAN EnterPMCMain( )
{
InitDefaults_PMC( );
RenderPMCMain( );
return(TRUE);
}
void ExitPMCMain( )
{
RemoveDefaults_PMC( );
}
void HandlePMCMain( )
{
}
void RenderPMCMain( )
{
CHAR16 sText[800];
swprintf( sText, L"" );
UINT16 usPosX, usPosY;
DisplayDefaults_PMC( );
SetFontShadow( MERCOMP_FONT_SHADOW );
usPosX = LAPTOP_SCREEN_UL_X;
usPosY = MCA_START_CONTENT_Y;
for ( int i = TEXT_PMC_MAIN1; i < TEXT_PMC_CONTRACT_TEAM_INTRO; ++i )
{
swprintf( sText, szPMCWebSite[i] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosY += 10;
}
SetFontShadow( DEFAULT_SHADOW );
MarkButtonsDirty( );
RenderWWWProgramTitleBar( );
InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
}
////////////////////////// MAIN PAGE ////////////////////////////////
////////////////////////// CONTRACT PAGE ////////////////////////////////
BOOLEAN fPMCContractRedraw = FALSE;
// two dropdowns, which we'll use to toggle between our mercs
template<> void DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::SetRefresh( ) {
fPMCContractRedraw = TRUE;
}
INT32 gPMCButtonImage[4];
INT32 gPMCButton[4] = {-1, -1, -1, -1};
BOOLEAN gPMCButtonCreated[4] = {FALSE, FALSE, FALSE, FALSE};
INT32 gPMCHireButton = -1;
BOOLEAN gPMCHireButtonCreated = FALSE;
typedef struct
{
UINT8 usBodyType;
UINT8 usHair;
UINT8 usSkin;
UINT8 usVest;
UINT8 usPants;
UINT8 usToHire;
UINT16 usCostEach;
} PMCPersonnelData;
PMCPersonnelData pmcdata[2];
// how much does it cost to hire a militia from the PMC?
UINT16 GetMilitiaCostPMC( UINT8 aSoldierClass )
{
switch ( aSoldierClass )
{
case REGULAR_MILITIA:
return (4 * gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier) / gGameExternalOptions.iTrainingSquadSize + 7 * gGameExternalOptions.usDailyCostTownRegular;
break;
case ELITE_MILITIA:
// elites are upgradded regulars, so we pay for the basic + specail training
return ((4 * gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier) + (2 * gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iVeteranCostModifier)) / gGameExternalOptions.iTrainingSquadSize + 7 * gGameExternalOptions.usDailyCostTownElite;
break;
}
return 0;
}
void InitPMCData( )
{
pmcdata[0].usBodyType = Random( ADULTFEMALEMONSTER );
pmcdata[0].usHair = Random( 5 );
pmcdata[0].usSkin = Random( 4 );
pmcdata[0].usVest = 7;
pmcdata[0].usPants = 4;
pmcdata[0].usToHire = 0;
pmcdata[1].usBodyType = Random( ADULTFEMALEMONSTER );
pmcdata[1].usHair = Random( 5 );
pmcdata[1].usSkin = Random( 4 );
pmcdata[1].usVest = 6;
pmcdata[1].usPants = 4;
pmcdata[1].usToHire = 0;
}
CHAR16 gPMCSectorNamesstr[10][64];
BOOLEAN EnterPMCContract( )
{
InitDefaults_PMC( );
InitPMCData();
UINT8 count = 0;
std::vector<std::pair<INT16, STR16> > dropdownvector;
for ( INT16 sX = 1; sX < MAP_WORLD_X - 1; ++sX )
{
for ( INT16 sY = 1; sY < MAP_WORLD_Y - 1; ++sY )
{
if ( SectorOursAndPeaceful( sX, sY, 0 ) )
{
// if militia can land in this sector, add it to our list
// Is there a prison in this sector?
UINT16 prisonerbaselimit = 0;
for ( UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt )
{
// Is this facility here?
if ( gFacilityLocations[SECTOR( sX, sY )][cnt].fFacilityHere )
{
// we determine wether this is a prison by checking for usPrisonBaseLimit
if ( gFacilityTypes[cnt].usFacilityFlags & FACILITYTYPE_PMCENTRYPOINT )
{
GetSectorIDString( sX, sY, 0, gPMCSectorNamesstr[count], TRUE );
gPMCSectorNamesstr[count][63] = '/0';
dropdownvector.push_back( std::make_pair( SECTOR( sX, sY ), gPMCSectorNamesstr[count] ) );
++count;
break;
}
}
}
}
if ( count >= 10 )
break;
}
if ( count >= 10 )
break;
}
if ( !dropdownvector.empty( ) )
{
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).SetEntries( dropdownvector );
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).SetHelpText( szPMCWebSite[TEXT_PMC_CONTRACT_DROPDOWNTEXT] );
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).Create( LAPTOP_SCREEN_UL_X + 200, MCA_START_CONTENT_Y + 150 );
}
else
{
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).ClearEntries( );
}
return(TRUE);
}
void ExitPMCContract( )
{
for ( int i = 0; i < 4; ++i )
{
if ( gPMCButtonCreated[i] )
{
// delete militia panel bottom
RemoveButton( gPMCButton[i] );
UnloadButtonImage( gPMCButtonImage[i] );
gPMCButtonCreated[i] = FALSE;
}
}
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).Destroy( );
if ( gPMCHireButtonCreated )
{
RemoveButton( gPMCHireButton );
gPMCHireButtonCreated = FALSE;
}
RemoveDefaults_PMC( );
}
void HandlePMCContract( )
{
if ( fPMCContractRedraw )
{
RenderPMCContract( );
fPMCContractRedraw = FALSE;
}
}
BOOLEAN RenderMilitiaExamples( )
{
VOBJECT_DESC VObjectDesc;
HVOBJECT hHandle;
UINT32 uiGraphicHandle;
// regular militia
UINT16 usPosX = LAPTOP_SCREEN_UL_X;
UINT16 usPosY = MCA_START_CONTENT_Y + 20;
// load it
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
// Pick images based on body type
switch ( pmcdata[0].usBodyType )
{
case REGMALE: FilenameForBPP( "Laptop\\IMPSmallMercImages.sti", VObjectDesc.ImageFile ); break;
case BIGMALE: FilenameForBPP( "Laptop\\IMPBigMercImages.sti", VObjectDesc.ImageFile ); break;
case STOCKYMALE: FilenameForBPP( "Laptop\\IMPBigMercImages.sti", VObjectDesc.ImageFile ); break;
case REGFEMALE: FilenameForBPP( "Laptop\\IMPFemaleMercImages.sti", VObjectDesc.ImageFile ); break;
default:
return FALSE;
break;
}
// safety check if loaded
CHECKF( AddVideoObject( &VObjectDesc, &uiGraphicHandle ) );
// Get it
GetVideoObject( &hHandle, uiGraphicHandle );
// show background first
BltVideoObject( FRAME_BUFFER, hHandle, 0, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show skin (1 - 4)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[0].usSkin + 1), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show head (5 - 9)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[0].usHair + 5), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show vest (10 - 20)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[0].usVest + 10), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show pants (21 - 26)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[0].usPants + 21), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
DeleteVideoObjectFromIndex( uiGraphicHandle );
// veteran militia
usPosX = LAPTOP_SCREEN_UL_X + 250;
// load it
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
// Pick images based on body type
switch ( pmcdata[1].usBodyType )
{
case REGMALE: FilenameForBPP( "Laptop\\IMPSmallMercImages.sti", VObjectDesc.ImageFile ); break;
case BIGMALE: FilenameForBPP( "Laptop\\IMPBigMercImages.sti", VObjectDesc.ImageFile ); break;
case STOCKYMALE: FilenameForBPP( "Laptop\\IMPBigMercImages.sti", VObjectDesc.ImageFile ); break;
case REGFEMALE: FilenameForBPP( "Laptop\\IMPFemaleMercImages.sti", VObjectDesc.ImageFile ); break;
default:
return FALSE;
break;
}
// safety check if loaded
CHECKF( AddVideoObject( &VObjectDesc, &uiGraphicHandle ) );
// Get it
GetVideoObject( &hHandle, uiGraphicHandle );
// show background first
BltVideoObject( FRAME_BUFFER, hHandle, 0, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show skin (1 - 4)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[1].usSkin + 1), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show head (5 - 9)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[1].usHair + 5), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show vest (10 - 20)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[1].usVest + 10), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
// show pants (21 - 26)
BltVideoObject( FRAME_BUFFER, hHandle, (pmcdata[1].usPants + 21), usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
DeleteVideoObjectFromIndex( uiGraphicHandle );
return (TRUE);
}
void PMCButtonCallback( 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 == gPMCButton[0] )
pmcdata[0].usToHire = min( pmcdata[0].usToHire + 1, gPMCData.usRegularsAvailable );
else if ( btn->IDNum == gPMCButton[1] )
pmcdata[0].usToHire = max( pmcdata[0].usToHire - 1, 0 );
else if ( btn->IDNum == gPMCButton[2] )
pmcdata[1].usToHire = min( pmcdata[1].usToHire + 1, gPMCData.usVeteransAvailable );
else if ( btn->IDNum == gPMCButton[3] )
pmcdata[1].usToHire = max( pmcdata[1].usToHire - 1, 0 );
RenderPMCContract();
}
}
}
void PMCConfirmationCallback( UINT8 val )
{
fPMCContractRedraw = TRUE;
}
void PMCTeamHireCallback( GUI_BUTTON *btn, INT32 reason )
{
if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
AddTransactionToPlayersBook( PMC_CONTRACT, 0, GetWorldTotalMin( ), (-1) * (INT32)(pmcdata[0].usToHire * GetMilitiaCostPMC( REGULAR_MILITIA ) + pmcdata[1].usToHire * GetMilitiaCostPMC( ELITE_MILITIA )) );
PMCReinforcesHireEvent hiringevent;
// look for a free ID
UINT8 id = 0;
BOOLEAN found = FALSE;
for ( UINT8 i = 0; i < 255; ++i )
{
found = TRUE;
std::vector<PMCReinforcesHireEvent>::iterator itend = gPMCHiringEvents.end();
for ( std::vector<PMCReinforcesHireEvent>::iterator it = gPMCHiringEvents.begin( ); it != itend; ++it )
{
if ( (*it).usId == id )
{
++id;
found = FALSE;
break;
}
}
if ( found = TRUE )
break;
}
hiringevent.usId = id;
hiringevent.usRegulars = pmcdata[0].usToHire;
hiringevent.usVeterans = pmcdata[1].usToHire;
hiringevent.usSectorToArrive = (UINT8)DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).GetSelectedEntryKey( );
hiringevent.usTimeToArrive = GetWorldTotalMin() + 1440;
gPMCData.usRegularsHired += hiringevent.usRegulars;
gPMCData.usVeteransHired += hiringevent.usVeterans;
gPMCData.usTotalMoneyEarned += pmcdata[0].usToHire * GetMilitiaCostPMC( REGULAR_MILITIA ) + pmcdata[1].usToHire * GetMilitiaCostPMC( ELITE_MILITIA );
gPMCHiringEvents.push_back( hiringevent );
AddStrategicEvent( EVENT_PMC_REINFORCEMENT_ARRIVAL, hiringevent.usTimeToArrive, hiringevent.usId );
gPMCData.usRegularsAvailable -= pmcdata[0].usToHire;
pmcdata[0].usToHire = 0;
gPMCData.usVeteransAvailable -= pmcdata[1].usToHire;
pmcdata[1].usToHire = 0;
CHAR16 sString[256];
swprintf( sString, szPMCWebSite[TEXT_PMC_CONFIRMATION], ((GetWorldTotalMin( ) + 1440) % 1440) / 60, ((GetWorldTotalMin( ) + 1440) % 1440) % 60 );
DoLowerScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, PMCConfirmationCallback );
}
}
void RenderPMCContract( )
{
CHAR16 sText[800];
swprintf( sText, L"" );
UINT16 usPosX, usPosY;
DisplayDefaults_PMC( );
SetFontShadow( MERCOMP_FONT_SHADOW );
usPosX = LAPTOP_SCREEN_UL_X;
usPosY = MCA_START_CONTENT_Y;
swprintf( sText, szPMCWebSite[TEXT_PMC_CONTRACT_TEAM_INTRO] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
// show example pics of militia
RenderMilitiaExamples( );
for ( int i = 0; i < 4; ++i )
{
if ( gPMCButtonCreated[i] )
{
// delete militia panel bottom
RemoveButton( gPMCButton[i] );
UnloadButtonImage( gPMCButtonImage[i] );
gPMCButtonCreated[i] = FALSE;
}
}
gPMCButtonImage[0] = LoadButtonImage( "INTERFACE\\plusminusbuttons.sti", -1, 0, -1, 0, -1 );
gPMCButtonImage[1] = LoadButtonImage( "INTERFACE\\plusminusbuttons.sti", -1, 1, -1, 1, -1 );
gPMCButtonImage[2] = LoadButtonImage( "INTERFACE\\plusminusbuttons.sti", -1, 0, -1, 0, -1 );
gPMCButtonImage[3] = LoadButtonImage( "INTERFACE\\plusminusbuttons.sti", -1, 1, -1, 1, -1 );
// regulars
usPosX = LAPTOP_SCREEN_UL_X + 120;
usPosY = MCA_START_CONTENT_Y + 20;
swprintf( sText, szPMCWebSite[TEXT_PMC_REGULAR] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosY += 10;
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL], gPMCData.usRegularsAvailable, GetMilitiaCostPMC( REGULAR_MILITIA ) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
gPMCButton[0] = QuickCreateButton( gPMCButtonImage[0], usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PMCButtonCallback );
gPMCButtonCreated[0] = TRUE;
gPMCButton[1] = QuickCreateButton( gPMCButtonImage[1], usPosX + 20, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PMCButtonCallback );
gPMCButtonCreated[1] = TRUE;
usPosY += 20;
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL + 1], pmcdata[0].usToHire );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL + 2], pmcdata[0].usToHire * GetMilitiaCostPMC( REGULAR_MILITIA ) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
// veterans
usPosX = LAPTOP_SCREEN_UL_X + 370;
usPosY = MCA_START_CONTENT_Y + 20;
swprintf( sText, szPMCWebSite[TEXT_PMC_VETERAN] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosY += 10;
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL], gPMCData.usVeteransAvailable, GetMilitiaCostPMC( ELITE_MILITIA ) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
gPMCButton[2] = QuickCreateButton( gPMCButtonImage[2], usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PMCButtonCallback );
gPMCButtonCreated[2] = TRUE;
gPMCButton[3] = QuickCreateButton( gPMCButtonImage[3], usPosX + 20, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PMCButtonCallback );
gPMCButtonCreated[3] = TRUE;
usPosY += 20;
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL + 1], pmcdata[1].usToHire );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
swprintf( sText, szPMCWebSite[TEXT_PMC_DETAIL + 2], pmcdata[1].usToHire * GetMilitiaCostPMC( REGULAR_MILITIA ) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosX = LAPTOP_SCREEN_UL_X;
usPosY = MCA_START_CONTENT_Y + 158;
swprintf( sText, szPMCWebSite[TEXT_PMC_SELECTAREA] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
usPosY += 10;
swprintf( sText, szPMCWebSite[TEXT_PMC_TOTALCOST], pmcdata[0].usToHire * GetMilitiaCostPMC( REGULAR_MILITIA ) + pmcdata[1].usToHire * GetMilitiaCostPMC( ELITE_MILITIA ) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
swprintf( sText, szPMCWebSite[TEXT_PMC_ETA], ((GetWorldTotalMin( ) + 1440) % 1440) / 60, ((GetWorldTotalMin( ) + 1440) % 1440) % 60 );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
if ( gPMCHireButtonCreated )
{
RemoveButton( gPMCHireButton );
gPMCHireButtonCreated = FALSE;
}
if ( DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance().HasEntries() )
{
gPMCHireButton = CreateTextButton( szPMCWebSite[TEXT_PMC_CONTRACTBUTTON], CAMPHIS_FONT_MED, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
usPosX, usPosY, 100, 20, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, PMCTeamHireCallback );
gPMCHireButtonCreated = TRUE;
}
else
{
swprintf( sText, szPMCWebSite[TEXT_PMC_NODROPOFF] );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
}
usPosY += 50;
// if we hired personnel and they are inbound, show the next deployment
if ( !gPMCHiringEvents.empty() )
{
CHAR16 sectorname[64];
GetSectorIDString( SECTORX( gPMCHiringEvents[0].usSectorToArrive ), SECTORY( gPMCHiringEvents[0].usSectorToArrive ), 0, sectorname, TRUE );
swprintf( sText, szPMCWebSite[TEXT_PMC_NEXTDEPLOYMENT], gPMCHiringEvents[0].usRegulars, gPMCHiringEvents[0].usVeterans, sectorname, (gPMCHiringEvents[0].usTimeToArrive % 1440) / 60, (gPMCHiringEvents[0].usTimeToArrive % 1440) % 60, 1 + (gPMCHiringEvents[0].usTimeToArrive / 1440) );
usPosY += DisplayWrappedString( usPosX, usPosY, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
}
DropDownTemplate<DROPDOWNNR_PMC_LOCATION>::getInstance( ).Display( );
MarkButtonsDirty( );
RenderWWWProgramTitleBar( );
InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
}
////////////////////////// CONTRACT PAGE ////////////////////////////////
void GameInitPMC()
{
gPMCData.usTotalMoneyEarned = 0;
gPMCData.usRegularsHired = 0;
gPMCData.usVeteransHired = 0;
gPMCData.usRegularsAvailable = Random( gGameExternalOptions.usPMCMaxRegulars );
gPMCData.usVeteransAvailable = Random( gGameExternalOptions.usPMCMaxVeterans );
}
// the PMC replenishes personnel
void HourlyUpdatePMC( )
{
if ( Chance( 50 ) )
gPMCData.usRegularsAvailable = min( gPMCData.usRegularsAvailable + 1, gGameExternalOptions.usPMCMaxRegulars );
if ( Chance( 30 ) )
gPMCData.usVeteransAvailable = min( gPMCData.usVeteransAvailable + 1, gGameExternalOptions.usPMCMaxVeterans );
}
void HandlePMCArrival( UINT8 usId )
{
std::vector<PMCReinforcesHireEvent>::iterator itend = gPMCHiringEvents.end( );
for ( std::vector<PMCReinforcesHireEvent>::iterator it = gPMCHiringEvents.begin( ); it != itend; ++it )
{
if ( (*it).usId == usId )
{
// the militia we ordered have arrived!
StrategicAddMilitiaToSector( SECTORX( (*it).usSectorToArrive ), SECTORY( (*it).usSectorToArrive ), REGULAR_MILITIA, (*it).usRegulars );
StrategicAddMilitiaToSector( SECTORX( (*it).usSectorToArrive ), SECTORY( (*it).usSectorToArrive ), ELITE_MILITIA, (*it).usVeterans );
// if this is in the current sector, militia will be updated
ResetMilitia( );
GetSectorIDString( SECTORX( (*it).usSectorToArrive ), SECTORY( (*it).usSectorToArrive ), 0, gPMCSectorNamesstr[0], TRUE );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPMCWebSite[TEXT_PMC_ARRIVAL], gPMCSectorNamesstr[0] );
// delete event, we're done here
gPMCHiringEvents.erase( it );
return;
}
}
}
// it could happen that we load events incorrectly. To detect that early, we write an extra eyecacher befoer and after the list of events. Should we fail to read it correctly, we will knowm where to look.
UINT32 gPMCSaveCheck = 0xF123456F;
BOOLEAN SavePMC( HWFILE hwFile )
{
UINT32 uiNumBytesWritten = 0;
if ( !FileWrite( hwFile, &gPMCData, sizeof(PMCGlobalData), &uiNumBytesWritten ) )
return(FALSE);
// in order to save a vector, we first save its size and then its content
UINT32 size = gPMCHiringEvents.size( );
if ( !FileWrite( hwFile, &size, sizeof(UINT32), &uiNumBytesWritten ) )
return(FALSE);
if ( !FileWrite( hwFile, &gPMCSaveCheck, sizeof(UINT32), &uiNumBytesWritten ) )
return(FALSE);
for ( UINT32 i = 0; i < size; ++i )
{
if ( !FileWrite( hwFile, &gPMCHiringEvents[i], sizeof(PMCReinforcesHireEvent), &uiNumBytesWritten ) )
return(FALSE);
}
if ( !FileWrite( hwFile, &gPMCSaveCheck, sizeof(UINT32), &uiNumBytesWritten ) )
return(FALSE);
return(TRUE);
}
BOOLEAN LoadPMC( HWFILE hwFile )
{
if ( guiCurrentSaveGameVersion >= PMC_WEBSITE )
{
gPMCHiringEvents.clear();
UINT32 numBytesRead = 0;
numBytesRead = ReadFieldByField( hwFile, &gPMCData, sizeof(gPMCData), sizeof(PMCGlobalData), numBytesRead );
UINT32 size = 0;
numBytesRead = ReadFieldByField( hwFile, &size, sizeof(size), sizeof(UINT32), numBytesRead );
UINT32 safetycheck1 = 0;
numBytesRead = ReadFieldByField( hwFile, &safetycheck1, sizeof(safetycheck1), sizeof(UINT32), numBytesRead );
for ( UINT32 i = 0; i < size; ++i )
{
PMCReinforcesHireEvent event;
numBytesRead = ReadFieldByField( hwFile, &event, sizeof(event), sizeof(PMCReinforcesHireEvent), 0 );
gPMCHiringEvents.push_back( event );
}
UINT32 safetycheck2 = 0;
numBytesRead = ReadFieldByField( hwFile, &safetycheck2, sizeof(safetycheck2), sizeof(UINT32), numBytesRead );
if ( safetycheck1 != gPMCSaveCheck || safetycheck2 != gPMCSaveCheck )
{
ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, L"Eyecatcher corruption detected while loading PMC data!" );
return FALSE;
}
}
else
{
// if loading an older savegame, initialise the PMC
GameInitPMC();
}
return TRUE;
}
+56
View File
@@ -0,0 +1,56 @@
#ifndef __PMC_H
#define __PMC_H
/**
* @file
* @author Flugente (bears-pit.com)
*/
// main page (explains what this is all about)
BOOLEAN EnterPMCMain( );
void ExitPMCMain( );
void HandlePMCMain( );
void RenderPMCMain( );
// on this site you can conclude a contract with the WHO to get strategic data on diseases
BOOLEAN EnterPMCContract( );
void ExitPMCContract( );
void HandlePMCContract( );
void RenderPMCContract( );
// in case we hire miltia from the PMC, we have to know how many, where and when they should arrive
typedef struct
{
UINT8 usId; // number of this hiring event
UINT8 usSectorToArrive;
UINT8 usRegulars;
UINT8 usVeterans;
UINT32 usTimeToArrive;
} PMCReinforcesHireEvent;
extern std::vector<PMCReinforcesHireEvent> gPMCHiringEvents;
// global data on the PMC
typedef struct
{
UINT32 usTotalMoneyEarned;
UINT16 usRegularsHired;
UINT16 usVeteransHired;
UINT8 usRegularsAvailable;
UINT8 usVeteransAvailable;
UINT8 usUnused[2];
} PMCGlobalData;
extern PMCGlobalData gPMCData;
void GameInitPMC();
void HourlyUpdatePMC();
void HandlePMCArrival( UINT8 usId );
BOOLEAN SavePMC( HWFILE hwFile );
BOOLEAN LoadPMC( HWFILE hwFile );
#endif //__PMC_H
+11 -6
View File
@@ -3682,18 +3682,18 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr
break;
//Dealtar's Airport Externalization
case BOBBYR_SHIPMENT_ARRIVED:
wstring wstrMail;
wstring::size_type index;
CHAR16 szMail[MAIL_STRING_SIZE];
if (!pMessageRecordList)
{
wstring wstrMail;
wstring::size_type index;
CHAR16 szMail[MAIL_STRING_SIZE];
// WANNE.MAIL: Fix
gusCurShipmentDestinationID = -1; // Reset
gusCurShipmentDestinationID = pMail->iCurrentShipmentDestinationID;
// Loop through each line of the shipment EDT-file
for (int i = 0; i < BOBBYR_SHIPMENT_ARRIVED_LENGTH; i++)
for (int i = 0; i < BOBBYR_SHIPMENT_ARRIVED_LENGTH; ++i)
{
wstrMail.clear();
LoadEncryptedDataFromFile("BINARYDATA\\Email.edt", szMail, MAIL_STRING_SIZE *usMessageId, MAIL_STRING_SIZE);
@@ -3724,12 +3724,17 @@ BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr
AddEmailRecordToList((STR16)wstrMail.c_str());
usMessageId++;
++usMessageId;
}
}
giPrevMessageId = giMessageId;
break;
case(PMC_INTRO) :
SetBookMark( PMC_BOOKMARK );
fReDrawScreenFlag = TRUE;
break;
#endif
}
+4
View File
@@ -363,6 +363,9 @@
#define JOHN_KULBA_MISSED_FLIGHT_3 ( JOHN_KULBA_MISSED_FLIGHT_2 + JOHN_KULBA_MISSED_FLIGHT_2_LENGTH )
#define JOHN_KULBA_MISSED_FLIGHT_3_LENGTH 3
#define PMC_INTRO (JOHN_KULBA_MISSED_FLIGHT_3 + JOHN_KULBA_MISSED_FLIGHT_3_LENGTH)
#define PMC_INTRO_LENGTH 3
#endif
// WANNE: New 1.13 MERC merc mail text for level up that Speck sends
@@ -507,6 +510,7 @@ enum {
#ifdef JA2UB
MAIL_MIGUEL,
#endif
PMC,
};
// the length of the subject in char
+5 -3
View File
@@ -1455,7 +1455,6 @@ void IncrementCurrentPageFinancialDisplay( void )
void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance)
{
switch( pFinance->ubCode)
{
case ACCRUED_INTEREST:
@@ -1595,9 +1594,12 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance)
case WHO_SUBSCRIPTION:
swprintf( pString, L"%s", pTransactionText[WHO_SUBSCRIPTION] );
break;
// Flugente: a contract with a PMC
case PMC_CONTRACT:
swprintf( pString, L"%s", pTransactionText[PMC_CONTRACT] );
break;
}
}
+1
View File
@@ -55,6 +55,7 @@ enum
MILITIA_UPKEEP, // HEADROCK HAM 3.6: Militia Upkeep Costs (daily payment)
PRISONER_RANSOM, // Flugente: ransom for released prisoners
WHO_SUBSCRIPTION, // Flugente: subscription do WHO data
PMC_CONTRACT, // Flugente: hired militia from a PMC
TEXT_NUM_FINCANCES
};
+87
View File
@@ -89,6 +89,7 @@
#include "CampaignHistory_Summary.h" // added by Flugente
#include "MercCompare.h" // added by Flugente
#include "WHO.h" // added by Flugente
#include "PMC.h" // added by Flugente
#endif
#include "connect.h"
@@ -1485,6 +1486,18 @@ void RenderLaptop()
case LAPTOP_MODE_WHO_TIPS:
RenderWHOTips( );
break;
case LAPTOP_MODE_PMC_MAIN:
RenderPMCMain( );
break;
case LAPTOP_MODE_PMC_CONTRACT_MILITIA:
RenderPMCContract( );
break;
case LAPTOP_MODE_PMC_CONTRACT_INDIVIDUAL:
RenderPMCContract( );
break;
}
if( guiCurrentLaptopMode >= LAPTOP_MODE_WWW )
@@ -1930,6 +1943,17 @@ void EnterNewLaptopMode()
EnterWHOTips( );
break;
case LAPTOP_MODE_PMC_MAIN:
EnterPMCMain( );
break;
case LAPTOP_MODE_PMC_CONTRACT_MILITIA:
EnterPMCContract( );
break;
case LAPTOP_MODE_PMC_CONTRACT_INDIVIDUAL:
EnterPMCContract( );
break;
}
// first time using webbrowser in this laptop session
@@ -2191,6 +2215,18 @@ void HandleLapTopHandles()
case LAPTOP_MODE_WHO_TIPS:
HandleWHOTips( );
break;
case LAPTOP_MODE_PMC_MAIN:
HandlePMCMain( );
break;
case LAPTOP_MODE_PMC_CONTRACT_MILITIA:
HandlePMCContract( );
break;
case LAPTOP_MODE_PMC_CONTRACT_INDIVIDUAL:
HandlePMCContract( );
break;
}
}
@@ -2761,6 +2797,18 @@ UINT32 ExitLaptopMode(UINT32 uiMode)
case LAPTOP_MODE_WHO_TIPS:
ExitWHOTips( );
break;
case LAPTOP_MODE_PMC_MAIN:
ExitPMCMain( );
break;
case LAPTOP_MODE_PMC_CONTRACT_MILITIA:
ExitPMCContract( );
break;
case LAPTOP_MODE_PMC_CONTRACT_INDIVIDUAL:
ExitPMCContract( );
break;
}
if( ( uiMode != LAPTOP_MODE_NONE )&&( uiMode < LAPTOP_MODE_WWW ) )
@@ -3748,6 +3796,24 @@ void SetBookMark(INT32 iBookId)
}
}
BOOLEAN IsBookMarkSet( INT32 iBookId )
{
INT32 iCounter = 0;
while ( LaptopSaveInfo.iBookMarkList[iCounter] != -1 )
{
// move through list until empty
if ( LaptopSaveInfo.iBookMarkList[iCounter] == iBookId )
{
// found it, return
return TRUE;
}
++iCounter;
}
return FALSE;
}
BOOLEAN RemoveBookMark( INT32 iBookId )
{
@@ -4357,6 +4423,27 @@ if( (gubQuest[ QUEST_FIX_LAPTOP ] != QUESTINPROGRESS) || (gGameUBOptions.LaptopQ
}
}
break;
case PMC_BOOKMARK:
{
guiCurrentWWWMode = LAPTOP_MODE_PMC_MAIN;
guiCurrentLaptopMode = LAPTOP_MODE_PMC_MAIN;
// do we have to have a World Wide Wait
if ( LaptopSaveInfo.fVisitedBookmarkAlready[PMC_BOOKMARK] == FALSE )
{
// reset flag and set load pending flag
LaptopSaveInfo.fVisitedBookmarkAlready[PMC_BOOKMARK] = TRUE;
fLoadPendingFlag = TRUE;
}
else
{
// fast reload
fLoadPendingFlag = TRUE;
fFastLoadFlag = TRUE;
}
}
break;
}
#ifdef JA2UB
+7
View File
@@ -22,6 +22,7 @@ void DrawButtonText();
void InitBookMarkList();
void SetBookMark(INT32 iBookId);
void RemoveBookmark(INT32 iBookId);
BOOLEAN IsBookMarkSet( INT32 iBookId );
BOOLEAN LeaveLapTopScreen( );
void SetLaptopExitScreen( UINT32 uiExitScreen );
void SetLaptopNewGameFlag( );
@@ -155,6 +156,11 @@ enum
LAPTOP_MODE_WHO_MAIN,
LAPTOP_MODE_WHO_CONTRACT,
LAPTOP_MODE_WHO_TIPS,
// Flugente: PMC
LAPTOP_MODE_PMC_MAIN,
LAPTOP_MODE_PMC_CONTRACT_MILITIA,
LAPTOP_MODE_PMC_CONTRACT_INDIVIDUAL,
LAPTOP_MODE_BOBBYR_SHIPMENTS,
@@ -234,6 +240,7 @@ enum{
CAMPAIGNHISTORY_BOOKMARK, // added by Flugente
MERCCOMPARE_BOOKMARK, // added by Flugente
WHO_BOOKMARK, // added by Flugente
PMC_BOOKMARK, // added by Flugente
TEXT_NUM_LAPTOP_BOOKMARKS
};