MERGED source code from development trunk revision 4545 up to latest current revision 4882

Development Trunk: https://ja2svn.dyndns.org/source/ja2/branches/Wanne/JA2%201.13%20MP
A detailed list of all the features (changes) is visible in the history log of the development trunk:

INFO: The source code for the official 2011 release (4870) has been branched here:
https://ja2svn.dyndns.org/source/ja2/branches/JA2_rev.4870_2011

This commit contains the following features:

*** Externalized Vehicles ***
o Now with this feature we can add/remove vehicles
o New XML File: TableData\Vehicles.xml
o Added a new function parameter to lua file Scripts\Overhead lua to set up the helicopter in method: SetUpHelicopterForPlayer()
o Added example mini (Docs\Externalized Vehicles Example.zip) mod which adds 2 additional vehicles (hummer and ice-cream truck to sector A9)

*** Up to 255 save slots ***
- There is a "Next" and "Prev" button where you can scroll through the save slots
- It is now possible to load the automatic save (SAVE_EVERY_N_HOURS) from the load screen. This is the first slot after the quickload slot
- Added the 2 alternate players end turn saves (which can be enabled/disabled in option screen) to the save/load game form

*** New Feature: Externalized emails from Emails.edt to XML***
o This feature can be enabled/disabled in the Source:
--> See email.cpp: If "ReadXMLEmail" == FALSE, then normal way (read from Email.edt) otherwise read from XML files
o 2 new XML files: TableData\Email\EmailMercAvailable.xml and EmailMercLevelUp.xml
o Renamed SenderNamesList.xml to EmailSenderNamesList.xml and moved from TableData folder to TableData\Email folder
o Names for mercenaries are get from the file MercProfiles.xml and different names get from the file EmailSenderNamesList.xml

*** Externalized Hidden Towns (Tixa, Orta) ***
o Now it is possible to add new hidden towns (locations)
o See file: TableData/Map/Cities.xml
o New variable in TableData/Map/Cities.xml
- hiddenTown:   0 = show on strategy map, 1 = Hide on strategy map
- townIcon:     1 = on, 0 = off (This is the icon you see on the strategy map)
- szIconFile:   The path to the sti icon file (eg: interface\prison.sti, interface\my_icon.sti)
- iconPosition: The x,y position of the icon on the strategy map

*** Encyclopedia and Briefing Room, reachable from the laptop ***
o 2 new ja2_options.ini properties: BRIEFING_ROOM, ENCYCLOPEDIA
o demonstration video: http://www.youtube.com/watch?v=7CIXdXWLrAo
o Added Example usage of the Briefing Room
- Extract it in your JA2 1.13 folder and use the latest development executable
- The briefing room can be reached from the laptop. Enter SN5631 for the code and then click the "Exit" button
- See "Info_BriefingRoom.txt" and "BriefingRoom_Mission1.png"

*** Improved interrupt system (IIS) ***
o This system changes the way interrupts work. See: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=290787#Post290787
o Option system (see ja2_options.ini: IMPROVED_INTERRUPT_SYSTEM)
o A few more settings for the interrupt system in ja2_options.ini
o INFO: Multiplayer games always use the "old" interrupt system, not matter what the user selects in the ja2_options.ini

*** Walking and sidestepping with weapon raised ***
o Enable/disable the walking/sidestepping with raised weapon in ja2_options.ini: ALLOW_WALKING_WITH_WEAPON_RAISED
o You can set an AP/BP modifier when walking/sidestepping with weapon raised in APBPConstants.ini: AP_MODIFIER_WEAPON_READY
o The following feature apply when you walk/sidestep with weapon raised:
-> limited angle of view, but you can see more farther when the weapon has a scope
-> better change for interrupts if you see an enemy
-> less APs and BPs when shooting, because the weapon is already raised
-> It should cost more APs when walking. Maybe you can export the additional AP and BP modifier to the APBPConstants.ini

*** Increase squad size to 8 (800x600) and 8 and 10 (1024x768) ***
o Squad sizes (dependend on the screen resolution) can be selected in the start new game screen
o In a multiplayer game, the squad size will always be 6, because it does not work with more soldiers/squad

*** Added UB-1.13 source code ***
o Merged the UB-1.13 source code (Revision: 4721) from svn: http://subversion.assembla.com/svn/ub-source113
o If you want to build UB-EXE or UB-MapEditor, just enable the 2 defines (JA2UB and JA2UBMAPS) in "builddefines.h"
o The UB-Verion reads from "ja2_UB.ini" instead of "ja2.ini"
o There are 2 new XML files
- Layout\LayoutMainMenu.xml
- MapAction\ActionItems.xml
o There are 2 new LUA-Script files
- Scripts\ExplosionControl.lua
- Scripts\InterfaceDialogue.lua

*** Hide enemy health text / enemy hit count ***
o ja2_options.ini: HIDE_ENEMY_HEALTH_TEXT, HIDE_ENEMY_HIT_COUNT
o both new settings only have effect in a singleplayer game
o see: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=128840&page=1


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4885 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-01-18 11:19:01 +00:00
parent c42d68ff0f
commit e64d5a2fa6
264 changed files with 40710 additions and 2771 deletions
+289 -35
View File
@@ -1,6 +1,11 @@
#ifdef PRECOMPILEDHEADERS
#include "Laptop All.h"
#include "GameSettings.h"
#ifdef JA2UB
#include "Ja25 Strategic Ai.h"
#endif
#else
#include "laptop.h"
#include "mercs.h"
@@ -27,6 +32,12 @@
#include "Quests.h"
#endif
#ifdef JA2UB
#include "Ja25_Tactical.h"
#include "Ja25 Strategic Ai.h"
#include "Speck Quotes.h"
#endif
#include "connect.h"
UINT8 NUMBER_OF_MERCS = 0;
@@ -102,7 +113,11 @@ UINT8 NUMBER_OF_BAD_MERCS = -1;
#define SPECK_IDLE_CHAT_DELAY 10000
#ifdef JA2UB
#define MERC_NUMBER_OF_RANDOM_QUOTES 20//19//14
#else
#define MERC_NUMBER_OF_RANDOM_QUOTES 19//14
#endif
#define MERC_FIRST_MERC BIFF
@@ -212,10 +227,16 @@ typedef struct
} NUMBER_TIMES_QUOTE_SAID;
NUMBER_TIMES_QUOTE_SAID gNumberOfTimesQuoteSaid[ MERC_NUMBER_OF_RANDOM_QUOTES ] =
{
#ifdef JA2UB
{ SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING, 0 },
#endif
{ SPECK_QUOTE_RANDOM_CHIT_CHAT_1, 0 },
{ SPECK_QUOTE_RANDOM_CHIT_CHAT_2, 0 },
#ifdef JA2UB
{ SPECK_QUOTE_RANDOM_CHIT_CHAT_3, 0 },
#endif
{ SPECK_QUOTE_ADVERTISE_GASTON, 0 },
{ SPECK_QUOTE_ADVERTISE_STOGIE, 0 },
@@ -304,6 +325,11 @@ BOOLEAN AreAnyOfTheNewMercsAvailable();
void ShouldAnyNewMercMercBecomeAvailable();
BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck );
UINT32 CalcMercDaysServed();
#ifdef JA2UB
void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum );
BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum );
INT8 IsSpeckQuoteImportantQuote( UINT32 uiQuoteNum );
#endif
//ppp
BOOLEAN SaveNewMercsToSaveGameFile( HWFILE hFile )
@@ -368,6 +394,17 @@ void GameInitMercs()
{
LaptopSaveInfo.gubLastMercIndex = LAST_MERC_ID; //NUMBER_OF_BAD_MERCS;
}
#ifdef JA2UB
//Ja25. create an account immediately
{
//open an account
LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID;
//Get an account number
LaptopSaveInfo.guiPlayersMercAccountNumber = Random( 99999 );
}
#endif
gubCurrentMercVideoMode = MERC_VIDEO_NO_VIDEO_MODE;
gfMercVideoIsBeingDisplayed = FALSE;
@@ -430,13 +467,16 @@ BOOLEAN EnterMercs()
// Account Box button
guiAccountBoxButtonImage = LoadButtonImage("LAPTOP\\SmallButtons.sti", -1,0,-1,1,-1 );
#ifdef JA2UB
// no UB
#else
guiAccountBoxButton = QuickCreateButton(guiAccountBoxButtonImage, MERC_ACCOUNT_BUTTON_X, MERC_ACCOUNT_BUTTON_Y,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnAccountBoxButtonCallback);
SetButtonCursor(guiAccountBoxButton, CURSOR_LAPTOP_SCREEN);
SpecifyDisabledButtonStyle( guiAccountBoxButton, DISABLED_STYLE_SHADED);
#endif
guiFileBoxButton = QuickCreateButton(guiAccountBoxButtonImage, MERC_FILE_BUTTON_X, MERC_FILE_BUTTON_Y,
BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnFileBoxButtonCallback);
@@ -524,8 +564,11 @@ void ExitMercs()
UnloadButtonImage( guiAccountBoxButtonImage );
RemoveButton( guiFileBoxButton );
#ifdef JA2UB
//JA25: removed RemoveButton( guiAccountBoxButton );
#else
RemoveButton( guiAccountBoxButton );
#endif
RemoveMercBackGround();
DeleteVideoSurfaceFromIndex( guiMercVideoFaceBackground );
@@ -634,21 +677,31 @@ void RenderMercs()
//Text on the Speck Portrait
DisplayWrappedString(MERC_PORTRAIT_TEXT_X, MERC_PORTRAIT_TEXT_Y, MERC_PORTRAIT_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_SPECK_OWNER], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#ifdef JA2UB
//Display the "ask about or special offer
DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, 230, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, gzNewLaptopMessages[ LPTP_MSG__MERC_SPECIAL_OFFER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#else
/* ja25:*/
//Text on the Account Box
if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_NO_ACCOUNT )
DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, MERC_ACCOUNT_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_OPEN_ACCOUNT], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
else
DisplayWrappedString(MERC_ACCOUNT_BOX_TEXT_X, MERC_ACCOUNT_BOX_TEXT_Y, MERC_ACCOUNT_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_VIEW_ACCOUNT], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
#endif
//Text on the Files Box
DisplayWrappedString(MERC_FILE_BOX_TEXT_X, MERC_FILE_BOX_TEXT_Y, MERC_FILE_BOX_TEXT_WIDTH, 2, MERC_TEXT_FONT, MERC_TEXT_COLOR, MercHomePageText[MERC_VIEW_FILES], FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED);
//If the Specks popup dioalogue box is active, display it.
if( iMercPopUpBox != -1 )
{
#ifdef JA2UB
//JA25: removed DrawButton( guiAccountBoxButton );
// ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#else
DrawButton( guiAccountBoxButton );
ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#endif
RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER);
}
@@ -657,9 +710,11 @@ void RenderMercs()
//if the page is redrawn, and we are in video conferencing, redraw the VC backgrund graphic
gfMercSiteScreenIsReDrawn = TRUE;
#ifdef JA2UB
//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY;
#else
ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY;
#endif
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
@@ -692,8 +747,9 @@ BOOLEAN RemoveMercBackGround()
}
#ifdef JA2UB
//no UB
#else
void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
@@ -728,6 +784,7 @@ void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason)
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
#endif
void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
@@ -793,12 +850,20 @@ void DailyUpdateOfMercSite( UINT16 usDate)
// pSoldier->iTotalContractLength++;
}
#ifdef JA2UB
//JA25: MERC does a 1 time fee, no longer pay as you go
#else
//Get the longest time
if( gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength > iNumDays )
iNumDays = gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength;
#endif
}
}
#ifdef JA2UB
//JA25: No longer pay as you go, now pay up front
#else
//if the players hasnt paid for a while, get email him to tell him to pay
//iTotalContractLength
if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_INVALID )
@@ -806,7 +871,7 @@ void DailyUpdateOfMercSite( UINT16 usDate)
if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID )
{
LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_INVALID;
AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1);
AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
}
}
else if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_SUSPENDED )
@@ -814,7 +879,7 @@ void DailyUpdateOfMercSite( UINT16 usDate)
if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_SUSPENDED )
{
LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_SUSPENDED;
AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1);
AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
// Have speck complain next time player come to site
LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT;
@@ -825,13 +890,13 @@ void DailyUpdateOfMercSite( UINT16 usDate)
if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_VALID_FIRST_WARNING )
{
LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID_FIRST_WARNING;
AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1);
AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
// Have speck complain next time player come to site
LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT;
}
}
#endif
//Check and act if any new Merc Mercs should become available
ShouldAnyNewMercMercBecomeAvailable();
@@ -868,7 +933,7 @@ void DailyUpdateOfMercSite( UINT16 usDate)
//if we havent already sent an email this turn
if( !fAlreadySentEmailToPlayerThisTurn )
{
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin());
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), TYPE_EMAIL_EMAIL_EDT);
fAlreadySentEmailToPlayerThisTurn = TRUE;
}
LaptopSaveInfo.gbNumDaysTillFirstMercArrives = -1;
@@ -961,6 +1026,9 @@ void DailyUpdateOfMercSite( UINT16 usDate)
// If the merc site has never gone down, the number of MERC payment days is above 'X',
// and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way )
#ifdef JA2UB
// no UB
#else
if( ShouldTheMercSiteServerGoDown() )
{
UINT32 uiTimeInMinutes=0;
@@ -979,6 +1047,7 @@ void DailyUpdateOfMercSite( UINT16 usDate)
//Add an event that will get the site back up and running
AddStrategicEvent( EVENT_MERC_SITE_BACK_ONLINE, uiTimeInMinutes, 0 );
}
#endif
}
@@ -1523,8 +1592,13 @@ void HandleTalkingSpeck()
if( iMercPopUpBox != -1 )
{
#ifdef JA2UB
//JA25: removed DrawButton( guiAccountBoxButton );
//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#else
DrawButton( guiAccountBoxButton );
ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#endif
RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER);
}
@@ -1643,7 +1717,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
if( fJustEnteredScreen )
{
gfDoneIntroSpeech = FALSE;
#ifdef JA2UB
usQuoteToSay = SPECK_QUOTE_NEW_INTRO_1;
#else
usQuoteToSay = 0;
#endif
return( FALSE );
}
@@ -1656,31 +1734,65 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
gfDoneIntroSpeech = TRUE;
//set the opening quote based on if the player has been here before
#ifdef JA2UB
if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_FIRST_VISIT && usQuoteToSay <= SPECK_QUOTE_NEW_INTRO_7 ) //!= 0 )
#else
if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_FIRST_VISIT && usQuoteToSay <= 8 ) //!= 0 )
#endif
{
StartSpeckTalking( usQuoteToSay );
usQuoteToSay++;
#ifdef JA2UB
if( usQuoteToSay <= SPECK_QUOTE_NEW_INTRO_7 )
#else
if( usQuoteToSay <= 8 )
#endif
gfDoneIntroSpeech = FALSE;
}
#ifdef JA2UB
//else if its the first time back since the laptop went down
else if( gJa25SaveStruct.fHaveAimandMercOffferItems && !HasImportantSpeckQuoteBeingSaid( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1 ) )
{
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1 );
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_2 );
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_3 );
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_4 );
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_5 );
StartSpeckTalking( SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_6 );
}
#else
//if its the players second visit
else if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_SECOND_VISIT )
{
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_1_TOUGH_START );
fCanUseIdleTag = TRUE;
}
#endif
// We have been here at least 2 times before, Check which quote we should use
else
{
//if the player has not hired any MERC mercs before
// CJC Dec 1 2002: fixing this, so near-bankrupt msg will play
#ifdef JA2UB
if( !IsAnyMercMercsHired( ) && CalcMercDaysServed() == 0)
StartSpeckTalking( SPECK_QUOTE_DEFAULT_INTRO_HAVENT_HIRED_MERCS );
else
StartSpeckTalking( SPECK_QUOTE_DEFAULT_INTRO_HAVE_HIRED_MERCS );
#endif
#ifdef JA2UB
//JA25: not using quote quote
#else
//if the player has not hired any MERC mercs before
if( !IsAnyMercMercsHired( ) && CalcMercDaysServed() == 0)
{
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_2_BUSINESS_BAD );
}
#endif
#ifdef JA2UB
//JA25: not using quote quote
#else
//else if it is the first visit since the server went down
else if( LaptopSaveInfo.fFirstVisitSinceServerWentDown == TRUE )
{
@@ -1688,6 +1800,7 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_9_FIRST_VISIT_SINCE_SERVER_WENT_DOWN );
fCanUseIdleTag = TRUE;
}
#endif
/*
//else if new mercs are available
else if( LaptopSaveInfo.fNewMercsAvailableAtMercSite )
@@ -1698,14 +1811,20 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
}
*/
//else if lots of MERC mercs are DEAD, and speck can say the quote ( dont want him to continously say it )
#ifdef JA2UB
if( CountNumberOfMercMercsWhoAreDead() >= 2 && LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote )
#else
else if( CountNumberOfMercMercsWhoAreDead() >= 2 && LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote )
#endif
{
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_12_PLAYERS_LOST_MERCS );
//Set it so speck Wont say the quote again till someone else dies
LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote = 0;
}
#ifdef JA2UB
//JA25: not using quote quote
#else
//else if player owes lots of money
else if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_SUSPENDED )
{
@@ -1713,8 +1832,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
fCanSayLackOfPaymentQuote = FALSE;
}
#endif
//else if the player owes speck a large sum of money, have speck say so
#ifdef JA2UB
//JA25: not using quote quote
#else
else if( CalculateHowMuchPlayerOwesSpeck() > 5000 )
{
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_1 );
@@ -1722,11 +1844,17 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
fCanSayLackOfPaymentQuote = FALSE;
}
#endif
else
{
#ifdef JA2UB
UINT8 ubNumMercsDead = NumberOfMercMercsDead();
BOOLEAN fCanUseIdleTag = FALSE;
#endif
UINT8 ubRandom = ( UINT8 ) Random( 100 );
#ifdef JA2UB
//JA25: not using quote quote
#else
//if business is good
// if( ubRandom < 40 && ubNumMercsDead < 2 && CountNumberOfMercMercsHired() > 1 )
if( ubRandom < 40 && AreAnyOfTheNewMercsAvailable() && CountNumberOfMercMercsHired() > 1 )
@@ -1734,9 +1862,12 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_3_BUSINESS_GOOD );
fCanUseIdleTag = TRUE;
}
#endif
//or if still trying to recruit ( the last recruit hasnt arrived and the player has paid for some of his mercs )
// else if( ubRandom < 80 && LaptopSaveInfo.gbNumDaysTillFourthMercArrives != -1 && LaptopSaveInfo.gbNumDaysTillFirstMercArrives < MERC_NUM_DAYS_TILL_FIRST_MERC_AVAILABLE )
#ifdef JA2UB
//JA25: not using quote quote
#else
else if( ubRandom < 80 && gConditionsForMercAvailability[ LaptopSaveInfo.ubLastMercAvailableId ].usMoneyPaid <= LaptopSaveInfo.uiTotalMoneyPaidToSpeck && CanMercBeAvailableYet( LaptopSaveInfo.ubLastMercAvailableId ) )
{
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_4_TRYING_TO_RECRUIT );
@@ -1745,10 +1876,16 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
//else use the generic opening
else
#endif
{
#ifdef JA2UB
//JA25: not using quote quote
#else
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING );
fCanUseIdleTag = TRUE;
//JA25: not using quote quote
//if the merc hasnt said the line before
if( !LaptopSaveInfo.fSaidGenericOpeningInMercSite )
{
@@ -1756,8 +1893,11 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_TAG_FOR_20 );
}
}
#endif
}
#ifdef JA2UB
//no UB
#else
if( fCanUseIdleTag )
{
UINT8 ubRandom = Random( 100 );
@@ -1784,10 +1924,13 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
Assert( 0 );
}
}
#endif
}
}
#ifdef JA2UB
//JA25: not using quote quote
#else
//If Speck has sent an email to the player, and the player still hasnt paid, has speck complain about it.
// CJC Dec 1 2002 ACTUALLY HOOKED IN THAT CHECK
if (fCanSayLackOfPaymentQuote)
@@ -1807,18 +1950,22 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE );
}
#endif
//if any mercs are dead
if( IsAnyMercMercsDead() )
{
UINT8 ubMercID;
//if no merc has died before
#ifdef JA2UB
//JA25: not using quote quote
#else
if( !LaptopSaveInfo.fHasAMercDiedAtMercSite )
{
LaptopSaveInfo.fHasAMercDiedAtMercSite = TRUE;
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_FIRST_MERC_DIES );
}
#endif
//loop through all the mercs and see if any are dead and the quote is not said
for( ubCnt=0; ubCnt<NUMBER_OF_MERCS; ubCnt++ )
{
@@ -1873,12 +2020,21 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
case BUBBA:
StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_BUBBA_IS_DEAD );
break;
#ifdef JA2UB
case 58://GASTON:
StartSpeckTalking( SPECK_QUOTE_GASTON_DEAD );
break;
case 59://STOGIE:
StartSpeckTalking( SPECK_QUOTE_STOGIE_DEAD );
break;
#else
case GASTON:
StartSpeckTalking( SPECK_QUOTE_GASTON_DEAD );
break;
case STOGIE:
StartSpeckTalking( SPECK_QUOTE_STOGIE_DEAD );
break;
#endif
};
}
@@ -1886,7 +2042,9 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
}
}
#ifdef JA2UB
//JA25: not using quote quote
#else
//if flo has married the cousin
if( gubFact[ FACT_PC_MARRYING_DARYL_IS_FLO ] )
{
@@ -1899,7 +2057,7 @@ BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen )
MakeBiffAwayForCoupleOfDays();
}
}
#endif
//if larry has relapsed
if( HasLarryRelapsed() && !( LaptopSaveInfo.uiSpeckQuoteFlags & SPECK_QUOTE__ALREADY_TOLD_PLAYER_THAT_LARRY_RELAPSED ) )
@@ -2096,7 +2254,21 @@ void HandlePlayerHiringMerc( UINT8 ubHiredMercID )
if( IsMercMercAvailable( BIFF ) )
StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_LARRY_SPECK_PLUGS_BIFF );
break;
#ifdef JA2UB
//Gaston is hired
case 58: //GASTON:
//if biff is available, advertise for biff
if( IsMercMercAvailable( FLO ) )
StartSpeckTalking( SPECK_QUOTE_PLAYER_HIRES_GASTON );
break;
//Stogie is hired
case 59: //STOGIE:
//if biff is available, advertise for biff
if( IsMercMercAvailable( BIFF ) )
StartSpeckTalking( SPECK_QUOTE_PLAYER_HIRES_STOGIE );
break;
#else
//Gaston is hired
case GASTON:
//if biff is available, advertise for biff
@@ -2110,6 +2282,7 @@ void HandlePlayerHiringMerc( UINT8 ubHiredMercID )
if( IsMercMercAvailable( BIFF ) )
StartSpeckTalking( SPECK_QUOTE_PLAYER_HIRES_STOGIE );
break;
#endif
}
}
@@ -2145,13 +2318,25 @@ BOOLEAN ShouldSpeckStartTalkingDueToActionOnSubPage()
{
HandlePlayerHiringMerc( GetMercIDFromMERCArray( gubCurMercIndex ) );
//get speck to say the thank you
#ifdef JA2UB
//if it hasnt been said, say the better equipment quote
if( !HasImportantSpeckQuoteBeingSaid( SPECK_QUOTE_BETTER_STARTING_EQPMNT_TAG_ON ) )
{
StartSpeckTalking( SPECK_QUOTE_BETTER_STARTING_EQPMNT_TAG_ON );
}
#endif
//get speck to say the thank you
if( Random( 100 ) > 50 )
StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1 );
else
StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_2 );
#ifdef JA2UB
//if it hasnt been said, say the encouraged to shop quote
if( !HasImportantSpeckQuoteBeingSaid( SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON ) )
{
StartSpeckTalking( SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON );
}
#endif
gfJustHiredAMercMerc = FALSE;
// gfDoneIntroSpeech = TRUE;
@@ -2246,6 +2431,11 @@ void HandleSpeckIdleConversation( BOOLEAN fReset )
{
IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 1 );
}
#ifdef JA2UB
//if its the biff is dead quote, only say the quote once
else if( sLeastSaidQuote == SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING )
IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 255 );
#endif
else if( sLeastSaidQuote != -1 )
IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 3 );
}
@@ -2348,15 +2538,18 @@ BOOLEAN ShouldTheMercSiteServerGoDown()
return( FALSE );
}
#ifdef JA2UB
//no UB
#else
void GetMercSiteBackOnline()
{
//Add an email telling the user the site is back up
AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 );
AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1 , TYPE_EMAIL_EMAIL_EDT);
//Set a flag indicating that the server just went up ( so speck can make a comment when the player next visits the site )
LaptopSaveInfo.fFirstVisitSinceServerWentDown = TRUE;
}
#endif
void DrawMercVideoBackGround()
{
@@ -2374,7 +2567,11 @@ void DisableMercSiteButton()
{
if( iMercPopUpBox != -1 )
{
#ifdef JA2UB
//JA25: removed ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#else
ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY;
#endif
}
}
@@ -2434,6 +2631,22 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID )
if( !IsMercMercAvailable( BUBBA ) )
fRetVal = FALSE;
break;
#ifdef JA2UB
case SPECK_QUOTE_BIFF_DEAD_WHEN_IMPORTING:
if( !gJa25SaveStruct.fBiffWasKilledWhenImportingSave )
fRetVal = FALSE;
break;
case SPECK_QUOTE_ADVERTISE_GASTON:
if( !IsMercMercAvailable( 58 ) )//GASTON
fRetVal = FALSE;
break;
case SPECK_QUOTE_ADVERTISE_STOGIE:
if( !IsMercMercAvailable( 59 ) )//STOGIE
fRetVal = FALSE;
break;
#else
case SPECK_QUOTE_ADVERTISE_GASTON:
if( !IsMercMercAvailable( GASTON ) )
fRetVal = FALSE;
@@ -2443,6 +2656,7 @@ BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID )
if( !IsMercMercAvailable( STOGIE ) )
fRetVal = FALSE;
break;
#endif
}
@@ -2536,7 +2750,7 @@ void NewMercsAvailableAtMercSiteCallBack( )
for(UINT8 i=0; i<NUM_PROFILES; i++)
{
if ( gConditionsForMercAvailability[i].ProfilId != 0 && gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gConditionsForMercAvailability[i].StartMercsAvailable == FALSE )
{
{
if( CanMercBeAvailableYet( gConditionsForMercAvailability[i].uiIndex ) )
{
gConditionsForMercAvailability[i].NewMercsAvailable = TRUE;
@@ -2563,7 +2777,7 @@ void NewMercsAvailableAtMercSiteCallBack( )
LaptopSaveInfo.ubLastMercAvailableId = gConditionsForMercAvailability[i].uiIndex;
gConditionsForMercAvailability[i].StartMercsAvailable = TRUE;
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1);
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
//new mercs are available
LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE;
@@ -2604,11 +2818,51 @@ UINT32 CalcMercDaysServed()
}
return( uiDaysServed );
}
#ifdef JA2UB
INT8 IsSpeckQuoteImportantQuote( UINT32 uiQuoteNum )
{
INT32 iFlag=-1;
switch( uiQuoteNum )
{
case SPECK_QUOTE_BETTER_STARTING_EQPMNT_TAG_ON:
iFlag = SPECK__BETTER_EQUIPMENT;
break;
case SPECK_QUOTE_ENCOURAGE_SHOP_TAG_ON:
iFlag = SPECK__ENCOURAGE_POAYER_TO_KEEP_SHOPPING;
break;
case SPECK_QUOTE_2ND_INTRO_LAPTOP_WORKING_AGAIN_1:
iFlag = SPECK__SECOND_INTRO_BEEN_SAID;
break;
}
return( (INT8) iFlag );
}
BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum )
{
INT8 iFlag;
iFlag = IsSpeckQuoteImportantQuote( uiQuoteNum );
if( iFlag == -1 )
{
return( FALSE );
}
//has the quote been said
return( ( gJa25SaveStruct.ubImportantSpeckQuotesSaidBefore & ( 1 << iFlag ) ) != 0 );
}
//if the quote is a special quote, mark it said so we dont say it again
void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum )
{
INT8 iFlag;
iFlag = IsSpeckQuoteImportantQuote( uiQuoteNum );
if( iFlag == -1 )
{
return;
}
gJa25SaveStruct.ubImportantSpeckQuotesSaidBefore |= ( 1 << iFlag );
}
#endif