New Feature: Campaign History collects combat data and displays battle reports on the website.

requires GameDir >= r1901.

For more info, see http://www.bears-pit.com/board/ubbthreads.php/topics/329205.html#Post329205

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6705 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-12-22 23:22:45 +00:00
parent b3df6f55b5
commit f4dcc15ffa
57 changed files with 5074 additions and 220 deletions
+6 -1
View File
@@ -15,6 +15,7 @@
#include "Interface.h"
#include "Food.h" // added by Flugente
#include "Animation data.h" // added by Flugente for SoldierBodyTypes
#include "CampaignStats.h" // added by Flugente
#endif
//forward declarations of common classes to eliminate includes
@@ -224,9 +225,13 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
UseKitPoints( pObject, 100, pSoldier );
else
{
UINT16 ptsused = (*pObject)[0]->data.objectStatus;
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)(ptsused * Item[usItem].ubWeight / 100.0) );
// remove object
pObject->RemoveObjectsFromStack(1);
}
}
}
if ( (ubDrugType & DRUG_ALCOHOL) != 0 )
+18
View File
@@ -57,6 +57,7 @@
#include "Food.h"
#include "opplist.h"
#include "Sys Globals.h"//dnl ch74 201013
#include "CampaignStats.h" // added by Flugente
#endif
#ifdef JA2UB
@@ -7322,6 +7323,15 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier )
if( (usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction)))/100) < (*pObj)[bLoop]->data.objectStatus )
{
(*pObj)[bLoop]->data.objectStatus -= (INT8)(usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction) ) )/100);
// Flugente: campaign stats
if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen)
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) );
else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype)
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) );
else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) )
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) );
return( usOriginalPoints );
}
// Flugente: we no longer destroy canteens upon emtptying them - as we can now refill them
@@ -7361,6 +7371,14 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier )
}*/
}
// Flugente: campaign stats
if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen)
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) );
else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype)
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) );
else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) )
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) );
// check if pocket/hand emptied..update inventory, then update panel
if( pObj->exists() == false )
{
+4
View File
@@ -51,6 +51,7 @@
#include "soldier tile.h" // added by Flugente
#include "Sound Control.h" // added by Flugente
#include "Soldier Functions.h" // added by Flugente for DoesSoldierWearGasMask(...)
#include "CampaignStats.h" // added by Flugente
#include "AIInternals.h"//dnl ch61 180813
//forward declarations of common classes to eliminate includes
@@ -5820,6 +5821,9 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT
GunIncreaseHeat( pObj, pThrower );
// Flugente: campaign stats
gCurrentIncident.AddStat( pThrower, CAMPAIGNHISTORY_TYPE_SHOT );
// Flugente : Added a malus to reliability for overheated guns
// HEADROCK HAM 5: Variable NCTH base change
UINT32 uiDepreciateTest = 0;
+51 -11
View File
@@ -110,6 +110,7 @@
#include "Lua Interpreter.h"
#include "bullets.h"
#include "Inventory Choosing.h" // added by Flugente for TakeMilitiaEquipmentfromSector()
#include "CampaignStats.h" // added by Flugente
#endif
#include "connect.h"
@@ -6627,8 +6628,8 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
prisonerstobemoved = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
prisonerstobemoved = GetNumberOfPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
DeleteAllPrisoners( pSectorInfo );
if ( usSectorID > 0)
@@ -6651,8 +6652,8 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
{
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
prisonerstobemoved = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
prisonerstobemoved = GetNumberOfPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
DeleteAllPrisoners( pSectorInfo );
if ( usSectorID > 0)
@@ -6711,6 +6712,9 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
break;
}
// Flugente: campaign stats
gCurrentIncident.AddStat( pTeamSoldier, CAMPAIGNHISTORY_TYPE_PRISONER );
++ubNumPrisoners;
// place items on the floor
@@ -6832,6 +6836,38 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
}
}
// Flugente: for campaign stats, we want to know how many people were wounded.
// Each time we are wounded, we set a 'wounded'-flag
// Once combat ends, we count all these flags and remove them
void UpdateWoundedFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
SOLDIERTYPE *pSoldier;
INT32 cnt = 0;
UINT8 ubNumPrisoners = 0;
UINT8 ubNumPrisonerAdmin = 0;
UINT8 ubNumPrisonerTroop = 0;
UINT8 ubNumPrisonerElite = 0;
// Check if the battle is won!
// Loop through all mercs and make go
for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; ++pSoldier, ++cnt )
{
// Kill those not already dead.,...
if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bSoldierFlagMask & SOLDIER_FRESHWOUND )
{
// remove flag, so we are not counted again
pSoldier->bSoldierFlagMask &= ~SOLDIER_FRESHWOUND;
// the dead count as dead, not as wounded
if ( pSoldier->stats.bLife <= 0 )
continue;
// Flugente: campaign stats
gCurrentIncident.AddStat( pSoldier, CAMPAIGNHISTORY_TYPE_WOUND );
}
}
}
void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
if (!bMapZ) // Battle ended Above-ground
@@ -6933,12 +6969,15 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
}
}
if( ( fBattleLost ) || ( fBattleWon ) )
if ( fBattleLost || fBattleWon )
{
if( !gbWorldSectorZ )
{
SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY) ].bLastKnownEnemies = NumEnemiesInSector( gWorldSectorX, gWorldSectorY );
}
// Flugente: note number of wounded for campaign stats
UpdateWoundedFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
}
// We should NEVER have a battle lost and won at the same time...
@@ -7012,7 +7051,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
LogBattleResults( LOG_DEFEAT );
gfBlitBattleSectorLocator = FALSE;
// If we are the server, we escape this function at the top if we think the game should still be running
// If we are the server, we escape this function at the top if we think the game should still be running
// hence if we get here the game is over for all clients and we should report it
if (is_networked && is_server)
game_over();
@@ -7259,10 +7298,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
if ( gTacticalStatus.bBoxingState == NOT_BOXING ) // if boxing don't do any of this stuff
{
LogBattleResults( LOG_VICTORY );
SetThisSectorAsPlayerControlled( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, TRUE );
HandleVictoryInNPCSector( gWorldSectorX, gWorldSectorY,( INT16 ) gbWorldSectorZ );
LogBattleResults( LOG_VICTORY );
if ( CheckFact( FACT_FIRST_BATTLE_BEING_FOUGHT, 0 ) )
{
// ATE: Need to trigger record for this event .... for NPC scripting
@@ -7298,7 +7338,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
//But only if the option is turned ON.
if(gGameExternalOptions.gfRevealItems)
RevealAllDroppedEnemyItems();
// If we are the server, we escape this function at the top if we think the game should still be running
// hence if we get here the game is over for all clients and we should report it
if (is_networked && is_server)
@@ -10497,7 +10537,7 @@ BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr)
return FALSE;
}
UINT16 GetNumberOrPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
{
if ( !pSectorInfo )
return 0;
@@ -10510,7 +10550,7 @@ UINT16 GetNumberOrPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* a
return (UINT16)(pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN]);
}
UINT16 GetNumberOrPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
{
if ( !pSectorInfo )
return 0;
+2 -2
View File
@@ -373,8 +373,8 @@ BOOLEAN AllowedToStealFromTeamMate( UINT8 aAccessorID, UINT8 aTargetID );
BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr);
// Flugente: functions altering a sector's prisoners
UINT16 GetNumberOrPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
UINT16 GetNumberOrPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
UINT16 GetNumberOfPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
UINT16 GetNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin );
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aSpecial, INT16 aElite, INT16 aRegular, INT16 aAdmin );
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aSpecial, INT16 aElite, INT16 aRegular, INT16 aAdmin );
+11 -4
View File
@@ -34,10 +34,11 @@
#include "Map Information.h"
#include "Interface Items.h"
#include "Soldier Control.h" // added by SANDRO
#include "opplist.h" // added by SANDRO
#include "lighting.h" // added by SANDRO
#include "Food.h" // added by Flugente
#include "AIInternals.h"//dnl ch69 150913
#include "opplist.h" // added by SANDRO
#include "lighting.h" // added by SANDRO
#include "Food.h" // added by Flugente
#include "AIInternals.h" //dnl ch69 150913
#include "CampaignStats.h" // added by Flugente
#endif
#include "connect.h"
//rain
@@ -2841,6 +2842,12 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos )
(*pObjUsed)[0]->data.gun.ubGunShotsLeft--;
}
}
// Flugente: campaign stats - ammo. explosive consumption is handled elsewhere
if ( pSoldier->bTeam == OUR_TEAM )
{
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_AMMO, (FLOAT)(Item[(*pObjUsed)[0]->data.gun.usGunAmmoItem].ubWeight) / (FLOAT)(Magazine[ Item[ (*pObjUsed)[0]->data.gun.usGunAmmoItem ].ubClassIndex ].ubMagSize ) );
}
}
else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[pObj->usItem].cannon || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )
{
+40 -3
View File
@@ -23,6 +23,8 @@
#include "Exit Grids.h"
#include "Interface.h" // added by Flugente for zBackground
#include "renderworld.h" // added by Flugente
#include "Vehicles.h" // added by Flugente
#include "CampaignStats.h" // added by Flugente
#endif
#ifdef JA2UB
@@ -1195,7 +1197,42 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
sGridNo = pSoldier->sInsertionGridNo;
}
}
// Flugente: campaign stats
if ( pSoldier->bSoldierFlagMask & SOLDIER_AIRDROP )
gCurrentIncident.usIncidentFlags |= INCIDENT_AIRDROP;
// problem: soldiers already present in a sector have ubStrategicInsertionCode = 0, which is INSERTION_CODE_NORTH - but they don't actually coem from north, as they are already present
// we thus count them as coming from north if they either already have a gridno, or usStrategicInsertionData
if ( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_NORTH && pSoldier->usStrategicInsertionData || pSoldier->sGridNo != NOWHERE )
{
if ( pSoldier->bSide == gbPlayerNum )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_NORTH;
else if ( !pSoldier->aiData.bNeutral )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_NORTH_ENEMY;
}
else if ( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_SOUTH )
{
if ( pSoldier->bSide == gbPlayerNum )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_SOUTH;
else if ( !pSoldier->aiData.bNeutral )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_SOUTH_ENEMY;
}
else if ( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_EAST )
{
if ( pSoldier->bSide == gbPlayerNum )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_EAST;
else if ( !pSoldier->aiData.bNeutral )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_EAST_ENEMY;
}
else if ( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_WEST )
{
if ( pSoldier->bSide == gbPlayerNum )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_WEST;
else if ( !pSoldier->aiData.bNeutral )
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_WEST_ENEMY;
}
// add this flag whenever we enter strategically enter a sector (= we attack a sector)
pSoldier->bSoldierFlagMask |= SOLDIER_ASSAULT_BONUS;
@@ -1496,7 +1533,7 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir
if ( pSoldier->bSoldierFlagMask & SOLDIER_AIRDROP )
{
pSoldier->bSoldierFlagMask &= ~SOLDIER_AIRDROP;
if ( gGameExternalOptions.ubSkyriderHotLZ == 3 )
{
gfIgnoreScrolling = FALSE;
@@ -1536,7 +1573,7 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir
pSoldier->EVENT_SetSoldierDesiredDirection( ubDirection );
}
}
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
{
if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) )
+4
View File
@@ -61,6 +61,7 @@
#include "interface dialogue.h"
#include "Strategic Status.h"
#include "Food.h"
#include "CampaignStats.h" // added by Flugente
#endif
// anv: for enemy taunts
@@ -3974,6 +3975,9 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
}
}
// Flugente: campaign stats
gCurrentIncident.AddStat( pSoldier, CAMPAIGNHISTORY_TYPE_KILL );
if ( TurnSoldierIntoCorpse( pSoldier, TRUE, TRUE ) )
{
*pfMadeCorpse = TRUE;
+30 -2
View File
@@ -91,6 +91,7 @@
#include "Strategic Pathing.h"
#include "Debug Control.h"
#include "LOS.h" // added by SANDRO
#include "CampaignStats.h" // added by Flugente
#endif
#include "ub_config.h"
@@ -9529,7 +9530,7 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso
}
break;
}
// 0verhaul: This is also already handled by the animation transitions
// if ( ubReason == TAKE_DAMAGE_ELECTRICITY )
// {
@@ -9851,6 +9852,9 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sPo
this->bPoisonBleeding = 0;
}
// Flugente: note we received a fresh wound
if ( sLifeDeduct > 0 )
this->bSoldierFlagMask |= SOLDIER_FRESHWOUND;
// Calculate damage to our items if from an explosion!
if ( ubReason == TAKE_DAMAGE_EXPLOSION || ubReason == TAKE_DAMAGE_STRUCTURE_EXPLOSION)
@@ -12929,6 +12933,9 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
pVictim->iHealableInjury = ((pVictim->stats.bLifeMax - pVictim->stats.bLife)*100);
else if (pVictim->iHealableInjury < 0)
pVictim->iHealableInjury = 0;
// Flugente: campaign stats
gCurrentIncident.usIncidentFlags |= INCIDENT_SURGERY;
}
// if any healing points remain, apply that to any remaining bleeding (1/1)
@@ -15803,7 +15810,7 @@ BOOLEAN SOLDIERTYPE::CanProcessPrisoners()
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( this->sSectorX, this->sSectorY ) ] );
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
if ( GetNumberOrPrisoners(pSectorInfo, &tmp1, &tmp2, &tmp3, &tmp4) > 0 )
if ( GetNumberOfPrisoners(pSectorInfo, &tmp1, &tmp2, &tmp3, &tmp4) > 0 )
return TRUE;
}
@@ -17044,6 +17051,22 @@ void SOLDIERTYPE::SoldierPropertyUpkeep()
else
usSkillCounter[counter] = max(0, usSkillCounter[counter] - 1 );
}
// if there is a combat going and we are in sector, note that in the battle report
if ( this->bInSector && (gTacticalStatus.uiFlags & INCOMBAT || gTacticalStatus.fEnemyInSector) )
{
if ( !(this->bSoldierFlagMask & SOLDIER_BATTLE_PARTICIPATION) )
{
this->bSoldierFlagMask |= SOLDIER_BATTLE_PARTICIPATION;
// Flugente: campaign stats
gCurrentIncident.AddStat( this, CAMPAIGNHISTORY_TYPE_PARTICIPANT );
}
}
else
{
this->bSoldierFlagMask &= ~SOLDIER_BATTLE_PARTICIPATION;
}
}
// check if Soldier can use the spell skillwise, with fAPCheck = TRUE also check current APs
@@ -17859,6 +17882,11 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN
else
// how did this even happen?
return FALSE;
if ( bTeam == ENEMY_TEAM )
gCurrentIncident.usIncidentFlags |= INCIDENT_ARTILLERY_ENEMY;
else
gCurrentIncident.usIncidentFlags |= INCIDENT_ARTILLERY_PLAYERSIDE;
return TRUE;
}
+4 -5
View File
@@ -328,9 +328,8 @@ enum
SOLDIER_CLASS_ELITE_MILITIA,
SOLDIER_CLASS_CREATURE,
SOLDIER_CLASS_MINER,
#ifdef ENABLE_ZOMBIES
SOLDIER_CLASS_ZOMBIE,
#endif
SOLDIER_CLASS_MAX,
};
// Flugente: there are now separate gun choices, depending on a soldier's class
@@ -381,10 +380,10 @@ enum
#define SOLDIER_RADIO_OPERATOR_JAMMING 0x00100000 //1048576 // radio operator is jamming frequencies
#define SOLDIER_RADIO_OPERATOR_SCANNING 0x00200000 //2097152 // radio operator is scanning for jammers
#define SOLDIER_AIRDROP 0x00400000 //4194304 // soldier is entering the sector via airdrop from a helicopter. Sligthly different from SOLDIER_AIRDROP_TURN
/*#define PLAYER_NET_4_LVL_2 0x00800000 //8388608
#define SOLDIER_FRESHWOUND 0x00800000 //8388608 // campaign stats: soldier was wounded in this battle
#define PLAYER_NET_1_LVL_3 0x01000000 //16777216
#define PLAYER_NET_2_LVL_3 0x02000000 //33554432
#define SOLDIER_BATTLE_PARTICIPATION 0x01000000 //16777216 // campaign stats: soldier took part in this battle
/*#define PLAYER_NET_2_LVL_3 0x02000000 //33554432
#define PLAYER_NET_3_LVL_3 0x04000000 //67108864
#define PLAYER_NET_4_LVL_3 0x08000000 //134217728
+9 -2
View File
@@ -53,7 +53,8 @@
#include "Queen Command.h"
#include "Map Edgepoints.h"
#include "Campaign.h" // added by Flugente for HighestPlayerProgressPercentage()
#include "Campaign.h" // added by Flugente for HighestPlayerProgressPercentage()
#include "CampaignStats.h" // added by Flugente
BOOLEAN gfOriginalList = TRUE;
@@ -2717,6 +2718,12 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
// Flugente: due to a fix, also note here that the reinforcements get no APs.
pSoldier->bSoldierFlagMask |= SOLDIER_NO_AP;
// Flugente: campaign stats
if ( IsOurSoldier(pSoldier) )
gCurrentIncident.usIncidentFlags |= INCIDENT_REINFORCEMENTS_PLAYERSIDE;
else
gCurrentIncident.usIncidentFlags |= INCIDENT_REINFORCEMENTS_ENEMY;
}
}
}
@@ -2818,7 +2825,7 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
// only continue if there are prisoners in this sector that need to be placed
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
UINT16 numprisoners = GetNumberOrPrisoners(pSector, &tmp1, &tmp2, &tmp3, &tmp4);
UINT16 numprisoners = GetNumberOfPrisoners(pSector, &tmp1, &tmp2, &tmp3, &tmp4);
if ( !numprisoners )
return;
+8 -2
View File
@@ -2686,6 +2686,12 @@ BOOLEAN DoesVehicleGroupHaveAnyPassengers( GROUP *pGroup )
return DoesVehicleHaveAnyPassengers( iVehicleID );
}
BOOLEAN IsHelicopterInSector(INT16 sX, INT16 sY)
{
if ( pVehicleList[ iHelicopterVehicleId ].sSectorX == sX && pVehicleList[ iHelicopterVehicleId ].sSectorY == sY )
{
return TRUE;
}
return FALSE;
}
+1
View File
@@ -449,5 +449,6 @@ void InitAVehicle(int index, int x, int y);
void InitAllVehicles( );
BOOLEAN IsHelicopterInSector(INT16 sX, INT16 sY);
#endif
+47 -12
View File
@@ -49,6 +49,7 @@
#include "Drugs And Alcohol.h" // HEADROCK HAM 4: Get drunk level
#include "LOS.h" // HEADROCK HAM 4: Required for new shooting mechanism. Alternately, maybe move the functions to LOS.h.
#include "Campaign Types.h" // added by Flugente
#include "CampaignStats.h" // added by Flugente
#endif
//forward declarations of common classes to eliminate includes
@@ -2293,6 +2294,17 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
GunIncreaseHeat( pObjAttHand, pSoldier );
// Flugente: campaign stats
gCurrentIncident.AddStat( pSoldier, CAMPAIGNHISTORY_TYPE_SHOT );
if ( Weapon[Item[(pObjAttHand)->usItem].ubClassIndex].ubWeaponType == GUN_SN_RIFLE )
{
if ( pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM )
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_PLAYERSIDE;
else
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_ENEMY;
}
// CJC: since jamming is no longer affected by reliability, increase chance of status going down for really unreliabile guns
//INT16 ammoReliability = 0; // Madd: ammo reliability affects gun
@@ -2919,6 +2931,17 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
GunIncreaseHeat( pObjUsed, pSoldier );
// Flugente: campaign stats
gCurrentIncident.AddStat( pSoldier, CAMPAIGNHISTORY_TYPE_SHOT );
if ( Weapon[Item[(pObjUsed)->usItem].ubClassIndex].ubWeaponType == GUN_SN_RIFLE )
{
if ( pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM )
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_PLAYERSIDE;
else
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_ENEMY;
}
/* //WarmSteel - Replaced with GetReliability( pObj )
// CJC: since jamming is no longer affected by reliability, increase chance of status going down for really unreliabile guns
INT16 ammoReliability = 0; // Madd: ammo reliability affects gun
@@ -4068,25 +4091,37 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
}
}
// ATE: Check here if the launcher should fail 'cause of bad status.....
if ( WillExplosiveWeaponFail( pSoldier, pgunobj ) )
{
GunIncreaseHeat( pgunobj, pSoldier );
// Explode dude!
// Flugente: campaign stats
gCurrentIncident.AddStat( pSoldier, CAMPAIGNHISTORY_TYPE_SHOT );
// So we still should have ABC > 0
// Begin explosion due to failure...
if ( Weapon[Item[(pgunobj)->usItem].ubClassIndex].ubWeaponType == GUN_SN_RIFLE )
{
if ( pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM )
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_PLAYERSIDE;
else
gCurrentIncident.usIncidentFlags |= INCIDENT_SNIPERS_ENEMY;
}
// ATE: Check here if the launcher should fail 'cause of bad status.....
if ( WillExplosiveWeaponFail( pSoldier, pgunobj ) )
{
GunIncreaseHeat( pgunobj, pSoldier );
// Explode dude!
// So we still should have ABC > 0
// Begin explosion due to failure...
IgniteExplosion( pSoldier->ubID, CenterX( pSoldier->sGridNo ), CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, Launchable.usItem, pSoldier->pathing.bLevel );
// Reduce again for attack end 'cause it has been incremented for a normal attack
// Nope, not anymore.
// Reduce again for attack end 'cause it has been incremented for a normal attack
// Nope, not anymore.
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY BAD EXPLOSIVE CHECK, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) );
DebugAttackBusy( String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY BAD EXPLOSIVE CHECK\n", gAnimControl[ pSoldier->usAnimState ].zAnimStr ) );
// ReduceAttackBusyCount( pSoldier->ubID, FALSE );
// So all's well, should be good from here....
return( FALSE );
}
// So all's well, should be good from here....
return( FALSE );
}
GunIncreaseHeat( pgunobj, pSoldier );
+5
View File
@@ -237,6 +237,7 @@ typedef PARSE_STAGE;
#define VEHICLESFILENAME "Vehicles.xml"
#define SQUADNAMEFILENAME "SquadNames.xml"
#define BACKGROUNDSFILENAME "Backgrounds.xml"
#define CAMPAIGNSTATSEVENTSFILENAME "CampaignStatsEvents.xml"
#define TAUNTSFOLDERNAME "EnemyTaunts\\"
#define TAUNTSFILENAME "EnemyTaunts.xml"
@@ -478,6 +479,10 @@ extern void LoadIMPPortraitsTEMP();
extern BOOLEAN ReadInBackgrounds(STR fileName, BOOLEAN localizedVersion );
extern BOOLEAN WriteBackgrounds( STR fileName);
// Flugente: campaign stats events
extern BOOLEAN ReadInCampaignStatsEvents(STR fileName, BOOLEAN localizedVersion );
extern BOOLEAN WriteCampaignStatsEvents( STR fileName);
// anv: externalised taunts
extern BOOLEAN ReadInTaunts(STR fileName, BOOLEAN localizedVersion );
extern BOOLEAN WriteTaunts( STR fileName );