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
+3 -3
View File
@@ -2678,7 +2678,7 @@ UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ] );
UINT8 prisonersspecial = 0, prisonerselite = 0, prisonersregular = 0, prisonersadmin = 0;
*pusMaxPts = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
*pusMaxPts = GetNumberOfPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
// no prisoners -> no interrogation (this should not happen)
if ( !*pusMaxPts )
@@ -5734,7 +5734,7 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
UINT8 prisoners[PRISONER_MAX] = {0};
UINT16 numprisoners = GetNumberOrPrisoners( pSectorInfo, &prisoners[PRISONER_SPECIAL], &prisoners[PRISONER_ELITE], &prisoners[PRISONER_REGULAR], &prisoners[PRISONER_ADMIN] );
UINT16 numprisoners = GetNumberOfPrisoners( pSectorInfo, &prisoners[PRISONER_SPECIAL], &prisoners[PRISONER_ELITE], &prisoners[PRISONER_REGULAR], &prisoners[PRISONER_ADMIN] );
// add interrogation progress from last hour and erase it in data
UINT32 interrogationpoints = pSectorInfo->uiInterrogationHundredsLeft;
@@ -5963,7 +5963,7 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
UINT8 prisonersspecial = 0, prisonerselite = 0, prisonersregular = 0, prisonersadmin = 0;
UINT16 numprisoners = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
UINT16 numprisoners = GetNumberOfPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
// for now, simply count specials as elites
ChangeNumberOfPrisoners( pSectorInfo, -prisonersspecial, prisonersspecial, 0, 0 );
+11
View File
@@ -69,6 +69,7 @@
#include "interface Dialogue.h"
#include "AIInternals.h" // added by SANDRO
#include "Bullets.h" // HEADROCK HAM 5, for use with Bullet Impact.
#include "CampaignStats.h" // added by Flugente
#endif
#include "Reinforcement.h"
@@ -1693,6 +1694,9 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB
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)
@@ -4603,6 +4607,10 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
}
if( iNewLife <= 0 )
{ //soldier has been killed
// Flugente: campaign stats
gCurrentIncident.AddStat( pTarget->pSoldier, CAMPAIGNHISTORY_TYPE_KILL );
if( pAttacker->uiFlags & CELL_MERC )
{ //Player killed the enemy soldier -- update his stats as well as any assisters.
/////////////////////////////////////////////////////////////////////////////////////
@@ -4798,6 +4806,9 @@ void TargetHitCallback( SOLDIERCELL *pTarget, INT32 index )
{
if( pKiller->uiFlags & CELL_MERC )
{
// Flugente: campaign stats
gCurrentIncident.AddStat( pTarget->pSoldier, CAMPAIGNHISTORY_TYPE_KILL );
/////////////////////////////////////////////////////////////////////////////////////
// SANDRO - new mercs' records
switch(pTarget->pSoldier->ubSoldierClass)
+4
View File
@@ -59,6 +59,7 @@
// HEADROCK HAM 4: Include for initializing Manual Restrictions
#include "MilitiaSquads.h"
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
#include "CampaignStats.h" // added by Flugente
#endif
#include "Vehicles.h"
@@ -695,6 +696,9 @@ fFirstTimeInMapScreen = TRUE;
//Init the laptop here
InitLaptopAndLaptopScreens();
// Flugente campaign stats
gCampaignStats.clear();
InitStrategicLayer();
// Set new game flag
+16
View File
@@ -27,6 +27,7 @@
#include "Random.h"
// HEADROCK HAM 3.6: Added for facility string printing...
#include "PopUpBox.h"
#include "CampaignStats.h" // added by Flugente
#endif
#include "postalservice.h"
@@ -382,6 +383,21 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
// also set fact the player knows they own it
SectorInfo[ SECTOR( sMapX, sMapY ) ].fPlayer[ bMapZ ] = TRUE;
// Flugente: campaign stats
if ( !SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled )
{
//UINT8 ubSector = (UINT8)SECTOR( sMapX, sMapY );
//UINT8 ubTraverseType = SectorInfo[ ubSector ].ubTraversability[ 4 ];
//if ( ubTraverseType == )
if ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR )
{
// first liberation of a town sector -> special texts
gCurrentIncident.usIncidentFlags |= INCIDENT_FIRST_LIBERATION;
}
}
if ( bMapZ == 0 )
{
SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled = TRUE;
+27
View File
@@ -47,6 +47,7 @@
// added by SANDRO
#include "Tactical Save.h"
#include "message.h"
#include "CampaignStats.h" // added by Flugente
#endif
#ifdef JA2UB
@@ -2157,6 +2158,9 @@ void LogBattleResults( UINT8 ubVictoryCode)
AddHistoryToPlayersLog( HISTORY_SLAUGHTEREDBLOODCATS, 0, GetWorldTotalMin(), sSectorX, sSectorY );
break;
}
// Flugente: campaign stats
gCurrentIncident.usIncidentFlags |= INCIDENT_WIN;
}
else
{
@@ -2183,6 +2187,29 @@ void LogBattleResults( UINT8 ubVictoryCode)
break;
}
}
switch( gubEnemyEncounterCode )
{
case ENEMY_INVASION_CODE:
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACK_ENEMY;
break;
case ENEMY_ENCOUNTER_CODE:
case ENTERING_ENEMY_SECTOR_CODE:
case CREATURE_ATTACK_CODE:
case ENTERING_BLOODCAT_LAIR_CODE:
case FIGHTING_CREATURES_CODE:
case HOSTILE_CIVILIANS_CODE:
case HOSTILE_BLOODCATS_CODE:
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACK_PLAYERSIDE;
break;
case ENEMY_AMBUSH_CODE:
case BLOODCAT_AMBUSH_CODE:
gCurrentIncident.usIncidentFlags |= (INCIDENT_ATTACK_ENEMY|INCIDENT_AMBUSH);
break;
}
// Flugente: if battle has ended, close this incident, add it to the global incidents, and clear it
FinishIncident(gWorldSectorX, gWorldSectorY, gbWorldSectorZ);
}
void HandlePreBattleInterfaceStates()
+7
View File
@@ -43,6 +43,7 @@
#include "meanwhile.h"
#include "Soldier macros.h"
#include "Morale.h"
#include "CampaignStats.h" // added by Flugente
#endif
#ifdef JA2BETAVERSION
@@ -1899,6 +1900,12 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub
// 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;
}
}
+4
View File
@@ -36,6 +36,7 @@
#include "MilitiaSquads.h"
// HEADROCK HAM 3.6: Include for Facility Debt
#include "Facilities.h"
#include "CampaignStats.h" // added by Flugente
#endif
#include "Luaglobal.h"
@@ -1869,6 +1870,9 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec
#else
HandleMeanWhileEventPostingForTownLiberation( bTownId );
#endif
// Flugente: campaign stats: if we captured an entire city for the first time, take note of that. We don't have to note the city here, as that is obvious from the sector anyway
gCurrentIncident.usOneTimeEventFlags |= INCIDENT_ONETIMEEVENT_CITY_LIBERATED;
}
// even taking over non-trainable "towns" like Orta/Tixa for the first time should count as "player activity"
+2 -1
View File
@@ -15,6 +15,7 @@
#include "Isometric Utils.h"
#include "Vehicles.h"
#include "Game Clock.h"
#include "CampaignStats.h" // added by Flugente
#endif
#ifdef JA2UB
@@ -90,7 +91,7 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier )
StopTimeCompression();
}
return( TRUE );
}