From 198d1fe9d37622a7f8cfe9076832268075cb2385 Mon Sep 17 00:00:00 2001 From: SpaceViking Date: Mon, 9 Apr 2007 01:02:46 +0000 Subject: [PATCH] Code for "new way to progress" (visiting sectors) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@843 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Campaign.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index e4c028d98..f10fc77f1 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -55,6 +55,7 @@ STR16 wDebugStatStrings[]={ // local prototypes UINT8 CalcImportantSectorControl( void ); +UINT16 CountSurfaceSectorsVisited( void ); @@ -1254,6 +1255,7 @@ UINT8 CurrentPlayerProgressPercentage(void) UINT8 ubKillsPerPoint; UINT16 usKillsProgress; UINT16 usControlProgress; + UINT16 usVisitProgress; if( gfEditMode ) @@ -1323,6 +1325,13 @@ UINT8 CurrentPlayerProgressPercentage(void) // add control progress ubCurrentProgress += usControlProgress; + // WDS: Adding more ways to progress in the game + // Get a ratio of sectors visited to the total number of sectors + usVisitProgress = CountSurfaceSectorsVisited() * gGameExternalOptions.ubGameProgressPortionVisited / ((MAP_WORLD_X - 2) * (MAP_WORLD_Y - 2)); + + // add control progress + ubCurrentProgress += usVisitProgress; + return(ubCurrentProgress); } @@ -1574,6 +1583,26 @@ UINT8 CalcImportantSectorControl( void ) } +// WDS: Adding more ways to progress in the game +// Count how many surface sectors the player has visited +UINT16 CountSurfaceSectorsVisited( void ) +{ + UINT8 ubMapX, ubMapY; + UINT16 ubSectorsVisited = 0; + + + for ( ubMapX = 1; ubMapX < MAP_WORLD_X - 1; ubMapX++ ) + { + for ( ubMapY = 1; ubMapY < MAP_WORLD_Y - 1; ubMapY++ ) + { + if( GetSectorFlagStatus( ubMapX, ubMapY, 0, SF_ALREADY_VISITED ) == TRUE ) + ++ubSectorsVisited; + } + } + + return( ubSectorsVisited ); +} + void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ) { UINT8 ubEmailOffset = 0;