mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Merge branch 'master' into ExtraMercs
This commit is contained in:
+2
-2
@@ -1198,7 +1198,7 @@ void EnemyHeliMANPADSCheck( INT16 id )
|
||||
if ( pObj )
|
||||
{
|
||||
// abort if this is a launcher without ammo
|
||||
if ( Item[pObj->usItem].rocketlauncher && !Item[pObj->usItem].singleshotrocketlauncher )
|
||||
if (ItemIsRocketLauncher(pObj->usItem) && !ItemIsSingleShotRocketLauncher(pObj->usItem))
|
||||
{
|
||||
OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE );
|
||||
if ( !pAttachment->exists( ) )
|
||||
@@ -1227,7 +1227,7 @@ void EnemyHeliMANPADSCheck( INT16 id )
|
||||
MapScreenMessage( FONT_MCOLOR_LTRED, MSG_INTERFACE, szEnemyHeliText[7], pSoldier->GetName( ), Item[pObj->usItem].szItemName, pStrSectorName );
|
||||
|
||||
// 'fire' (remove shot)
|
||||
if ( Item[pObj->usItem].singleshotrocketlauncher )
|
||||
if (ItemIsSingleShotRocketLauncher(pObj->usItem))
|
||||
{
|
||||
CreateItem( Item[pObj->usItem].discardedlauncheritem, (*pObj)[0]->data.objectStatus, pObj );
|
||||
|
||||
|
||||
+12
-12
@@ -1561,7 +1561,7 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier )
|
||||
return ( TRUE );
|
||||
|
||||
// Flugente: stats can also be damaged
|
||||
if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold ) )
|
||||
if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold ) )
|
||||
{
|
||||
if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 )
|
||||
return ( TRUE );
|
||||
@@ -3348,7 +3348,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
|
||||
}
|
||||
|
||||
// can't repair at all without a toolkit
|
||||
if (!Item[pSoldier->inv[HANDPOS].usItem].toolkit )
|
||||
if (!ItemIsToolkit(pSoldier->inv[HANDPOS].usItem))
|
||||
{
|
||||
*pusMaxPts = 0;
|
||||
return(0);
|
||||
@@ -4062,7 +4062,7 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier)
|
||||
// CHRISL: Changed to dynamically determine max inventory locations.
|
||||
for (int ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket)
|
||||
{
|
||||
if( Item[pSoldier->inv[ ubPocket ].usItem].toolkit )
|
||||
if(ItemIsToolkit(pSoldier->inv[ ubPocket ].usItem))
|
||||
{
|
||||
usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) );
|
||||
}
|
||||
@@ -5137,7 +5137,7 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, IN
|
||||
|
||||
// repairs on electronic items take twice as long if the guy doesn't have the skill
|
||||
// Technician/Electronic traits - repairing electronic items - SANDRO
|
||||
if ( Item[ usItem ].electronic )
|
||||
if (ItemIsElectronic(usItem))
|
||||
{
|
||||
if (gGameOptions.fNewTraitSystem)
|
||||
{
|
||||
@@ -5744,7 +5744,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
|
||||
BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold )
|
||||
{
|
||||
// check to see if item can/needs to be repaired
|
||||
if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) )
|
||||
if ( ( bStatus < 100) && ItemIsRepairable(usItem) )
|
||||
{
|
||||
if ( gGameExternalOptions.fAdvRepairSystem )
|
||||
{
|
||||
@@ -10458,7 +10458,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier )
|
||||
INT8 bPocket = 0, bonus = -101, bToolkitPocket = NO_SLOT;
|
||||
|
||||
// if there isn't a toolkit in his hand
|
||||
if( Item[pSoldier->inv[ HANDPOS].usItem].toolkit )
|
||||
if(ItemIsToolkit(pSoldier->inv[ HANDPOS].usItem))
|
||||
{
|
||||
bonus = Item[pSoldier->inv[ HANDPOS].usItem].RepairModifier;
|
||||
bToolkitPocket = HANDPOS;
|
||||
@@ -10468,7 +10468,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier )
|
||||
// CHRISL: Changed to dynamically determine max inventory locations.
|
||||
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
|
||||
{
|
||||
if( Item[pSoldier->inv[ bPocket ].usItem].toolkit && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus)
|
||||
if(ItemIsToolkit(pSoldier->inv[ bPocket ].usItem) && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus)
|
||||
{
|
||||
bonus = Item[pSoldier->inv[ bPocket ].usItem].RepairModifier;
|
||||
bToolkitPocket = bPocket;
|
||||
@@ -10502,7 +10502,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
|
||||
fTeamPanelDirty = TRUE;
|
||||
|
||||
// if there is a MEDICAL BAG in his hand, we're set
|
||||
if ( Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit )
|
||||
if (ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem))
|
||||
{
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -10510,7 +10510,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
|
||||
// run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found
|
||||
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
|
||||
{
|
||||
if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit )
|
||||
if (ItemIsMedicalKit(pSoldier->inv[ bPocket ].usItem))
|
||||
{
|
||||
medkit_found = true;
|
||||
can_swap = true;
|
||||
@@ -10578,7 +10578,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
|
||||
return FALSE;
|
||||
|
||||
// we didn't find a medical bag, so settle for a FIRST AID KIT
|
||||
if ( Item[pSoldier->inv[ HANDPOS ].usItem].firstaidkit )
|
||||
if (ItemIsFirstAidKit(pSoldier->inv[ HANDPOS ].usItem))
|
||||
{
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -10587,10 +10587,10 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
|
||||
// CHRISL: Changed to dynamically determine max inventory locations.
|
||||
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
|
||||
{
|
||||
if ( Item[pSoldier->inv[ bPocket ].usItem].firstaidkit )
|
||||
if (ItemIsFirstAidKit(pSoldier->inv[ bPocket ].usItem))
|
||||
{
|
||||
// CHRISL: This needs to start with the first "non-big" pocket.
|
||||
if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCKSTART ) )
|
||||
if( (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && (bPocket >= SMALLPOCKSTART)))
|
||||
{
|
||||
// first move from hand to second hand
|
||||
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE );
|
||||
|
||||
@@ -681,7 +681,7 @@ UINT32 AutoResolveScreenHandle()
|
||||
SGPRect ClipRect;
|
||||
gpAR->fEnteringAutoResolve = FALSE;
|
||||
//Take the framebuffer, shade it, and save it to the SAVEBUFFER.
|
||||
ClipRect.iLeft = 0 + xResOffset;
|
||||
ClipRect.iLeft = 0;
|
||||
ClipRect.iTop = 0;
|
||||
/*ClipRect.iRight = 640;
|
||||
ClipRect.iBottom = 480;*/
|
||||
@@ -692,7 +692,7 @@ UINT32 AutoResolveScreenHandle()
|
||||
Blt16BPPBufferShadowRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect );
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
//BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, 640, 480 );
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0 + xResOffset, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
KillPreBattleInterface();
|
||||
CalculateAutoResolveInfo();
|
||||
CalculateSoldierCells( FALSE );
|
||||
@@ -4257,7 +4257,7 @@ BOOLEAN FireTankCannon( SOLDIERCELL *pAttacker )
|
||||
{
|
||||
pItem = &pSoldier->inv[i];
|
||||
|
||||
if ( Item[pItem->usItem].cannon )
|
||||
if (ItemIsCannon(pItem->usItem))
|
||||
{
|
||||
PlayAutoResolveSample( Weapon[pItem->usItem].sSound, RATE_11025, 50, 1, MIDDLEPAN );
|
||||
|
||||
@@ -4291,7 +4291,7 @@ BOOLEAN FireAntiTankWeapon( SOLDIERCELL *pAttacker )
|
||||
{
|
||||
pItem = &pSoldier->inv[i];
|
||||
|
||||
if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || Item[pItem->usItem].cannon )
|
||||
if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || ItemIsCannon(pItem->usItem))
|
||||
{
|
||||
pAttacker->bWeaponSlot = (INT8)i;
|
||||
if ( gpAR->fUnlimitedAmmo )
|
||||
|
||||
@@ -206,26 +206,6 @@ BOOLEAN ReadInAltSectors(STR fileName)
|
||||
|
||||
BOOLEAN WriteInAltSectors(STR fileName)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Lets output the current Strategic map format using the XML structure I've devised.
|
||||
FILE *outfile = fopen(fileName, "wt");
|
||||
|
||||
UINT32 x, y;
|
||||
|
||||
fprintf (outfile, "<ALT_SECTORS_LIST>\n");
|
||||
for(y = 1;y <= 16;y++)
|
||||
{
|
||||
fprintf (outfile, "\t<ROW y=\"%c\">",(y+0x40));
|
||||
for(x = 1;x <= 16; x++)
|
||||
{
|
||||
fprintf (outfile, " %d",RandomSector[ ((y - 1) * 16) + (x - 1) ] );
|
||||
}
|
||||
fprintf (outfile, " </ROW>\n");
|
||||
}
|
||||
fprintf (outfile, "</ALT_SECTORS_LIST>\n");
|
||||
|
||||
fclose(outfile);
|
||||
#else
|
||||
XMLWriter xmlw;
|
||||
xmlw.openNode(L"ALT_SECTORS_LIST");
|
||||
UINT32 x, y;
|
||||
@@ -241,7 +221,6 @@ BOOLEAN WriteInAltSectors(STR fileName)
|
||||
}
|
||||
xmlw.closeNode();
|
||||
xmlw.writeToFile(fileName);
|
||||
#endif
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "DEBUG.H"
|
||||
#include <map>
|
||||
|
||||
const int MAXIMUM_VALID_X_COORDINATE = 16;
|
||||
const int MINIMUM_VALID_X_COORDINATE = 1;
|
||||
@@ -223,6 +224,11 @@ enum
|
||||
NUM_RISKS,
|
||||
};
|
||||
|
||||
enum class FacilityRiskVectorTypes
|
||||
{
|
||||
RISK_DRUG_ITEMS,
|
||||
};
|
||||
|
||||
typedef struct FACILITYRISKTYPE
|
||||
{
|
||||
// The risks involved with perfoming an assignment at a specific facility.
|
||||
@@ -231,6 +237,7 @@ typedef struct FACILITYRISKTYPE
|
||||
INT8 bBaseEffect; // Base result. If negative, result will always be negative. If positive, result will always be positive.
|
||||
// If 0, result can be either negative or positive.
|
||||
UINT8 ubRange; // Range of deviation for the base effect.
|
||||
std::map<FacilityRiskVectorTypes, std::vector<INT16>> valueVectors; // Optional additional data
|
||||
|
||||
} FACILITYRISKTYPE;
|
||||
|
||||
@@ -333,7 +340,6 @@ typedef struct FACILITYTYPE
|
||||
std::vector<PRODUCTION_LINE> ProductionData;
|
||||
|
||||
} FACILITYTYPE;
|
||||
#define FACILITYTYPE_SIZEOF_POD offsetof(FACILITYTYPE, ProductionData)
|
||||
|
||||
// HEADROCK HAM 3.5: Maximum number of different facility types
|
||||
#define MAX_NUM_FACILITY_TYPES 255
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "Isometric Utils.h"
|
||||
#include "MilitiaSquads.h"
|
||||
#include "Tactical Save.h"
|
||||
#include <random>
|
||||
|
||||
INT16 gsSkyriderCostModifier;
|
||||
// HEADROCK HAM 3.6: Strategic info variable, total of income/costs accumulated for the use of facilities today.
|
||||
@@ -1808,9 +1809,25 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
|
||||
}
|
||||
|
||||
// Add effects
|
||||
CreateItem( ALCOHOL, Item[ALCOHOL].usPortionSize, &gTempObject );
|
||||
|
||||
ApplyConsumable( pSoldier, &gTempObject, TRUE, FALSE );
|
||||
{
|
||||
std::vector<INT16>& riskDrugItems =
|
||||
gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].Risk[iCounter].valueVectors[FacilityRiskVectorTypes::RISK_DRUG_ITEMS];
|
||||
|
||||
if (riskDrugItems.empty())
|
||||
{
|
||||
CreateItem(ALCOHOL, Item[ALCOHOL].usPortionSize, &gTempObject);
|
||||
|
||||
ApplyConsumable(pSoldier, &gTempObject, TRUE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
INT16 sItemId = riskDrugItems[std::uniform_int_distribution<>(0, riskDrugItems.size() - 1)(std::mt19937{ std::random_device{}() })];
|
||||
|
||||
CreateItem(sItemId, Item[sItemId].usPortionSize, &gTempObject);
|
||||
|
||||
ApplyConsumable(pSoldier, &gTempObject, TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
//pSoldier->AddDrugValues( DRUG_TYPE_ALCOHOL, Drug[DRUG_TYPE_ALCOHOL].ubDrugEffect, Drug[DRUG_TYPE_ALCOHOL].ubDrugTravelRate, Drug[DRUG_TYPE_ALCOHOL].ubDrugSideEffect );
|
||||
|
||||
|
||||
+95
-29
@@ -39,8 +39,8 @@
|
||||
// anv: for hourly heli repair
|
||||
#include "Vehicles.h"
|
||||
#include "Map Screen Helicopter.h"
|
||||
// anv: transition to save screen in extreme iron man mode
|
||||
#include "gameloop.h"
|
||||
#include "gameloop.h" // anv: transition to save screen in extreme iron man mode
|
||||
#include <random> // anv: shuffle drug items in hourly update
|
||||
|
||||
void HourlyQuestUpdate();
|
||||
void HourlyLarryUpdate();
|
||||
@@ -342,6 +342,7 @@ void HourlyQuestUpdate()
|
||||
}
|
||||
|
||||
#define BAR_TEMPTATION 4
|
||||
#define INVENTORY_DRUG_TEMPTATION 5
|
||||
|
||||
// Flugente: abandoned the LarryItems for the new drug system
|
||||
/*#define NUM_LARRY_ITEMS 6
|
||||
@@ -377,40 +378,105 @@ void HourlyLarryUpdate()
|
||||
{
|
||||
fTookDrugs = FALSE;
|
||||
|
||||
if ( pSoldier->bAssignment < ON_DUTY && !pSoldier->flags.fBetweenSectors && pSoldier->bInSector && !( gTacticalStatus.fEnemyInSector || guiCurrentScreen == GAME_SCREEN ) )
|
||||
const std::vector<INT16> drugItems = pSoldier->GetBackgroundValueVector(BackgroundVectorTypes::BG_DRUGUSE_ITEMS);
|
||||
const std::vector<INT16> drugTypes = pSoldier->GetBackgroundValueVector(BackgroundVectorTypes::BG_DRUGUSE_TYPES);
|
||||
|
||||
if ( pSoldier->bAssignment < ON_DUTY && !pSoldier->flags.fBetweenSectors && !( gTacticalStatus.fEnemyInSector || guiCurrentScreen == GAME_SCREEN ) )
|
||||
{
|
||||
// Flugente: reworked this for the new drug system. We now loop over our entire inventory
|
||||
INT8 invsize = (INT8)pSoldier->inv.size(); // remember inventorysize, so we don't call size() repeatedly
|
||||
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ...
|
||||
{
|
||||
if ( pSoldier->inv[bLoop].exists() && Item[ pSoldier->inv[bLoop].usItem ].drugtype > 0 )
|
||||
if (pSoldier->inv[bLoop].exists())
|
||||
{
|
||||
pObj = &(pSoldier->inv[bLoop]);
|
||||
|
||||
usTemptation = 5;
|
||||
|
||||
// any drug will do... I'm not going to create a new tag for sth minor like this
|
||||
break;
|
||||
INT16 sCurrentItemId = pSoldier->inv[bLoop].usItem;
|
||||
INT16 sCurrentDrugType = Item[sCurrentItemId].drugtype;
|
||||
if (Item[sCurrentItemId].drugtype > 0 && Item[sCurrentItemId].usItemClass & (IC_KIT | IC_MISC))
|
||||
{
|
||||
// anv: if drug user has no items or types specified, assume any is valid, otherwise check drug item id or type
|
||||
if ((drugItems.empty() && drugTypes.empty()) ||
|
||||
(!drugItems.empty() && std::find(drugItems.begin(), drugItems.end(), sCurrentItemId) != drugItems.end()) ||
|
||||
(!drugTypes.empty() && std::find(drugTypes.begin(), drugTypes.end(), sCurrentDrugType) != drugTypes.end()))
|
||||
{
|
||||
pObj = &(pSoldier->inv[bLoop]);
|
||||
usTemptation = INVENTORY_DRUG_TEMPTATION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check to see if we're in a bar sector, if we are, we have access to alcohol
|
||||
// which may be better than anything we've got...
|
||||
if ( usTemptation < BAR_TEMPTATION && GetCurrentBalance() >= Item[ ALCOHOL ].usPrice )
|
||||
INT16 sBarDrugItemId = 0;
|
||||
if ( usTemptation < BAR_TEMPTATION )
|
||||
{
|
||||
if ( pSoldier->bSectorZ == 0 &&
|
||||
( ( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_D) ||
|
||||
( pSoldier->sSectorX == 13 && pSoldier->sSectorY == MAP_ROW_C) ||
|
||||
( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_C) ||
|
||||
( pSoldier->sSectorX == 6 && pSoldier->sSectorY == MAP_ROW_C) ||
|
||||
( pSoldier->sSectorX == 5 && pSoldier->sSectorY == MAP_ROW_D) ||
|
||||
( pSoldier->sSectorX == 2 && pSoldier->sSectorY == MAP_ROW_H)
|
||||
)
|
||||
)
|
||||
// sevenfm: check facility
|
||||
if (pSoldier->bSectorZ == 0)
|
||||
{
|
||||
// in a bar!
|
||||
fBar = TRUE;
|
||||
usTemptation = BAR_TEMPTATION;
|
||||
for (UINT16 usFacilityType = 0; usFacilityType < NUM_FACILITY_TYPES; usFacilityType++)
|
||||
{
|
||||
// Is this facility here?
|
||||
if (gFacilityLocations[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][usFacilityType].fFacilityHere)
|
||||
{
|
||||
for (UINT16 usFacilityAssignment = 0; usFacilityAssignment < NUM_FACILITY_ASSIGNMENTS; usFacilityAssignment++)
|
||||
{
|
||||
// is it a place with risk of getting drunk?
|
||||
if (gFacilityTypes[usFacilityType].AssignmentData[usFacilityAssignment].Risk[RISK_DRUNK].usChance > 0)
|
||||
{
|
||||
// anv: check all items available for this risk
|
||||
const std::vector<INT16>& riskDrugItems =
|
||||
gFacilityTypes[usFacilityType].AssignmentData[usFacilityAssignment].Risk[RISK_DRUNK].valueVectors[FacilityRiskVectorTypes::RISK_DRUG_ITEMS];
|
||||
|
||||
if (riskDrugItems.empty())
|
||||
{
|
||||
if (GetCurrentBalance() >= Item[ALCOHOL].usPrice)
|
||||
{
|
||||
if ((drugItems.empty() && drugTypes.empty()) ||
|
||||
(!drugItems.empty() && std::find(drugItems.begin(), drugItems.end(), sBarDrugItemId) != drugItems.end()) ||
|
||||
(!drugTypes.empty() && std::find(drugTypes.begin(), drugTypes.end(), Item[ALCOHOL].drugtype) != drugTypes.end()))
|
||||
{
|
||||
sBarDrugItemId = ALCOHOL;
|
||||
|
||||
// Cool.
|
||||
fBar = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<INT16> shuffledRiskDrugItems = riskDrugItems;
|
||||
std::shuffle(shuffledRiskDrugItems.begin(), shuffledRiskDrugItems.end(), std::mt19937{ std::random_device{}() });
|
||||
for (INT16 sItemId : shuffledRiskDrugItems)
|
||||
{
|
||||
if (sItemId < MAXITEMS && Item[sItemId].usItemClass & (IC_KIT | IC_MISC) && GetCurrentBalance() >= Item[sItemId].usPrice)
|
||||
{
|
||||
if ((drugItems.empty() && drugTypes.empty()) ||
|
||||
(!drugItems.empty() && std::find(drugItems.begin(), drugItems.end(), sItemId) != drugItems.end()) ||
|
||||
(!drugTypes.empty() && std::find(drugTypes.begin(), drugTypes.end(), Item[sItemId].drugtype) != drugTypes.end()))
|
||||
{
|
||||
sBarDrugItemId = sItemId;
|
||||
|
||||
// Cool.
|
||||
fBar = TRUE;
|
||||
|
||||
// sevenfm: stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fBar)
|
||||
{
|
||||
usTemptation = BAR_TEMPTATION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,10 +539,10 @@ void HourlyLarryUpdate()
|
||||
bBoozeSlot = FindEmptySlotWithin( pSoldier, HANDPOS, NUM_INV_SLOTS );
|
||||
if ( bBoozeSlot != NO_SLOT )
|
||||
{
|
||||
INVTYPE drugItem = Item[sBarDrugItemId];
|
||||
// take $ from player's account
|
||||
// silversurfer: changed the price to reflect the changed amount of 25% below
|
||||
//usCashAmount = Item[ ALCOHOL ].usPrice;
|
||||
usCashAmount = (UINT16)( Item[ALCOHOL].usPrice / 4.0f );
|
||||
usCashAmount = (UINT16)(drugItem.usPrice / 4.0f);
|
||||
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin(), -( usCashAmount ) );
|
||||
|
||||
// give Larry booze here
|
||||
@@ -484,10 +550,10 @@ void HourlyLarryUpdate()
|
||||
// Now the bottle will be fully consumed below and vanishes from inventory before the player even gets to see it. This simulates going to a bar to have a drink there.
|
||||
|
||||
UINT8 portionsize = 25;
|
||||
if ( Item[ALCOHOL].usPortionSize > 0 && Item[ALCOHOL].usPortionSize < 25 )
|
||||
portionsize = Item[ALCOHOL].usPortionSize;
|
||||
if (drugItem.usPortionSize > 0 && drugItem.usPortionSize < 25)
|
||||
portionsize = drugItem.usPortionSize;
|
||||
|
||||
CreateItem( ALCOHOL, portionsize, &( pSoldier->inv[bBoozeSlot] ) );
|
||||
CreateItem( sBarDrugItemId, portionsize, &( pSoldier->inv[bBoozeSlot] ) );
|
||||
|
||||
ApplyConsumable( pSoldier, &( pSoldier->inv[bBoozeSlot] ), TRUE, FALSE );
|
||||
}
|
||||
@@ -561,7 +627,7 @@ void HourlySmokerUpdate( )
|
||||
INT8 invsize = (INT8)pSoldier->inv.size( ); // remember inventorysize, so we don't call size() repeatedly
|
||||
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
|
||||
{
|
||||
if ( pSoldier->inv[bLoop].exists( ) && Item[pSoldier->inv[bLoop].usItem].cigarette )
|
||||
if ( pSoldier->inv[bLoop].exists( ) && ItemIsCigarette(pSoldier->inv[bLoop].usItem) )
|
||||
{
|
||||
pObj = &(pSoldier->inv[bLoop]);
|
||||
|
||||
|
||||
+25
-61
@@ -570,9 +570,6 @@ static int l_AnimMercPtsrusStrategicInsertionData (lua_State *L);
|
||||
|
||||
static int l_SetMusicMode (lua_State *L);
|
||||
static int l_MusicPlay (lua_State *L);
|
||||
#ifdef NEWMUSIC
|
||||
static int l_MusicPlayId (lua_State *L);
|
||||
#endif
|
||||
static int l_MusicSetVolume (lua_State *L);
|
||||
static int l_MusicGetVolume (lua_State *L);
|
||||
#ifdef NEWMUSIC
|
||||
@@ -1398,7 +1395,6 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
|
||||
lua_register(L, "SetMusicMode", l_SetMusicMode );
|
||||
lua_register(L, "MusicPlay", l_MusicPlay );
|
||||
#ifdef NEWMUSIC
|
||||
lua_register(L, "MusicIdPlay", l_MusicPlayId );
|
||||
lua_register(L, "AddMusic", l_gAddMusic );
|
||||
|
||||
lua_register(L, "SetMusicID", l_SetMusicID );
|
||||
@@ -5716,33 +5712,16 @@ static int l_gAddMusic(lua_State *L)
|
||||
}
|
||||
#endif
|
||||
static int l_MusicPlay (lua_State *L)
|
||||
{
|
||||
if ( lua_gettop(L) >= 1 )
|
||||
{
|
||||
UINT32 uiNum = lua_tointeger(L,1);
|
||||
#ifdef NEWMUSIC
|
||||
MusicPlay( uiNum, MUSIC_OLD_TYPE, FALSE);
|
||||
#else
|
||||
MusicPlay( uiNum );
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NEWMUSIC
|
||||
static int l_MusicPlayId (lua_State *L)
|
||||
{
|
||||
if ( lua_gettop(L) >= 2 )
|
||||
{
|
||||
UINT32 uiNum = lua_tointeger(L,1);
|
||||
UINT32 uiType = lua_tointeger(L,2);
|
||||
|
||||
if (uiType>=1 || uiType<=5 )
|
||||
MusicPlay( uiNum, uiType, TRUE);
|
||||
UINT32 musicMode = lua_tointeger(L, 1);
|
||||
UINT32 song = lua_tointeger(L,2);
|
||||
MusicPlay( static_cast<NewMusicList>(musicMode), song );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int l_SetMusicMode (lua_State *L)
|
||||
{
|
||||
if ( lua_gettop(L) >= 1 )
|
||||
@@ -13614,58 +13593,43 @@ static int l_GetNumHostilesInSector( lua_State *L )
|
||||
|
||||
void LuaGetIntelAndQuestMapData( INT32 aLevel )
|
||||
{
|
||||
static LuaScopeState _LS(true);
|
||||
static bool isInitialized = false;
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
|
||||
// Initialize only once during lifetime of program
|
||||
if (!isInitialized)
|
||||
{
|
||||
isInitialized = true;
|
||||
IniFunction(_LS.L(), TRUE);
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
|
||||
}
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 );
|
||||
}
|
||||
|
||||
void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft )
|
||||
{
|
||||
static LuaScopeState _LS(true);
|
||||
static bool isInitialized = false;
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
|
||||
// Initialize only once during lifetime of program
|
||||
if (!isInitialized)
|
||||
{
|
||||
isInitialized = true;
|
||||
IniFunction(_LS.L(), TRUE);
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
|
||||
}
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 );
|
||||
}
|
||||
|
||||
INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber )
|
||||
{
|
||||
static LuaScopeState _LS( true );
|
||||
static bool isInitialized = false;
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
|
||||
// Initialize only once during lifetime of program
|
||||
if (!isInitialized)
|
||||
{
|
||||
isInitialized = true;
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
const char* filename = "scripts\\strategicmap.lua";
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
}
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
IniGlobalGameSetting(_LS.L());
|
||||
LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 );
|
||||
|
||||
if ( lua_gettop( _LS.L() ) >= 0 )
|
||||
|
||||
@@ -1936,7 +1936,7 @@ BOOLEAN AllowedToExitFromMapscreenTo( INT8 bExitToWhere )
|
||||
}
|
||||
|
||||
// battle about to occur?
|
||||
if( ( fDisableDueToBattleRoster ) || ( fDisableMapInterfaceDueToBattle ) )
|
||||
if( ( fDisableDueToBattleRoster ) || ( fDisableMapInterfaceDueToBattle ) || ( gfPreBattleInterfaceActive ))
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -1481,7 +1481,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !(Item[twItem->object.usItem].singleshotrocketlauncher))
|
||||
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !ItemIsSingleShotRocketLauncher(twItem->object.usItem))
|
||||
{
|
||||
EmptyWeaponMagazine( &twItem->object, &gItemPointer );
|
||||
InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] );
|
||||
@@ -6009,7 +6009,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
|
||||
|
||||
//original code by flugente, renamed variables to fit here, removed "min (OVERHEATING_MAX_TEMPERATURE, newValue)" for dirt to allow to go beyond maximum and deduct later the same amount if neccessary.
|
||||
// ... if we use overheating and item is a gun, a launcher or a barrel ...
|
||||
if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[itemStack->usItem].barrel == TRUE ) )
|
||||
if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel(itemStack->usItem) ) )
|
||||
{
|
||||
for(INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
|
||||
{
|
||||
@@ -6017,7 +6017,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
|
||||
|
||||
FLOAT cooldownfactor = GetItemCooldownFactor(itemStack); // ... get item cooldown factor provided of attachments ...
|
||||
|
||||
if ( Item[itemStack->usItem].barrel == TRUE ) // ... a barrel lying around cools down a bit faster ...
|
||||
if (ItemIsBarrel(itemStack->usItem)) // ... a barrel lying around cools down a bit faster ...
|
||||
cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel;
|
||||
|
||||
FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ...
|
||||
|
||||
@@ -1792,11 +1792,16 @@ void InitializeMilitiaPopup(void)
|
||||
const UINT16 xVal = 330 + xResOffset;
|
||||
const UINT16 yVal = 25 + yResOffset;
|
||||
|
||||
if (isWidescreenUI() || iResolution >= _1024x768)
|
||||
if (iResolution >= _1024x768)
|
||||
{
|
||||
MAP_MILITIA_BOX_POS_X = xVal + 190;
|
||||
MAP_MILITIA_BOX_POS_Y = yVal + 285;
|
||||
}
|
||||
else if (isWidescreenUI())
|
||||
{
|
||||
MAP_MILITIA_BOX_POS_X = xVal + 190;
|
||||
MAP_MILITIA_BOX_POS_Y = yVal + 116;
|
||||
}
|
||||
else if (iResolution >= _800x600)
|
||||
{
|
||||
MAP_MILITIA_BOX_POS_X = xVal + 77;
|
||||
|
||||
@@ -4616,6 +4616,28 @@ void HandleSettingTheSelectedListOfMercs( void )
|
||||
INT8 pbErrorNumber = -1;
|
||||
pSoldier = MercPtrs[gCharactersList[GetSelectedDestChar()].usSolID];
|
||||
INT8 bSquadValue = pSoldier->bAssignment;
|
||||
if (bSquadValue == VEHICLE)
|
||||
{
|
||||
for (INT8 bCounter = 0; bCounter < NUMBER_OF_SQUADS; ++bCounter)
|
||||
{
|
||||
if (Squad[bCounter][0] != NULL && IsVehicle(Squad[bCounter][0]) &&
|
||||
Squad[bCounter][0]->bVehicleID == pSoldier->iVehicleId)
|
||||
{
|
||||
bSquadValue = bCounter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bSquadValue >= NUMBER_OF_SQUADS)
|
||||
{
|
||||
if (pbErrorNumber != -1)
|
||||
{
|
||||
ReportMapScreenMovementError(pbErrorNumber);
|
||||
}
|
||||
SetSelectedDestChar(-1);
|
||||
giDestHighLine = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// find number of characters in particular squad.
|
||||
for (INT8 bCounter = 0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; ++bCounter)
|
||||
@@ -4727,17 +4749,21 @@ INT8 FindSquadThatSoldierCanJoin( SOLDIERTYPE *pSoldier )
|
||||
// run through the list of squads
|
||||
for( bCounter = 0; bCounter < NUMBER_OF_SQUADS; bCounter++ )
|
||||
{
|
||||
// is this squad in this sector
|
||||
if( IsThisSquadInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, bCounter ) )
|
||||
// anv: don't automatically put people in vehicle squads
|
||||
if (Squad[bCounter][0] == NULL || !IsVehicle(Squad[bCounter][0]))
|
||||
{
|
||||
// does it have room?
|
||||
if( IsThisSquadFull( bCounter ) == FALSE )
|
||||
// is this squad in this sector
|
||||
if (IsThisSquadInThisSector(pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, bCounter))
|
||||
{
|
||||
// is it doing the same thing as the soldier is (staying or going) ?
|
||||
if( IsSquadSelectedForMovement( bCounter ) == IsSoldierSelectedForMovement( pSoldier ) )
|
||||
// does it have room?
|
||||
if (IsThisSquadFull(bCounter) == FALSE)
|
||||
{
|
||||
// go ourselves a match, then
|
||||
return( bCounter );
|
||||
// is it doing the same thing as the soldier is (staying or going) ?
|
||||
if (IsSquadSelectedForMovement(bCounter) == IsSoldierSelectedForMovement(pSoldier))
|
||||
{
|
||||
// go ourselves a match, then
|
||||
return(bCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,13 +995,13 @@ BOOLEAN StrategicRemoveMerc( SOLDIERTYPE *pSoldier )
|
||||
if( ( pSoldier->bAssignment != VEHICLE ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) )
|
||||
//if ( pSoldier->bAssignment != VEHICLE )
|
||||
{ //Can only remove groups if they aren't persistant (not in a squad or vehicle)
|
||||
RemoveGroup( pSoldier->ubGroupID );
|
||||
RemovePlayerFromGroup(pSoldier->ubGroupID, pSoldier);
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove him from any existing merc slot he could be in
|
||||
RemoveMercSlot( pSoldier );
|
||||
TakeSoldierOutOfVehicle( pSoldier );
|
||||
TakeSoldierOutOfVehicle( pSoldier );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+197
-127
@@ -48,6 +48,7 @@
|
||||
#include "militiasquads.h" // added by Flugente
|
||||
#include "SkillCheck.h" // added by Flugente
|
||||
#include "Strategic Transport Groups.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "ub_config.h"
|
||||
@@ -99,13 +100,23 @@ enum //GraphicIDs for the panel
|
||||
#define ROW_HEIGHT 10
|
||||
//The start of the black space
|
||||
#define TOP_Y 113
|
||||
#define TOP_Y_TEXT_BUFFER 1
|
||||
//The end of the black space
|
||||
//#define BOTTOM_Y (349+(OUR_TEAM_SIZE_NO_VEHICLE-18)*ROW_HEIGHT)
|
||||
#define BOTTOM_Y 349
|
||||
#define BOTTOM_HEIGHT 8
|
||||
//The internal height of the uninvolved panel
|
||||
#define INTERNAL_HEIGHT 27
|
||||
//The actual height of the uninvolved panel
|
||||
#define ACTUAL_HEIGHT 24
|
||||
#define UNINVOLVED_RELEVANT_HEIGHT 28
|
||||
#define UNINVOLVED_OFFSET_HEIGHT 7
|
||||
|
||||
#define PREBATTLE_INTERFACE_WIDTH 261
|
||||
INT32 iPrebattleInterfaceHeight = 360;
|
||||
UINT16 xOffset;
|
||||
UINT16 yOffset;
|
||||
UINT16 blanketStartX;
|
||||
UINT16 blanketStartY;
|
||||
|
||||
INT16 bListOffset = 0;
|
||||
UINT16 ubDesiredListHeight = 0;
|
||||
UINT16 ubAllowedListHeight = 0;
|
||||
|
||||
BOOLEAN gfDisplayPotentialRetreatPaths = FALSE;
|
||||
UINT16 gusRetreatButtonLeft, gusRetreatButtonTop, gusRetreatButtonRight, gusRetreatButtonBottom;
|
||||
@@ -300,6 +311,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
|
||||
gAmbushRadiusModifier = 0.0f;
|
||||
|
||||
bListOffset = 0;
|
||||
|
||||
// ARM: Feb01/98 - Cancel out of mapscreen movement plotting if PBI subscreen is coming up
|
||||
if ( ( GetSelectedDestChar() != -1) || fPlotForHelicopter || fPlotForMilitia )
|
||||
{
|
||||
@@ -481,32 +494,69 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
|
||||
fMapScreenBottomDirty = TRUE;
|
||||
ChangeSelectedMapSector( gubPBSectorX, gubPBSectorY, gubPBSectorZ );
|
||||
// Headrock: Added FALSE argument, We might need TRUE but not sure. Will need to initiate battle :)
|
||||
RenderMapScreenInterfaceBottom( FALSE );
|
||||
|
||||
if( !fShowTeamFlag )
|
||||
{
|
||||
ToggleShowTeamsMode();
|
||||
}
|
||||
|
||||
//Define the blanket region to cover all of the other regions used underneath the panel.
|
||||
MSYS_DefineRegion( &PBInterfaceBlanket, 0 + xResOffset, 0 + yResOffset, 261 + xResOffset, 359 + yResOffset, MSYS_PRIORITY_HIGHEST - 5, 0, 0, 0 );
|
||||
|
||||
//Create the panel
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
GetMLGFilename( VObjectDesc.ImageFile, MLG_PREBATTLEPANEL );
|
||||
|
||||
// anv: prebattle interface per vertical resolution
|
||||
if (isWidescreenUI())
|
||||
{
|
||||
GetMLGFilename(VObjectDesc.ImageFile, MLG_PREBATTLEPANEL_1280x720);
|
||||
iPrebattleInterfaceHeight = 600;
|
||||
xOffset = xResOffset + 15;
|
||||
yOffset = 0;
|
||||
blanketStartX = 0;
|
||||
blanketStartY = 0;
|
||||
}
|
||||
else if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
{
|
||||
GetMLGFilename(VObjectDesc.ImageFile, MLG_PREBATTLEPANEL);
|
||||
iPrebattleInterfaceHeight = 360;
|
||||
xOffset = xResOffset;
|
||||
yOffset = yResOffset;
|
||||
blanketStartX = yOffset;
|
||||
blanketStartY = yOffset;
|
||||
}
|
||||
else if (iResolution < _1024x768)
|
||||
{
|
||||
GetMLGFilename(VObjectDesc.ImageFile, MLG_PREBATTLEPANEL_800x600);
|
||||
iPrebattleInterfaceHeight = 478;
|
||||
xOffset = xResOffset;
|
||||
yOffset = yResOffset;
|
||||
blanketStartX = yOffset;
|
||||
blanketStartY = yOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetMLGFilename(VObjectDesc.ImageFile, MLG_PREBATTLEPANEL_1024x768);
|
||||
iPrebattleInterfaceHeight = 647;
|
||||
xOffset = xResOffset;
|
||||
yOffset = yResOffset;
|
||||
blanketStartX = yOffset;
|
||||
blanketStartY = yOffset;
|
||||
}
|
||||
ubAllowedListHeight = iPrebattleInterfaceHeight - TOP_Y - BOTTOM_HEIGHT;
|
||||
|
||||
if( !AddVideoObject( &VObjectDesc, &uiInterfaceImages ) )
|
||||
AssertMsg( 0, "Failed to load interface\\PreBattlePanel.sti" );
|
||||
|
||||
//Define the blanket region to cover all of the other regions used underneath the panel.
|
||||
MSYS_DefineRegion( &PBInterfaceBlanket, blanketStartX, blanketStartY, PREBATTLE_INTERFACE_WIDTH + xOffset, iPrebattleInterfaceHeight + yOffset, MSYS_PRIORITY_HIGHEST, 0, 0, 0 );
|
||||
|
||||
//Create the 3 buttons
|
||||
iPBButtonImage[0] = LoadButtonImage( "INTERFACE\\PreBattleButton.sti", -1, 0, -1, 1, -1 );
|
||||
if( iPBButtonImage[ 0 ] == -1 )
|
||||
AssertMsg( 0, "Failed to load interface\\PreBattleButton.sti" );
|
||||
iPBButtonImage[1] = UseLoadedButtonImage( iPBButtonImage[ 0 ], -1, 0, -1, 1, -1 );
|
||||
iPBButtonImage[2] = UseLoadedButtonImage( iPBButtonImage[ 0 ], -1, 0, -1, 1, -1 );
|
||||
iPBButton[0] = QuickCreateButton( iPBButtonImage[0], 27 + xResOffset, 54 + yResOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, DEFAULT_MOVE_CALLBACK, AutoResolveBattleCallback );
|
||||
iPBButton[1] = QuickCreateButton( iPBButtonImage[1], 98 + xResOffset, 54 + yResOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, DEFAULT_MOVE_CALLBACK, GoToSectorCallback );
|
||||
iPBButton[2] = QuickCreateButton( iPBButtonImage[2], 169 + xResOffset, 54 + yResOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, DEFAULT_MOVE_CALLBACK, RetreatMercsCallback );
|
||||
iPBButton[0] = QuickCreateButton( iPBButtonImage[0], 27 + xOffset, 54 + yOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, AutoResolveBattleCallback );
|
||||
iPBButton[1] = QuickCreateButton( iPBButtonImage[1], 98 + xOffset, 54 + yOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, GoToSectorCallback );
|
||||
iPBButton[2] = QuickCreateButton( iPBButtonImage[2], 169 + xOffset, 54 + yOffset, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, RetreatMercsCallback );
|
||||
|
||||
SpecifyGeneralButtonTextAttributes( iPBButton[0], gpStrategicString[ STR_PB_AUTORESOLVE_BTN ], BLOCKFONT, FONT_BEIGE, 141 );
|
||||
SpecifyGeneralButtonTextAttributes( iPBButton[1], gpStrategicString[ STR_PB_GOTOSECTOR_BTN ], BLOCKFONT, FONT_BEIGE, 141 );
|
||||
@@ -1050,7 +1100,7 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
INT32 iPercentage, iFactor;
|
||||
UINT32 uiTimeRange;
|
||||
INT16 sStartLeft, sEndLeft, sStartTop, sEndTop;
|
||||
INT32 iLeft, iTop, iWidth, iHeight;
|
||||
INT32 iLeft, iTop, iWidth;
|
||||
BOOLEAN fEnterAutoResolveMode = FALSE;
|
||||
|
||||
if( !gfExtraBuffer )
|
||||
@@ -1058,12 +1108,11 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
|
||||
PauseTime( FALSE );
|
||||
|
||||
PBIRect.iLeft = 0 + xResOffset;
|
||||
PBIRect.iTop = 0 + yResOffset;
|
||||
PBIRect.iRight = 261 + xResOffset;
|
||||
PBIRect.iBottom = 359 + yResOffset;
|
||||
iWidth = 261;
|
||||
iHeight = 359;
|
||||
PBIRect.iLeft = 0 + xOffset;
|
||||
PBIRect.iTop = 0 + yOffset;
|
||||
PBIRect.iRight = PREBATTLE_INTERFACE_WIDTH + xOffset;
|
||||
PBIRect.iBottom = iPrebattleInterfaceHeight + yOffset;
|
||||
iWidth = PREBATTLE_INTERFACE_WIDTH;
|
||||
|
||||
uiTimeRange = 1000;
|
||||
iPercentage = 0;
|
||||
@@ -1072,8 +1121,8 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
GetScreenXYFromMapXY( gubPBSectorX, gubPBSectorY, &sStartLeft, &sStartTop );
|
||||
sStartLeft += UI_MAP.GridSize.iX / 2;
|
||||
sStartTop += UI_MAP.GridSize.iY / 2;
|
||||
sEndLeft = 131 + xResOffset;
|
||||
sEndTop = 180 + yResOffset;
|
||||
sEndLeft = PBIRect.iLeft;
|
||||
sEndTop = PBIRect.iTop;
|
||||
|
||||
//save the mapscreen buffer
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiEXTRABUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
@@ -1095,17 +1144,23 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
gfEnterAutoResolveMode = TRUE;
|
||||
}
|
||||
|
||||
BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, 27 + xResOffset, 54 + yResOffset, 209, 32 );
|
||||
BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, 27 + xOffset, 54 + yOffset, 209, 32 );
|
||||
RenderButtons();
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 27 + xResOffset, 54 + yResOffset, 209, 32 );
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 27 + xOffset, 54 + yOffset, 209, 32 );
|
||||
gfRenderPBInterface = TRUE;
|
||||
|
||||
//hide the prebattle interface
|
||||
BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, 0 + xResOffset, 0 + yResOffset, 261 + xResOffset, 359 + yResOffset );
|
||||
BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, 0 + xOffset, 0 + yOffset, PREBATTLE_INTERFACE_WIDTH + xOffset, iPrebattleInterfaceHeight + yOffset );
|
||||
PlayJA2SampleFromFile( "SOUNDS\\Laptop power up (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||
InvalidateScreen();
|
||||
RefreshScreen( NULL );
|
||||
|
||||
SGPRect PrevRect;
|
||||
PrevRect.iLeft = sStartLeft;
|
||||
PrevRect.iRight = sStartLeft + 1;
|
||||
PrevRect.iTop = sStartTop;
|
||||
PrevRect.iBottom = sStartTop + 1;
|
||||
|
||||
while( iPercentage < 100 )
|
||||
{
|
||||
uiCurrTime = GetJA2Clock();
|
||||
@@ -1117,19 +1172,12 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
if( iPercentage < 50 )
|
||||
iPercentage = (UINT32)(iPercentage + iPercentage * iFactor * 0.01 + 0.5);
|
||||
else
|
||||
iPercentage = (UINT32)(iPercentage + (100-iPercentage) * iFactor * 0.01 + 0.05);
|
||||
iPercentage = (UINT32)(iPercentage + (100 - iPercentage) * iFactor * 0.01 + 0.05);
|
||||
|
||||
//Calculate the center point.
|
||||
iLeft = sStartLeft - (sStartLeft-sEndLeft+1) * iPercentage / 100;
|
||||
if( sStartTop > sEndTop )
|
||||
iTop = sStartTop - (sStartTop-sEndTop+1) * iPercentage / 100;
|
||||
else
|
||||
iTop = sStartTop + (sEndTop-sStartTop+1) * iPercentage / 100;
|
||||
|
||||
DstRect.iLeft = iLeft - iWidth * iPercentage / 200;
|
||||
DstRect.iLeft = sStartLeft + (sEndLeft - sStartLeft) * iPercentage / 100;
|
||||
DstRect.iRight = DstRect.iLeft + max( iWidth * iPercentage / 100, 1 );
|
||||
DstRect.iTop = iTop - iHeight * iPercentage / 200;
|
||||
DstRect.iBottom = DstRect.iTop + max( iHeight * iPercentage / 100, 1 );
|
||||
DstRect.iTop = sStartTop + (sEndTop - sStartTop) * iPercentage / 100;
|
||||
DstRect.iBottom = DstRect.iTop + max(iPrebattleInterfaceHeight * iPercentage / 100, 1);
|
||||
|
||||
BltStretchVideoSurface( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, 0, &PBIRect, &DstRect );
|
||||
|
||||
@@ -1137,14 +1185,35 @@ void DoTransitionFromMapscreenToPreBattleInterface()
|
||||
RefreshScreen( NULL );
|
||||
|
||||
//Restore the previous rect.
|
||||
BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, (UINT16)DstRect.iLeft, (UINT16)DstRect.iTop,
|
||||
(UINT16)(DstRect.iRight-DstRect.iLeft+1), (UINT16)(DstRect.iBottom-DstRect.iTop+1) );
|
||||
BlitBufferToBuffer(guiEXTRABUFFER, FRAME_BUFFER, (UINT16)PrevRect.iLeft, (UINT16)PrevRect.iTop,
|
||||
(UINT16)PrevRect.iRight, (UINT16)PrevRect.iBottom);
|
||||
|
||||
PrevRect.iLeft = DstRect.iLeft;
|
||||
PrevRect.iRight = DstRect.iRight;
|
||||
PrevRect.iTop = DstRect.iTop;
|
||||
PrevRect.iBottom = DstRect.iBottom;
|
||||
}
|
||||
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gfZoomDone = TRUE;
|
||||
}
|
||||
|
||||
void ScrollPreBattleInterface( BOOLEAN fUp )
|
||||
{
|
||||
if ( ubDesiredListHeight <= ubAllowedListHeight )
|
||||
return;
|
||||
|
||||
if ( fUp )
|
||||
{
|
||||
bListOffset = max( 0, bListOffset - ubAllowedListHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
bListOffset = min( bListOffset + ubAllowedListHeight, ubDesiredListHeight - ubAllowedListHeight );
|
||||
}
|
||||
gfRenderPBInterface = TRUE;
|
||||
}
|
||||
|
||||
void KillPreBattleInterface()
|
||||
{
|
||||
if( !gfPreBattleInterfaceActive )
|
||||
@@ -1184,7 +1253,7 @@ void KillPreBattleInterface()
|
||||
//Enable the options button when the auto resolve screen comes up
|
||||
EnableDisAbleMapScreenOptionsButton( TRUE );
|
||||
|
||||
ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 261 + xResOffset, 359 + yResOffset, 0 );
|
||||
ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, PREBATTLE_INTERFACE_WIDTH + xOffset, iPrebattleInterfaceHeight + yOffset, 0 );
|
||||
|
||||
EnableTeamInfoPanels();
|
||||
if( ButtonList[ giMapContractButton ] )
|
||||
@@ -1277,8 +1346,8 @@ void RenderPBHeader( INT32 *piX, INT32 *piWidth)
|
||||
}
|
||||
width = StringPixLength( str, FONT10ARIALBOLD );
|
||||
x = 130 - width / 2;
|
||||
mprintf( x + xResOffset, 4 + yResOffset, str );
|
||||
InvalidateRegion( 0, 0, 231 + xResOffset, 12 + yResOffset );
|
||||
mprintf( x + xOffset, 4 + yOffset, str );
|
||||
InvalidateRegion( 0, 0, 231 + xOffset, 12 + yOffset );
|
||||
*piX = x;
|
||||
*piWidth = width;
|
||||
}
|
||||
@@ -1293,10 +1362,15 @@ void RenderPreBattleInterface()
|
||||
UINT8 ubHPPercent, ubBPPercent;
|
||||
BOOLEAN fMouseInRetreatButtonArea;
|
||||
UINT8 ubJunk;
|
||||
SGPRect ClipRect;
|
||||
UINT16 ubDesiredParticipantsListHeight = 0;
|
||||
UINT16 ubDesiredUninvolvedListHeight = 0;
|
||||
UINT16 ubUninvolvedStartY = 0;
|
||||
|
||||
//PLAYERGROUP *pPlayer;
|
||||
|
||||
// Make the background black!
|
||||
//ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 261 + xResOffset, SCREEN_HEIGHT - 120, 0 );
|
||||
//ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, 261 + xOffset, SCREEN_HEIGHT - 120, 0 );
|
||||
|
||||
//This code determines if the cursor is inside the rectangle consisting of the
|
||||
//retreat button. If it is inside, then we set up the variables so that the retreat
|
||||
@@ -1337,33 +1411,21 @@ void RenderPreBattleInterface()
|
||||
gfRenderPBInterface = FALSE;
|
||||
GetVideoObject( &hVObject, uiInterfaceImages );
|
||||
//main panel
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, MAINPANEL, xResOffset, yResOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, MAINPANEL, xOffset, yOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
//main title
|
||||
|
||||
RenderPBHeader( &x, &width );
|
||||
//now draw the title bars up to the text.
|
||||
for( i = x - 12; i > 20; i -= 10 )
|
||||
{
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TITLE_BAR_PIECE, i + xResOffset, 6 + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TITLE_BAR_PIECE, i + xOffset, 6 + yOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
for( i = x + width + 2; i < 231; i += 10 )
|
||||
{
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TITLE_BAR_PIECE, i + xResOffset, 6 + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TITLE_BAR_PIECE, i + xOffset, 6 + yOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_LINE, 0 + xResOffset, BOTTOM_Y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_LINE, 0 + xResOffset, BOTTOM_Y + yResOffset + 10, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_LINE, 0 + xResOffset, BOTTOM_Y + yResOffset + 20, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_LINE, 0 + xResOffset, BOTTOM_Y + yResOffset + 30, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
//Draw the bottom edges
|
||||
for (i = 0; i < max(guiNumUninvolved, 1); i++)
|
||||
{
|
||||
y = BOTTOM_Y + ROW_HEIGHT * (i + 1) + 30;
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_LINE, 0 + xResOffset, y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
}
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, UNINVOLVED_HEADER, 8 + xResOffset, BOTTOM_Y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_END, 0 + xResOffset, BOTTOM_Y + yResOffset + 35 + ROW_HEIGHT * max(guiNumUninvolved, 1), VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
|
||||
// header
|
||||
SetFont( BLOCKFONT );
|
||||
SetFontForeground( FONT_BEIGE );
|
||||
swprintf( str, gpStrategicString[ STR_PB_LOCATION ] );
|
||||
@@ -1373,7 +1435,7 @@ void RenderPreBattleInterface()
|
||||
SetFont( BLOCKFONTNARROW );
|
||||
width = StringPixLength( str, BLOCKFONTNARROW );
|
||||
}
|
||||
mprintf( 65 - width + xResOffset , 17 + yResOffset, str );
|
||||
mprintf( 65 - width + xOffset , 17 + yOffset, str );
|
||||
|
||||
SetFont( BLOCKFONT );
|
||||
if( GetEnemyEncounterCode() == CREATURE_ATTACK_CODE )
|
||||
@@ -1405,7 +1467,7 @@ void RenderPreBattleInterface()
|
||||
SetFont( BLOCKFONTNARROW );
|
||||
width = StringPixLength( str, BLOCKFONTNARROW );
|
||||
}
|
||||
mprintf( 54 + xResOffset - width , 38 + yResOffset, str );
|
||||
mprintf( 54 + xOffset - width , 38 + yOffset, str );
|
||||
|
||||
SetFont( BLOCKFONT );
|
||||
swprintf( str, gpStrategicString[ STR_PB_MERCS ] );
|
||||
@@ -1415,7 +1477,7 @@ void RenderPreBattleInterface()
|
||||
SetFont( BLOCKFONTNARROW );
|
||||
width = StringPixLength( str, BLOCKFONTNARROW );
|
||||
}
|
||||
mprintf( 139 + xResOffset - width , 38 + yResOffset, str );
|
||||
mprintf( 139 + xOffset - width , 38 + yOffset, str );
|
||||
|
||||
SetFont( BLOCKFONT );
|
||||
swprintf( str, gpStrategicString[ STR_PB_MILITIA ] );
|
||||
@@ -1425,29 +1487,53 @@ void RenderPreBattleInterface()
|
||||
SetFont( BLOCKFONTNARROW );
|
||||
width = StringPixLength( str, BLOCKFONTNARROW );
|
||||
}
|
||||
mprintf( 224 + xResOffset - width , 38 + yResOffset, str );
|
||||
mprintf( 224 + xOffset - width , 38 + yOffset, str );
|
||||
|
||||
//Draw the bottom columns
|
||||
for( i = 0; i < (INT32)max( guiNumUninvolved, 1 ); i++ )
|
||||
ubDesiredParticipantsListHeight = guiNumInvolved * ROW_HEIGHT;
|
||||
ubDesiredUninvolvedListHeight = UNINVOLVED_RELEVANT_HEIGHT + max(guiNumUninvolved, 1) * ROW_HEIGHT;
|
||||
|
||||
ubDesiredListHeight = ubDesiredParticipantsListHeight + ubDesiredUninvolvedListHeight;
|
||||
|
||||
if (ubDesiredListHeight >= ubAllowedListHeight)
|
||||
{
|
||||
y = BOTTOM_Y + ROW_HEIGHT * (i+1) + 1 + ACTUAL_HEIGHT;
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, BOTTOM_COLUMN, 161 + xResOffset, y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
ubUninvolvedStartY = ubDesiredParticipantsListHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
ubUninvolvedStartY = ubAllowedListHeight - ubDesiredUninvolvedListHeight;
|
||||
}
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
for( i = 0; i < (INT32)(25/*3+ OUR_TEAM_SIZE_NO_VEHICLE - max( guiNumUninvolved, 1 )*/); i++ )
|
||||
ClipRect.iLeft = xOffset;
|
||||
ClipRect.iTop = yOffset + TOP_Y;
|
||||
ClipRect.iRight = xOffset + PREBATTLE_INTERFACE_WIDTH;
|
||||
ClipRect.iBottom = yOffset + TOP_Y + ubAllowedListHeight;// + TOP_Y_BUFFER;
|
||||
SetClippingRect(&ClipRect);
|
||||
|
||||
// Draw the top columns
|
||||
// Draw from the top to uninvolved header
|
||||
for ( y = TOP_Y - bListOffset; y < TOP_Y - bListOffset + ubUninvolvedStartY; y += ROW_HEIGHT )
|
||||
{
|
||||
y = TOP_Y + ROW_HEIGHT * i;
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TOP_COLUMN, 186 + xResOffset, y + yResOffset, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, TOP_COLUMN, 186 + xOffset, y + yOffset, VO_BLT_CLIP | VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
}
|
||||
|
||||
// Draw extra empty participants rows to close off bottom of the content area
|
||||
for ( y = TOP_Y - bListOffset + ubUninvolvedStartY + ROW_HEIGHT; y < TOP_Y - bListOffset + ubUninvolvedStartY + ubDesiredUninvolvedListHeight; y += ROW_HEIGHT )
|
||||
{
|
||||
BltVideoObject(guiSAVEBUFFER, hVObject, BOTTOM_COLUMN, 161 + xOffset, y + yOffset, VO_BLT_CLIP | VO_BLT_SRCTRANSPARENCY, NULL);
|
||||
}
|
||||
|
||||
// Draw uninvolved header
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, UNINVOLVED_HEADER, 8 + xOffset, yOffset + TOP_Y + ubUninvolvedStartY - UNINVOLVED_OFFSET_HEIGHT - bListOffset, VO_BLT_CLIP | VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
RestoreClipRegionToFullScreen();
|
||||
|
||||
//location
|
||||
SetFont( FONT10ARIAL );
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
|
||||
GetSectorIDString( gubPBSectorX, gubPBSectorY, gubPBSectorZ, pSectorName, TRUE );
|
||||
mprintf( 70 + xResOffset, 17 + yResOffset, L"%s %s", gpStrategicString[ STR_PB_SECTOR ], pSectorName );
|
||||
mprintf( 70 + xOffset, 17 + yOffset, L"%s %s", gpStrategicString[STR_PB_SECTOR], pSectorName );
|
||||
|
||||
//enemy
|
||||
SetFont( FONT14ARIAL );
|
||||
@@ -1472,58 +1558,55 @@ void RenderPreBattleInterface()
|
||||
}
|
||||
x = 57 + (27 - StringPixLength( str, FONT14ARIAL )) / 2;
|
||||
y = 36;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//player
|
||||
swprintf( str, L"%d", guiNumInvolved );
|
||||
x = 142 + (27 - StringPixLength( str, FONT14ARIAL )) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//militia
|
||||
swprintf( str, L"%d", NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, MILITIA_TEAM ) );
|
||||
x = 227 + (27 - StringPixLength( str, FONT14ARIAL )) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
|
||||
SetFont( BLOCKFONT2 );
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
|
||||
SetFontDestBuffer( guiSAVEBUFFER, xOffset, yOffset + TOP_Y,
|
||||
xOffset + PREBATTLE_INTERFACE_WIDTH, yOffset + TOP_Y + ubAllowedListHeight, FALSE );
|
||||
|
||||
//print out the participants of the battle.
|
||||
// | NAME | ASSIGN | COND | HP | BP |
|
||||
line = 0;
|
||||
y = TOP_Y + 1;
|
||||
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
|
||||
y = TOP_Y + TOP_Y_TEXT_BUFFER - bListOffset;
|
||||
for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++)
|
||||
{
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
|
||||
if( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife && !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
|
||||
{
|
||||
if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
|
||||
{ //involved
|
||||
if( line == giHilitedInvolved )
|
||||
SetFontForeground( FONT_WHITE );
|
||||
else
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
if( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
|
||||
{
|
||||
//NAME
|
||||
wcscpy( str, MercPtrs[ i ]->name );
|
||||
x = 17 + (52-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset , y + yResOffset, str );
|
||||
x = 17 + (52 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//ASSIGN
|
||||
GetMapscreenMercAssignmentString( MercPtrs[ i ], str );
|
||||
x = 72 + (54-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 72 + (54 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//COND
|
||||
GetSoldierConditionInfo( MercPtrs[ i ], str, &ubHPPercent, &ubBPPercent );
|
||||
x = 129 + (58-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 129 + (58 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//HP
|
||||
swprintf( str, L"%d%%", ubHPPercent );
|
||||
x = 189 + (25-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
x = 189 + (25 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
wcscat( str, sSpecialCharacters[0] );
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//BP
|
||||
swprintf( str, L"%d%%", ubBPPercent );
|
||||
x = 217 + (25-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
wcscat( str, sSpecialCharacters[0] );
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
|
||||
line++;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
y += ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
@@ -1533,51 +1616,44 @@ void RenderPreBattleInterface()
|
||||
// | NAME | ASSIGN | LOC | DEST | DEP |
|
||||
if( !guiNumUninvolved )
|
||||
{
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
wcscpy( str, gpStrategicString[ STR_PB_NONE ] );
|
||||
x = 17 + (52-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
y = BOTTOM_Y + ROW_HEIGHT + 2 + ACTUAL_HEIGHT;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 17 + (52 - StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, yOffset + TOP_Y + TOP_Y_TEXT_BUFFER + ubUninvolvedStartY + UNINVOLVED_RELEVANT_HEIGHT - bListOffset, str );
|
||||
}
|
||||
else
|
||||
{
|
||||
pGroup = gpGroupList;
|
||||
y = BOTTOM_Y + ROW_HEIGHT + 2 + ACTUAL_HEIGHT;
|
||||
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ )
|
||||
y = TOP_Y + TOP_Y_TEXT_BUFFER + ubUninvolvedStartY + UNINVOLVED_RELEVANT_HEIGHT - bListOffset;
|
||||
for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ )
|
||||
{
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) )
|
||||
{
|
||||
if ( !PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) )
|
||||
if( !PlayerMercInvolvedInThisCombat(MercPtrs[ i ]) )
|
||||
{
|
||||
// uninvolved
|
||||
if( line == giHilitedUninvolved )
|
||||
SetFontForeground( FONT_WHITE );
|
||||
else
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
//NAME
|
||||
wcscpy( str, MercPtrs[ i ]->name );
|
||||
x = 17 + (52-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 17 + (52 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//ASSIGN
|
||||
GetMapscreenMercAssignmentString( MercPtrs[ i ], str );
|
||||
x = 72 + (54-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 72 + (54 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//LOC
|
||||
GetMapscreenMercLocationString( MercPtrs[ i ], str );
|
||||
x = 128 + (33-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 128 + (33 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
//DEST
|
||||
GetMapscreenMercDestinationString( MercPtrs[ i ], str );
|
||||
if( wcslen( str ) > 0 )
|
||||
if (wcslen(str) > 0)
|
||||
{
|
||||
x = 164 + (41-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
x = 164 + (41 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xOffset, y + yOffset, str );
|
||||
}
|
||||
//DEP
|
||||
GetMapscreenMercDepartureString( MercPtrs[ i ], str, &ubJunk );
|
||||
x = 208 + (34-StringPixLength( str, BLOCKFONT2)) / 2;
|
||||
mprintf( x + xResOffset, y + yResOffset, str );
|
||||
line++;
|
||||
x = 208 + (34 - StringPixLength(str, BLOCKFONT2)) / 2;
|
||||
mprintf(x + xOffset, y + yOffset, str);
|
||||
|
||||
y += ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
@@ -1587,12 +1663,7 @@ void RenderPreBattleInterface()
|
||||
// mark any and ALL pop up boxes as altered
|
||||
MarkAllBoxesAsAltered( );
|
||||
|
||||
if(!gfZoomDone)
|
||||
RestoreExternBackgroundRect( 0 + xResOffset, 0 + yResOffset, 261 + xResOffset, 359 + yResOffset );
|
||||
else if(!guiNumUninvolved)
|
||||
RestoreExternBackgroundRect( 0 + xResOffset, 0 + yResOffset, 261 + xResOffset, 389 + yResOffset );
|
||||
else
|
||||
RestoreExternBackgroundRect( 0 + xResOffset, 0 + yResOffset, 261 + xResOffset, y + yResOffset );
|
||||
RestoreExternBackgroundRect( 0 + xOffset, 0 + yOffset, PREBATTLE_INTERFACE_WIDTH, iPrebattleInterfaceHeight );
|
||||
|
||||
// restore font destinanation buffer to the frame buffer
|
||||
SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
|
||||
@@ -1602,7 +1673,7 @@ void RenderPreBattleInterface()
|
||||
RenderPBHeader( &x, &width ); //the text is important enough to blink.
|
||||
}
|
||||
|
||||
//InvalidateRegion( 0, 0, 261, 359 );
|
||||
InvalidateRegion( 0, 0, PREBATTLE_INTERFACE_WIDTH, iPrebattleInterfaceHeight );
|
||||
if( gfEnterAutoResolveMode )
|
||||
{
|
||||
gfEnterAutoResolveMode = FALSE;
|
||||
@@ -1611,7 +1682,6 @@ void RenderPreBattleInterface()
|
||||
}
|
||||
|
||||
gfIgnoreAllInput = FALSE;
|
||||
|
||||
}
|
||||
|
||||
void AutoResolveBattleCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI );
|
||||
void KillPreBattleInterface();
|
||||
void RenderPreBattleInterface();
|
||||
void ScrollPreBattleInterface( BOOLEAN fUp );
|
||||
|
||||
extern BOOLEAN gfPreBattleInterfaceActive;
|
||||
extern BOOLEAN gfDisplayPotentialRetreatPaths;
|
||||
|
||||
@@ -4417,19 +4417,20 @@ void SetupInfo()
|
||||
// (Item[i].usItemClass & IC_AMMO) && (Magazine[ Item[i].ubClassIndex ].ubMagType == AMMO_BOX or AMMO_CRATE?)
|
||||
for (UINT16 i = 0; i < MAXITEMS; ++i)
|
||||
{
|
||||
if (Item[i].gascan) ItemIdCache::gasCans.push_back(i);
|
||||
else if (Item[i].firstaidkit) ItemIdCache::firstAidKits.push_back(i);
|
||||
else if (Item[i].medicalkit) ItemIdCache::medKits.push_back(i);
|
||||
else if (Item[i].toolkit) ItemIdCache::toolKits.push_back(i);
|
||||
if (ItemIsGascan(i)) ItemIdCache::gasCans.push_back(i);
|
||||
else if (ItemIsFirstAidKit(i)) ItemIdCache::firstAidKits.push_back(i);
|
||||
else if (ItemIsMedicalKit(i)) ItemIdCache::medKits.push_back(i);
|
||||
else if (ItemIsToolkit(i)) ItemIdCache::toolKits.push_back(i);
|
||||
else if (Item[i].usItemClass & IC_AMMO)
|
||||
{
|
||||
if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX)
|
||||
{
|
||||
if ((gGameOptions.fGunNut || !Item[i].biggunlist)
|
||||
&& (gGameOptions.ubGameStyle == STYLE_SCIFI || !Item[i].scifi))
|
||||
if ((gGameOptions.fGunNut || !ItemIsOnlyInTonsOfGuns(i))
|
||||
&& (gGameOptions.ubGameStyle == STYLE_SCIFI || !ItemIsOnlyInScifi(i)))
|
||||
{
|
||||
// coolness runs from 1-10, so apply offset
|
||||
ItemIdCache::ammo[Item[i].ubCoolness-1].push_back(i);
|
||||
const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10);
|
||||
ItemIdCache::ammo[coolness-1].push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5430,22 +5430,11 @@ void LogStrategicMsg( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "%s\n", string );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id, string);
|
||||
#endif
|
||||
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
@@ -5455,33 +5444,17 @@ void LogStrategicMsg( STR8 str, ... )
|
||||
{
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "\n%S:\n", WORLDTIMESTR );
|
||||
fprintf( fp, "%s\n", string );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id) << sgp::endl << WORLDTIMESTR << ":" << sgp::endl << string << sgp::endl;
|
||||
#endif
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
ScreenMsg( FONT_LTKHAKI, MSG_DIALOG, L"%S", string );
|
||||
@@ -5490,25 +5463,11 @@ void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClearStrategicLog()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
fp = fopen( "Strategic Decisions.txt", "w" );
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
fprintf( fp, "STRATEGIC LOG\n" );
|
||||
|
||||
fclose( fp );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id) << sgp::flush;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1334,7 +1334,7 @@ void CheckForMissingHospitalSupplies( void )
|
||||
}
|
||||
}
|
||||
#endif//obsoleteCode
|
||||
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
|
||||
if (ItemIsFirstAidKit(pObj->usItem) || ItemIsMedicalKit(pObj->usItem) || 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 )
|
||||
|
||||
@@ -1757,30 +1757,30 @@ void AddCorpsesToBloodcatLair( INT16 sSectorX, INT16 sSectorY )
|
||||
Corpse.usFlags = ROTTING_CORPSE_FIND_SWEETSPOT_FROM_GRIDNO;
|
||||
|
||||
// 1st gridno
|
||||
Corpse.sGridNo = 14319; //dnl!!!
|
||||
ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos );
|
||||
Corpse.dXPos = (FLOAT)( CenterX( sXPos ) );
|
||||
Corpse.dYPos = (FLOAT)( CenterY( sYPos ) );
|
||||
Corpse.sGridNo = 14319; //dnl!!!
|
||||
ConvertGridNoToCenterCellXY(Corpse.sGridNo, &sXPos, &sYPos);
|
||||
Corpse.dXPos = (FLOAT)( sXPos );
|
||||
Corpse.dYPos = (FLOAT)( sYPos );
|
||||
|
||||
//Add the rotting corpse info to the sectors unloaded rotting corpse file
|
||||
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sSectorX, sSectorY, 0, &Corpse);
|
||||
|
||||
|
||||
// 2nd gridno
|
||||
Corpse.sGridNo = 9835; //dnl!!!
|
||||
ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos );
|
||||
Corpse.dXPos = (FLOAT)( CenterX( sXPos ) );
|
||||
Corpse.dYPos = (FLOAT)( CenterY( sYPos ) );
|
||||
Corpse.sGridNo = 9835; //dnl!!!
|
||||
ConvertGridNoToCenterCellXY(Corpse.sGridNo, &sXPos, &sYPos);
|
||||
Corpse.dXPos = (FLOAT)(sXPos);
|
||||
Corpse.dYPos = (FLOAT)(sYPos);
|
||||
|
||||
//Add the rotting corpse info to the sectors unloaded rotting corpse file
|
||||
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sSectorX, sSectorY, 0, &Corpse);
|
||||
|
||||
|
||||
// 3rd gridno
|
||||
Corpse.sGridNo = 11262; //dnl!!!
|
||||
ConvertGridNoToXY( Corpse.sGridNo, &sXPos, &sYPos );
|
||||
Corpse.dXPos = (FLOAT)( CenterX( sXPos ) );
|
||||
Corpse.dYPos = (FLOAT)( CenterY( sYPos ) );
|
||||
Corpse.sGridNo = 11262; //dnl!!!
|
||||
ConvertGridNoToCenterCellXY(Corpse.sGridNo, &sXPos, &sYPos);
|
||||
Corpse.dXPos = (FLOAT)(sXPos);
|
||||
Corpse.dYPos = (FLOAT)(sYPos);
|
||||
|
||||
//Add the rotting corpse info to the sectors unloaded rotting corpse file
|
||||
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( sSectorX, sSectorY, 0, &Corpse);
|
||||
@@ -1951,33 +1951,33 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
SectorInfo[SECTOR( pGroup->ubSectorX, pGroup->ubSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM );
|
||||
}
|
||||
|
||||
// award life 'experience' for travelling, based on travel time!
|
||||
if ( !pGroup->fVehicle )
|
||||
// Flugente: do not award experience gain if we never left
|
||||
if (!fNeverLeft)
|
||||
{
|
||||
// Flugente: do not award experience gain if we never left
|
||||
if ( !fNeverLeft )
|
||||
// award life 'experience' for travelling, based on travel time!
|
||||
if (!pGroup->fVehicle)
|
||||
{
|
||||
// gotta be walking to get tougher
|
||||
AwardExperienceForTravelling( pGroup );
|
||||
AwardExperienceForTravelling(pGroup);
|
||||
}
|
||||
}
|
||||
else if( !IsGroupTheHelicopterGroup( pGroup ) )
|
||||
{
|
||||
SOLDIERTYPE *pSoldier;
|
||||
INT32 iVehicleID;
|
||||
iVehicleID = GivenMvtGroupIdFindVehicleId( pGroup->ubGroupID );
|
||||
AssertMsg( iVehicleID != -1, "GroupArrival for vehicle group. Invalid iVehicleID. " );
|
||||
|
||||
pSoldier = GetSoldierStructureForVehicle( iVehicleID );
|
||||
AssertMsg( pSoldier, "GroupArrival for vehicle group. Invalid soldier pointer." );
|
||||
|
||||
SpendVehicleFuel( pSoldier, (INT16)(pGroup->uiTraverseTime*6) );
|
||||
|
||||
if( !VehicleFuelRemaining( pSoldier ) )
|
||||
else if (!IsGroupTheHelicopterGroup(pGroup))
|
||||
{
|
||||
ReportVehicleOutOfGas( iVehicleID, pGroup->ubSectorX, pGroup->ubSectorY );
|
||||
//Nuke the group's path, so they don't continue moving.
|
||||
ClearMercPathsAndWaypointsForAllInGroup( pGroup );
|
||||
SOLDIERTYPE* pSoldier;
|
||||
INT32 iVehicleID;
|
||||
iVehicleID = GivenMvtGroupIdFindVehicleId(pGroup->ubGroupID);
|
||||
AssertMsg(iVehicleID != -1, "GroupArrival for vehicle group. Invalid iVehicleID. ");
|
||||
|
||||
pSoldier = GetSoldierStructureForVehicle(iVehicleID);
|
||||
AssertMsg(pSoldier, "GroupArrival for vehicle group. Invalid soldier pointer.");
|
||||
|
||||
SpendVehicleFuel(pSoldier, (INT16)(pGroup->uiTraverseTime * 6));
|
||||
|
||||
if (!VehicleFuelRemaining(pSoldier))
|
||||
{
|
||||
ReportVehicleOutOfGas(iVehicleID, pGroup->ubSectorX, pGroup->ubSectorY);
|
||||
//Nuke the group's path, so they don't continue moving.
|
||||
ClearMercPathsAndWaypointsForAllInGroup(pGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5137,7 +5137,7 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle )
|
||||
OBJECTTYPE *pItem;
|
||||
INT16 sFuelNeeded, sFuelAvailable, sFuelAdded;
|
||||
pItem = &pSoldier->inv[ HANDPOS ];
|
||||
if( !Item[pItem->usItem].gascan )
|
||||
if( !ItemIsGascan(pItem->usItem))
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
CHAR16 str[ 100 ];
|
||||
|
||||
@@ -500,18 +500,18 @@ void UpdateTransportGroupInventory()
|
||||
if (!ItemIsLegal(i, TRUE)) continue;
|
||||
if ((Item[i].usItemClass & IC_AMMO) == 0 && (Item[i].iTransportGroupMaxProgress == 0 || Item[i].iTransportGroupMinProgress > progress || progress > Item[i].iTransportGroupMaxProgress)) continue;
|
||||
|
||||
if (Item[i].medical)
|
||||
if (ItemIsMedical(i))
|
||||
{
|
||||
if (Item[i].firstaidkit) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i);
|
||||
else if (Item[i].medicalkit) itemMap[MEDICAL_MEDKITS].push_back(i);
|
||||
if (ItemIsFirstAidKit(i)) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i);
|
||||
else if (ItemIsMedicalKit(i)) itemMap[MEDICAL_MEDKITS].push_back(i);
|
||||
else itemMap[MEDICAL_OTHER].push_back(i);
|
||||
}
|
||||
else if (Item[i].gascan) itemMap[GAS_CANS].push_back(i);
|
||||
else if (Item[i].toolkit) itemMap[TOOL_KITS].push_back(i);
|
||||
else if (ItemIsGascan(i)) itemMap[GAS_CANS].push_back(i);
|
||||
else if (ItemIsToolkit(i)) itemMap[TOOL_KITS].push_back(i);
|
||||
else if (HasItemFlag(i, RADIO_SET)) itemMap[RADIOS].push_back(i);
|
||||
else if (Item[i].usItemClass & IC_GRENADE)
|
||||
{
|
||||
if (Item[i].glgrenade == 0
|
||||
if (!ItemIsGLgrenade(i)
|
||||
&& Item[i].attachmentclass != AC_GRENADE // not for a grenade launcher
|
||||
&& Item[i].attachmentclass != AC_ROCKET) // not for a rocket launcher
|
||||
itemMap[GRENADE_THROWN].push_back(i);
|
||||
@@ -523,7 +523,7 @@ void UpdateTransportGroupInventory()
|
||||
itemMap[BACKPACKS].push_back(i);
|
||||
}
|
||||
}
|
||||
else if (Item[i].camouflagekit) itemMap[CAMO_KITS].push_back(i);
|
||||
else if (ItemIsCamoKit(i)) itemMap[CAMO_KITS].push_back(i);
|
||||
else if (Item[i].usItemClass & IC_MISC)
|
||||
{
|
||||
switch (Item[i].attachmentclass)
|
||||
@@ -555,11 +555,11 @@ void UpdateTransportGroupInventory()
|
||||
{
|
||||
itemMap[GUNS].push_back(i);
|
||||
}
|
||||
else if (Item[i].grenadelauncher)
|
||||
else if (ItemIsGrenadeLauncher(i))
|
||||
{
|
||||
itemMap[GRENADELAUNCHERS].push_back(i);
|
||||
}
|
||||
else if (Item[i].rocketlauncher)
|
||||
else if (ItemIsRocketLauncher(i))
|
||||
{
|
||||
itemMap[ROCKETLAUNCHERS].push_back(i);
|
||||
}
|
||||
@@ -713,7 +713,7 @@ void UpdateTransportGroupInventory()
|
||||
|
||||
case ROCKETLAUNCHERS:
|
||||
{
|
||||
addItemToInventory(pSoldier, id, Item[id].singleshotrocketlauncher ? 3 : 1);
|
||||
addItemToInventory(pSoldier, id, ItemIsSingleShotRocketLauncher(id) ? 3 : 1);
|
||||
|
||||
const UINT16 launchableId = PickARandomLaunchable(id);
|
||||
if (launchableId == 0) continue; // no launchable matches, skip
|
||||
@@ -773,7 +773,7 @@ void UpdateTransportGroupInventory()
|
||||
for (int i = 0; i < pSoldier->inv.size(); ++i)
|
||||
{
|
||||
OBJECTTYPE* item = &pSoldier->inv[i];
|
||||
if (item->exists() && Item[item->usItem].defaultundroppable == FALSE)
|
||||
if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE)
|
||||
{
|
||||
item->fFlags &= ~OBJECT_UNDROPPABLE;
|
||||
}
|
||||
@@ -861,7 +861,7 @@ void UpdateTransportGroupInventory()
|
||||
for (int i = 0; i < pSoldier->inv.size(); ++i)
|
||||
{
|
||||
OBJECTTYPE* item = &pSoldier->inv[i];
|
||||
if (item->exists() && Item[item->usItem].defaultundroppable == FALSE)
|
||||
if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE)
|
||||
{
|
||||
item->fFlags &= ~OBJECT_UNDROPPABLE;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ typedef enum
|
||||
typedef struct
|
||||
{
|
||||
FACILITYTYPE_PARSE_STAGE curElement;
|
||||
PARSE_STAGE curGenericElement;
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
INT16 curAssignmentType;
|
||||
INT16 curRisk;
|
||||
@@ -168,7 +169,7 @@ facilitytypeStartElementHandle(void *userData, const XML_Char *name, const XML_C
|
||||
pData->curElement = FACILITYTYPE_TYPE;
|
||||
|
||||
// Set all values to default before applying XML data
|
||||
memset(&pData->curFacilityTypeData, 0, FACILITYTYPE_SIZEOF_POD);
|
||||
pData->curFacilityTypeData = FACILITYTYPE();
|
||||
InitFacilityTypeEntry( pData );
|
||||
|
||||
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3,"MergeStartElementHandle: setting memory for curMerge");
|
||||
@@ -405,6 +406,23 @@ facilitytypeStartElementHandle(void *userData, const XML_Char *name, const XML_C
|
||||
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
else if (pData->curElement == FACILITYTYPE_RISK &&
|
||||
pData->curRisk == RISK_DRUNK &&
|
||||
strcmp(name, "drugitems") == 0)
|
||||
{
|
||||
pData->curGenericElement = ELEMENT_VECTOR_OF_NUMBERS;
|
||||
pData->curElement = FACILITYTYPE_RISK_ELEMENT;
|
||||
pData->curAssignmentData.Risk[pData->curRisk].valueVectors[FacilityRiskVectorTypes::RISK_DRUG_ITEMS].clear();
|
||||
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
else if (pData->curGenericElement == ELEMENT_VECTOR_OF_NUMBERS &&
|
||||
strcmp(name, "drugitem") == 0)
|
||||
{
|
||||
pData->curGenericElement = ELEMENT_VECTOR_OF_NUMBERS_NUMBER;
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
|
||||
else if ( pData->curElement == FACILITYTYPE_PRODUCTION &&
|
||||
( strcmp( name, "szProductionName" ) == 0 ||
|
||||
strcmp( name, "szAdditionalRequirementTips" ) == 0 ||
|
||||
@@ -530,6 +548,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].usChance = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].usChance;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].bBaseEffect = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].bBaseEffect;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].ubRange = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].ubRange;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].valueVectors = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].valueVectors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,6 +692,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].Risk[cnt].usChance = pData->curAssignmentData.Risk[cnt].usChance;
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].Risk[cnt].bBaseEffect = pData->curAssignmentData.Risk[cnt].bBaseEffect;
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].Risk[cnt].ubRange = pData->curAssignmentData.Risk[cnt].ubRange;
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].Risk[cnt].valueVectors = pData->curAssignmentData.Risk[cnt].valueVectors;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1252,6 +1272,14 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curProductionData.usOptional_PreProducts.push_back( data );
|
||||
}
|
||||
}
|
||||
else if (pData->curGenericElement == ELEMENT_VECTOR_OF_NUMBERS_NUMBER && strcmp(name, "drugitem") == 0)
|
||||
{
|
||||
pData->curGenericElement = ELEMENT_VECTOR_OF_NUMBERS;
|
||||
pData->curElement = FACILITYTYPE_RISK;
|
||||
|
||||
INT16 drugValue = (INT16)atol(pData->szCharData);
|
||||
pData->curAssignmentData.Risk[pData->curRisk].valueVectors[FacilityRiskVectorTypes::RISK_DRUG_ITEMS].push_back(drugValue);
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
@@ -1299,7 +1327,7 @@ BOOLEAN ReadInFacilityTypes(STR fileName, BOOLEAN localizedVersion)
|
||||
XML_SetCharacterDataHandler(parser, facilitytypeCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData, 0, FACILITYTYPEPARSEDATA_SIZE_OF_POD);
|
||||
pData = facilitytypeParseData();
|
||||
pData.maxArraySize = MAXITEMS;
|
||||
pData.curIndex = 0;
|
||||
|
||||
|
||||
+44
-26
@@ -3369,7 +3369,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.AGL.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.AGL.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3384,7 +3384,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.DEX.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.DEX.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3399,7 +3399,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.STR.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.STR.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3414,7 +3414,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.WIS.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.WIS.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3429,7 +3429,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.MRK.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.MRK.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3444,7 +3444,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.LDR.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.LDR.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3459,7 +3459,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.MEC.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.MEC.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3474,7 +3474,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.EXP.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.EXP.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3489,7 +3489,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.MED.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.MED.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -3504,7 +3504,7 @@ void DisplayCharacterInfo( void )
|
||||
const auto x = UI_CHARPANEL.Attr.LVL.iX;
|
||||
const auto y = UI_CHARPANEL.Attr.LVL.iY;
|
||||
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, pSoldier->stats.bExpLevel);
|
||||
ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, &gMercProfiles[pSoldier->ubProfile]);
|
||||
ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH));
|
||||
ClipRect.iTop = (y-1);
|
||||
ClipRect.iBottom = (y-1) + STAT_HEIGHT;
|
||||
@@ -5712,7 +5712,7 @@ UINT32 MapScreenHandle(void)
|
||||
HandleCharBarRender( );
|
||||
}
|
||||
|
||||
if( (fShowInventoryFlag && !isWidescreenUI()) || fDisableDueToBattleRoster )
|
||||
if( ( fShowInventoryFlag || fDisableDueToBattleRoster ) && !isWidescreenUI() )
|
||||
{
|
||||
for( iCounter = 0; iCounter < MAX_SORT_METHODS; iCounter++ )
|
||||
{
|
||||
@@ -5828,9 +5828,6 @@ UINT32 MapScreenHandle(void)
|
||||
|
||||
HandleContractRenewalSequence( );
|
||||
|
||||
// handle dialog
|
||||
HandleDialogue( );
|
||||
|
||||
// handle display of inventory pop up
|
||||
// HEADROCK HAM 3.5: Externalize!
|
||||
HandleDisplayOfItemPopUpForSector( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ );
|
||||
@@ -6069,6 +6066,8 @@ UINT32 MapScreenHandle(void)
|
||||
//InvalidateRegion( 0,0, 640, 480);
|
||||
EndFrameBufferRender( );
|
||||
|
||||
// handle dialog
|
||||
HandleDialogue();
|
||||
|
||||
// if not going anywhere else
|
||||
if ( guiPendingScreen == NO_PENDING_SCREEN )
|
||||
@@ -7229,14 +7228,29 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
break;
|
||||
|
||||
case PGUP:
|
||||
// WANNE: Jump to first merc in list
|
||||
fResetMapCoords = TRUE;
|
||||
GoToFirstCharacterInList( );
|
||||
if (gfPreBattleInterfaceActive)
|
||||
{
|
||||
ScrollPreBattleInterface(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// WANNE: Jump to first merc in list
|
||||
fResetMapCoords = TRUE;
|
||||
GoToFirstCharacterInList();
|
||||
}
|
||||
|
||||
break;
|
||||
case PGDN:
|
||||
// WANNE: Jump to last merc in list
|
||||
fResetMapCoords = TRUE;
|
||||
GoToLastCharacterInList( );
|
||||
if (gfPreBattleInterfaceActive)
|
||||
{
|
||||
ScrollPreBattleInterface(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// WANNE: Jump to last merc in list
|
||||
fResetMapCoords = TRUE;
|
||||
GoToLastCharacterInList();
|
||||
}
|
||||
break;
|
||||
|
||||
case SHIFT_PGUP:
|
||||
@@ -9787,12 +9801,12 @@ void BltCharInvPanel()
|
||||
UINT32 fontColour = FONT_MCOLOR_RED;
|
||||
|
||||
// robot targeting bonus
|
||||
if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus)
|
||||
if (ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem))
|
||||
{
|
||||
swprintf(text, szRobotText[ROBOT_TEXT_LASER]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
}
|
||||
else if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision)
|
||||
else if (ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem))
|
||||
{
|
||||
swprintf(text, szRobotText[ROBOT_TEXT_NIGHT_VISION]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
@@ -9815,7 +9829,7 @@ void BltCharInvPanel()
|
||||
swprintf(text, szRobotText[ROBOT_TEXT_STAT_BONUSES]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
}
|
||||
else if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo)
|
||||
else if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem))
|
||||
{
|
||||
swprintf(text, szRobotText[ROBOT_TEXT_CAMO]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
@@ -9848,12 +9862,12 @@ void BltCharInvPanel()
|
||||
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_RADIO]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
}
|
||||
else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector == 1)
|
||||
else if (ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem))
|
||||
{
|
||||
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_METAL_DETECTOR]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
}
|
||||
else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1)
|
||||
else if (ItemHasXRay(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem))
|
||||
{
|
||||
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_XRAY]);
|
||||
fontColour = FONT_MCOLOR_LTGREEN;
|
||||
@@ -10432,7 +10446,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason )
|
||||
{
|
||||
if ( !InItemDescriptionBox( ) )
|
||||
{
|
||||
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[pSoldier->inv[ uiHandPos ].usItem].singleshotrocketlauncher) )
|
||||
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(pSoldier->inv[ uiHandPos ].usItem) )
|
||||
{
|
||||
EmptyWeaponMagazine( &(pSoldier->inv[ uiHandPos ]), &gItemPointer, uiHandPos );
|
||||
InternalMAPBeginItemPointer( pSoldier );
|
||||
@@ -10931,6 +10945,10 @@ void BlitBackgroundToSaveBuffer( void )
|
||||
ForceButtonUnDirty( giMapContractButton );
|
||||
ForceButtonUnDirty( giCharInfoButton[ 0 ] );
|
||||
ForceButtonUnDirty( giCharInfoButton[ 1 ] );
|
||||
if (isWidescreenUI())
|
||||
{
|
||||
ForceButtonUnDirty(giMapInvDoneButton);
|
||||
}
|
||||
RenderPreBattleInterface();
|
||||
}
|
||||
|
||||
|
||||
+13
-93
@@ -1659,80 +1659,6 @@ void EndLoadScreen( )
|
||||
'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ, uiSeconds, uiHundreths );
|
||||
}
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
if ( fStartNewFile )
|
||||
{ //start new file
|
||||
fp = fopen( "TimeResults.txt", "w" );
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, L"See JA2\\Data\\TimeResults.txt for more detailed timings." );
|
||||
fStartNewFile = FALSE;
|
||||
}
|
||||
else
|
||||
{ //append to end of file
|
||||
fp = fopen( "TimeResults.txt", "a" );
|
||||
|
||||
if ( fp )
|
||||
{
|
||||
fprintf( fp, "\n\n--------------------------------------------------------------------\n\n" );
|
||||
}
|
||||
}
|
||||
if ( fp )
|
||||
{
|
||||
//Record all of the timings.
|
||||
fprintf( fp, "%S\n", str );
|
||||
fprintf( fp, "EnterSector() supersets LoadWorld(). This includes other external sections.\n" );
|
||||
//FileRead()
|
||||
fprintf( fp, "\n\nVARIOUS FUNCTION TIMINGS (exclusive of actual function timings in second heading)\n" );
|
||||
uiSeconds = uiTotalFileReadTime / 1000;
|
||||
uiHundreths = (uiTotalFileReadTime / 10) % 100;
|
||||
fprintf( fp, "FileRead: %d.%02d (called %d times)\n", uiSeconds, uiHundreths, uiTotalFileReadCalls );
|
||||
|
||||
fprintf( fp, "\n\nSECTIONS OF LOADWORLD (all parts should add up to 100%)\n" );
|
||||
//TrashWorld()
|
||||
uiSeconds = uiTrashWorldTime / 1000;
|
||||
uiHundreths = (uiTrashWorldTime / 10) % 100;
|
||||
fprintf( fp, "TrashWorld: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadMapTilesets()
|
||||
uiSeconds = uiLoadMapTilesetTime / 1000;
|
||||
uiHundreths = (uiLoadMapTilesetTime / 10) % 100;
|
||||
fprintf( fp, "LoadMapTileset: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadMapLights()
|
||||
uiSeconds = uiLoadMapLightsTime / 1000;
|
||||
uiHundreths = (uiLoadMapLightsTime / 10) % 100;
|
||||
fprintf( fp, "LoadMapLights: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
uiSeconds = uiBuildShadeTableTime / 1000;
|
||||
uiHundreths = (uiBuildShadeTableTime / 10) % 100;
|
||||
fprintf( fp, " 1) BuildShadeTables: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
|
||||
uiPercentage = uiNumImagesReloaded * 100 / giNumberOfTileTypes;
|
||||
fprintf( fp, " 2) %d%% of the tileset images were actually reloaded.\n", uiPercentage );
|
||||
if ( (uiNumTablesSaved + uiNumTablesLoaded) != 0 )
|
||||
{
|
||||
uiPercentage = uiNumTablesSaved * 100 / (uiNumTablesSaved + uiNumTablesLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiPercentage = 0;
|
||||
}
|
||||
fprintf( fp, " 3) Of that, %d%% of the shade tables were generated (not loaded).\n", uiPercentage );
|
||||
if ( gfForceBuildShadeTables )
|
||||
fprintf( fp, " NOTE: Force building of shadetables enabled on this local computer.\n" );
|
||||
|
||||
|
||||
//Unaccounted
|
||||
uiUnaccounted = uiLoadWorldTime - uiTrashWorldTime - uiLoadMapTilesetTime - uiLoadMapLightsTime;
|
||||
uiSeconds = uiUnaccounted / 1000;
|
||||
uiHundreths = (uiUnaccounted / 10) % 100;
|
||||
fprintf( fp, "Unaccounted: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadWorld()
|
||||
uiSeconds = uiLoadWorldTime / 1000;
|
||||
uiHundreths = (uiLoadWorldTime / 10) % 100;
|
||||
fprintf( fp, "\nTotal: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
#else
|
||||
sgp::Logger_ID time_log_id = sgp::Logger::instance( ).createLogger( );
|
||||
sgp::Logger::instance( ).connectFile( time_log_id, L"TimeResults.txt", true, sgp::Logger::FLUSH_ON_ENDL );
|
||||
sgp::Logger::LogInstance timeResults = SGP_LOG( time_log_id );
|
||||
@@ -1793,7 +1719,6 @@ void EndLoadScreen( )
|
||||
uiSeconds = uiLoadWorldTime / 1000;
|
||||
uiHundreths = (uiLoadWorldTime / 10) % 100;
|
||||
timeResults << vfs::Log::endl << "Total: " << uiSeconds << "." << uiHundreths << sgp::endl;
|
||||
#endif // USE_VFS
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3457,27 +3382,22 @@ void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY,
|
||||
break;
|
||||
|
||||
case INSERTION_CODE_ARRIVING_GAME:
|
||||
// Are we in Omerta!
|
||||
if ( sSectorX == gWorldSectorX && gWorldSectorX == 9 && sSectorY == gWorldSectorY && gWorldSectorY == 1 && bSectorZ == gbWorldSectorZ && gbWorldSectorZ == 0 )
|
||||
#ifdef JA2UB
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->sInsertionGridNo = gGameUBOptions.LOCATEGRIDNO;
|
||||
#else
|
||||
extern BOOLEAN gfFirstHeliRun;
|
||||
if (gfFirstHeliRun)
|
||||
{
|
||||
// TODO.WANNE: Hardcoded grid number
|
||||
// Try another location and walk into map
|
||||
pSoldier->sInsertionGridNo = 4379;//dnl!!!
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->sInsertionGridNo = gGameExternalOptions.iInitialMercArrivalLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef JA2UB
|
||||
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
//pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo;
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->sInsertionGridNo = gGameUBOptions.LOCATEGRIDNO;
|
||||
#else
|
||||
//pSoldier->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
//pSoldier->sInsertionGridNo = gMapInformation.sNorthGridNo;
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->sInsertionGridNo = gGameExternalOptions.iInitialMercArrivalLocation;
|
||||
#endif
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER;
|
||||
pSoldier->sInsertionGridNo = gMapInformation.sCenterGridNo;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case INSERTION_CODE_CHOPPER:
|
||||
// Try another location and walk into map
|
||||
@@ -4773,8 +4693,8 @@ void DoneFadeOutAdjacentSector( )
|
||||
curr->pSoldier->ubWaitActionToDo = 1;
|
||||
// OK, here we have been given a position, a gridno has been given to use as well....
|
||||
sOldGridNo = curr->pSoldier->sGridNo;
|
||||
sWorldX = CenterX( sGridNo );
|
||||
sWorldY = CenterY( sGridNo );
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sWorldX, &sWorldY);
|
||||
|
||||
curr->pSoldier->EVENT_SetSoldierPosition( sWorldX, sWorldY );
|
||||
if ( sGridNo != sOldGridNo )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user