From c74e13fb5c01bfb2bbdaecec7cca2281638f861e Mon Sep 17 00:00:00 2001 From: Wanne Date: Mon, 29 Jul 2013 11:48:53 +0000 Subject: [PATCH] - Added playable mercs: John Kulba (the tourist) and 3 JA1 natives (Elio, Juan, Wahan) (by anv) o Added faces (except camo faces), speech, bio, ... o All those 4 mercs are available at M.E.R.C o Added INI options for enabling/disabling recruitable Speck, Kulba and natives o If enabled, Kulba becomes available as a MERC merc after finishing escort quest, delay is configurable (two weeks by default). He won't be available earlier even if MERC_WEBSITE_ALL_MERCS_AVAILABLE is set to TRUE see: http://www.bears-pit.com/board/ubbthreads.php/topics/298288/47.html - Improvement: MERC mercs get unlocked according to their own availability conditions, not to their order in MercAvailability.xml git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6258 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 8 + GameSettings.h | 8 + Laptop/AimLinks.cpp | 2 +- Laptop/LaptopSave.h | 7 + Laptop/email.h | 548 ++++++++++++++++---------------- Laptop/laptop.cpp | 8 + Laptop/mercs Files.cpp | Bin 143608 -> 145798 bytes Laptop/mercs.cpp | 180 ++++++++++- Laptop/mercs.h | 8 +- Tactical/Interface Dialogue.cpp | 8 + Tactical/Merc Hiring.cpp | 38 +++ Tactical/Soldier Profile.h | 6 + builddefines.h | 2 +- 13 files changed, 538 insertions(+), 285 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index f20807aa..49683fe6 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -849,6 +849,14 @@ void LoadGameExternalOptions() // CHRISL: New setting to allow Slay to remain as a hired PC gGameExternalOptions.fEnableSlayForever = iniReader.ReadBoolean("Recruitment Settings", "SLAY_STAYS_FOREVER", FALSE); + // anv: playable Speck + gGameExternalOptions.fEnableRecruitableSpeck = iniReader.ReadBoolean("Recruitment Settings", "RECRUITABLE_SPECK", TRUE); + // anv: John Kulba becomes recruitable as a merc after finishing escort quest + gGameExternalOptions.fEnableRecruitableJohnKulba = iniReader.ReadBoolean("Recruitment Settings", "RECRUITABLE_JOHN_KULBA", TRUE); + gGameExternalOptions.ubRecruitableJohnKulbaDelay = iniReader.ReadInteger("Recruitment Settings", "RECRUITABLE_JOHN_KULBA_DELAY", 14, 0, 255); + // anv: enable JA1 natives as MERC mercs + gGameExternalOptions.fEnableRecruitableJA1Natives = iniReader.ReadBoolean("Recruitment Settings", "RECRUITABLE_JA1_NATIVES", TRUE); + // Buggler: setting to show/hide skills/traits in AIM & MERC hiring page gGameExternalOptions.fShowSkillsInHirePage = iniReader.ReadBoolean("Recruitment Settings", "SHOW_SKILLS_IN_HIRING_PAGE", FALSE); diff --git a/GameSettings.h b/GameSettings.h index 73c0bf95..50f16e88 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -726,6 +726,14 @@ typedef struct // CHRISL: option to allow Slay to remain as a hired PC BOOLEAN fEnableSlayForever; + // anv: playable Speck + BOOLEAN fEnableRecruitableSpeck; + // anv: John Kulba becomes recruitable as a merc after finishing escort quest + BOOLEAN fEnableRecruitableJohnKulba; + UINT16 ubRecruitableJohnKulbaDelay; + // anv: enable JA1 natives as MERC mercs + BOOLEAN fEnableRecruitableJA1Natives; + // CHRISL: Setting to turn off the description and stack popup options from the sector inventory panel BOOLEAN fSectorDesc; diff --git a/Laptop/AimLinks.cpp b/Laptop/AimLinks.cpp index 8b513865..79f98b09 100644 --- a/Laptop/AimLinks.cpp +++ b/Laptop/AimLinks.cpp @@ -189,7 +189,7 @@ void ExitAimLinks() DeleteVideoObjectFromIndex(guiFuneralLink); DeleteVideoObjectFromIndex(guiInsuranceLink); - for(i=0; i{f9waSQ+t= zA4T*7-gJsGPxwh#D9%9_4Y8Yuin5#NLey@gi|Re6wt}2c91h?2Jn#EH@6UJ6H~qnU z{)@SLc?VCe#Z=}R4Xd9!f@wP9rBO9-5$;*6p-5P=pLS;0XEo!N+{z ztb)*?d7uD1u$mYxTY%Oe>9o+=N)gR)jCT8pY0_=6T!(ZV&^cx8&PRtjW3eKgT05=$N88G~q3t&s_X`t@V~DOPzw7Vmwy6H(?hi*QM20F%VdI&??|nhhUZ zjA<<6(qZvwA9gzv=n5Rdx5#CVNxYxo6JB%~U2J5qj2E?`jX!e`Khc4*7;nc`WFs$) zd@6$F3DkHS$IZG^&pC=IxP)ho30$?r7f@6)3>*Gkb}5SFYv?k>&x5@YDZJl->EiYc zTxHUEF?t6BbM!4QHAsDY{4P$!p;zSJ!*(f-|1#fyIIB7T@vP?ieY2YLpJHF4YfBr= zA-1Z8sqWU#{&elmm1F`;Y-YagJq^_U;h@flL j=+wRFzV*^%7qG%7M*hGp1%I>AUMm})OyZ{trQ<&UgmbvR delta 589 zcmZqs%<4(gj{HANIWGvhKr!P-*y3!-Ypv~u&Sg}r)TVpgiW0lObw~TC) zSFK(*eO47C-}GlQ8HFZCELWKRU_GP2fg1siZlNFwNOkT1>VLD46quum(;*5Ng`;N&?esEe~ za^6X{=?jDzxi&jId%!%sp^cGivVm{j=9mj>z&3)NU9tJWjSe1612!u>+tWB*pc&|R zxvOg1|D`i}F-~uhW0aaMm&M4oJu8z@glV$bdV%eI*^C-WApP5c4p_r7yBS80HRj9(a{lk1lC1#K>qqf&AX7phNG5xj!gIJ7x zd(Z~P6^zq?q~G?aO^jVk$O8Yip$RP7jV9oB08QZ45yl;?Fqhq8oZfJPQDysq35*|r zOsvk6V4NOsoKa}H0w)vC^jV@zQrq<|GCmU64vh8?O^~~GY 0 && gConditionsForMercAvailability[ gConditionsForMercAvailability[i - 1].uiIndex ].uiAlternateIndex != 255) { // Previous merc has alternate (drunk) merc, skip his one! - LaptopSaveInfo.gubLastMercIndex = LaptopSaveInfo.gubLastMercIndex + 2; + //LaptopSaveInfo.gubLastMercIndex = LaptopSaveInfo.gubLastMercIndex + 2; + LaptopSaveInfo.gubLastMercIndex = LaptopSaveInfo.gubLastMercIndex++; } else { LaptopSaveInfo.gubLastMercIndex++; } } - - gConditionsForMercAvailability[gConditionsForMercAvailability[i].uiIndex].NewMercsAvailable = TRUE; - LaptopSaveInfo.ubLastMercAvailableId = gConditionsForMercAvailability[i].uiIndex; + //gConditionsForMercAvailability[gConditionsForMercAvailability[i].uiIndex].NewMercsAvailable = TRUE; LaptopSaveInfo.ubLastMercAvailableId = gConditionsForMercAvailability[i].uiIndex; gConditionsForMercAvailability[i].StartMercsAvailable = TRUE; - + #ifdef JA2UB 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; #else - if( IsSpeckComAvailable() ) { AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT); diff --git a/Laptop/mercs.h b/Laptop/mercs.h index 08fb5281..f18dc26a 100644 --- a/Laptop/mercs.h +++ b/Laptop/mercs.h @@ -109,7 +109,7 @@ enum }; - +BOOLEAN CanMercBeAvailableDuringInit( UINT8 ubMercToCheck );// anv: for all mercs available void GameInitMercs(); BOOLEAN EnterMercs(); void ExitMercs(); @@ -123,6 +123,9 @@ BOOLEAN RemoveMercBackGround(); void DailyUpdateOfMercSite( UINT16 usDate); UINT8 GetMercIDFromMERCArray(UINT8 ubMercID); +UINT8 GetAvailableMercIndex(UINT8 gubCurMercIndex); +UINT8 GetAvailableMercIDFromMERCArray(UINT8 ubMercID); + void DisplayTextForSpeckVideoPopUp(STR16 pString); BOOLEAN IsMercMercAvailable( UINT8 ubMercID ); @@ -157,6 +160,9 @@ void MakeBiffAwayForCoupleOfDays(); #else BOOLEAN IsSpeckComAvailable(); void HandleSpeckWitnessingEmployeeDeath( SOLDIERTYPE* pSoldier ); + + // anv: for Kulba hireable after escort quest + void AddJohnAsMerc( ); #endif void InitializeNumDaysMercArrive(); diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 0aeb07e1..ba0d6155 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -2731,6 +2731,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if( pSoldier->ubProfile == FLO ) { SetFactTrue( FACT_PC_MARRYING_DARYL_IS_FLO ); + #ifdef JA2UB #else // anv: make Speck whine about it immediately if on team @@ -4013,6 +4014,13 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_ADD_JOHNS_GUN_SHIPMENT: AddJohnsGunShipment(); + +#ifdef JA2UB +#else + // anv: recruitable Kulba + if( gGameExternalOptions.fEnableRecruitableJohnKulba == TRUE ) + AddJohnAsMerc(); +#endif // also close panel DeleteTalkingMenu(); break; diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 17907f30..3391721d 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -65,6 +65,12 @@ #include "ub_config.h" #endif +#ifdef JA2UB +#else + // anv: for Kulba's odyssey + #include "email.h" +#endif + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -452,6 +458,38 @@ void MercArrivesCallback( UINT8 ubSoldierID ) pMerc = &gMercProfiles[ pSoldier->ubProfile ]; +// anv: handle Kulba's odyssey +#ifdef JA2UB + // too many Kulbas +#else + if(pSoldier->ubProfile == JOHN_MERC) + { + // just in case + if( LaptopSaveInfo.ubJohnPossibleMissedFlights > 3 ) + LaptopSaveInfo.ubJohnPossibleMissedFlights = 3; + // every time Kulba delays his arrival, chances of next delay decrease + if( Random( 100 ) < LaptopSaveInfo.ubJohnPossibleMissedFlights * 25 ) + { + pSoldier->uiTimeSoldierWillArrive = pSoldier->uiTimeSoldierWillArrive + 720 + Random ( 720 ); + AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pSoldier->uiTimeSoldierWillArrive, pSoldier->ubID ); + if(LaptopSaveInfo.ubJohnPossibleMissedFlights == 3 ) + AddEmail( JOHN_KULBA_MISSED_FLIGHT_1, JOHN_KULBA_MISSED_FLIGHT_1_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + else if(LaptopSaveInfo.ubJohnPossibleMissedFlights == 2 ) + AddEmail( JOHN_KULBA_MISSED_FLIGHT_2, JOHN_KULBA_MISSED_FLIGHT_2_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + else if(LaptopSaveInfo.ubJohnPossibleMissedFlights == 1 ) + AddEmail( JOHN_KULBA_MISSED_FLIGHT_3, JOHN_KULBA_MISSED_FLIGHT_3_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT ); + + LaptopSaveInfo.ubJohnPossibleMissedFlights--; + return; + } + else + { + // reset possible missed flights, for the future Kulba's adventures + LaptopSaveInfo.ubJohnPossibleMissedFlights = 3; + } + } +#endif + // add the guy to a squad AddCharacterToAnySquad( pSoldier ); diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 0fb3639a..7a373c20 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -242,6 +242,12 @@ enum NPCIDs #endif NPC170 = NPC169 + 84, SPECK_PLAYABLE = 191,// anv + + // Those 4 only available in JA2 113 and not in JA2 UB! + JOHN_MERC = 195, + ELIO = 196, + JUAN = 197, + WAHAN = 198, } ; BOOLEAN LoadMercProfiles(void); diff --git a/builddefines.h b/builddefines.h index b05bd24d..8e9f45bb 100644 --- a/builddefines.h +++ b/builddefines.h @@ -22,7 +22,7 @@ // ----------------------------- // ***************************** -// WANNE: With these define we can build JA2 DEMO version that runs with 1.13 +// WANNE: With this defin we can build JA2 DEMO version that runs with 1.13 // The 2 UB defines (JA2UB and JA2UBMAPS) should be disabled, because we only want to build the demo version from the JA2 code! //#define JA113DEMO