mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Merged New Inventory Project into main branch
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "Strategic Event Handler.h"
|
||||
#include "MemMan.h"
|
||||
#include "message.h"
|
||||
#include "Item Types.h"
|
||||
#include "Items.h"
|
||||
#include "Handle Items.h"
|
||||
#include "LaptopSave.h"
|
||||
@@ -34,6 +33,11 @@
|
||||
#endif
|
||||
#include "BobbyRMailOrder.h"
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
|
||||
|
||||
#define MEDUNA_ITEM_DROP_OFF_GRIDNO 10959
|
||||
#define MEDUNA_ITEM_DROP_OFF_SECTOR_X 3
|
||||
#define MEDUNA_ITEM_DROP_OFF_SECTOR_Y 14
|
||||
@@ -42,7 +46,6 @@
|
||||
|
||||
extern INT16 gsRobotGridNo;
|
||||
|
||||
|
||||
UINT32 guiPabloExtraDaysBribed = 0;
|
||||
|
||||
UINT8 gubCambriaMedicalObjects;
|
||||
@@ -54,8 +57,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
{
|
||||
UINT8 i,j;
|
||||
UINT16 usItem;
|
||||
OBJECTTYPE Object;
|
||||
UINT16 usMapPos, usStandardMapPos;
|
||||
INT16 sMapPos, sStandardMapPos;
|
||||
UINT16 usNumberOfItems;
|
||||
BOOLEAN fSectorLoaded = FALSE;
|
||||
UINT16 usTotalNumberOfItemTypes;
|
||||
@@ -71,7 +73,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
UINT8 ubTempNumItems;
|
||||
UINT8 ubItemsPurchased;
|
||||
|
||||
usStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO;
|
||||
sStandardMapPos = BOBBYR_SHIPPING_DEST_GRIDNO;
|
||||
|
||||
// if the delivery is for meduna, drop the items off there instead
|
||||
if( gpNewBobbyrShipments[ ubOrderID ].fActive && gpNewBobbyrShipments[ ubOrderID ].ubDeliveryLoc == BR_MEDUNA )
|
||||
@@ -96,8 +98,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
{
|
||||
// shipment went to wrong airport... reroute all items to a temporary
|
||||
// gridno to represent the other airport (and damage them)
|
||||
SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT );
|
||||
usStandardMapPos = LOST_SHIPMENT_GRIDNO;
|
||||
SetFactTrue( FACT_LAST_SHIPMENT_WENT_TO_WRONG_AIRPORT );
|
||||
sStandardMapPos = LOST_SHIPMENT_GRIDNO;
|
||||
SetFactFalse( FACT_NEXT_PACKAGE_CAN_BE_DELAYED );
|
||||
}
|
||||
else if ( (gTownLoyalty[ DRASSEN ].ubRating < 20) || StrategicMap[ CALCULATE_STRATEGIC_INDEX( 13, MAP_ROW_B ) ].fEnemyControlled )
|
||||
@@ -147,12 +149,10 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
if( !fSectorLoaded )
|
||||
{
|
||||
//build an array of objects to be added
|
||||
pObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
pStolenObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
pObject = new OBJECTTYPE[ usNumberOfItems ];
|
||||
pStolenObject = new OBJECTTYPE[ usNumberOfItems ];
|
||||
if( pObject == NULL || pStolenObject == NULL)
|
||||
return;
|
||||
memset( pObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
memset( pStolenObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
}
|
||||
|
||||
// WDS - Option to turn off stealing
|
||||
@@ -164,7 +164,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
}
|
||||
else if (CheckFact( FACT_PABLOS_BRIBED, 0 ))
|
||||
{
|
||||
// Since Pacos has some money, reduce record of # of shipments since last bribed...
|
||||
// Since Pacos has some money, reduce record of # of shipments since last bribed...
|
||||
ubShipmentsSinceNoBribes /= 2;
|
||||
uiChanceOfTheft = 0;
|
||||
}
|
||||
@@ -182,14 +182,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
usItem = gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].usItemIndex;
|
||||
|
||||
//Create the item
|
||||
CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &Object );
|
||||
CreateItem( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, &gTempObject );
|
||||
|
||||
// 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
|
||||
// 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.
|
||||
Object.ItemData.Gun.ubGunShotsLeft = 0;
|
||||
gTempObject[0]->data.gun.ubGunShotsLeft = 0;
|
||||
}
|
||||
|
||||
ubItemsDelivered = 0;
|
||||
@@ -208,25 +208,25 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
if ( !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + ubItemsPurchased) )
|
||||
{
|
||||
uiStolenCount++;
|
||||
usMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen!
|
||||
sMapPos = PABLOS_STOLEN_DEST_GRIDNO; // off screen!
|
||||
fPablosStoleSomething = TRUE;
|
||||
fPablosStoleLastItem = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
usMapPos = usStandardMapPos;
|
||||
sMapPos = sStandardMapPos;
|
||||
fPablosStoleLastItem = FALSE;
|
||||
|
||||
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
|
||||
if (sStandardMapPos == LOST_SHIPMENT_GRIDNO)
|
||||
{
|
||||
// damage the item a random amount!
|
||||
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
|
||||
gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 );
|
||||
// make damn sure it can't hit 0
|
||||
if (Object.ItemData.Generic.bStatus[0] == 0)
|
||||
if (gTempObject[0]->data.objectStatus == 0)
|
||||
{
|
||||
Object.ItemData.Generic.bStatus[0] = 1;
|
||||
gTempObject[0]->data.objectStatus = 1;
|
||||
}
|
||||
AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 );
|
||||
AddItemToPool( sMapPos, &gTempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +239,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
{
|
||||
if ( j > 1 && !fPablosStoleLastItem && uiChanceOfTheft > 0 && Random( 100 ) < (uiChanceOfTheft + j) )
|
||||
{
|
||||
memcpy( &pStolenObject[ uiStolenCount ], &Object, sizeof( OBJECTTYPE ) );
|
||||
pStolenObject[ uiStolenCount ] = gTempObject;
|
||||
uiStolenCount++;
|
||||
fPablosStoleSomething = TRUE;
|
||||
fPablosStoleLastItem = TRUE;
|
||||
@@ -251,16 +251,16 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
//else we are not currently in the sector, so we build an array of items to add in one lump
|
||||
//add the item to the item array
|
||||
|
||||
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
|
||||
if (sStandardMapPos == LOST_SHIPMENT_GRIDNO)
|
||||
{
|
||||
// damage the item a random amount!
|
||||
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
|
||||
gTempObject[0]->data.objectStatus = (INT8) ( ( (70 + Random( 11 )) * (INT32) gTempObject[0]->data.objectStatus ) / 100 );
|
||||
// make damn sure it can't hit 0
|
||||
if (Object.ItemData.Generic.bStatus[0] == 0)
|
||||
if (gTempObject[0]->data.objectStatus == 0)
|
||||
{
|
||||
Object.ItemData.Generic.bStatus[0] = 1;
|
||||
gTempObject[0]->data.objectStatus = 1;
|
||||
}
|
||||
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
|
||||
pObject[ uiCount ] = gTempObject;
|
||||
uiCount++;
|
||||
}
|
||||
else
|
||||
@@ -273,14 +273,14 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
|
||||
if ( gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].ubNumberPurchased == 1 && ubItemsDelivered == 1 )
|
||||
{
|
||||
// the item in Object will be the item to deliver
|
||||
// the item in gTempObject will be the item to deliver
|
||||
if( fSectorLoaded )
|
||||
{
|
||||
AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 );
|
||||
AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
|
||||
pObject[ uiCount ] = gTempObject;
|
||||
uiCount++;
|
||||
}
|
||||
}
|
||||
@@ -289,17 +289,17 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
while ( ubItemsDelivered )
|
||||
{
|
||||
// treat 0s as 1s :-)
|
||||
ubTempNumItems = __min( ubItemsDelivered, __max( 1, Item[ usItem ].ubPerPocket ) );
|
||||
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &Object );
|
||||
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&gTempObject, STACK_SIZE_LIMIT) );
|
||||
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderID ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &gTempObject );
|
||||
|
||||
// stack as many as possible
|
||||
if( fSectorLoaded )
|
||||
{
|
||||
AddItemToPool( usStandardMapPos, &Object, -1, 0, 0, 0 );
|
||||
AddItemToPool( sStandardMapPos, &gTempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
|
||||
pObject[ uiCount ] = gTempObject;
|
||||
uiCount++;
|
||||
}
|
||||
|
||||
@@ -312,9 +312,9 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
if( !fSectorLoaded )
|
||||
{
|
||||
//add all the items from the array that was built above
|
||||
usMapPos = PABLOS_STOLEN_DEST_GRIDNO;
|
||||
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
|
||||
if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, usStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
|
||||
sMapPos = PABLOS_STOLEN_DEST_GRIDNO;
|
||||
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
|
||||
if( !AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, sStandardMapPos, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
|
||||
{
|
||||
//Error adding the items
|
||||
//return;
|
||||
@@ -327,8 +327,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
//return;
|
||||
}
|
||||
}
|
||||
MemFree( pObject );
|
||||
MemFree( pStolenObject );
|
||||
delete[] pObject ;
|
||||
delete[]( pStolenObject );
|
||||
pObject = NULL;
|
||||
pStolenObject = NULL;
|
||||
}
|
||||
@@ -402,15 +402,13 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
|
||||
|
||||
void HandleDelayedItemsArrival( UINT32 uiReason )
|
||||
{
|
||||
// This function moves all the items that Pablos has stolen
|
||||
// (or items that were delayed) to the arrival location for new shipments,
|
||||
// This function moves all the items that Pablos has stolen
|
||||
// (or items that were delayed) to the arrival location for new shipments,
|
||||
INT16 sStartGridNo;
|
||||
UINT32 uiNumWorldItems, uiLoop;
|
||||
BOOLEAN fOk;
|
||||
WORLDITEM * pTemp;
|
||||
WORLDITEM * pTemp = 0;
|
||||
UINT8 ubLoop;
|
||||
OBJECTTYPE Object;
|
||||
|
||||
if (uiReason == NPC_SYSTEM_EVENT_ACTION_PARAM_BONUS + NPC_ACTION_RETURN_STOLEN_SHIPMENT_ITEMS )
|
||||
{
|
||||
if ( gMercProfiles[ PABLO ].bMercStatus == MERC_IS_DEAD )
|
||||
@@ -431,34 +429,34 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
||||
{
|
||||
case 0:
|
||||
// 1 in 10 chance of a badly damaged gas mask
|
||||
CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &Object );
|
||||
CreateItem( GASMASK, (INT8) (20 + Random( 10 )), &gTempObject );
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
// 2 in 10 chance of a battered Desert Eagle
|
||||
CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &Object );
|
||||
CreateItem( DESERTEAGLE, (INT8) (40 + Random( 10 )), &gTempObject );
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
// 3 in 10 chance of a stun grenade
|
||||
CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &Object );
|
||||
CreateItem( STUN_GRENADE, (INT8) (70 + Random( 10 )), &gTempObject );
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
// 4 in 10 chance of two 38s!
|
||||
CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &Object );
|
||||
CreateItems( SW38, (INT8) (90 + Random( 10 )), 2, &gTempObject );
|
||||
break;
|
||||
}
|
||||
if ( ( gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X ) && ( gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y ) && ( gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z ) )
|
||||
{
|
||||
AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &Object, -1, 0, 0, 0 );
|
||||
AddItemToPool( BOBBYR_SHIPPING_DEST_GRIDNO, &gTempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &Object, 0, 0, 0, -1, FALSE );
|
||||
AddItemsToUnLoadedSector( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, BOBBYR_SHIPPING_DEST_GRIDNO, 1, &gTempObject, 0, 0, 0, -1, FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,12 +484,12 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pTemp = (WORLDITEM *) MemAlloc( sizeof( WORLDITEM ) * uiNumWorldItems);
|
||||
pTemp = new WORLDITEM[ uiNumWorldItems];
|
||||
if (!pTemp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
|
||||
fOk = LoadWorldItemsFromTempItemFile( BOBBYR_SHIPPING_DEST_SECTOR_X, BOBBYR_SHIPPING_DEST_SECTOR_Y, BOBBYR_SHIPPING_DEST_SECTOR_Z, pTemp );
|
||||
if (fOk)
|
||||
{
|
||||
for (uiLoop = 0; uiLoop < uiNumWorldItems; uiLoop++)
|
||||
@@ -505,6 +503,9 @@ void HandleDelayedItemsArrival( UINT32 uiReason )
|
||||
}
|
||||
}
|
||||
|
||||
if (pTemp) {
|
||||
delete [] pTemp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -513,7 +514,7 @@ void AddSecondAirportAttendant( void )
|
||||
// add the second airport attendant to the Drassen airport...
|
||||
gMercProfiles[99].sSectorX = BOBBYR_SHIPPING_DEST_SECTOR_X;
|
||||
gMercProfiles[99].sSectorY = BOBBYR_SHIPPING_DEST_SECTOR_Y;
|
||||
gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z;
|
||||
gMercProfiles[99].bSectorZ = BOBBYR_SHIPPING_DEST_SECTOR_Z;
|
||||
}
|
||||
|
||||
void SetPabloToUnbribed( void )
|
||||
@@ -557,9 +558,9 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
|
||||
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
||||
{
|
||||
// loop through all items, look for ownership
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY )
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY )
|
||||
{
|
||||
uiTotalCash += gWorldItems[uiLoop].o.ItemData.Money.uiMoneyAmount;
|
||||
uiTotalCash += gWorldItems[uiLoop].object[0]->data.money.uiMoneyAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,7 +578,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
|
||||
// add history log here
|
||||
AddHistoryToPlayersLog( HISTORY_FOUND_MONEY, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY );
|
||||
|
||||
SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE );
|
||||
SetFactTrue( FACT_KINGPIN_WILL_LEARN_OF_MONEY_GONE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,17 +592,17 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
|
||||
if ( fFirstCheck )
|
||||
{
|
||||
// add event to make Kingpin aware, two days from now
|
||||
fKingpinWillDiscover = TRUE;
|
||||
fKingpinWillDiscover = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fKingpinDiscovers = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( fKingpinWillDiscover )
|
||||
{
|
||||
// set event for next day to check for real
|
||||
// set event for next day to check for real
|
||||
AddFutureDayStrategicEvent( EVENT_SET_BY_NPC_SYSTEM, Random( 120 ), FACT_KINGPIN_KNOWS_MONEY_GONE, 1 );
|
||||
|
||||
// the sector is unloaded NOW so set Kingpin's balance and remove the cash
|
||||
@@ -610,7 +611,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
|
||||
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
||||
{
|
||||
// loop through all items, look for ownership
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY )
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == MONEY )
|
||||
{
|
||||
// remove!
|
||||
gWorldItems[ uiLoop ].fExists = FALSE;
|
||||
@@ -647,7 +648,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
|
||||
{
|
||||
// set "really heavy old shipment" fact
|
||||
SetFactTrue( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FACT_SHIPMENT_DELAYED_24_HOURS:
|
||||
@@ -708,7 +709,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
|
||||
}
|
||||
break;
|
||||
case NPC_ACTION_DELAYED_MAKE_BRENDA_LEAVE:
|
||||
//IC:
|
||||
//IC:
|
||||
//TriggerNPCRecord( 85, 9 );
|
||||
SetFactTrue( FACT_BRENDA_PATIENCE_TIMER_EXPIRED );
|
||||
break;
|
||||
@@ -742,7 +743,7 @@ void HandleNPCSystemEvent( UINT32 uiEvent )
|
||||
|
||||
case NPC_ACTION_ADD_JOEY_TO_WORLD:
|
||||
// If Joey is not dead, escorted, or already delivered
|
||||
if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) &&
|
||||
if ( gMercProfiles[ JOEY ].bMercStatus != MERC_IS_DEAD && !CheckFact( FACT_JOEY_ESCORTED, 0 ) &&
|
||||
gMercProfiles[ JOEY ].sSectorX == 4 &&
|
||||
gMercProfiles[ JOEY ].sSectorY == MAP_ROW_D &&
|
||||
gMercProfiles[ JOEY ].bSectorZ == 1 )
|
||||
@@ -816,7 +817,7 @@ void HandleEarlyMorningEvents( void )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) )
|
||||
{
|
||||
@@ -869,7 +870,7 @@ void HandleEarlyMorningEvents( void )
|
||||
case 4:
|
||||
gMercProfiles[ DEVIN ].sSectorX = 6;
|
||||
gMercProfiles[ DEVIN ].sSectorY = MAP_ROW_C;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -914,7 +915,7 @@ void HandleEarlyMorningEvents( void )
|
||||
gMercProfiles[ HAMOUS ].sSectorY = MAP_ROW_D;
|
||||
gMercProfiles[ PROF_ICECREAM ].sSectorX = 9;
|
||||
gMercProfiles[ PROF_ICECREAM ].sSectorY = MAP_ROW_D;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,7 +949,7 @@ void HandleEarlyMorningEvents( void )
|
||||
gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_C;
|
||||
gMercProfiles[ CARMEN ].bSectorZ = 0;
|
||||
|
||||
// we should also reset # of terrorist heads and give him cash
|
||||
// we should also reset # of terrorist heads and give him cash
|
||||
if (gMercProfiles[ CARMEN ].bNPCData2 > 0)
|
||||
{
|
||||
if (gMercProfiles[ CARMEN ].uiMoney < 10000)
|
||||
@@ -991,7 +992,7 @@ void HandleEarlyMorningEvents( void )
|
||||
gMercProfiles[ CARMEN ].sSectorY = MAP_ROW_G;
|
||||
break;
|
||||
}
|
||||
// he should have $5000... unless the player forgot to meet him
|
||||
// he should have $5000... unless the player forgot to meet him
|
||||
if (gMercProfiles[ CARMEN ].uiMoney < 5000)
|
||||
{
|
||||
SetMoneyInSoldierProfile( CARMEN, 5000 );
|
||||
@@ -1043,20 +1044,31 @@ void CheckForMissingHospitalSupplies( void )
|
||||
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
||||
{
|
||||
// loop through all items, look for ownership
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP && gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].object.usItem == OWNERSHIP && gWorldItems[ uiLoop ].object[0]->data.owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
|
||||
{
|
||||
GetItemPool( gWorldItems[ uiLoop ].sGridNo, &pItemPool, 0 ) ;
|
||||
while( pItemPool )
|
||||
GetItemPoolFromGround( gWorldItems[ uiLoop ].sGridNo, &pItemPool ) ;
|
||||
while( pItemPool )
|
||||
{
|
||||
pObj = &( gWorldItems[ pItemPool->iItemIndex ].o );
|
||||
pObj = &( gWorldItems[ pItemPool->iItemIndex ].object );
|
||||
|
||||
if ( pObj->ItemData.Generic.bStatus[ 0 ] > 60 )
|
||||
#ifdef obsoleteCode
|
||||
if ( (*pObj)[0]->data.objectStatus > 60 )
|
||||
{
|
||||
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
|
||||
{
|
||||
ubMedicalObjects++;
|
||||
}
|
||||
}
|
||||
#endif//obsoleteCode
|
||||
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
|
||||
{
|
||||
for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) {
|
||||
if ( iter->data.objectStatus > 60 )
|
||||
{
|
||||
ubMedicalObjects++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pItemPool = pItemPool->pNext;
|
||||
}
|
||||
@@ -1065,7 +1077,7 @@ void CheckForMissingHospitalSupplies( void )
|
||||
|
||||
if ( CheckFact( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN, 0 ) == TRUE )
|
||||
{
|
||||
// player returning stuff! if back to full then can operate
|
||||
// player returning stuff! if back to full then can operate
|
||||
if ( ubMedicalObjects >= gubCambriaMedicalObjects )
|
||||
{
|
||||
SetFactFalse( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN );
|
||||
@@ -1073,7 +1085,7 @@ void CheckForMissingHospitalSupplies( void )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ubMedicalObjects < gubCambriaMedicalObjects )
|
||||
{
|
||||
// player's stolen something!
|
||||
@@ -1089,14 +1101,13 @@ void CheckForMissingHospitalSupplies( void )
|
||||
SetFactTrue( FACT_PLAYER_STOLE_MEDICAL_SUPPLIES_AGAIN );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
{
|
||||
BOOLEAN fSectorLoaded = FALSE;
|
||||
OBJECTTYPE Object;
|
||||
UINT32 uiCount = 0;
|
||||
OBJECTTYPE *pObject=NULL;
|
||||
UINT16 usNumberOfItems=0, usItem;
|
||||
@@ -1127,7 +1138,7 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
ChangeStatusOfOpenableStructInUnloadedSector( MEDUNA_ITEM_DROP_OFF_SECTOR_X, MEDUNA_ITEM_DROP_OFF_SECTOR_Y, MEDUNA_ITEM_DROP_OFF_SECTOR_Z, MEDUNA_ITEM_DROP_OFF_GRIDNO, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(i=0; i<gpNewBobbyrShipments[ ubOrderNum ].ubNumberPurchases; i++)
|
||||
{
|
||||
// Count how many items were purchased
|
||||
@@ -1138,10 +1149,9 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
if( !fSectorLoaded )
|
||||
{
|
||||
//build an array of objects to be added
|
||||
pObject = (OBJECTTYPE *) MemAlloc( sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
pObject = new OBJECTTYPE[ usNumberOfItems ];
|
||||
if( pObject == NULL )
|
||||
return;
|
||||
memset( pObject, 0, sizeof( OBJECTTYPE ) * usNumberOfItems );
|
||||
}
|
||||
|
||||
|
||||
@@ -1153,20 +1163,21 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
ubItemsDelivered = gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].ubNumberPurchased;
|
||||
usItem = gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].usItemIndex;
|
||||
|
||||
CreateItem(usItem, 100, &gTempObject);//to get the ItemSlotLimit only!
|
||||
while ( ubItemsDelivered )
|
||||
{
|
||||
// treat 0s as 1s :-)
|
||||
ubTempNumItems = __min( ubItemsDelivered, __max( 1, Item[ usItem ].ubPerPocket ) );
|
||||
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &Object );
|
||||
ubTempNumItems = __min( ubItemsDelivered, ItemSlotLimit(&gTempObject, STACK_SIZE_LIMIT) );
|
||||
CreateItems( usItem, gpNewBobbyrShipments[ ubOrderNum ].BobbyRayPurchase[i].bItemQuality, ubTempNumItems, &gTempObject );
|
||||
|
||||
// stack as many as possible
|
||||
if( fSectorLoaded )
|
||||
{
|
||||
AddItemToPool( MEDUNA_ITEM_DROP_OFF_GRIDNO, &Object, -1, 0, 0, 0 );
|
||||
AddItemToPool( MEDUNA_ITEM_DROP_OFF_GRIDNO, &gTempObject, -1, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
|
||||
pObject[ uiCount ] = gTempObject;
|
||||
uiCount++;
|
||||
}
|
||||
|
||||
@@ -1179,13 +1190,13 @@ void DropOffItemsInMeduna( UINT8 ubOrderNum )
|
||||
{
|
||||
//add all the items from the array that was built above
|
||||
|
||||
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
|
||||
//The item are to be added to the Top part of Drassen, grid loc's 10112, 9950
|
||||
if( !AddItemsToUnLoadedSector( MEDUNA_ITEM_DROP_OFF_SECTOR_X, MEDUNA_ITEM_DROP_OFF_SECTOR_Y, MEDUNA_ITEM_DROP_OFF_SECTOR_Z, MEDUNA_ITEM_DROP_OFF_GRIDNO, uiCount, pObject, 0, 0, 0, -1, FALSE ) )
|
||||
{
|
||||
//error
|
||||
Assert( 0 );
|
||||
}
|
||||
MemFree( pObject );
|
||||
delete[]( pObject );
|
||||
pObject = NULL;
|
||||
}
|
||||
|
||||
@@ -1194,4 +1205,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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user