Headrock found a bug in the CTH calculation with regards to autofire penalties.

Think I've fixed a glich where mercs who were already in a sector (but not active) could not be placed on the tactical placement screen (either because of an assertion error or simply being told the placement wasn't valid).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2385 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-10-28 18:41:22 +00:00
parent 7bd9d49e7c
commit 2eb729ab31
6 changed files with 26 additions and 16 deletions
+4 -4
View File
@@ -13,12 +13,12 @@
#ifdef JA2EDITOR #ifdef JA2EDITOR
//MAP EDITOR BUILD VERSION //MAP EDITOR BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2377" }; CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2385" };
#elif defined JA2BETAVERSION #elif defined JA2BETAVERSION
//BETA/TEST BUILD VERSION //BETA/TEST BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2377" }; CHAR16 zVersionLabel[256] = { L"Debug v1.13.2385" };
#elif defined CRIPPLED_VERSION #elif defined CRIPPLED_VERSION
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else #else
//RELEASE BUILD VERSION //RELEASE BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Release v1.13.2375" }; CHAR16 zVersionLabel[256] = { L"Release v1.13.2385" };
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 08.10.15" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 08.10.28" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
+1 -1
View File
@@ -3732,7 +3732,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime,
{ {
// Snap: bipod may reduce auto penalty // Snap: bipod may reduce auto penalty
iPenalty = GetAutoPenalty(pInHand, gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE) iPenalty = GetAutoPenalty(pInHand, gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)
* (pSoldier->bDoBurst - 1); * (pSoldier->bDoAutofire - 1);
// halve the penalty for people with the autofire trait // halve the penalty for people with the autofire trait
if ( HAS_SKILL_TRAIT( pSoldier, AUTO_WEAPS ) ) if ( HAS_SKILL_TRAIT( pSoldier, AUTO_WEAPS ) )
+7 -3
View File
@@ -1040,7 +1040,7 @@ BOOLEAN LoadMapEdgepoints( INT8 **hBuffer )
return TRUE; return TRUE;
} }
UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode ) UINT16 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode )
{ {
INT16 *psArray=NULL; INT16 *psArray=NULL;
UINT16 usArraySize=0; UINT16 usArraySize=0;
@@ -1048,7 +1048,9 @@ UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode )
//First validate and get access to the correct array based on strategic direction. //First validate and get access to the correct array based on strategic direction.
//We will use the selected array to choose insertion gridno's. //We will use the selected array to choose insertion gridno's.
switch( ubStrategicInsertionCode ) if( *ubStrategicInsertionCode == INSERTION_CODE_GRIDNO)
*ubStrategicInsertionCode = lastValidICode;
switch( *ubStrategicInsertionCode )
{ {
case INSERTION_CODE_NORTH: case INSERTION_CODE_NORTH:
psArray = gps1stNorthEdgepointArray; psArray = gps1stNorthEdgepointArray;
@@ -1251,7 +1253,7 @@ void EndMapEdgepointSearch()
//THIS CODE ISN'T RECOMMENDED FOR TIME CRITICAL AREAS. //THIS CODE ISN'T RECOMMENDED FOR TIME CRITICAL AREAS.
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode ) INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode, UINT8 *storedICode )
{ {
INT32 i, iDirectionLoop; INT32 i, iDirectionLoop;
INT16 *psArray=NULL; INT16 *psArray=NULL;
@@ -1263,6 +1265,8 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode
{ //Everything is reserved. { //Everything is reserved.
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum..."); AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
} }
if( ubInsertionCode == INSERTION_CODE_GRIDNO )
*storedICode = ubInsertionCode = defaultICode;
switch( ubInsertionCode ) switch( ubInsertionCode )
{ {
case INSERTION_CODE_NORTH: case INSERTION_CODE_NORTH:
+3 -2
View File
@@ -3,6 +3,7 @@
#include "types.h" #include "types.h"
#include "Fileman.h" #include "Fileman.h"
#include "strategic.h"
typedef struct MAPEDGEPOINTINFO typedef struct MAPEDGEPOINTINFO
{ {
@@ -11,7 +12,7 @@ typedef struct MAPEDGEPOINTINFO
INT16 sGridNo[ 32 ]; INT16 sGridNo[ 32 ];
}MAPEDGEPOINTINFO; }MAPEDGEPOINTINFO;
UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode ); UINT16 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode );
void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategicInsertionCode, UINT8 ubNumDesiredPoints ); void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategicInsertionCode, UINT8 ubNumDesiredPoints );
void GenerateMapEdgepoints(); void GenerateMapEdgepoints();
void SaveMapEdgepoints( HWFILE fp ); void SaveMapEdgepoints( HWFILE fp );
@@ -62,7 +63,7 @@ extern UINT16 gus2ndWestEdgepointMiddleIndex;
//code shouldn't be used for enemies or anybody else. //code shouldn't be used for enemies or anybody else.
void BeginMapEdgepointSearch(); void BeginMapEdgepointSearch();
void EndMapEdgepointSearch(); void EndMapEdgepointSearch();
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode ); INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode = INSERTION_CODE_GRIDNO, UINT8 *storedICode = NULL );
INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode ); INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
//There are two classes of edgepoints. //There are two classes of edgepoints.
+7 -2
View File
@@ -907,14 +907,16 @@ void KillTacticalPlacementGUI()
void ChooseRandomEdgepoints() void ChooseRandomEdgepoints()
{ {
INT32 i; INT32 i;
UINT8 lastValidICode = INSERTION_CODE_GRIDNO;
for( i = 0; i < giPlacements; i++ ) for( i = 0; i < giPlacements; i++ )
{ {
if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{ {
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( gMercPlacement[ i ].ubStrategicInsertionCode ); gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( &gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode );
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData != NOWHERE ) if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData != NOWHERE )
{ {
gMercPlacement[ i ].pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; gMercPlacement[ i ].pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
lastValidICode = gMercPlacement[ i ].ubStrategicInsertionCode;
} }
else else
{ {
@@ -1109,6 +1111,7 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
INT32 i; INT32 i;
INT16 sGridNo; INT16 sGridNo;
BOOLEAN fInvalidArea = FALSE; BOOLEAN fInvalidArea = FALSE;
UINT8 lastValidICode = INSERTION_CODE_GRIDNO;
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{ //if we have a selected merc, move him to the new closest map edgepoint of his side. { //if we have a selected merc, move him to the new closest map edgepoint of his side.
if( gfValidCursor ) if( gfValidCursor )
@@ -1127,12 +1130,14 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
//the problem. If everything's okay, we will place them all. //the problem. If everything's okay, we will place them all.
if( gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID ) if( gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID )
{ {
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode ); gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode, &gMercPlacement[ i ].ubStrategicInsertionCode );
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData == NOWHERE ) if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData == NOWHERE )
{ {
fInvalidArea = TRUE; fInvalidArea = TRUE;
break; break;
} }
else
lastValidICode = gMercPlacement[ i ].ubStrategicInsertionCode;
} }
} }
if( !fInvalidArea ) if( !fInvalidArea )
+4 -4
View File
@@ -66,7 +66,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\ja2_debug_2375_en.exe" OutputFile="$(OutDir)\ja2_debug_2385_en.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
@@ -145,7 +145,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\ja2_release_2375_en.exe" OutputFile="$(OutDir)\ja2_release_2385_en.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -229,7 +229,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\Map Editor_2375_en.exe" OutputFile="$(OutDir)\Map Editor_2385_en.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -316,7 +316,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\Map EditorD_2375_en.exe" OutputFile="$(OutDir)\Map EditorD_2385_en.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"