mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
*** Merged Code from Multiplayer Branch Revision 3040 ***
Bugfixes: Bobby Ray Shipment - Re-enabled stealing from delivery sector (STEALING_FROM_SHIPMENTS_DISABLED) - Re-enabled & externalized chance that whole shipment is lost (CHANCE_OF_SHIPMENT_LOST) - Re-enabled delivery from John Kulba git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3041 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -783,6 +783,9 @@ void LoadGameExternalOptions()
|
||||
// WDS - Option to turn off stealing
|
||||
gGameExternalOptions.fStealingDisabled = iniReader.ReadBoolean("JA2 Gameplay Settings","STEALING_FROM_SHIPMENTS_DISABLED",FALSE);
|
||||
|
||||
// WANNE - Chance of shipment lost
|
||||
gGameExternalOptions.gubChanceOfShipmentLost = iniReader.ReadInteger("JA2 Gameplay Settings","CHANCE_OF_SHIPMENT_LOST", 10);
|
||||
|
||||
// WDS: Game progress
|
||||
gGameExternalOptions.ubGameProgressPortionKills = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_KILLS", 25, 0, 100);
|
||||
gGameExternalOptions.ubGameProgressPortionControl = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_CONTROL", 25, 0, 100);
|
||||
|
||||
@@ -258,6 +258,9 @@ typedef struct
|
||||
// WDS - Option to turn off stealing
|
||||
BOOLEAN fStealingDisabled;
|
||||
|
||||
// WANNE: Externalize chance of shipment package lost
|
||||
UINT32 gubChanceOfShipmentLost;
|
||||
|
||||
// Militia Settings
|
||||
BOOLEAN fAllowTacticalMilitiaCommand;
|
||||
BOOLEAN gfTrainVeteranMilitia;
|
||||
|
||||
@@ -219,9 +219,7 @@ enum
|
||||
#define BOBBYR_PACKAXGE_WEIGHT_Y LAPTOP_SCREEN_WEB_UL_Y + 249
|
||||
#define BOBBYR_PACKAXGE_WEIGHT_WIDTH 188
|
||||
|
||||
//Dealtar's Airport Externalization.
|
||||
#define BOBBYR_SENDER_ID 0
|
||||
#define JOHN_KULBA_SENDER_ID 1
|
||||
|
||||
|
||||
UINT16 gShippingSpeedAreas[] = {585, 218 + LAPTOP_SCREEN_WEB_DELTA_Y,
|
||||
585, 238 + LAPTOP_SCREEN_WEB_DELTA_Y,
|
||||
@@ -344,12 +342,6 @@ void BobbyRDeliveryCallback(RefToCShipmentManipulator ShipmentManipulator)
|
||||
{
|
||||
// ScreenMsg(FONT_MCOLOR_RED, MSG_DEBUG, L"Shipment from Bobby Ray has arrived at %s!", ShipmentManipulator.GetDestination().wstrName.c_str());
|
||||
gusCurShipmentDestinationID = ShipmentManipulator.GetDestination().usID;
|
||||
|
||||
StopTimeCompression();
|
||||
|
||||
// WANNE - MP: Do not send email notification from Bobby Ray in a multiplayer game
|
||||
if (!is_networked)
|
||||
AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -923,7 +915,7 @@ void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
//uiResetTimeSec += (8 + Random(4) ) * 60;
|
||||
|
||||
//AddStrategicEvent( EVENT_BOBBYRAY_PURCHASE, uiResetTimeSec, cnt);
|
||||
AddFutureDayStrategicEvent( EVENT_BOBBYRAY_PURCHASE, (8 + Random(4) ) * 60, cnt, bDaysAhead );
|
||||
AddFutureDayStrategicEvent( EVENT_BOBBYRAY_PURCHASE, (8 + Random(4) ) * 60, cnt, bDaysAhead );
|
||||
|
||||
}
|
||||
|
||||
@@ -2480,10 +2472,12 @@ BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT16 us
|
||||
{
|
||||
UINT16 usID;
|
||||
|
||||
// Shipment from Bobby Ray
|
||||
if(fPurchasedFromBobbyR)
|
||||
usID = gPostalService.CreateNewShipment(usDeliveryLoc, ubDeliveryMethod, 0);
|
||||
usID = gPostalService.CreateNewShipment(usDeliveryLoc, ubDeliveryMethod, BOBBYR_SENDER_ID);
|
||||
// Shipment from John Kulba (Automag 2)
|
||||
else
|
||||
usID = gPostalService.CreateNewShipment(usDeliveryLoc, 2, 1);
|
||||
usID = gPostalService.CreateNewShipment(usDeliveryLoc, 2, JOHN_KULBA_SENDER_ID);
|
||||
|
||||
for(int i=0; i < MAX_PURCHASE_AMOUNT && pPurchaseStruct[i].usItemIndex > 0; i++)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
#include "LaptopSave.h"
|
||||
|
||||
|
||||
|
||||
//Dealtar's Airport Externalization.
|
||||
#define BOBBYR_SENDER_ID 0
|
||||
#define JOHN_KULBA_SENDER_ID 1
|
||||
|
||||
|
||||
//enums for the various destinations that are available in the bobbyR dest drop down box
|
||||
|
||||
+161
-13
@@ -10,6 +10,10 @@
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "Quests.h"
|
||||
#include "Strategic Town Loyalty.h"
|
||||
#include "email.h"
|
||||
#include "BobbyRMailOrder.h"
|
||||
|
||||
// WANNE - MP: Used for multiplayer
|
||||
#include "connect.h"
|
||||
@@ -233,6 +237,13 @@ BOOLEAN CPostalService::SendShipment(UINT16 usShipmentID)
|
||||
|
||||
BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
{
|
||||
UINT32 uiChanceOfTheft;
|
||||
static UINT8 ubShipmentsSinceNoBribes = 0;
|
||||
BOOLEAN fPablosStoleLastItem = FALSE;
|
||||
UINT32 uiStolenCount = 0;
|
||||
INT16 sMapPos;
|
||||
BOOLEAN fPablosStoleSomething = FALSE;
|
||||
|
||||
if( usShipmentID > _UsedShipmentIDList.size() ||
|
||||
!_UsedShipmentIDList[usShipmentID])
|
||||
{
|
||||
@@ -285,9 +296,18 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
|
||||
RefToShipmentStruct shs = SHIPMENT(sli);
|
||||
|
||||
// Sector is enemy controlled or shipment sector does not exist (->ubMapX = 0, ubMapY = 0) -> Clear the shipments
|
||||
if( StrategicMap[ CALCULATE_STRATEGIC_INDEX( shs.pDestination->ubMapX, shs.pDestination->ubMapY ) ].fEnemyControlled )
|
||||
{
|
||||
return FALSE;
|
||||
shs.ShipmentPackages.clear();
|
||||
shs.pDestination = NULL;
|
||||
shs.pDestinationDeliveryInfo = NULL;
|
||||
shs.ShipmentStatus = SHIPMENT_STATIONARY;
|
||||
_UsedShipmentIDList[usShipmentID] = FALSE;
|
||||
|
||||
_Shipments.erase(sli);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if( (shs.pDestination->ubMapX > 0) &&
|
||||
@@ -300,6 +320,49 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
( gWorldSectorY == shs.pDestination->ubMapY ) &&
|
||||
( gbWorldSectorZ == shs.pDestination->ubMapZ);
|
||||
|
||||
|
||||
// WDS - Option to turn off stealing
|
||||
// check for potential theft
|
||||
if (gGameExternalOptions.fStealingDisabled ||
|
||||
CheckFact( FACT_PABLO_WONT_STEAL, 0 ))
|
||||
{
|
||||
uiChanceOfTheft = 0;
|
||||
}
|
||||
else if (CheckFact( FACT_PABLOS_BRIBED, 0 ))
|
||||
{
|
||||
// Since Pablo has some money, reduce record of # of shipments since last bribed...
|
||||
ubShipmentsSinceNoBribes /= 2;
|
||||
uiChanceOfTheft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ubShipmentsSinceNoBribes++;
|
||||
// this chance might seem high but it's only applied at most to every second item
|
||||
uiChanceOfTheft = 12 + Random( 4 * ubShipmentsSinceNoBribes );
|
||||
}
|
||||
|
||||
// Shipment from John Kulba can never be lost, only from Bobby Ray
|
||||
if (shs.sSenderID == BOBBYR_SENDER_ID)
|
||||
{
|
||||
// The whole shipment will be lost
|
||||
if (Random( 100 ) < gGameExternalOptions.gubChanceOfShipmentLost)
|
||||
{
|
||||
// lose the whole shipment!
|
||||
// Delete the shipments!
|
||||
shs.ShipmentPackages.clear();
|
||||
shs.pDestination = NULL;
|
||||
shs.pDestinationDeliveryInfo = NULL;
|
||||
shs.ShipmentStatus = SHIPMENT_STATIONARY;
|
||||
_UsedShipmentIDList[usShipmentID] = FALSE;
|
||||
|
||||
_Shipments.erase(sli);
|
||||
|
||||
SetFactTrue( FACT_LAST_SHIPMENT_CRASHED );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(fSectorLoaded)
|
||||
{
|
||||
SetOpenableStructureToClosed( shs.pDestination->sGridNo, 0 );
|
||||
@@ -317,11 +380,13 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
}
|
||||
|
||||
OBJECTTYPE *pObject;
|
||||
OBJECTTYPE *pStolenObject;
|
||||
if(!fSectorLoaded)
|
||||
{
|
||||
pObject = new OBJECTTYPE[usNumberOfItems];
|
||||
pStolenObject = new OBJECTTYPE[ usNumberOfItems ];
|
||||
|
||||
if(!pObject)
|
||||
if(!pObject || !pStolenObject)
|
||||
{
|
||||
Assert(0);
|
||||
return FALSE;
|
||||
@@ -336,13 +401,30 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
// A package is the sum of the same items (e.g: 5 Colts = 1 package, 2 Colts & 1 legging = 2 packages)
|
||||
for(int i=0; i < (int)shs.ShipmentPackages.size(); i++)
|
||||
{
|
||||
// Wie viele items sollen geliefert werden ?
|
||||
ubItemsDelivered = shs.ShipmentPackages[i].ubNumber;
|
||||
|
||||
// das aktuelle item
|
||||
usItem = shs.ShipmentPackages[i].usItemIndex;
|
||||
|
||||
CreateItem(usItem, 100, &tempObject);
|
||||
|
||||
// if it's a gun
|
||||
if (Item [ usItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
// Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR
|
||||
// simply to be consistent with the dealers in Arulco, who must sell guns empty to prevent ammo cheats by players.
|
||||
tempObject[0]->data.gun.ubGunShotsLeft = 0;
|
||||
}
|
||||
|
||||
// TODO.RW: Hier Pablo stealing code einfügen und ubItemsDelivered reduzieren!!!
|
||||
|
||||
UINT8 cnt = -1;
|
||||
// Loop through the items of a package
|
||||
while ( ubItemsDelivered )
|
||||
{
|
||||
cnt++;
|
||||
|
||||
// Check how many items we can group together on one stack
|
||||
if (UsingNewInventorySystem() == false)
|
||||
{
|
||||
@@ -358,13 +440,39 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
|
||||
if( fSectorLoaded )
|
||||
{
|
||||
// Add the single item to the pool
|
||||
AddItemToPool( shs.pDestination->sGridNo, &tempObject, -1, 0, 0, 0 );
|
||||
// Pablo has stolen the item
|
||||
if ( !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + cnt) )
|
||||
{
|
||||
uiStolenCount++;
|
||||
sMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen!
|
||||
fPablosStoleSomething = TRUE;
|
||||
fPablosStoleLastItem = TRUE;
|
||||
}
|
||||
// Item not stolen
|
||||
else
|
||||
{
|
||||
sMapPos = shs.pDestination->sGridNo;
|
||||
fPablosStoleLastItem = FALSE;
|
||||
}
|
||||
|
||||
// Add the single item to the pool (the Crate or Pablose stolen grid no)
|
||||
AddItemToPool( sMapPos, &tempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pObject[ uiCount ] = tempObject;
|
||||
uiCount++;
|
||||
// Pablo steals the item
|
||||
if ( !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + cnt) )
|
||||
{
|
||||
pStolenObject[ uiStolenCount ] = gTempObject;
|
||||
uiStolenCount++;
|
||||
fPablosStoleSomething = TRUE;
|
||||
fPablosStoleLastItem = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObject[ uiCount ] = tempObject;
|
||||
uiCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Substract the number of items we already placed from the total number of items of this package
|
||||
@@ -374,13 +482,55 @@ BOOLEAN CPostalService::DeliverShipment(UINT16 usShipmentID)
|
||||
|
||||
if( !fSectorLoaded )
|
||||
{
|
||||
if( !AddItemsToUnLoadedSector( shs.pDestination->ubMapX, shs.pDestination->ubMapY,
|
||||
shs.pDestination->ubMapZ, shs.pDestination->sGridNo, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
|
||||
// Successfull delivered items into the crate
|
||||
if (uiCount > 0)
|
||||
{
|
||||
Assert( 0 );
|
||||
if( !AddItemsToUnLoadedSector( shs.pDestination->ubMapX, shs.pDestination->ubMapY,
|
||||
shs.pDestination->ubMapZ, shs.pDestination->sGridNo, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
delete[]( pObject );
|
||||
pObject = NULL;
|
||||
}
|
||||
delete[]( pObject );
|
||||
pObject = NULL;
|
||||
|
||||
// Stolen items by Pablo
|
||||
if (uiStolenCount > 0)
|
||||
{
|
||||
// Delivered items
|
||||
if( !AddItemsToUnLoadedSector( shs.pDestination->ubMapX, shs.pDestination->ubMapY,
|
||||
shs.pDestination->ubMapZ, PABLOS_STOLEN_DEST_GRIDNO, uiStolenCount, pStolenObject, 0, 0, 0, -1, FALSE ) )
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
delete[]( pStolenObject );
|
||||
pStolenObject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (fPablosStoleSomething)
|
||||
{
|
||||
SetFactTrue( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFactFalse( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT );
|
||||
}
|
||||
|
||||
SetFactFalse( FACT_PLAYER_FOUND_ITEMS_MISSING );
|
||||
SetFactFalse( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING );
|
||||
|
||||
// WANNE - MP: Do not send email notification from Bobby Ray in a multiplayer game
|
||||
if (!is_networked)
|
||||
{
|
||||
StopTimeCompression();
|
||||
|
||||
// Shipment from Bobby Ray
|
||||
if (shs.sSenderID == BOBBYR_SENDER_ID)
|
||||
AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
||||
// Shipment from John Kulba
|
||||
else
|
||||
AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1 );
|
||||
}
|
||||
|
||||
shs.ShipmentPackages.clear();
|
||||
@@ -503,8 +653,6 @@ BOOLEAN CPostalService::DeliverShipmentForMultiplayer(UINT16 usShipmentID)
|
||||
|
||||
while ( ubItemsDelivered )
|
||||
{
|
||||
//ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(usItem, BIGPOCK1POS) );
|
||||
|
||||
if (UsingNewInventorySystem() == false)
|
||||
{
|
||||
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&tempObject, BIGPOCK1POS) );
|
||||
|
||||
@@ -545,7 +545,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
g_Console.Create(ghWindow);
|
||||
cout << "LUA console ready" << endl;
|
||||
cout << "> ";
|
||||
|
||||
|
||||
// Reset the pressed keys
|
||||
gfKeyState[ ALT ] = FALSE;
|
||||
gfKeyState[ 219 ] = FALSE; // "\"
|
||||
|
||||
@@ -181,12 +181,15 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
}
|
||||
break;
|
||||
case EVENT_AIM_RESET_MERC_ANNOYANCE:
|
||||
ResetMercAnnoyanceAtPlayer( (UINT8) pEvent->uiParam );
|
||||
ResetMercAnnoyanceAtPlayer( (UINT8) pEvent->uiParam );
|
||||
break;
|
||||
// WANNE: This is the EVENT for the old Bobby Ray shipment code. Look for the EVENT "EVENT_POSTAL_SERVICE_SHIPMENT" below
|
||||
/*
|
||||
//The players purchase from Bobby Ray has arrived
|
||||
case EVENT_BOBBYRAY_PURCHASE:
|
||||
BobbyRayPurchaseEventCallback( (UINT8) pEvent->uiParam);
|
||||
break;
|
||||
*/
|
||||
//Gets called once a day ( at BOBBYRAY_UPDATE_TIME). To simulate the items being bought and sold at bobby rays
|
||||
case EVENT_DAILY_UPDATE_BOBBY_RAY_INVENTORY:
|
||||
DailyUpdateOfBobbyRaysNewInventory();
|
||||
|
||||
@@ -11,7 +11,7 @@ enum
|
||||
EVENT_CHECKFORQUESTS,
|
||||
EVENT_AMBIENT,
|
||||
EVENT_AIM_RESET_MERC_ANNOYANCE,
|
||||
EVENT_BOBBYRAY_PURCHASE,
|
||||
EVENT_BOBBYRAY_PURCHASE, // WANNE: Unused (old Bobby Ray Shipment EVENT)
|
||||
EVENT_DAILY_UPDATE_BOBBY_RAY_INVENTORY,
|
||||
EVENT_UPDATE_BOBBY_RAY_INVENTORY,
|
||||
EVENT_DAILY_UPDATE_OF_MERC_SITE,
|
||||
|
||||
@@ -52,9 +52,10 @@ UINT32 guiPabloExtraDaysBribed = 0;
|
||||
|
||||
UINT8 gubCambriaMedicalObjects;
|
||||
|
||||
// WANNE: No more used for the new airport code
|
||||
//void DropOffItemsInMeduna( UINT8 ubOrderNum );
|
||||
|
||||
void DropOffItemsInMeduna( UINT8 ubOrderNum );
|
||||
|
||||
/*
|
||||
// WANNE: Dieser Code wird nicht mehr ausgeführt. Es gibt jetzt das PostalService.cpp::DeliverShipment()
|
||||
// In der Methode DeliverShipment() fehlt eine ganze Menge (PABLO Quests, ...)
|
||||
void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
@@ -409,7 +410,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin(), -1 );
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void HandleDelayedItemsArrival( UINT32 uiReason )
|
||||
@@ -1116,7 +1117,8 @@ void CheckForMissingHospitalSupplies( void )
|
||||
|
||||
}
|
||||
|
||||
|
||||
// WANNE: No more used for the new airport code
|
||||
/*
|
||||
void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
{
|
||||
BOOLEAN fSectorLoaded = FALSE;
|
||||
@@ -1218,3 +1220,4 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
//Add an email from kulba telling the user the shipment is there
|
||||
AddEmail( BOBBY_R_MEDUNA_SHIPMENT, BOBBY_R_MEDUNA_SHIPMENT_LENGTH, BOBBY_R, GetWorldTotalMin(), -1 );
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ extern UINT8 gubCambriaMedicalObjects;
|
||||
void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck );
|
||||
void CheckForMissingHospitalSupplies( void );
|
||||
|
||||
void BobbyRayPurchaseEventCallback( UINT8 ubOrderID );
|
||||
//void BobbyRayPurchaseEventCallback( UINT8 ubOrderID );
|
||||
|
||||
void HandleStolenItemsReturned( void );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user