Merged from revision: 7401

Fixes (by Buggler)
- Fixed enemies retreating to inaccessible sectors
- Fixed hardcoded interrogation sector values

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7402 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-08-20 04:39:30 +00:00
parent a205b41ba5
commit 27c9a9ce6b
2 changed files with 27 additions and 7 deletions
+23 -5
View File
@@ -6639,12 +6639,30 @@ void CrippledVersionFailureToLoadMapCallBack( UINT8 bExitValue )
#endif
BOOLEAN EscapeDirectionIsValid( INT8 * pbDirection )
{
UINT8 ubSectorID = SECTOR( gWorldSectorX, gWorldSectorY );
switch( *pbDirection )
{
case NORTHEAST: if( gWorldSectorX + 1 > MAXIMUM_VALID_X_COORDINATE ) *pbDirection = -1; break; // east
case SOUTHEAST: if( gWorldSectorY + 1 > MAXIMUM_VALID_Y_COORDINATE ) *pbDirection = -1; break; // south
case SOUTHWEST: if( gWorldSectorX - 1 < MINIMUM_VALID_X_COORDINATE ) *pbDirection = -1; break; // west
case NORTHWEST: if( gWorldSectorY - 1 < MINIMUM_VALID_Y_COORDINATE ) *pbDirection = -1; break; // north
{
case NORTHEAST: // east
if( gWorldSectorX + 1 > MAXIMUM_VALID_X_COORDINATE || gMapInformation.sEastGridNo == NOWHERE ||
SectorInfo[ ubSectorID ].ubTraversability[ EAST_STRATEGIC_MOVE ] == GROUNDBARRIER || SectorInfo[ ubSectorID ].ubTraversability[ EAST_STRATEGIC_MOVE ] == EDGEOFWORLD )
*pbDirection = -1;
break;
case SOUTHEAST: // south
if( gWorldSectorY + 1 > MAXIMUM_VALID_Y_COORDINATE || gMapInformation.sSouthGridNo == NOWHERE ||
SectorInfo[ ubSectorID ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] == GROUNDBARRIER || SectorInfo[ ubSectorID ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] == EDGEOFWORLD )
*pbDirection = -1;
break;
case SOUTHWEST: // west
if( gWorldSectorX - 1 < MINIMUM_VALID_X_COORDINATE || gMapInformation.sWestGridNo == NOWHERE ||
SectorInfo[ ubSectorID ].ubTraversability[ WEST_STRATEGIC_MOVE ] == GROUNDBARRIER || SectorInfo[ ubSectorID ].ubTraversability[ WEST_STRATEGIC_MOVE ] == EDGEOFWORLD )
*pbDirection = -1;
break;
case NORTHWEST: // north
if( gWorldSectorY - 1 < MINIMUM_VALID_Y_COORDINATE || gMapInformation.sNorthGridNo == NOWHERE ||
SectorInfo[ ubSectorID ].ubTraversability[ NORTH_STRATEGIC_MOVE ] == GROUNDBARRIER || SectorInfo[ ubSectorID ].ubTraversability[ NORTH_STRATEGIC_MOVE ] == EDGEOFWORLD )
*pbDirection = -1;
break;
default: *pbDirection = -1;
}
return( *pbDirection != -1 );
+4 -2
View File
@@ -7082,7 +7082,8 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_LOST, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
// SANDRO - end quest if cleared the sector after interrogation (sector N7 by Meduna)
if ( gWorldSectorX == 7 && gWorldSectorY == 14 && gbWorldSectorZ == 0 && gubQuest[ QUEST_INTERROGATION ] == QUESTINPROGRESS )
if ( gWorldSectorX == gModSettings.ubMeanwhileInterrogatePOWSectorX && gWorldSectorY == gModSettings.ubMeanwhileInterrogatePOWSectorY &&
gbWorldSectorZ == 0 && gubQuest[ QUEST_INTERROGATION ] == QUESTINPROGRESS )
{
// Quest failed
InternalEndQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY, FALSE );
@@ -7271,7 +7272,8 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
ShouldBeginAutoBandage( );
}
// SANDRO - end quest if cleared the sector after interrogation (sector N7 by Meduna)
if ( gWorldSectorX == 7 && gWorldSectorY == 14 && gbWorldSectorZ == 0 && gubQuest[ QUEST_INTERROGATION ] == QUESTINPROGRESS )
if ( gWorldSectorX == gModSettings.ubMeanwhileInterrogatePOWSectorX && gWorldSectorY == gModSettings.ubMeanwhileInterrogatePOWSectorY &&
gbWorldSectorZ == 0 && gubQuest[ QUEST_INTERROGATION ] == QUESTINPROGRESS )
{
// Complete quest
EndQuest( QUEST_INTERROGATION, gWorldSectorX, gWorldSectorY );