New feature: exploration assignment indicates items on the map

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360244&#msg_360244


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8815 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-06-01 20:46:45 +00:00
parent b25a4be4e7
commit f0c8db784a
25 changed files with 514 additions and 58 deletions
+205 -1
View File
@@ -513,6 +513,9 @@ void HandleSpyAssignments();
// Flugente: handle administration assignment
void HandleAdministrationAssignments();
// Flugente: handle exploration assignements
void HandleExplorationAssignments();
// is the character between secotrs in mvt
BOOLEAN CharacterIsBetweenSectors( SOLDIERTYPE *pSoldier );
@@ -1111,6 +1114,29 @@ BOOLEAN CanCharacterAdministration( SOLDIERTYPE *pSoldier )
return TRUE;
}
BOOLEAN CanCharacterExplore( SOLDIERTYPE *pSoldier )
{
AssertNotNIL( pSoldier );
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
return FALSE;
if ( pSoldier->bSectorZ )
{
UNDERGROUND_SECTORINFO* pSector = FindUnderGroundSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
if ( !pSector || pSector->usExplorationProgress >= 250 )
return FALSE;
}
else
{
SECTORINFO* pSector = &( SectorInfo[SECTOR( pSoldier->sSectorX, pSoldier->sSectorY )] );
if ( !pSector || pSector->usExplorationProgress >= 250 )
return FALSE;
}
return TRUE;
}
BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier )
{
AssertNotNIL(pSoldier);
@@ -2967,6 +2993,9 @@ void UpdateAssignments()
// handle administration assignment
HandleAdministrationAssignments();
// handle exploration
HandleExplorationAssignments();
// check to see if anyone is done healing?
UpdatePatientsWhoAreDoneHealing( );
@@ -6898,6 +6927,96 @@ void HandleAdministrationAssignments()
}
}
// Flugente: handle exploration assignments
void HandleExplorationAssignments()
{
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt = 0;
UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID;
UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID;
for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier )
{
if ( pSoldier && pSoldier->bAssignment == EXPLORATION && !pSoldier->flags.fMercAsleep && EnoughTimeOnAssignment( pSoldier ) )
{
UINT32 pts = pSoldier->GetExplorationPoints();
bool awardpts = false;
if ( pSoldier->bSectorZ )
{
UNDERGROUND_SECTORINFO *pSector;
pSector = FindUnderGroundSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
if ( pSector && pSector->usExplorationProgress < 250 )
{
awardpts = true;
UINT32 oldprogress = pSector->usExplorationProgress;
UINT32 newprogress = min( 255, oldprogress + pts );
if ( newprogress > 250 )
{
pSector->usExplorationProgress = 255;
CHAR16 wSectorName[64];
GetShortSectorString( pSoldier->sSectorX, pSoldier->sSectorY, wSectorName );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_ASSIGNMENT_EXPLORATION_DONE], pSoldier->GetName(), wSectorName );
AssignmentDone( pSoldier, TRUE, TRUE );
}
else
{
pSector->usExplorationProgress = (UINT8)newprogress;
}
}
else
{
AssignmentDone( pSoldier, TRUE, TRUE );
}
}
else
{
SECTORINFO* pSector = &( SectorInfo[SECTOR( pSoldier->sSectorX, pSoldier->sSectorY )] );
if ( pSector && pSector->usExplorationProgress < 250 )
{
awardpts = true;
UINT32 oldprogress = pSector->usExplorationProgress;
UINT32 newprogress = min( 255, oldprogress + pts );
if ( newprogress > 250 )
{
pSector->usExplorationProgress = 255;
CHAR16 wSectorName[64];
GetShortSectorString( pSoldier->sSectorX, pSoldier->sSectorY, wSectorName );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[STR_ASSIGNMENT_EXPLORATION_DONE], pSoldier->GetName(), wSectorName );
AssignmentDone( pSoldier, TRUE, TRUE );
}
else
{
pSector->usExplorationProgress = (UINT8)newprogress;
}
}
else
{
AssignmentDone( pSoldier, TRUE, TRUE );
}
}
if ( awardpts )
{
StatChange( pSoldier, AGILAMT, 1, FROM_TRAINING );
StatChange( pSoldier, WISDOMAMT, 1, FROM_TRAINING );
StatChange( pSoldier, EXPERAMT, 1, FROM_TRAINING );
}
}
}
}
// handle snitch spreading propaganda assignment
// totally not a copy of HandleRadioScanInSector
void HandleSpreadingPropagandaInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
@@ -10567,7 +10686,19 @@ void HandleShadingOfLinesForAssignmentMenus( void )
{
ShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_ADMINISTRATION );
}
// exploration
if ( CanCharacterExplore( pSoldier ) )
{
// unshade line
UnShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_EXPLORATION );
}
else
{
// shade line
ShadeStringInBox( ghAssignmentBox, ASSIGN_MENU_EXPLORATION );
}
// militia
if ( CanCharacterOnDuty( pSoldier ) )
{
@@ -14130,6 +14261,42 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
}
break;
case ASSIGN_MENU_EXPLORATION:
if ( CanCharacterExplore( pSoldier ) )
{
// stop showing menu
fShowAssignmentMenu = FALSE;
giAssignHighLine = -1;
pSoldier->bOldAssignment = pSoldier->bAssignment;
if ( ( pSoldier->bAssignment != EXPLORATION ) )
{
SetTimeOfAssignmentChangeForMerc( pSoldier );
}
// remove from squad
if ( pSoldier->bOldAssignment == VEHICLE )
{
TakeSoldierOutOfVehicle( pSoldier );
}
RemoveCharacterFromSquads( pSoldier );
ChangeSoldiersAssignment( pSoldier, EXPLORATION );
AssignMercToAMovementGroup( pSoldier );
MakeSoldiersTacticalAnimationReflectAssignment( pSoldier );
// set dirty flag
fTeamPanelDirty = TRUE;
fMapScreenBottomDirty = TRUE;
// set assignment for group
SetAssignmentForList( (INT8)EXPLORATION, 0 );
}
break;
case( ASSIGN_MENU_CANCEL ):
fShowAssignmentMenu = FALSE;
giAssignHighLine = -1;
@@ -17083,6 +17250,30 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam
AssignMercToAMovementGroup( pSoldier );
}
break;
case EXPLORATION:
if ( CanCharacterExplore( pSoldier ) )
{
pSoldier->bOldAssignment = pSoldier->bAssignment;
// remove from squad
RemoveCharacterFromSquads( pSoldier );
// remove from any vehicle
if ( pSoldier->bOldAssignment == VEHICLE )
{
TakeSoldierOutOfVehicle( pSoldier );
}
if ( pSoldier->bAssignment != bAssignment )
{
SetTimeOfAssignmentChangeForMerc( pSoldier );
}
ChangeSoldiersAssignment( pSoldier, bAssignment );
AssignMercToAMovementGroup( pSoldier );
}
break;
}
}
@@ -18234,6 +18425,10 @@ void ReEvaluateEveryonesNothingToDo( BOOLEAN aDoExtensiveCheck )
fNothingToDo = !CanCharacterAdministration( pSoldier ) || !GetNumberofAdministratableMercs( pSoldier->sSectorX, pSoldier->sSectorY );
break;
case EXPLORATION:
fNothingToDo = !CanCharacterExplore( pSoldier );
break;
case VEHICLE:
default: // squads
fNothingToDo = FALSE;
@@ -18589,6 +18784,15 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam )
}
break;
case EXPLORATION:
if ( CanCharacterExplore( pSoldier ) )
{
pSoldier->bOldAssignment = pSoldier->bAssignment;
SetSoldierAssignment( pSoldier, bAssignment, bParam, 0, 0 );
fItWorked = TRUE;
}
break;
case( SQUAD_1 ):
case( SQUAD_2 ):
case( SQUAD_3 ):
+2
View File
@@ -98,6 +98,7 @@ enum
DRILL_MILITIA, // train existing militia (does not create new ones)
BURIAL, // merc removes corpses in this sector
ADMINISTRATION, // merc boosts the effectiveness of other mercs
EXPLORATION, // merc searches the sector for undiscovered items
NUM_ASSIGNMENTS,
};
@@ -213,6 +214,7 @@ BOOLEAN CanCharacterSpyAssignment( SOLDIERTYPE *pSoldier );
BOOLEAN CanCharacterBurial( SOLDIERTYPE *pSoldier );
BOOLEAN CanCharacterAdministration( SOLDIERTYPE *pSoldier );
BOOLEAN CanCharacterExplore( SOLDIERTYPE *pSoldier );
// can this character be assigned as a repairman?
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pCharacter );
+3 -2
View File
@@ -574,7 +574,7 @@ typedef struct SECTORINFO
UINT8 ubNumAdmins_Turncoat;
UINT8 ubNumTroops_Turncoat;
UINT8 ubNumElites_Turncoat;
UINT8 bPadding_1;
UINT8 usExplorationProgress;
INT8 bPadding[ 8 ];
@@ -624,8 +624,9 @@ typedef struct UNDERGROUND_SECTORINFO
UINT8 ubNumJeeps;
UINT8 ubJeepsInBattle;
UINT8 usExplorationProgress;
INT8 bPadding[14];
INT8 bPadding[12];
//no padding left!
}UNDERGROUND_SECTORINFO;
+1
View File
@@ -134,6 +134,7 @@ enum {
ASSIGN_MENU_FORTIFY, // added by Flugente
ASSIGN_MENU_SPY, // added by Flugente
ASSIGN_MENU_ADMINISTRATION, // added by Flugente
ASSIGN_MENU_EXPLORATION, // added by Flugente
ASSIGN_MENU_FACILITY, // HEAROCK HAM 3.6: Facility List menu
ASSIGN_MENU_CANCEL,
MAX_ASSIGN_STRING_COUNT,