mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- new feature: backgrounds allow more personalisation of mercenaries
- background feature replaces overheating on startup screen, moved overheating opion to ini WARNING: GameDir revision >= 1748 is required. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6353 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+6
-3
@@ -369,10 +369,13 @@ void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier )
|
||||
++sectortemperaturemod;
|
||||
|
||||
FLOAT temperaturemodifier = (FLOAT)(3 + sectortemperaturemod)/3;
|
||||
|
||||
|
||||
FLOAT specialfoodmodifier = (100 + pSoldier->GetBackgroundValue(BG_PERC_FOOD) ) / 100;
|
||||
FLOAT specialdrinkmodifier = (100 + pSoldier->GetBackgroundValue(BG_PERC_WATER)) / 100;
|
||||
|
||||
// due to digestion, reduce our food and drink levels
|
||||
pSoldier->bFoodLevel = max(pSoldier->bFoodLevel - (INT32) (activitymodifier * gGameExternalOptions.usFoodDigestionHourlyBaseFood), FOOD_MIN);
|
||||
pSoldier->bDrinkLevel = max(pSoldier->bDrinkLevel - (INT32) (activitymodifier * temperaturemodifier * gGameExternalOptions.usFoodDigestionHourlyBaseDrink), FOOD_MIN);
|
||||
pSoldier->bFoodLevel = max(pSoldier->bFoodLevel - (INT32) (specialfoodmodifier * activitymodifier * gGameExternalOptions.usFoodDigestionHourlyBaseFood), FOOD_MIN);
|
||||
pSoldier->bDrinkLevel = max(pSoldier->bDrinkLevel - (INT32) (specialdrinkmodifier * activitymodifier * temperaturemodifier * gGameExternalOptions.usFoodDigestionHourlyBaseDrink), FOOD_MIN);
|
||||
|
||||
// there is a chance that we take damage to our health and strength stats if we are starving (or insanely obese :-) )
|
||||
UINT8 foodsituation;
|
||||
|
||||
@@ -1783,6 +1783,11 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
|
||||
{
|
||||
pSoldier->inv[ HANDPOS ][0]->data.bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) );
|
||||
}
|
||||
|
||||
// Flugente: backgrounds
|
||||
if ( pSoldier->HasBackgroundFlag( BACKGROUND_TRAPLEVEL ) )
|
||||
pSoldier->inv[ HANDPOS ][0]->data.bTrap++;
|
||||
|
||||
pSoldier->inv[ HANDPOS ][0]->data.misc.ubBombOwner = pSoldier->ubID + 2;
|
||||
|
||||
// Flugente: determine the direction we are looking at and apply that direction to our explosive
|
||||
@@ -4993,6 +4998,10 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
gpTempSoldier->inv[ HANDPOS ][0]->data.bTrap = __min( 10, ( EffectiveExplosive( gpTempSoldier ) / 20) + (EffectiveExpLevel( gpTempSoldier ) / 3) );
|
||||
}
|
||||
|
||||
// Flugente: backgrounds
|
||||
if ( gpTempSoldier->HasBackgroundFlag( BACKGROUND_TRAPLEVEL ) )
|
||||
gpTempSoldier->inv[ HANDPOS ][0]->data.bTrap++;
|
||||
|
||||
// HACK IMMINENT!
|
||||
// value of 1 is stored in maps for SIDE of bomb owner... when we want to use IDs!
|
||||
|
||||
@@ -1906,7 +1906,8 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
|
||||
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 2 ] );
|
||||
}
|
||||
|
||||
if ( gGameOptions.fWeaponOverheating ) // Flugente
|
||||
// Flugente
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
//////////////////// TEMPERATURE MODIFICATOR
|
||||
{
|
||||
@@ -3707,7 +3708,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
|
||||
INT16 fDrawGenIndexes = FALSE;
|
||||
|
||||
// Flugente
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) )
|
||||
{
|
||||
@@ -4290,7 +4291,8 @@ void DrawAmmoStats( OBJECTTYPE * gpItemDescObject )
|
||||
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAmmoIcon, 2, gItemDescGenRegions[2][0].sLeft+sOffsetX, gItemDescGenRegions[2][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
|
||||
if ( gGameOptions.fWeaponOverheating ) // Flugente
|
||||
// Flugente
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
//////////////// TEMPERATURE MODIFICATOR
|
||||
{
|
||||
@@ -5107,7 +5109,7 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
|
||||
// Flugente
|
||||
// new line is necessary (Moa: only if needed)
|
||||
INT16 fDrawGenIndexes = FALSE;
|
||||
if ( gGameOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem )
|
||||
if ( gGameExternalOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem )
|
||||
{
|
||||
if( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[gpItemDescObject->usItem].barrel == TRUE || ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatCooldownModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) )
|
||||
{
|
||||
@@ -5115,7 +5117,8 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
|
||||
}
|
||||
}
|
||||
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
// Flugente
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
if( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) )
|
||||
{
|
||||
@@ -7591,8 +7594,8 @@ void DrawAmmoValues( OBJECTTYPE * gpItemDescObject, int shotsLeft )
|
||||
mprintf( usX, usY, pStr );
|
||||
}
|
||||
|
||||
|
||||
if ( gGameOptions.fWeaponOverheating ) // Flugente
|
||||
// Flugente
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
///////////////////// TEMPERATURE MODIFICATOR
|
||||
// Set line to draw into
|
||||
@@ -10963,7 +10966,7 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
|
||||
INT16 fDrawGenIndexes = FALSE;
|
||||
|
||||
// Flugente
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) )
|
||||
{
|
||||
|
||||
@@ -763,7 +763,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObject );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatdamagepercentage) - 1.0) * 0.1);
|
||||
@@ -908,7 +908,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObject );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatdamagepercentage) - 1.0) * 0.1);
|
||||
@@ -3735,7 +3735,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
sNewX = sX + 1;
|
||||
|
||||
// Flugente: If we display the thermometer for overheating, move the ammo counter a bit to the right
|
||||
if ( gGameOptions.fWeaponOverheating == TRUE && gGameExternalOptions.fDisplayOverheatThermometer == TRUE )
|
||||
if ( gGameExternalOptions.fWeaponOverheating && gGameExternalOptions.fDisplayOverheatThermometer )
|
||||
sNewX = sX + 2; //6; // SANDRO - 6 ps too much, 2 are fine
|
||||
|
||||
// Flugente: check for underbarrel weapons and use that object if necessary
|
||||
@@ -3890,7 +3890,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
}
|
||||
|
||||
// Flugente
|
||||
if ( gGameOptions.fWeaponOverheating == TRUE && gGameExternalOptions.fDisplayOverheatThermometer == TRUE && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObject->usItem].barrel == TRUE ) )
|
||||
if ( gGameExternalOptions.fWeaponOverheating && gGameExternalOptions.fDisplayOverheatThermometer && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObject->usItem].barrel == TRUE ) )
|
||||
{
|
||||
OBJECTTYPE* pObjShown = pObject;
|
||||
|
||||
@@ -6702,7 +6702,8 @@ void RenderItemDescriptionBox( )
|
||||
sCenY = sCenY + gItemDescAttachmentsXY[cnt].sBarDy;
|
||||
DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex );
|
||||
|
||||
if ( gGameOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[ (iter)->usItem ].barrel == TRUE) ) // Flugente FTW 1.1
|
||||
// Flugente: overheating
|
||||
if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[ (iter)->usItem ].barrel == TRUE) ) // Flugente FTW 1.1
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatJamPercentage( &(*iter));
|
||||
|
||||
@@ -6868,8 +6869,8 @@ void RenderItemDescriptionBox( )
|
||||
////////// label
|
||||
if (UsingEDBSystem())
|
||||
{
|
||||
// Flugente FTW 1: display temperature string
|
||||
if ( gGameOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].barrel == TRUE ) )
|
||||
// Flugente: display temperature string
|
||||
if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].barrel == TRUE ) )
|
||||
{
|
||||
// UDB system displays a string with colored condition text.
|
||||
int regionindex = 7;
|
||||
@@ -11598,7 +11599,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObject );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatdamagepercentage) - 1.0) * 0.1);
|
||||
@@ -11753,7 +11754,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObject );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatdamagepercentage) - 1.0) * 0.1);
|
||||
@@ -13237,6 +13238,10 @@ void BombInventoryMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
(*gpItemDescObject)[0]->data.bTrap = __min( 10, ( EffectiveExplosive( gpItemDescSoldier ) / 20) + (EffectiveExpLevel( gpItemDescSoldier ) / 3) );
|
||||
}
|
||||
|
||||
// Flugente: backgrounds
|
||||
if ( gpItemDescSoldier->HasBackgroundFlag( BACKGROUND_TRAPLEVEL ) )
|
||||
(*gpItemDescObject)[0]->data.bTrap++;
|
||||
|
||||
// Flugente: We armed a bomb in our inventory. We will NOT add it to the item pool and the world bombs.
|
||||
// Instead, we will count down the delay time every turn and eventually ignite the bomb from our inventory.
|
||||
|
||||
@@ -3880,7 +3880,10 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
if (INV_AP_COST)
|
||||
//Jenilee: determine the cost of moving this item around in our inventory
|
||||
usCostToMoveItem = GetInvMovementCost(gpItemPointer, uiLastHandPos, uiHandPos);
|
||||
|
||||
|
||||
// Flugente: backgrounds
|
||||
usCostToMoveItem = (usCostToMoveItem * (100 + gpSMCurrentMerc->GetBackgroundValue(BG_INVENTORY))) / 100;
|
||||
|
||||
if ( ( usCostToMoveItem == 0 ) || ( gpSMCurrentMerc->bActionPoints >= usCostToMoveItem ) )
|
||||
{
|
||||
fOKToGo = TRUE;
|
||||
|
||||
@@ -107,6 +107,8 @@ CIV_NAMES_VALUES zCivGroupName[NUM_CIV_GROUPS];
|
||||
SOLDIER_PROFILE_VALUES zSoldierProfile[6][NUM_SOLDIER_PROFILES];
|
||||
UINT16 num_found_soldier_profiles[6]; // the correct number is set on reading the xml
|
||||
|
||||
BACKGROUND_VALUES zBackground[NUM_BACKGROUND]; // Flugente: backgrounds
|
||||
|
||||
BOOLEAN gfInMovementMenu = FALSE;
|
||||
INT32 giMenuAnchorX, giMenuAnchorY;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "handle UI.h"
|
||||
#include "mousesystem.h"
|
||||
#include "structure.h"
|
||||
#include "Assignments.h" // added by Flugente for the stat-enums
|
||||
|
||||
#define MAX_UICOMPOSITES 4
|
||||
|
||||
@@ -106,6 +107,101 @@ extern SOLDIER_PROFILE_VALUES zSoldierProfile[6][NUM_SOLDIER_PROFILES];
|
||||
extern UINT16 num_found_soldier_profiles[6]; // the correct number is set on reading the xml
|
||||
extern UINT16 num_found_profiles; // a helper variable during reading xmls
|
||||
|
||||
// Flugente: backgrounds
|
||||
// enums for backgrounds
|
||||
enum {
|
||||
// sector dependent AP modifiers
|
||||
BG_POLAR, // not used ingame (yet?)
|
||||
BG_DESERT,
|
||||
BG_SWAMP,
|
||||
BG_URBAN,
|
||||
BG_RIVER,
|
||||
BG_TROPICAL,
|
||||
BG_COASTAL,
|
||||
BG_MOUNTAIN,
|
||||
|
||||
// stat effectiveness modifiers
|
||||
BG_AGILITY,
|
||||
BG_DEXTERITY,
|
||||
BG_STRENGTH,
|
||||
BG_LEADERSHIP,
|
||||
BG_MARKSMANSHIP,
|
||||
BG_MECHANICAL,
|
||||
BG_EXPLOSIVE_ASSIGN,
|
||||
BG_MEDICAL,
|
||||
|
||||
// ap modifiers for non-sector related tasks
|
||||
BG_HEIGHT,
|
||||
BG_SWIMMING,
|
||||
BG_FORTIFY,
|
||||
BG_ARTILLERY,
|
||||
BG_INVENTORY,
|
||||
BG_AIRDROP,
|
||||
BG_ASSAULT,
|
||||
|
||||
// travel speed modifiers
|
||||
BG_TRAVEL_FOOT,
|
||||
BG_TRAVEL_CAR,
|
||||
BG_TRAVEL_AIR,
|
||||
BG_TRAVEL_BOAT,
|
||||
|
||||
// resistances
|
||||
BG_RESI_POISON,
|
||||
BG_RESI_FEAR,
|
||||
BG_RESI_SUPPRESSION,
|
||||
BG_RESI_PHYSICAL,
|
||||
BG_RESI_ALCOHOL,
|
||||
|
||||
// various
|
||||
BG_PERC_INTERROGATION,
|
||||
BG_PERC_GUARD,
|
||||
BG_PERC_PRICES_GUNS,
|
||||
BG_PERC_PRICES,
|
||||
BG_PERC_CAPITULATION,
|
||||
BG_PERC_SPEED_RUNNING,
|
||||
BG_PERC_BANDAGING,
|
||||
BG_PERC_REGEN_ENERGY,
|
||||
BG_PERC_CARRYSTRENGTH,
|
||||
BG_PERC_FOOD,
|
||||
BG_PERC_WATER,
|
||||
BG_PERC_SLEEP,
|
||||
BG_PERC_DAMAGE_MELEE,
|
||||
BG_PERC_CTH_BLADE,
|
||||
BG_PERC_CAMO,
|
||||
BG_PERC_STEALTH,
|
||||
BG_PERC_CTH_MAX,
|
||||
BG_PERC_HEARING_NIGHT,
|
||||
BG_PERC_HEARING_DAY,
|
||||
|
||||
// approaches
|
||||
BG_PERC_APPROACH_FRIENDLY,
|
||||
BG_PERC_APPROACH_DIRECT,
|
||||
BG_PERC_APPROACH_THREATEN,
|
||||
BG_PERC_APPROACH_RECRUIT,
|
||||
|
||||
// various
|
||||
BG_BONUS_BREACHINGCHARGE,
|
||||
|
||||
BG_MAX,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 uiIndex;
|
||||
CHAR16 szName[MAX_ENEMY_NAMES_CHARS]; // name of a background etc.
|
||||
CHAR16 szShortName[20]; // abbreviated name for laptop display
|
||||
CHAR16 szDescription[256]; // description of background, should explain the abilities
|
||||
|
||||
UINT64 uiFlags; // this flagmask defines what speial properties this background has (on/off behaviour)
|
||||
INT16 value[BG_MAX]; // property values
|
||||
} BACKGROUND_VALUES;
|
||||
|
||||
#define NUM_BACKGROUND 100
|
||||
|
||||
extern BACKGROUND_VALUES zBackground[NUM_BACKGROUND];
|
||||
|
||||
extern UINT16 num_found_background; // the correct number is set on reading the xml
|
||||
|
||||
extern int INTERFACE_WIDTH; // 640
|
||||
extern int INTERFACE_HEIGHT; // 120
|
||||
extern int INV_INTERFACE_HEIGHT; // 140
|
||||
|
||||
+6
-2
@@ -3125,6 +3125,8 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
ubStrengthForCarrying = (ubStrengthForCarrying * (100 + gSkillTraitValues.ubBBCarryWeightBonus) / 100); // plus one third
|
||||
}
|
||||
|
||||
ubStrengthForCarrying = (ubStrengthForCarrying * (100 + pSoldier->GetBackgroundValue(BG_PERC_CARRYSTRENGTH)) / 100);
|
||||
|
||||
// for now, assume soldiers can carry 1/2 their strength in KGs without penalty.
|
||||
// instead of multiplying by 100 for percent, and then dividing by 10 to account
|
||||
@@ -13348,7 +13350,9 @@ INT16 GetWornStealth( SOLDIERTYPE * pSoldier )
|
||||
|
||||
// Add some default stealth ability to mercs with STEALTHY trait - SANDRO
|
||||
if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, STEALTHY_NT ))
|
||||
ttl += gSkillTraitValues.ubSTStealthBonus;
|
||||
ttl += gSkillTraitValues.ubSTStealthBonus;
|
||||
|
||||
ttl += pSoldier->GetBackgroundValue(BG_PERC_STEALTH);
|
||||
|
||||
return __min( ttl, 100 );
|
||||
}
|
||||
@@ -13643,7 +13647,7 @@ INT32 GetGunAccuracy( OBJECTTYPE *pObj )
|
||||
{
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObj );
|
||||
FLOAT accuracymalus = (max(1.0f, overheatdamagepercentage) - 1.0f) * 0.1f;
|
||||
|
||||
+2
-1
@@ -741,7 +741,8 @@ BOOLEAN AttemptToBlowUpLock( SOLDIERTYPE * pSoldier, DOOR * pDoor )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
iResult = SkillCheck( pSoldier, PLANTING_BOMB_CHECK, 0 );
|
||||
// Flugente: flat bonus to using door breaching charges
|
||||
iResult = SkillCheck( pSoldier, PLANTING_BOMB_CHECK, pSoldier->GetBackgroundValue(BG_BONUS_BREACHINGCHARGE) );
|
||||
if (iResult >= -20)
|
||||
{
|
||||
// Do explosive graphic....
|
||||
|
||||
+8
-4
@@ -520,7 +520,11 @@ INT8 GetSightAdjustmentCamouflageOnTerrain( SOLDIERTYPE* pSoldier, const UINT8&
|
||||
|
||||
INT8 scaler = -(ANIM_STAND+1 - ubStance); // stand = 7-6 => 10%, crouch = 7-3 => 66%, prone = 7-1 => 100%;
|
||||
|
||||
scaler = gGameExternalOptions.ubCamouflageEffectiveness * scaler / 6;
|
||||
UINT8 effectiveness = gGameExternalOptions.ubCamouflageEffectiveness;
|
||||
|
||||
effectiveness += (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CAMO));
|
||||
|
||||
scaler = effectiveness * scaler / 6;
|
||||
|
||||
switch(ubTerrainType) {
|
||||
case LOW_GRASS:
|
||||
@@ -5805,7 +5809,7 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT
|
||||
///////////////////////// OVERHEATING AND STATUS REDUCTION ////////////////////////////
|
||||
INT16 iOverheatReliabilityMalus = 0;
|
||||
// Flugente: Increase Weapon Temperature
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatDamagePercentage( pObj ); // ... how much above the gun's usOverheatingDamageThreshold are we? ...
|
||||
|
||||
@@ -5847,8 +5851,8 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT
|
||||
int condition = (*pObj)[0]->data.gun.bGunStatus;
|
||||
int invertedBaseJamChance = condition + (reliability * 2) - gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * 1;
|
||||
|
||||
// Flugente FTW 1: If overheating is allowed, a gun will be prone to more overheating if its temperature is high
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
// Flugente: If overheating is allowed, a gun will be prone to more overheating if its temperature is high
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatJamPercentage( pObj ); // how much above the gun's usOverheatingJamThreshold are we? ...
|
||||
|
||||
|
||||
@@ -357,6 +357,9 @@ void RefreshSoldierMorale( SOLDIERTYPE * pSoldier )
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
FoodMaxMoraleModifiy(pSoldier, &ubMaxMorale);
|
||||
|
||||
// Flugente: max morale can be lowered
|
||||
iActualMorale = min(iActualMorale, pSoldier->GetMoraleThreshold() );
|
||||
|
||||
if (ubMaxMorale > 0 && iActualMorale > ubMaxMorale)
|
||||
{
|
||||
// Normalize to Max Morale
|
||||
@@ -1092,6 +1095,9 @@ void HourlyMoraleUpdate( void )
|
||||
bOpinion = 0;
|
||||
}
|
||||
|
||||
if ( pSoldier->HasBackgroundFlag( BACKGROUND_XENOPHOBIC ) && pOtherSoldier->ubProfile != NO_PROFILE && gMercProfiles[pSoldier->ubProfile].usBackground != gMercProfiles[pOtherSoldier->ubProfile].usBackground )
|
||||
bOpinion -= 2;
|
||||
|
||||
if (bOpinion == HATED_OPINION)
|
||||
{
|
||||
|
||||
|
||||
@@ -7959,6 +7959,9 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier )
|
||||
bTolerance = __max(bTolerance, gGameExternalOptions.ubSuppressionToleranceMin);
|
||||
bTolerance = __min(bTolerance, gGameExternalOptions.ubSuppressionToleranceMax);
|
||||
|
||||
// Flugente: add personal bonus to suppresion tolerance
|
||||
bTolerance += pSoldier->GetSuppressionResistanceBonus();
|
||||
|
||||
return( bTolerance );
|
||||
}
|
||||
|
||||
@@ -8189,6 +8192,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
{
|
||||
bShockForCower = (INT8)((bShockForCower * 17 / 20 ) + 0.5); // -15% as shock
|
||||
}
|
||||
|
||||
// Flugente: personal fear resistance
|
||||
bShockForCower = (INT8)((bShockForCower * (100 - pSoldier->GetFearResistanceBonus()) / 100 ) + 0.5);
|
||||
}
|
||||
if (bShockForCower >= bTolerance)
|
||||
{
|
||||
@@ -10037,6 +10043,12 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
|
||||
}
|
||||
}
|
||||
|
||||
GetSoldier( &pSoldier, gusSelectedSoldier );
|
||||
|
||||
// if the merc asking for surrender is experienced in capitulation negotiations, we get a bonus to our strength
|
||||
if ( pSoldier )
|
||||
playersidestrength = (playersidestrength * (100 + pSoldier->GetBackgroundValue(BG_PERC_CAPITULATION))) / 100;
|
||||
|
||||
// enemy team
|
||||
firstid = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
||||
lastid = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID;
|
||||
|
||||
+21
-6
@@ -349,15 +349,18 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bDir, UINT
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: backgrounds
|
||||
if ( TERRAIN_IS_HIGH_WATER( ubTerrainID) )
|
||||
iPoints = (iPoints * (100 + pSoldier->GetBackgroundValue(BG_SWIMMING))) / 100;
|
||||
|
||||
// ATE: Adjust these by realtime movement
|
||||
if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||
{
|
||||
if (!(gTacticalStatus.uiFlags & TURNBASED) || !(gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||
{
|
||||
// ATE: ADJUST FOR RT - MAKE BREATH GO A LITTLE FASTER!
|
||||
// silversurfer: now externalized to APBPConstants.ini
|
||||
//iPoints = (INT32)( iPoints * TB_BREATH_DEDUCT_MODIFIER );
|
||||
iPoints = (INT32)( iPoints * APBPConstants[BP_RT_BREATH_DEDUCT_MODIFIER] / 100 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return( (INT16) iPoints);
|
||||
}
|
||||
@@ -477,6 +480,10 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: swimming background
|
||||
if ( TERRAIN_IS_HIGH_WATER( ubTerrainID) )
|
||||
sPoints = (sPoints * (100 + pSoldier->GetBackgroundValue(BG_SWIMMING))) / 100;
|
||||
|
||||
// Check if doors if not player's merc (they have to open them manually)
|
||||
if ( sSwitchValue == TRAVELCOST_DOOR && pSoldier->bTeam != gbPlayerNum )
|
||||
{
|
||||
@@ -832,6 +839,9 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, UINT8 ub
|
||||
if ( iBPCost < 0 && gGameOptions.fFoodSystem )
|
||||
ReduceBPRegenForHunger(pSoldier, &iBPCost);
|
||||
|
||||
// Flugente: backgrounds
|
||||
iBPCost = (INT32) (iBPCost * (100 + pSoldier->GetBackgroundValue(BG_PERC_REGEN_ENERGY)) / 100);
|
||||
|
||||
if (is_networked)
|
||||
{
|
||||
// Adjust breath changes due to spending or regaining of energy
|
||||
@@ -2250,9 +2260,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubHWRocketLaunchersAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100)+ 0.5);
|
||||
}
|
||||
// Decreased APs needed for mortar - Heavy Weapons
|
||||
else if ( Item[usUBItem].mortar && HAS_SKILL_TRAIT( pSoldier, HEAVY_WEAPONS_NT ) )
|
||||
else if ( Item[usUBItem].mortar )
|
||||
{
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubHWMortarAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100)+ 0.5);
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubHWMortarAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) + pSoldier->GetBackgroundValue(BG_ARTILLERY) ) / 100)+ 0.5);
|
||||
}
|
||||
// Decreased APs needed for pistols and machine pistols - Gunslinger
|
||||
else if (Weapon[ usUBItem ].ubWeaponType == GUN_PISTOL && HAS_SKILL_TRAIT( pSoldier, GUNSLINGER_NT ) )
|
||||
@@ -3754,6 +3764,11 @@ INT16 GetAPsForMultiTurnAction( SOLDIERTYPE *pSoldier, UINT8 usActionType )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( usActionType == MTA_FORTIFY || usActionType == MTA_REMOVE_FORTIFY || usActionType == MTA_FILL_SANDBAG )
|
||||
{
|
||||
sAPCost = (sAPCost * (100 + pSoldier->GetBackgroundValue(BG_FORTIFY))) / 100;
|
||||
}
|
||||
|
||||
return sAPCost;
|
||||
}
|
||||
|
||||
|
||||
@@ -3341,7 +3341,8 @@ UINT8 ubItemsNotCounted = 0; //ja25 UB
|
||||
uiItemPrice[ubCnt] += CalcShopKeeperItemPrice( fDealerSelling, fUnitPriceOnly, iter->usItem, dModifier, &(*iter)) ;
|
||||
}
|
||||
|
||||
// if Flo is doing the dealin' and wheelin'
|
||||
// Flugente: used in backgrounds now, old code in comments for historical reasons
|
||||
/*// if Flo is doing the dealin' and wheelin'
|
||||
if ( gpSMCurrentMerc->ubProfile == FLO )
|
||||
{
|
||||
// if it's a GUN or AMMO (but not Launchers, and all attachments and payload is included)
|
||||
@@ -3364,6 +3365,46 @@ UINT8 ubItemsNotCounted = 0; //ja25 UB
|
||||
}
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// if it's a GUN or AMMO (but not Launchers, and all attachments and payload is included)
|
||||
if ( Item [ usItemID ].usItemClass & (IC_GUN|IC_AMMO) )
|
||||
{
|
||||
if ( gpSMCurrentMerc->GetBackgroundValue(BG_PERC_PRICES_GUNS) )
|
||||
uiDiscountValue = ( uiItemPrice[ubCnt] * gpSMCurrentMerc->GetBackgroundValue(BG_PERC_PRICES_GUNS) ) / 100;
|
||||
// if we play without backgrounds, Flo gets the hardcoded bonus
|
||||
else if ( gpSMCurrentMerc->ubProfile == FLO )
|
||||
uiDiscountValue = ( uiItemPrice[ubCnt] * FLO_DISCOUNT_PERCENTAGE ) / 100;
|
||||
|
||||
// she gets a discount! Read her M.E.R.C. profile to understand why
|
||||
if ( fDealerSelling )
|
||||
{
|
||||
// she buys for less...
|
||||
uiItemPrice[ubCnt] -= uiDiscountValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// and sells for more!
|
||||
uiItemPrice[ubCnt] += uiDiscountValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Flugente: backgrounds
|
||||
else if ( Item [ usItemID ].usItemClass & (IC_MAPFILTER_MELEE|IC_MAPFILTER_KIT|IC_MAPFILTER_LBE|IC_MAPFILTER_ARMOR|IC_MAPFILTER_MISC) )
|
||||
{
|
||||
uiDiscountValue = ( uiItemPrice[ubCnt] * gpSMCurrentMerc->GetBackgroundValue(BG_PERC_PRICES) ) / 100;
|
||||
|
||||
if ( fDealerSelling )
|
||||
{
|
||||
// buy for less...
|
||||
uiItemPrice[ubCnt] -= uiDiscountValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// and sell for more!
|
||||
uiItemPrice[ubCnt] += uiDiscountValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// if it's the dealer selling this, make sure the item is worth at least $1
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "GameSettings.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Soldier Control.h"
|
||||
#include "Interface.h" // added by Flugente for zBackground
|
||||
#endif
|
||||
|
||||
extern void ReducePointsForHunger( SOLDIERTYPE *pSoldier, UINT32 *pusPoints );
|
||||
@@ -47,6 +48,8 @@ INT16 EffectiveStrength( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer )
|
||||
{
|
||||
iEffStrength = 0;
|
||||
}
|
||||
|
||||
iEffStrength = (iEffStrength * (100 + pSoldier->GetBackgroundValue(BG_STRENGTH))) / 100;
|
||||
|
||||
// ATE: Make sure at least 2...
|
||||
iEffStrength = __max( iEffStrength, 2 );
|
||||
@@ -84,6 +87,8 @@ INT16 EffectiveAgility( SOLDIERTYPE * pSoldier, BOOLEAN fTrainer )
|
||||
iEffAgility = (iEffAgility * 100) / pSoldier->sWeightCarriedAtTurnStart;
|
||||
}
|
||||
|
||||
iEffAgility = (iEffAgility * (100 + pSoldier->GetBackgroundValue(BG_AGILITY))) / 100;
|
||||
|
||||
return( (INT16) iEffAgility );
|
||||
}
|
||||
|
||||
@@ -96,6 +101,8 @@ INT8 EffectiveMechanical( SOLDIERTYPE * pSoldier )
|
||||
|
||||
iEffMechanical = EffectStatForBeingDrunk( pSoldier, iEffMechanical );
|
||||
|
||||
iEffMechanical = (iEffMechanical * (100 + pSoldier->GetBackgroundValue(BG_MECHANICAL))) / 100;
|
||||
|
||||
return( (INT8) iEffMechanical );
|
||||
}
|
||||
|
||||
@@ -108,6 +115,8 @@ INT8 EffectiveExplosive( SOLDIERTYPE * pSoldier )
|
||||
|
||||
iEffExplosive = EffectStatForBeingDrunk( pSoldier, iEffExplosive );
|
||||
|
||||
iEffExplosive = (iEffExplosive * (100 + pSoldier->GetBackgroundValue(BG_EXPLOSIVE_ASSIGN))) / 100;
|
||||
|
||||
return( (INT8) iEffExplosive );
|
||||
}
|
||||
|
||||
@@ -120,6 +129,8 @@ INT8 EffectiveMedical( SOLDIERTYPE * pSoldier )
|
||||
|
||||
iEffMedical = EffectStatForBeingDrunk( pSoldier, iEffMedical );
|
||||
|
||||
iEffMedical = (iEffMedical * (100 + pSoldier->GetBackgroundValue(BG_MEDICAL))) / 100;
|
||||
|
||||
return( (INT8) iEffMedical );
|
||||
}
|
||||
|
||||
@@ -138,6 +149,8 @@ INT8 EffectiveLeadership( SOLDIERTYPE * pSoldier )
|
||||
iEffLeadership = ( iEffLeadership * 120 / 100 );
|
||||
}
|
||||
|
||||
iEffLeadership = (iEffLeadership * (100 + pSoldier->GetBackgroundValue(BG_LEADERSHIP))) / 100;
|
||||
|
||||
return( (INT8) iEffLeadership );
|
||||
}
|
||||
|
||||
@@ -206,6 +219,8 @@ INT8 EffectiveMarksmanship( SOLDIERTYPE * pSoldier )
|
||||
|
||||
iEffMarksmanship = EffectStatForBeingDrunk( pSoldier, iEffMarksmanship );
|
||||
|
||||
iEffMarksmanship = (iEffMarksmanship * (100 + pSoldier->GetBackgroundValue(BG_MARKSMANSHIP))) / 100;
|
||||
|
||||
return( (INT8) iEffMarksmanship );
|
||||
}
|
||||
|
||||
@@ -220,6 +235,8 @@ INT16 EffectiveDexterity( SOLDIERTYPE * pSoldier, BOOLEAN fTrainer )
|
||||
|
||||
iEffDexterity = EffectStatForBeingDrunk( pSoldier, iEffDexterity );
|
||||
|
||||
iEffDexterity = (iEffDexterity * (100 + pSoldier->GetBackgroundValue(BG_DEXTERITY))) / 100;
|
||||
|
||||
return( (INT16) iEffDexterity );
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Render Fun.h"
|
||||
#include "meanwhile.h"
|
||||
#include "Exit Grids.h"
|
||||
#include "Interface.h" // added by Flugente for zBackground
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -1194,6 +1195,18 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente backgrounds
|
||||
if ( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_CENTER && pSoldier->GetBackgroundValue(BG_AIRDROP) )
|
||||
{
|
||||
fCalculateDirection = FALSE;
|
||||
pSoldier->ubInsertionDirection = Random( DIRECTION_IRRELEVANT );
|
||||
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_AIRDROP_BONUS;
|
||||
}
|
||||
|
||||
// add this flag whenever we enter strategically enter a sector (= we attack a sector)
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_ASSAULT_BONUS;
|
||||
|
||||
// Override calculated direction if we were told to....
|
||||
if ( pSoldier->ubInsertionDirection > 100 )
|
||||
{
|
||||
|
||||
@@ -1512,6 +1512,7 @@ void MERCPROFILESTRUCT::initialize()
|
||||
clearInventory();
|
||||
// SANDRO - added this
|
||||
memset( &records, 0, sizeof(STRUCT_Records) );
|
||||
memset( &usBackground, 0, sizeof(UINT8) );
|
||||
}
|
||||
|
||||
// Initialize the soldier.
|
||||
@@ -2073,6 +2074,9 @@ INT16 SOLDIERTYPE::CalcActionPoints( void )
|
||||
//ubPoints += 0;
|
||||
}
|
||||
|
||||
// Flugente: personal AP adjustments
|
||||
ubPoints = (INT16)( (ubPoints * (100 + this->GetAPBonus()) ) / 100);
|
||||
|
||||
// option to make special NPCs stronger - AP bonus
|
||||
if ( this->ubProfile != NO_PROFILE && gGameExternalOptions.usSpecialNPCStronger > 0 )
|
||||
{
|
||||
@@ -2192,6 +2196,9 @@ void SOLDIERTYPE::CalcNewActionPoints( void )
|
||||
//MaxActionPnts += 0;
|
||||
}
|
||||
|
||||
// Flugente: personal AP adjustments
|
||||
usMaxActionPnts = (INT16)( (usMaxActionPnts * (100 + this->GetAPBonus()) ) / 100);
|
||||
|
||||
// option to make special NPCs stronger - AP bonus
|
||||
if ( this->ubProfile != NO_PROFILE && gGameExternalOptions.usSpecialNPCStronger > 0 )
|
||||
{
|
||||
@@ -7426,6 +7433,9 @@ void SOLDIERTYPE::EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCou
|
||||
// If an AI guy, and we have 0 life, and are still at higher hieght,
|
||||
// Kill them.....
|
||||
|
||||
// Flugente: update for various personal properties
|
||||
// this has to happen before CalculateCarriedWeight(), otherwise strength modfiers will not be detected correctly
|
||||
this->SoldierPropertyUpkeep();
|
||||
|
||||
this->sWeightCarriedAtTurnStart = (INT16) CalculateCarriedWeight( this );
|
||||
|
||||
@@ -8492,6 +8502,8 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier
|
||||
bLifeDef = 50 - ( pStatsSoldier->stats.bLife / 2 );
|
||||
|
||||
uiTerrainDelay += ( bLifeDef + bBreathDef + bAgilDef + bAdditional );
|
||||
|
||||
uiTerrainDelay = (uiTerrainDelay * (100 + pSoldier->GetBackgroundValue(BG_PERC_SPEED_RUNNING) )) / 100;
|
||||
|
||||
pSoldier->sAniDelay = (INT16)uiTerrainDelay;
|
||||
|
||||
@@ -12443,7 +12455,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
|
||||
if (!(fOnSurgery) && gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( this, DOCTOR_NT ))
|
||||
{
|
||||
uiPossible = uiPossible * (100 - gSkillTraitValues.bSpeedModifierBandaging) / 100;
|
||||
uiPossible += ( uiPossible * gSkillTraitValues.ubDOBandagingSpeedPercent * NUM_SKILL_TRAITS( this, DOCTOR_NT ) / 100);
|
||||
uiPossible += ( uiPossible * gSkillTraitValues.ubDOBandagingSpeedPercent * NUM_SKILL_TRAITS( this, DOCTOR_NT ) + this->GetBackgroundValue(BG_PERC_BANDAGING) ) / 100;
|
||||
}
|
||||
|
||||
uiActual = uiPossible; // start by assuming maximum possible
|
||||
@@ -13745,7 +13757,7 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
||||
// handle flashlight. This is necessary in this location, as we need to do this at least once per turn
|
||||
this->HandleFlashLights();
|
||||
|
||||
if ( !gGameOptions.fWeaponOverheating && !gGameExternalOptions.fDirtSystem && !gGameOptions.fFoodSystem )
|
||||
if ( !gGameExternalOptions.fWeaponOverheating && !gGameExternalOptions.fDirtSystem && !gGameOptions.fFoodSystem )
|
||||
return;
|
||||
|
||||
// one hour has 60 minutes, with 12 5-second-intervals (cooldown values are based on 5-second values)
|
||||
@@ -13776,7 +13788,7 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
||||
if ( pObj != NULL ) // ... if pointer is not obviously useless ...
|
||||
{
|
||||
// ... if Item exists and is a gun, a launcher or a barrel ...
|
||||
if ( gGameOptions.fWeaponOverheating && ( Item[pObj->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[pObj->usItem].barrel == TRUE ) )
|
||||
if ( gGameExternalOptions.fWeaponOverheating && ( Item[pObj->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[pObj->usItem].barrel == TRUE ) )
|
||||
{
|
||||
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
|
||||
{
|
||||
@@ -14070,6 +14082,8 @@ INT32 SOLDIERTYPE::GetDamageResistance(BOOLEAN fAutoResolve, BOOLEAN fCalcBreath
|
||||
|
||||
// Flugente: drugs can now have an effect on damage resistance
|
||||
HandleDamageResistanceEffectDueToDrugs(this, &resistance);
|
||||
|
||||
resistance += this->GetBackgroundValue(BG_RESI_PHYSICAL);
|
||||
|
||||
// resistance is between -100% and 100%
|
||||
resistance = max( 0, resistance);
|
||||
@@ -14091,6 +14105,11 @@ INT8 SOLDIERTYPE::GetHearingBonus()
|
||||
|
||||
if ( gMercProfiles[ this->ubProfile ].bDisability == DEAF )
|
||||
bonus -= 5;
|
||||
|
||||
if ( NightTime() )
|
||||
bonus += this->GetBackgroundValue(BG_PERC_HEARING_NIGHT);
|
||||
else
|
||||
bonus += this->GetBackgroundValue(BG_PERC_HEARING_DAY);
|
||||
|
||||
return bonus;
|
||||
}
|
||||
@@ -14125,7 +14144,7 @@ INT16 SOLDIERTYPE::GetPoisonResistance( void )
|
||||
// Flugente: resistance can per definition only be between -100 and 100 (at least that's my definition)
|
||||
INT16 val = bPoisonResistance;
|
||||
|
||||
// without WH40K, there are no modifiers
|
||||
val += this->GetBackgroundValue(BG_RESI_POISON);
|
||||
|
||||
val = max(-100, val);
|
||||
val = min(100, val);
|
||||
@@ -16360,6 +16379,13 @@ void SOLDIERTYPE::AddDrugValues(UINT8 uDrugType, UINT8 usEffect, UINT8 usTravelR
|
||||
if ( uDrugType >= DRUG_TYPE_MAX )
|
||||
return;
|
||||
|
||||
// Flugente: backgrounds
|
||||
if ( this->ubProfile != NOBODY && uDrugType == DRUG_TYPE_ALCOHOL )
|
||||
{
|
||||
usEffect = usEffect * ((100 - this->GetBackgroundValue(BG_RESI_ALCOHOL)) / 100);
|
||||
usSideEffect = usSideEffect * ((100 - this->GetBackgroundValue(BG_RESI_ALCOHOL)) / 100);
|
||||
}
|
||||
|
||||
// Add effects
|
||||
if ( ( this->drugs.bFutureDrugEffect[ uDrugType ] + usEffect ) < 127 )
|
||||
{
|
||||
@@ -16565,6 +16591,134 @@ INT8 SOLDIERTYPE::GetSoldierProfileType(UINT8 usTeam)
|
||||
return type;
|
||||
}
|
||||
|
||||
// Flugente: do we have a specific background flag?
|
||||
BOOLEAN SOLDIERTYPE::HasBackgroundFlag( UINT64 aFlag)
|
||||
{
|
||||
if ( gGameOptions.fBackGround && this->ubProfile != NO_PROFILE )
|
||||
{
|
||||
if ( zBackground[ gMercProfiles[this->ubProfile].usBackground ].uiFlags & aFlag )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
INT16 SOLDIERTYPE::GetBackgroundValue( UINT16 aNr )
|
||||
{
|
||||
if ( gGameOptions.fBackGround && this->ubProfile != NO_PROFILE )
|
||||
{
|
||||
return zBackground[ gMercProfiles[this->ubProfile].usBackground ].value[aNr];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT8 SOLDIERTYPE::GetSuppressionResistanceBonus()
|
||||
{
|
||||
INT8 bonus = 0;
|
||||
|
||||
bonus += this->GetBackgroundValue(BG_RESI_SUPPRESSION);
|
||||
|
||||
return min( 100, max( -100, bonus) );
|
||||
}
|
||||
|
||||
INT16 SOLDIERTYPE::GetMeleeDamageBonus()
|
||||
{
|
||||
INT8 bonus = 0;
|
||||
|
||||
bonus += this->GetBackgroundValue(BG_PERC_DAMAGE_MELEE);
|
||||
|
||||
return bonus;
|
||||
}
|
||||
|
||||
INT16 SOLDIERTYPE::GetAPBonus()
|
||||
{
|
||||
INT16 bonus = 0;
|
||||
|
||||
if ( this->bSoldierFlagMask & SOLDIER_AIRDROP_BONUS )
|
||||
bonus += this->GetBackgroundValue(BG_AIRDROP);
|
||||
|
||||
if ( this->bSoldierFlagMask & SOLDIER_ASSAULT_BONUS )
|
||||
bonus += this->GetBackgroundValue(BG_ASSAULT);
|
||||
|
||||
UINT8 ubSector = (UINT8)SECTOR( this->sSectorX, this->sSectorY );
|
||||
UINT8 ubTraverseType = SectorInfo[ ubSector ].ubTraversability[ ubDirection ];
|
||||
|
||||
switch ( ubTraverseType )
|
||||
{
|
||||
case NS_RIVER:
|
||||
case EW_RIVER:
|
||||
bonus += this->GetBackgroundValue(BG_RIVER);
|
||||
break;
|
||||
case COASTAL:
|
||||
case COASTAL_ROAD:
|
||||
bonus += this->GetBackgroundValue(BG_COASTAL);
|
||||
break;
|
||||
case TROPICS_SAM_SITE:
|
||||
bonus += this->GetBackgroundValue(BG_COASTAL);
|
||||
bonus += this->GetBackgroundValue(BG_TROPICAL);
|
||||
break;
|
||||
case TROPICS:
|
||||
case TROPICS_ROAD:
|
||||
bonus += this->GetBackgroundValue(BG_TROPICAL);
|
||||
break;
|
||||
case HILLS:
|
||||
case HILLS_ROAD:
|
||||
bonus += this->GetBackgroundValue(BG_MOUNTAIN);
|
||||
break;
|
||||
case SWAMP:
|
||||
case SWAMP_ROAD:
|
||||
bonus += this->GetBackgroundValue(BG_SWAMP);
|
||||
break;
|
||||
case SAND:
|
||||
case SAND_ROAD:
|
||||
case SAND_SAM_SITE:
|
||||
bonus += this->GetBackgroundValue(BG_DESERT);
|
||||
break;
|
||||
case TOWN:
|
||||
case CAMBRIA_HOSPITAL_SITE:
|
||||
case DRASSEN_AIRPORT_SITE:
|
||||
case MEDUNA_AIRPORT_SITE:
|
||||
bonus += this->GetBackgroundValue(BG_URBAN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( this->pathing.bLevel )
|
||||
bonus += this->GetBackgroundValue(BG_HEIGHT);
|
||||
|
||||
return bonus;
|
||||
}
|
||||
|
||||
INT8 SOLDIERTYPE::GetFearResistanceBonus()
|
||||
{
|
||||
INT8 bonus = 0;
|
||||
|
||||
bonus += this->GetBackgroundValue(BG_RESI_FEAR);
|
||||
|
||||
return min(100, max(-100, bonus));
|
||||
}
|
||||
|
||||
UINT8 SOLDIERTYPE::GetMoraleThreshold()
|
||||
{
|
||||
UINT8 threshold = 100;
|
||||
UINT8 moraledamage = 0;
|
||||
|
||||
moraledamage = (moraledamage * (100 - GetFearResistanceBonus())) / 100;
|
||||
|
||||
return min(threshold, max(0, threshold - moraledamage));
|
||||
}
|
||||
|
||||
void SOLDIERTYPE::SoldierPropertyUpkeep()
|
||||
{
|
||||
// these flags are only used for the first turn, and thus always removed
|
||||
this->bSoldierFlagMask &= ~(SOLDIER_AIRDROP_BONUS|SOLDIER_ASSAULT_BONUS);
|
||||
|
||||
if ( HasBackgroundFlag( BACKGROUND_EXP_UNDERGROUND ) && this->bSectorZ )
|
||||
++bExtraExpLevel;
|
||||
}
|
||||
|
||||
INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT8 bBandaged; //,savedOurTurn;
|
||||
|
||||
@@ -370,9 +370,9 @@ enum
|
||||
#define SOLDIER_REDOFLASHLIGHT 0x00008000 //32768 // this flag signifies that we somehow interacted with the items in our hands. Thus we have to possible redo lighting from flashlights
|
||||
|
||||
#define SOLDIER_LIGHT_OWNER 0x00010000 //65536 // we 'own' at least one light source (via flashlights)
|
||||
/*#define PLAYER_NET_2_LVL_1 0x00020000 //131072
|
||||
#define PLAYER_NET_3_LVL_1 0x00040000 //262144
|
||||
#define PLAYER_NET_4_LVL_1 0x00080000 //524288
|
||||
#define SOLDIER_AIRDROP_BONUS 0x00020000 //131072 // backgrounds: special AP bonus during the first turn of an airdrop
|
||||
#define SOLDIER_ASSAULT_BONUS 0x00040000 //262144 // backgrounds: our first turn in an assault
|
||||
/*#define PLAYER_NET_4_LVL_1 0x00080000 //524288
|
||||
|
||||
#define PLAYER_NET_1_LVL_2 0x00100000 //1048576
|
||||
#define PLAYER_NET_2_LVL_2 0x00200000 //2097152
|
||||
@@ -390,6 +390,22 @@ enum
|
||||
#define WH40K_SOLDIER_KILLTHISTURN 0x80000000 //2147483648 // Soldier is on a kill streak*/
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
// -------- added by Flugente: background property flags --------
|
||||
// easier than adding 32 differently named variables. DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!!
|
||||
// a merc's background info reveals data about his previous life, like former regiments. These backgrounds add small abilities/disabilities. Nothing substantial, just small bits do
|
||||
// diversify your mercs and add more personality
|
||||
#define BACKGROUND_DRUGUSE 0x0000000000000001 //1 // might use drugs on his own (the 'Larry'-effect)
|
||||
#define BACKGROUND_XENOPHOBIC 0x0000000000000002 //2 // arrogant towards others without this background
|
||||
#define BACKGROUND_EXP_UNDERGROUND 0x0000000000000004 //4 // extra level in underground sectors
|
||||
#define BACKGROUND_SCROUNGING 0x0000000000000008 //8 // might pick up valuable items on his own
|
||||
|
||||
#define BACKGROUND_TRAPLEVEL 0x0000000000000010 //16 // trap level +1
|
||||
#define BACKGROUND_CORRUPTIONSPREAD 0x0000000000000020 //32 // spreads corruption to others - not used in trunk!
|
||||
//#define BACKGROUND_XENOPHOBIC 0x0000000000000040 //64 // arrogant towards others without this background
|
||||
//#define BACKGROUND_CAPITULATION 0x0000000000000080 //128 // if present, the team's surrender strength is higher
|
||||
|
||||
#define BACKGROUND_FLAG_MAX 6 // number of flagged backgrounds - keep this updated, or properties will get lost!
|
||||
|
||||
// Flugente: types of multi-turn actions
|
||||
enum
|
||||
{
|
||||
@@ -1573,6 +1589,19 @@ public:
|
||||
|
||||
// Flugente: soldier profiles
|
||||
INT8 GetSoldierProfileType(UINT8 usTeam); // retrieves the correct sub-array
|
||||
|
||||
// Flugente: do we have a specific background flag?
|
||||
BOOLEAN HasBackgroundFlag( UINT64 aFlag );
|
||||
INT16 GetBackgroundValue( UINT16 aNr );
|
||||
|
||||
INT8 GetSuppressionResistanceBonus(); // bonus to resistance against suppression
|
||||
INT16 GetMeleeDamageBonus();
|
||||
INT16 GetAPBonus();
|
||||
INT8 GetFearResistanceBonus(); // fear resistance lowers shock and morale damage from horror
|
||||
UINT8 GetMoraleThreshold();
|
||||
|
||||
void SoldierPropertyUpkeep(); // update functions for various properties (updating counters, resetting flags etc.)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // SOLDIERTYPE;
|
||||
|
||||
@@ -2345,7 +2345,7 @@ SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier )
|
||||
pSoldier->stats.bMechanical = pNewProfile->bMechanical + pNewProfile->bMechanicDelta;
|
||||
pSoldier->stats.bMedical = pNewProfile->bMedical + pNewProfile->bMedicalDelta;
|
||||
pSoldier->stats.bExplosive = pNewProfile->bExplosive + pNewProfile->bExplosivesDelta;
|
||||
|
||||
|
||||
if ( pSoldier->ubProfile == LARRY_DRUNK )
|
||||
{
|
||||
SetFactTrue( FACT_LARRY_CHANGED );
|
||||
@@ -2594,6 +2594,7 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop )
|
||||
gMercProfiles[ uiLoop ].ubCivilianGroup = tempProfiles[uiLoop].ubCivilianGroup;
|
||||
gMercProfiles[ uiLoop ].bTown = tempProfiles[uiLoop].bTown;
|
||||
gMercProfiles[ uiLoop ].bTownAttachment = tempProfiles[uiLoop].bTownAttachment;
|
||||
gMercProfiles[ uiLoop ].usBackground = tempProfiles[uiLoop].usBackground;
|
||||
|
||||
//None
|
||||
if ( tempProfiles[uiLoop].Type == 0 )
|
||||
|
||||
@@ -406,6 +406,9 @@ typedef struct
|
||||
INT8 bTown;
|
||||
INT8 bTownAttachment;
|
||||
|
||||
// Flugente: backgrounds
|
||||
UINT8 usBackground;
|
||||
|
||||
} TEMPPROFILETYPE;
|
||||
|
||||
extern TEMPPROFILETYPE tempProfiles[NUM_PROFILES+1];
|
||||
|
||||
@@ -1012,6 +1012,10 @@
|
||||
RelativePath=".\XML_AttachmentSlots.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Background.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_BurstSounds.cpp"
|
||||
>
|
||||
|
||||
@@ -1014,6 +1014,10 @@
|
||||
RelativePath=".\XML_AttachmentSlots.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Background.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="XML_BurstSounds.cpp"
|
||||
>
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
<ClCompile Include="XML_AttachmentInfo.cpp" />
|
||||
<ClCompile Include="XML_Attachments.cpp" />
|
||||
<ClCompile Include="XML_AttachmentSlots.cpp" />
|
||||
<ClCompile Include="XML_Background.cpp" />
|
||||
<ClCompile Include="XML_BurstSounds.cpp" />
|
||||
<ClCompile Include="XML_CivGroupNames.cpp" />
|
||||
<ClCompile Include="XML_Clothes.cpp" />
|
||||
|
||||
@@ -644,5 +644,8 @@
|
||||
<ClCompile Include="XML_SoldierProfiles.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_Background.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+21
-13
@@ -1282,7 +1282,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
|
||||
gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
|
||||
|
||||
// Flugente: If overheating is allowed, a gun will be prone to more overheating if its temperature is high
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatJamPercentage( pObj ); // how much above the gun's usOverheatingJamThreshold are we? ...
|
||||
|
||||
@@ -2267,7 +2267,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
|
||||
|
||||
INT16 iOverheatReliabilityMalus = 0;
|
||||
// Flugente: Increase Weapon Temperature
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatDamagePercentage( pObjAttHand ); // ... how much above the gun's usOverheatingDamageThreshold are we? ...
|
||||
|
||||
@@ -2888,7 +2888,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
|
||||
|
||||
INT16 iOverheatReliabilityMalus = 0;
|
||||
// Flugente: Increase Weapon Temperature
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatDamagePercentage( pObjUsed ); // ... how much above the gun's usOverheatingDamageThreshold are we? ...
|
||||
|
||||
@@ -6085,9 +6085,10 @@ else
|
||||
iChance = __max(iChance + (INT32)iAimPoints, iChance);
|
||||
iChance = __min(iChance, (INT32)uiCap);
|
||||
}
|
||||
|
||||
// Impose global limits.
|
||||
iChance = __min(iChance, gGameExternalOptions.ubMaximumCTH);
|
||||
|
||||
// Impose global limits.
|
||||
// Flugente: backgrounds
|
||||
iChance = min(iChance, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX)) );
|
||||
iChance = __max(iChance, gGameExternalOptions.ubMinimumCTH);
|
||||
|
||||
return (iChance);
|
||||
@@ -6552,7 +6553,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatJamPercentage( pInHand );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatjampercentage) - 1.0) * 0.1);
|
||||
@@ -7082,7 +7083,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
|
||||
|
||||
// Flugente: If overheating is allowed, an overheated gun receives a slight malus to accuracy
|
||||
FLOAT accuracyheatmultiplicator = 1.0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pInHand );
|
||||
FLOAT accuracymalus = (FLOAT)((max(1.0, overheatdamagepercentage) - 1.0) * 0.1);
|
||||
@@ -7363,8 +7364,9 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
|
||||
// HEADROCK (HAM): Externalized maximum to JA2_OPTIONS.INI
|
||||
// if (iChance > MAXCHANCETOHIT)
|
||||
// iChance = MAXCHANCETOHIT;
|
||||
if (iChance > gGameExternalOptions.ubMaximumCTH)
|
||||
iChance = gGameExternalOptions.ubMaximumCTH;
|
||||
|
||||
// Flugente: backgrounds
|
||||
iChance = min(iChance, gGameExternalOptions.ubMaximumCTH + (UINT8)(pSoldier->GetBackgroundValue(BG_PERC_CTH_MAX)) );
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10184,7 +10186,13 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi
|
||||
else if ( bNumMercs > 0 )
|
||||
iAttRating += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: backgrounds
|
||||
if (ubMode == HTH_MODE_STAB)
|
||||
{
|
||||
iAttRating = (iAttRating * (100 + pAttacker->GetBackgroundValue(BG_PERC_CTH_BLADE))) / 100;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (iAttRating < 1)
|
||||
@@ -11383,7 +11391,7 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
|
||||
{
|
||||
// malus for overheating
|
||||
INT16 iOverheatMalus = 0;
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatjampercentage = GetGunOverheatDamagePercentage( pObj);
|
||||
|
||||
@@ -11800,7 +11808,7 @@ void CalcMagFactorSimple( SOLDIERTYPE *pSoldier, FLOAT d2DDistance, INT16 bAimTi
|
||||
// Flugente: Increase temperature/dirt of gun in ubAttackingHand due to firing a shot
|
||||
void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier )
|
||||
{
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
if ( gGameExternalOptions.fWeaponOverheating )
|
||||
{
|
||||
if ( Item[pObj->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) // if item is a gun pr launcher...
|
||||
{
|
||||
|
||||
@@ -232,6 +232,7 @@ typedef PARSE_STAGE;
|
||||
#define SPREADPATTERNSFILENAME "SpreadPatterns.xml"
|
||||
#define VEHICLESFILENAME "Vehicles.xml"
|
||||
#define SQUADNAMEFILENAME "SquadNames.xml"
|
||||
#define BACKGROUNDSFILENAME "Backgrounds.xml"
|
||||
|
||||
#define ENEMY_ADMIN_PROFILE_FILENAME "Profiles\\SoldierProfileEnemyAdmin.xml"
|
||||
#define ENEMY_REGULAR_PROFILE_FILENAME "Profiles\\SoldierProfileEnemyRegular.xml"
|
||||
@@ -460,6 +461,10 @@ extern BOOLEAN WriteEnemyRank( STR fileName);
|
||||
extern BOOLEAN ReadInIMPPortraits(STR fileName, BOOLEAN localizedVersion);
|
||||
extern void LoadIMPPortraitsTEMP();
|
||||
|
||||
// Flugente: backgrounds
|
||||
extern BOOLEAN ReadInBackgrounds(STR fileName );
|
||||
extern BOOLEAN WriteBackgrounds( STR fileName);
|
||||
|
||||
//Enabled\Disabled profile sound by Jazz
|
||||
extern BOOLEAN ReadInSoundProfile( STR fileName );
|
||||
extern BOOLEAN WriteSoundProfile( STR fileName );
|
||||
|
||||
@@ -0,0 +1,602 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "sgp.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "Interface.h"
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
BACKGROUND_VALUES curBackground;
|
||||
BACKGROUND_VALUES * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
CHAR16 gzBackground[MAX_ENEMY_NAMES_CHARS];
|
||||
}
|
||||
typedef enemyRankParseData;
|
||||
|
||||
UINT16 num_found_background = 0; // the correct number is set on reading the xml
|
||||
|
||||
#define XML_BACKGROUND_AP_MAX 8
|
||||
#define XML_BACKGROUND_STAT_MAX 10
|
||||
#define XML_BACKGROUND_TRAVEL_MAX 20
|
||||
#define XML_BACKGROUND_RESI_MAX 20
|
||||
#define XML_VARIOUS_MAX 300
|
||||
|
||||
static void XMLCALL
|
||||
backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
enemyRankParseData * pData = (enemyRankParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "BACKGROUNDS") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
memset(pData->curArray,0,sizeof(BACKGROUND_VALUES)*pData->maxArraySize);
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "BACKGROUND") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
memset(&pData->curBackground,0,sizeof(BACKGROUND_VALUES));
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "szName") == 0 ||
|
||||
strcmp(name, "szShortName") == 0 ||
|
||||
strcmp(name, "szDescription") == 0 ||
|
||||
strcmp(name, "ap_polar") == 0 ||
|
||||
strcmp(name, "ap_desert") == 0 ||
|
||||
strcmp(name, "ap_swamp") == 0 ||
|
||||
strcmp(name, "ap_urban") == 0 ||
|
||||
strcmp(name, "ap_river") == 0 ||
|
||||
strcmp(name, "ap_coastal") == 0 ||
|
||||
strcmp(name, "ap_tropical") == 0 ||
|
||||
strcmp(name, "ap_mountain") == 0 ||
|
||||
strcmp(name, "ap_height") == 0 ||
|
||||
strcmp(name, "ap_swimming") == 0 ||
|
||||
strcmp(name, "ap_fortify") == 0 ||
|
||||
strcmp(name, "ap_artillery") == 0 ||
|
||||
strcmp(name, "ap_inventory") == 0 ||
|
||||
strcmp(name, "ap_airdrop") == 0 ||
|
||||
strcmp(name, "ap_assault") == 0 ||
|
||||
strcmp(name, "agility") == 0 ||
|
||||
strcmp(name, "strength") == 0 ||
|
||||
strcmp(name, "dexterity") == 0 ||
|
||||
strcmp(name, "mechanical") == 0 ||
|
||||
strcmp(name, "medical") == 0 ||
|
||||
strcmp(name, "explosives") == 0 ||
|
||||
strcmp(name, "leadership") == 0 ||
|
||||
strcmp(name, "marksmanship") == 0 ||
|
||||
strcmp(name, "travel_foot") == 0 ||
|
||||
strcmp(name, "travel_car") == 0 ||
|
||||
strcmp(name, "travel_air") == 0 ||
|
||||
strcmp(name, "travel_boat") == 0 ||
|
||||
strcmp(name, "resistance_poison") == 0 ||
|
||||
strcmp(name, "resistance_fear") == 0 ||
|
||||
strcmp(name, "resistance_suppression") == 0 ||
|
||||
strcmp(name, "resistance_physical") == 0 ||
|
||||
strcmp(name, "resistance_alcohol") == 0 ||
|
||||
strcmp(name, "interrogation") == 0 ||
|
||||
strcmp(name, "prisonguard") == 0 ||
|
||||
strcmp(name, "betterprices_guns") == 0 ||
|
||||
strcmp(name, "betterprices") == 0 ||
|
||||
strcmp(name, "capitulation") == 0 ||
|
||||
strcmp(name, "speed_run") == 0 ||
|
||||
strcmp(name, "speed_bandaging") == 0 ||
|
||||
strcmp(name, "drink_energyregen") == 0 ||
|
||||
strcmp(name, "carrystrength") == 0 ||
|
||||
strcmp(name, "food") == 0 ||
|
||||
strcmp(name, "water") == 0 ||
|
||||
strcmp(name, "sleep") == 0 ||
|
||||
strcmp(name, "meleedamage") == 0 ||
|
||||
strcmp(name, "cth_blades") == 0 ||
|
||||
strcmp(name, "camo") == 0 ||
|
||||
strcmp(name, "stealth") == 0 ||
|
||||
strcmp(name, "increased_maxcth") == 0 ||
|
||||
strcmp(name, "hearing_night") == 0 ||
|
||||
strcmp(name, "hearing_day") == 0 ||
|
||||
strcmp(name, "approach_friendly") == 0 ||
|
||||
strcmp(name, "approach_direct") == 0 ||
|
||||
strcmp(name, "approach_threaten") == 0 ||
|
||||
strcmp(name, "approach_recruit") == 0 ||
|
||||
strcmp(name, "breachingcharge") == 0 ||
|
||||
strcmp(name, "druguse") == 0 ||
|
||||
strcmp(name, "xenophobic") == 0 ||
|
||||
strcmp(name, "corruptionspread") == 0 ||
|
||||
strcmp(name, "level_underground") == 0 ||
|
||||
strcmp(name, "scrounging") == 0 ||
|
||||
strcmp(name, "traplevel") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
backgroundCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
enemyRankParseData * pData = (enemyRankParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
backgroundEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
enemyRankParseData * pData = (enemyRankParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth)
|
||||
{
|
||||
if(strcmp(name, "BACKGROUNDS") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "BACKGROUND") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curBackground.uiIndex < pData->maxArraySize)
|
||||
{
|
||||
pData->curArray[pData->curBackground.uiIndex] = pData->curBackground;
|
||||
}
|
||||
|
||||
num_found_background = pData->curBackground.uiIndex;
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiIndex = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "szName") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curBackground.szName, sizeof(pData->curBackground.szName)/sizeof(pData->curBackground.szName[0]) );
|
||||
pData->curBackground.szName[sizeof(pData->curBackground.szName)/sizeof(pData->curBackground.szName[0]) - 1] = '\0';
|
||||
}
|
||||
else if(strcmp(name, "szShortName") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curBackground.szShortName, sizeof(pData->curBackground.szShortName)/sizeof(pData->curBackground.szShortName[0]) );
|
||||
pData->curBackground.szShortName[sizeof(pData->curBackground.szShortName)/sizeof(pData->curBackground.szShortName[0]) - 1] = '\0';
|
||||
}
|
||||
else if(strcmp(name, "szDescription") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curBackground.szDescription, sizeof(pData->curBackground.szDescription)/sizeof(pData->curBackground.szDescription[0]) );
|
||||
pData->curBackground.szDescription[sizeof(pData->curBackground.szDescription)/sizeof(pData->curBackground.szDescription[0]) - 1] = '\0';
|
||||
}
|
||||
else if(strcmp(name, "ap_polar") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_POLAR] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_desert") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_DESERT] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_swamp") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_SWAMP] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_urban") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_URBAN] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_river") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RIVER] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_coastal") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_COASTAL] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_tropical") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TROPICAL] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_mountain") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_MOUNTAIN] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_height") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_HEIGHT] = min(XML_BACKGROUND_AP_MAX, max(-XML_BACKGROUND_AP_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_swimming") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_SWIMMING] = min(40, max(-40, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_fortify") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_FORTIFY] = min(40, max(-40, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_artillery") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_ARTILLERY] = min(40, max(-40, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_inventory") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_INVENTORY] = min(40, max(-40, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_airdrop") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_AIRDROP] = min(40, max(-40, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "ap_assault") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_ASSAULT] = min(10, max(-10, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "agility") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_AGILITY] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "strength") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_STRENGTH] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "dexterity") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_DEXTERITY] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "mechanical") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_MECHANICAL] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "medical") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_MEDICAL] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "explosives") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_EXPLOSIVE_ASSIGN] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "leadership") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_LEADERSHIP] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "marksmanship") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_MARKSMANSHIP] = min(XML_BACKGROUND_STAT_MAX, max(-XML_BACKGROUND_STAT_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "travel_foot") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TRAVEL_FOOT] = min(XML_BACKGROUND_TRAVEL_MAX, max(-XML_BACKGROUND_TRAVEL_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "travel_car") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TRAVEL_CAR] = min(XML_BACKGROUND_TRAVEL_MAX, max(-XML_BACKGROUND_TRAVEL_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "travel_air") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TRAVEL_AIR] = min(XML_BACKGROUND_TRAVEL_MAX, max(-XML_BACKGROUND_TRAVEL_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "travel_boat") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TRAVEL_BOAT] = min(XML_BACKGROUND_TRAVEL_MAX, max(-XML_BACKGROUND_TRAVEL_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "resistance_poison") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RESI_POISON] = min(XML_BACKGROUND_RESI_MAX, max(-XML_BACKGROUND_RESI_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "resistance_fear") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RESI_FEAR] = min(XML_BACKGROUND_RESI_MAX, max(-XML_BACKGROUND_RESI_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "resistance_suppression") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RESI_SUPPRESSION] = min(XML_BACKGROUND_RESI_MAX, max(-XML_BACKGROUND_RESI_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "resistance_physical") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RESI_PHYSICAL] = min(XML_BACKGROUND_RESI_MAX, max(-XML_BACKGROUND_RESI_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "resistance_alcohol") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_RESI_ALCOHOL] = min(XML_BACKGROUND_RESI_MAX, max(-XML_BACKGROUND_RESI_MAX, (INT8) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "interrogation") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_INTERROGATION] = min(XML_VARIOUS_MAX, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "prisonguard") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_GUARD] = min(XML_VARIOUS_MAX, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "betterprices_guns") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_PRICES_GUNS] = min(20, max(-20, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "betterprices") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_PRICES] = min(20, max(-20, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "capitulation") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_CAPITULATION] = min(100, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "speed_run") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_SPEED_RUNNING] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "speed_bandaging") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_BANDAGING] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "drink_energyregen") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_REGEN_ENERGY] = min(XML_VARIOUS_MAX, max(-80, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "carrystrength") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_CARRYSTRENGTH] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "food") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_FOOD] = min(100, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "water") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_WATER] = min(100, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "sleep") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_SLEEP] = min(2, max(-2, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "meleedamage") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_DAMAGE_MELEE] = min(10, max(-10, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "cth_blades") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_CTH_BLADE] = min(10, max(-10, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "camo") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_CAMO] = min(20, max(-20, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "stealth") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_STEALTH] = min(20, max(-20, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "increased_maxcth") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_CTH_MAX] = min(5, max(-5, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "hearing_night") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_HEARING_NIGHT] = min(10, max(-10, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "hearing_day") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_HEARING_DAY] = min(10, max(-10, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "approach_friendly") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_APPROACH_FRIENDLY] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "approach_direct") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_APPROACH_DIRECT] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "approach_threaten") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_APPROACH_THREATEN] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "approach_recruit") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_PERC_APPROACH_RECRUIT] = min(50, max(-50, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "breachingcharge") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_BONUS_BREACHINGCHARGE] = min(100, max(-100, (INT16) atol(pData->szCharData) ));
|
||||
}
|
||||
else if(strcmp(name, "druguse") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_DRUGUSE : 0;
|
||||
}
|
||||
else if(strcmp(name, "xenophobic") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_XENOPHOBIC : 0;
|
||||
}
|
||||
else if(strcmp(name, "corruptionspread") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_CORRUPTIONSPREAD : 0;
|
||||
}
|
||||
else if(strcmp(name, "level_underground") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_EXP_UNDERGROUND : 0;
|
||||
}
|
||||
else if(strcmp(name, "scrounging") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_SCROUNGING : 0;
|
||||
}
|
||||
else if(strcmp(name, "traplevel") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.uiFlags |= (UINT16) atol(pData->szCharData) ? BACKGROUND_TRAPLEVEL : 0;
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
BOOLEAN ReadInBackgrounds(STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
enemyRankParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Backgrounds.xml" );
|
||||
|
||||
// Open file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, backgroundStartElementHandle, backgroundEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, backgroundCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = zBackground;
|
||||
pData.maxArraySize = NUM_BACKGROUND;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in Backgrounds.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN WriteBackgrounds( STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
|
||||
//Debug code; make sure that what we got from the file is the same as what's there
|
||||
// Open a new file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
{
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<BACKGROUNDS>\r\n");
|
||||
for(cnt = 0; cnt < NUM_BACKGROUND; ++cnt)
|
||||
{
|
||||
FilePrintf(hFile,"\t<BACKGROUND>\r\n");
|
||||
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt);
|
||||
|
||||
FilePrintf(hFile,"\t</BACKGROUND>\r\n");
|
||||
}
|
||||
FilePrintf(hFile,"</BACKGROUNDS>\r\n");
|
||||
}
|
||||
FileClose( hFile );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -179,8 +179,9 @@ profileStartElementHandle(void *userData, const XML_Char *name, const XML_Char *
|
||||
strcmp(name, "sSectorZ") == 0 ||
|
||||
strcmp(name, "ubCivilianGroup") == 0 ||
|
||||
strcmp(name, "bTown") == 0 ||
|
||||
strcmp(name, "bTownAttachment") == 0
|
||||
|
||||
strcmp(name, "bTownAttachment") == 0 ||
|
||||
strcmp(name, "usBackground") == 0
|
||||
|
||||
))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
@@ -335,6 +336,7 @@ profileEndElementHandle(void *userData, const XML_Char *name)
|
||||
tempProfiles[pData->curIndex].ubCivilianGroup = pData->curProfile.ubCivilianGroup;
|
||||
tempProfiles[pData->curIndex].bTown = pData->curProfile.bTown;
|
||||
tempProfiles[pData->curIndex].bTownAttachment = pData->curProfile.bTownAttachment;
|
||||
tempProfiles[pData->curIndex].usBackground = pData->curProfile.usBackground;
|
||||
|
||||
tempProfiles[pData->curIndex].fGoodGuy = pData->curProfile.fGoodGuy;
|
||||
memcpy( &(tempProfiles[pData->curIndex].usApproachFactor), &(pData->curProfile.usApproachFactor), 4 * sizeof (UINT16));
|
||||
@@ -975,6 +977,11 @@ profileEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curProfile.bTownAttachment = (INT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "usBackground") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curProfile.usBackground = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
|
||||
@@ -1540,7 +1547,8 @@ BOOLEAN WriteMercProfiles()
|
||||
FilePrintf(hFile,"\t\t<ubCivilianGroup>%d</ubCivilianGroup>\r\n", gMercProfiles[ cnt ].ubCivilianGroup);
|
||||
FilePrintf(hFile,"\t\t<bTown>%d</bTown>\r\n", gMercProfiles[ cnt ].bTown);
|
||||
FilePrintf(hFile,"\t\t<bTownAttachment>%d</bTownAttachment>\r\n", gMercProfiles[ cnt ].bTownAttachment);
|
||||
|
||||
FilePrintf(hFile,"\t\t<usBackground>%d</usBackground>\r\n", gMercProfiles[ cnt ].usBackground);
|
||||
|
||||
|
||||
FilePrintf(hFile,"\t</PROFILE>\r\n");
|
||||
}
|
||||
|
||||
@@ -839,6 +839,9 @@ public:
|
||||
// SANDRO - merc records
|
||||
STRUCT_Records records;
|
||||
|
||||
// Flugente: background
|
||||
UINT8 usBackground;
|
||||
|
||||
}; // MERCPROFILESTRUCT;
|
||||
|
||||
// WANNE - BMP: DONE!
|
||||
|
||||
Reference in New Issue
Block a user