mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- Added Dealtar's and Zilpin's Airport Externalization
- Needed GameDir files are already committet to SVN GameDir git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2759 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+114
-14
@@ -14,6 +14,7 @@
|
||||
#include "wordwrap.h"
|
||||
#include "strategic.h"
|
||||
#include "strategicmap.h"
|
||||
#include "PostalService.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -104,6 +105,8 @@ void RemovePreviousShipmentsMouseRegions();
|
||||
void CreatePreviousShipmentsMouseRegions();
|
||||
INT32 CountNumberValidShipmentForTheShipmentsPage();
|
||||
//ppp
|
||||
extern CPostalService gPostalService;
|
||||
extern vector<PShipmentStruct> gShipmentTable;
|
||||
|
||||
|
||||
//
|
||||
@@ -151,6 +154,7 @@ BOOLEAN EnterBobbyRShipments()
|
||||
|
||||
giBobbyRShipmentSelectedShipment = -1;
|
||||
|
||||
/*
|
||||
//if there are shipments
|
||||
if( giNumberOfNewBobbyRShipment != 0 )
|
||||
{
|
||||
@@ -170,6 +174,26 @@ BOOLEAN EnterBobbyRShipments()
|
||||
giBobbyRShipmentSelectedShipment = iCnt;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//if there are shipments
|
||||
if( gShipmentTable.size() != 0 )
|
||||
{
|
||||
INT32 iCnt=0;
|
||||
|
||||
//get the first shipment #
|
||||
vector<PShipmentStruct>::iterator& psi = gShipmentTable.begin();
|
||||
|
||||
while(psi != gShipmentTable.end())
|
||||
{
|
||||
if(((PShipmentStruct)*psi)->ShipmentStatus == SHIPMENT_INTRANSIT)
|
||||
{
|
||||
giBobbyRShipmentSelectedShipment = iCnt;
|
||||
}
|
||||
psi++;
|
||||
iCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CreatePreviousShipmentsMouseRegions();
|
||||
|
||||
@@ -205,6 +229,13 @@ void RenderBobbyRShipments()
|
||||
{
|
||||
// HVOBJECT hPixHandle;
|
||||
|
||||
// Dealtar: this must be static as this is accessed after this function has returned
|
||||
static BobbyRayPurchaseStruct brps[MAX_PURCHASE_AMOUNT];
|
||||
for(int i = 0; i < MAX_PURCHASE_AMOUNT; i++)
|
||||
{
|
||||
memset(&brps[i], 0, sizeof(BobbyRayPurchaseStruct));
|
||||
}
|
||||
|
||||
DrawBobbyRWoodBackground();
|
||||
|
||||
DrawBobbyROrderTitle();
|
||||
@@ -214,6 +245,43 @@ void RenderBobbyRShipments()
|
||||
|
||||
DisplayShipmentGrid();
|
||||
|
||||
if(giBobbyRShipmentSelectedShipment != -1)
|
||||
{
|
||||
RefToShipmentPackageListIterator spli = gShipmentTable[giBobbyRShipmentSelectedShipment]->ShipmentPackages.begin();
|
||||
int j;
|
||||
for(int i = 0; i < gShipmentTable[giBobbyRShipmentSelectedShipment]->ShipmentPackages.size(); i++, spli++)
|
||||
{
|
||||
brps[i].bItemQuality = ((ShipmentPackageStruct)*spli).bItemQuality;
|
||||
brps[i].ubNumberPurchased = ((ShipmentPackageStruct)*spli).ubNumber;
|
||||
brps[i].usItemIndex = ((ShipmentPackageStruct)*spli).usItemIndex;
|
||||
brps[i].fUsed = (((ShipmentPackageStruct)*spli).bItemQuality < 100);
|
||||
|
||||
if(brps[i].fUsed)
|
||||
{
|
||||
for(j=0; j < MAXITEMS; j++)
|
||||
{
|
||||
if(LaptopSaveInfo.BobbyRayUsedInventory[j].usItemIndex == brps[i].usItemIndex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
brps[i].usBobbyItemIndex = j;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j=0; j < MAXITEMS; j++)
|
||||
{
|
||||
if(LaptopSaveInfo.BobbyRayInventory[j].usItemIndex == brps[i].usItemIndex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
brps[i].usBobbyItemIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if( giBobbyRShipmentSelectedShipment != -1 &&
|
||||
gpNewBobbyrShipments[ giBobbyRShipmentSelectedShipment ].fActive &&
|
||||
gpNewBobbyrShipments[ giBobbyRShipmentSelectedShipment ].fDisplayedInShipmentPage )
|
||||
@@ -226,6 +294,18 @@ void RenderBobbyRShipments()
|
||||
// DisplayPurchasedItems( FALSE, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, &LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[giBobbyRShipmentSelectedShipment].BobbyRayPurchase[0], TRUE );
|
||||
DisplayPurchasedItems( FALSE, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, NULL, TRUE, giBobbyRShipmentSelectedShipment );
|
||||
}
|
||||
*/
|
||||
|
||||
if( giBobbyRShipmentSelectedShipment != -1 &&
|
||||
gShipmentTable[ giBobbyRShipmentSelectedShipment ]->ShipmentStatus == SHIPMENT_INTRANSIT) // &&
|
||||
{
|
||||
DisplayPurchasedItems( FALSE, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y,&brps[0], FALSE, giBobbyRShipmentSelectedShipment );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayPurchasedItems( FALSE, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, NULL, TRUE, giBobbyRShipmentSelectedShipment );
|
||||
}
|
||||
|
||||
|
||||
DisplayShipmentTitles();
|
||||
DisplayPreviousShipments();
|
||||
@@ -310,17 +390,27 @@ void DisplayPreviousShipments()
|
||||
UINT32 uiCnt;
|
||||
CHAR16 zText[512];
|
||||
UINT16 usPosY = BOBBYR_SHIPMENT_ORDER_NUM_START_Y;
|
||||
UINT32 uiNumItems = CountNumberValidShipmentForTheShipmentsPage();
|
||||
UINT32 uiNumItems; // = CountNumberValidShipmentForTheShipmentsPage();
|
||||
UINT32 uiNumberItemsInShipments = 0;
|
||||
UINT32 uiItemCnt;
|
||||
UINT8 ubFontColor = BOBBYR_SHIPMENT_STATIC_TEXT_COLOR;
|
||||
|
||||
RefToShipmentListIterator sli = gPostalService.LookupShipmentList().begin();
|
||||
|
||||
uiNumItems = (UINT32)gPostalService.LookupShipmentList().size();
|
||||
if(uiNumItems > BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS)
|
||||
uiNumItems = BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS;
|
||||
|
||||
//loop through all the shipments
|
||||
for( uiCnt=0; uiCnt<uiNumItems; uiCnt++ )
|
||||
{
|
||||
/*
|
||||
//if it is a valid shipment, and can be displayed at bobby r
|
||||
if( gpNewBobbyrShipments[ uiCnt ].fActive &&
|
||||
gpNewBobbyrShipments[ giBobbyRShipmentSelectedShipment ].fDisplayedInShipmentPage )
|
||||
*/
|
||||
// if it is a shipment that is active (= in transit)
|
||||
if( gShipmentTable[ uiCnt ]->ShipmentStatus == SHIPMENT_INTRANSIT)
|
||||
{
|
||||
if( uiCnt == (UINT32)giBobbyRShipmentSelectedShipment )
|
||||
{
|
||||
@@ -332,17 +422,25 @@ void DisplayPreviousShipments()
|
||||
}
|
||||
|
||||
//Display the "ordered on day num"
|
||||
swprintf( zText, L"%s %d", gpGameClockString[0], gpNewBobbyrShipments[ uiCnt ].uiOrderedOnDayNum );
|
||||
//swprintf( zText, L"%s %d", gpGameClockString[0], gpNewBobbyrShipments[ uiCnt ].uiOrderedOnDayNum );
|
||||
swprintf( zText, L"%s %d", gpGameClockString[0], gShipmentTable[ uiCnt ]->uiOrderDate );
|
||||
DrawTextToScreen( zText, BOBBYR_SHIPMENT_ORDER_NUM_X, usPosY, BOBBYR_SHIPMENT_ORDER_NUM_WIDTH, BOBBYR_SHIPMENT_STATIC_TEXT_FONT, ubFontColor, 0, FALSE, CENTER_JUSTIFIED );
|
||||
|
||||
uiNumberItemsInShipments = 0;
|
||||
|
||||
/*
|
||||
// for( uiItemCnt=0; uiItemCnt<LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ uiCnt ].ubNumberPurchases; uiItemCnt++ )
|
||||
for( uiItemCnt=0; uiItemCnt<gpNewBobbyrShipments[ uiCnt ].ubNumberPurchases; uiItemCnt++ )
|
||||
{
|
||||
// uiNumberItemsInShipments += LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ uiCnt ].BobbyRayPurchase[uiItemCnt].ubNumberPurchased;
|
||||
uiNumberItemsInShipments += gpNewBobbyrShipments[ uiCnt ].BobbyRayPurchase[uiItemCnt].ubNumberPurchased;
|
||||
}
|
||||
*/
|
||||
for( uiItemCnt=0; uiItemCnt<gShipmentTable[ uiCnt ]->ShipmentPackages.size(); uiItemCnt++ )
|
||||
{
|
||||
uiNumberItemsInShipments += gShipmentTable[ uiCnt ]->ShipmentPackages[uiItemCnt].ubNumber;
|
||||
}
|
||||
|
||||
|
||||
//Display the # of items
|
||||
swprintf( zText, L"%d", uiNumberItemsInShipments );
|
||||
@@ -358,7 +456,8 @@ void CreatePreviousShipmentsMouseRegions()
|
||||
UINT16 usPosY = BOBBYR_SHIPMENT_ORDER_NUM_START_Y;
|
||||
UINT16 usWidth = BOBBYR_SHIPMENT_DELIVERY_GRID_WIDTH;
|
||||
UINT16 usHeight = GetFontHeight( BOBBYR_SHIPMENT_STATIC_TEXT_FONT );
|
||||
UINT32 uiNumItems = CountNumberOfBobbyPurchasesThatAreInTransit();
|
||||
//UINT32 uiNumItems = CountNumberOfBobbyPurchasesThatAreInTransit();
|
||||
UINT32 uiNumItems = gPostalService.GetShipmentCount(SHIPMENT_INTRANSIT);
|
||||
|
||||
// WDS - If there are more than 13 shipments only show 13 because
|
||||
// that is all that will fit on the screen. If you show more things
|
||||
@@ -381,7 +480,8 @@ void CreatePreviousShipmentsMouseRegions()
|
||||
void RemovePreviousShipmentsMouseRegions()
|
||||
{
|
||||
UINT32 uiCnt;
|
||||
UINT32 uiNumItems = CountNumberOfBobbyPurchasesThatAreInTransit();
|
||||
//UINT32 uiNumItems = CountNumberOfBobbyPurchasesThatAreInTransit();
|
||||
UINT32 uiNumItems = gPostalService.GetShipmentCount(SHIPMENT_INTRANSIT);
|
||||
|
||||
|
||||
for( uiCnt=0; uiCnt<uiNumItems; uiCnt++ )
|
||||
@@ -400,7 +500,8 @@ void SelectPreviousShipmentsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
|
||||
INT32 iSlotID = MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
|
||||
if( CountNumberOfBobbyPurchasesThatAreInTransit() > iSlotID )
|
||||
// if( CountNumberOfBobbyPurchasesThatAreInTransit() > iSlotID )
|
||||
if( gPostalService.GetShipmentCount(SHIPMENT_INTRANSIT) > iSlotID )
|
||||
{
|
||||
INT32 iCnt;
|
||||
INT32 iValidShipmentCounter=0;
|
||||
@@ -408,9 +509,11 @@ void SelectPreviousShipmentsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
|
||||
giBobbyRShipmentSelectedShipment = -1;
|
||||
|
||||
//loop through and get the "x" iSlotID shipment
|
||||
for( iCnt=0; iCnt<giNumberOfNewBobbyRShipment; iCnt++ )
|
||||
// for( iCnt=0; iCnt<giNumberOfNewBobbyRShipment; iCnt++ )
|
||||
for( iCnt=0; iCnt<gPostalService.GetShipmentCount(SHIPMENT_INTRANSIT); iCnt++ )
|
||||
{
|
||||
if( gpNewBobbyrShipments[iCnt].fActive )
|
||||
// if( gpNewBobbyrShipments[iCnt].fActive )
|
||||
if( gShipmentTable[iCnt]->ShipmentStatus == SHIPMENT_INTRANSIT )
|
||||
{
|
||||
if( iValidShipmentCounter == iSlotID )
|
||||
{
|
||||
@@ -426,6 +529,9 @@ void SelectPreviousShipmentsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
|
||||
}
|
||||
}
|
||||
|
||||
//Dealtar's Airport Externalization
|
||||
/*
|
||||
* Function no longer used.
|
||||
INT32 CountNumberValidShipmentForTheShipmentsPage()
|
||||
{
|
||||
if( giNumberOfNewBobbyRShipment > BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS )
|
||||
@@ -433,11 +539,5 @@ INT32 CountNumberValidShipmentForTheShipmentsPage()
|
||||
else
|
||||
return( giNumberOfNewBobbyRShipment );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user