mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Feature improvement: the prisoner system now distinguishes between different types of prisoners (admin, regular, elite). Advanced troops are harder to interrogate, but have a high chance of retaining their rank, should they join yor militia.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6219 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+5
-5
@@ -2416,8 +2416,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
|
||||
case FACILITY_INTERROGATE_PRISONERS:
|
||||
sIconIndex = 23;
|
||||
fDoIcon = TRUE;
|
||||
//sPtsAvailable = (INT16)( CalculateInterrogationValue(pSoldier, &usMaximumPts )/100 );
|
||||
bPtsAvailable = (FLOAT)( CalculateInterrogationValue(pSoldier, &usMaximumPts )/100.0 );
|
||||
sPtsAvailable = (INT16)( CalculateInterrogationValue(pSoldier, &usMaximumPts ) );
|
||||
//bPtsAvailable = (FLOAT)( CalculateInterrogationValue(pSoldier, &usMaximumPts )/100.0 );
|
||||
fShowNumber = TRUE;
|
||||
fShowMaximum = TRUE;
|
||||
break;
|
||||
@@ -2452,10 +2452,10 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
|
||||
|
||||
if ( fShowMaximum )
|
||||
{
|
||||
if ( pSoldier->bAssignment == FACILITY_INTERROGATE_PRISONERS )
|
||||
/*if ( pSoldier->bAssignment == FACILITY_INTERROGATE_PRISONERS )
|
||||
swprintf( sString, L"%2.2f/%d", bPtsAvailable, usMaximumPts );
|
||||
else
|
||||
swprintf( sString, L"%d/%d", sPtsAvailable, usMaximumPts );
|
||||
else*/
|
||||
swprintf( sString, L"%d/%d", sPtsAvailable, usMaximumPts );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+96
-18
@@ -3665,12 +3665,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
|
||||
|
||||
// Flugente: if this was a prisoner of war, reduce their sector count by 1
|
||||
if ( pSoldierOld->bSoldierFlagMask & SOLDIER_POW_PRISON )
|
||||
{
|
||||
// get sector
|
||||
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
if ( pSector )
|
||||
pSector->uiNumberOfPrisonersOfWar = max(0, pSector->uiNumberOfPrisonersOfWar - 1);
|
||||
}
|
||||
KillOnePrisoner( &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
|
||||
}
|
||||
else if ( pSoldierOld->bTeam == MILITIA_TEAM )
|
||||
{
|
||||
@@ -6548,15 +6543,16 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_RELEASED] );
|
||||
}
|
||||
|
||||
UINT32 prisonerstobemoved = 0;
|
||||
UINT16 prisonerstobemoved = 0;
|
||||
UINT8 prisonersspecial = 0, prisonerselite = 0, prisonersregular = 0, prisonersadmin = 0;
|
||||
BOOLEAN success = FALSE;
|
||||
if ( !gbWorldSectorZ )
|
||||
{
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ] );
|
||||
|
||||
prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
|
||||
prisonerstobemoved = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
|
||||
DeleteAllPrisoners( pSectorInfo );
|
||||
|
||||
if ( usSectorID > 0)
|
||||
{
|
||||
@@ -6566,7 +6562,7 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
success = TRUE;
|
||||
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
ChangeNumberOfPrisoners( pPrisonSectorInfo, prisonersspecial, prisonerselite, prisonersregular, prisonersadmin );
|
||||
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
|
||||
@@ -6578,9 +6574,9 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
|
||||
prisonerstobemoved = pSectorInfo->uiNumberOfPrisonersOfWar;
|
||||
prisonerstobemoved = GetNumberOrPrisoners( pSectorInfo, &prisonersspecial, &prisonerselite, &prisonersregular, &prisonersadmin );
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar = 0;
|
||||
DeleteAllPrisoners( pSectorInfo );
|
||||
|
||||
if ( usSectorID > 0)
|
||||
{
|
||||
@@ -6590,7 +6586,7 @@ void PrisonerMessageBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
success = TRUE;
|
||||
|
||||
pPrisonSectorInfo->uiNumberOfPrisonersOfWar += prisonerstobemoved;
|
||||
ChangeNumberOfPrisoners( pPrisonSectorInfo, prisonersspecial, prisonerselite, prisonersregular, prisonersadmin );
|
||||
|
||||
CHAR16 wString[ 64 ];
|
||||
GetShortSectorString( SECTORX(usSectorID), SECTORY(usSectorID), wString );
|
||||
@@ -6633,9 +6629,9 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
case SOLDIER_CLASS_ARMY: ubNumPrisonerTroop++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubNumPrisonerElite++; break;
|
||||
default:
|
||||
// if none of the above classes, ignore this one
|
||||
continue;
|
||||
break;
|
||||
// if none of the above classes, ignore this one
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
++ubNumPrisoners;
|
||||
@@ -6716,13 +6712,13 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
{
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar += ubNumPrisoners;
|
||||
ChangeNumberOfPrisoners(pSectorInfo, 0, ubNumPrisonerElite, ubNumPrisonerTroop, ubNumPrisonerAdmin);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSectorInfo = FindUnderGroundSector( sMapX, sMapY, bMapZ );
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar += ubNumPrisoners;
|
||||
ChangeNumberOfPrisoners(pSectorInfo, 0, ubNumPrisonerElite, ubNumPrisonerTroop, ubNumPrisonerAdmin);
|
||||
}
|
||||
|
||||
if ( ubNumPrisoners )
|
||||
@@ -10195,3 +10191,85 @@ BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
UINT16 GetNumberOrPrisoners( SECTORINFO *pSectorInfo, UINT8* apSpecial, UINT8* apElite, UINT8* apRegular, UINT8* apAdmin )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return 0;
|
||||
|
||||
*apSpecial = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL];
|
||||
*apElite = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE];
|
||||
*apRegular = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR];
|
||||
*apAdmin = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN];
|
||||
|
||||
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 )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return 0;
|
||||
|
||||
*apSpecial = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL];
|
||||
*apElite = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE];
|
||||
*apRegular = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR];
|
||||
*apAdmin = pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN];
|
||||
|
||||
return (UINT16)(pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN]);
|
||||
}
|
||||
|
||||
void ChangeNumberOfPrisoners( SECTORINFO *pSectorInfo, INT16 aSpecial, INT16 aElite, INT16 aRegular, INT16 aAdmin )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return;
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] + aSpecial) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + aElite) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + aRegular) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] + aAdmin) );
|
||||
}
|
||||
|
||||
void ChangeNumberOfPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo, INT16 aSpecial, INT16 aElite, INT16 aRegular, INT16 aAdmin )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return;
|
||||
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_SPECIAL] + aSpecial) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ELITE] + aElite) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_REGULAR] + aRegular) );
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] = max(0, min(255, pSectorInfo->uiNumberOfPrisonersOfWar[PRISONER_ADMIN] + aAdmin) );
|
||||
}
|
||||
|
||||
void DeleteAllPrisoners( SECTORINFO *pSectorInfo )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return;
|
||||
|
||||
for (int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i)
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[i] = 0;
|
||||
}
|
||||
|
||||
void DeleteAllPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return;
|
||||
|
||||
for (int i = PRISONER_ADMIN; i < PRISONER_MAX; ++i)
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[i] = 0;
|
||||
}
|
||||
|
||||
// used when the player kills a prisoner. We kill of high-value prisoners first, to punish this kind of behaviour
|
||||
void KillOnePrisoner( SECTORINFO *pSectorInfo )
|
||||
{
|
||||
if ( !pSectorInfo )
|
||||
return;
|
||||
|
||||
for (int i = PRISONER_SPECIAL; i >= PRISONER_ADMIN; --i)
|
||||
{
|
||||
if ( pSectorInfo->uiNumberOfPrisonersOfWar[i] )
|
||||
{
|
||||
pSectorInfo->uiNumberOfPrisonersOfWar[i] -= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Soldier Control.h"
|
||||
#include "overhead types.h"
|
||||
#include "soldier find.h"
|
||||
#include "Campaign Types.h" // added by Flugente for SECTORINFO and UNDERGROUND_SECTORINFO
|
||||
#define ADD_SOLDIER_NO_PROFILE_ID 200
|
||||
|
||||
#define MAX_REALTIME_SPEED_VAL 10
|
||||
@@ -364,5 +365,18 @@ BOOLEAN AllowedToStealFromTeamMate( UINT8 aAccessorID, UINT8 aTargetID );
|
||||
// Flugente: is an soldier profile already used?
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
void DeleteAllPrisoners( SECTORINFO *pSectorInfo );
|
||||
void DeleteAllPrisoners( UNDERGROUND_SECTORINFO *pSectorInfo );
|
||||
|
||||
// used when the player kills a prisoner. We kill of high-value prisoners first, to punish this kind of behaviour
|
||||
void KillOnePrisoner( SECTORINFO *pSectorInfo );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15520,7 +15520,8 @@ BOOLEAN SOLDIERTYPE::CanProcessPrisoners()
|
||||
{
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( this->sSectorX, this->sSectorY ) ] );
|
||||
|
||||
if ( pSectorInfo->uiNumberOfPrisonersOfWar > 0 )
|
||||
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
|
||||
if ( GetNumberOrPrisoners(pSectorInfo, &tmp1, &tmp2, &tmp3, &tmp4) > 0 )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -2818,7 +2818,8 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
return;
|
||||
|
||||
// only continue if there are prisoners in this sector that need to be placed
|
||||
UINT32 numprisoners = pSector->uiNumberOfPrisonersOfWar;
|
||||
UINT8 tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp4 = 0;
|
||||
UINT16 numprisoners = GetNumberOrPrisoners(pSector, &tmp1, &tmp2, &tmp3, &tmp4);
|
||||
if ( !numprisoners )
|
||||
return;
|
||||
|
||||
@@ -2842,7 +2843,7 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
// we can't spawn if all civilian slots are already taken (we leave a bit of reserve for more important civs)
|
||||
UINT8 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3);
|
||||
|
||||
for (UINT8 i = numberofpows; i < numprisoners; ++i)
|
||||
for (UINT16 i = numberofpows; i < numprisoners; ++i)
|
||||
{
|
||||
if ( numberofcivs < maxcivs )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user