mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Added property pages to make it easy to change build language (at least with VS2K5)
Added support for Russian city names and Items Fixed contract length exploit (hire merc for 2 weeks for the price of 1 day) Fixed insurance emails repeating when you choose "delete" but then say no Corrected UTF-8 to wide char translation on Windows platforms (Windows doesn't handle mbstowcs correctly) Moved UTF-8 to Wide Char translation for item descriptions and names so it happens at XML load time (fix bug that Russian has half the description space) Fix overflow when combining two items with high counts (such as 200-round boxes of ammo) Path AI fixes Fixed issues with non-interruptable animations causing infinite clock Fixed some issues with soldiers not reaching their plotted destination Fixed escorted players who were cowering, being unable to move after joining party Only allow militia to climb roofs if their orders allow them to move Fix bug where AI might climb the wrong roof on the way to the destination roof Allow AI who have gone outside their patrol grid, to return to the Grid git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1702 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="German"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="GERMAN"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
||||||
@@ -89,6 +89,27 @@ extern BOOLEAN gfUseConsecutiveQuickSaveSlots;
|
|||||||
extern HINSTANCE ghInstance;
|
extern HINSTANCE ghInstance;
|
||||||
|
|
||||||
|
|
||||||
|
// Prepends the language prefix to the file name in a proposed path.
|
||||||
|
static void AddLanguagePrefix(STR fileName, const STR language)
|
||||||
|
{
|
||||||
|
char *fileComponent;
|
||||||
|
|
||||||
|
fileComponent = strrchr( fileName, '\\');
|
||||||
|
if (fileComponent)
|
||||||
|
{
|
||||||
|
fileComponent++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileComponent = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure to use the overlap-safe version of memory copy
|
||||||
|
memmove( fileComponent + strlen( language), fileComponent, strlen( fileComponent) + 1);
|
||||||
|
memmove( fileComponent, language, strlen( language) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN LoadExternalGameplayData(STR directoryName)
|
BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||||
{
|
{
|
||||||
char fileName[MAX_PATH];
|
char fileName[MAX_PATH];
|
||||||
@@ -373,6 +394,16 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
|||||||
if(!ReadInMapStructure(fileName))
|
if(!ReadInMapStructure(fileName))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef RUSSIAN
|
||||||
|
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||||
|
if ( FileExists(fileName) )
|
||||||
|
{
|
||||||
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||||
|
if(!ReadInMapStructure(fileName))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp,
|
// Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp,
|
||||||
// function BOOLEAN InitStrategicMovementCosts();
|
// function BOOLEAN InitStrategicMovementCosts();
|
||||||
// It is called several times from various places and acts after clearing SectorInfo array
|
// It is called several times from various places and acts after clearing SectorInfo array
|
||||||
|
|||||||
@@ -1592,6 +1592,8 @@ void BtnContractLengthButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
|
|
||||||
gubContractLength = ubRetValue;
|
gubContractLength = ubRetValue;
|
||||||
DisplaySelectLights(TRUE, FALSE);
|
DisplaySelectLights(TRUE, FALSE);
|
||||||
|
|
||||||
|
DisplayMercChargeAmount();
|
||||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||||
}
|
}
|
||||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||||
@@ -1626,6 +1628,7 @@ void BtnBuyEquipmentButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
gfBuyEquipment = (UINT8)MSYS_GetBtnUserData( btn, 0 );
|
gfBuyEquipment = (UINT8)MSYS_GetBtnUserData( btn, 0 );
|
||||||
DisplaySelectLights(FALSE, TRUE);
|
DisplaySelectLights(FALSE, TRUE);
|
||||||
|
|
||||||
|
DisplayMercChargeAmount();
|
||||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||||
}
|
}
|
||||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||||
|
|||||||
+13
-10
@@ -5008,21 +5008,24 @@ void ModifyInsuranceEmails( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail,
|
|||||||
// increment height for size of one line
|
// increment height for size of one line
|
||||||
iHeight+=GetFontHeight( MESSAGE_FONT );
|
iHeight+=GetFontHeight( MESSAGE_FONT );
|
||||||
|
|
||||||
for( ubCnt=0; ubCnt<ubNumberOfRecords; ubCnt++)
|
// list doesn't exist, reload
|
||||||
|
if( !pTempRecord )
|
||||||
{
|
{
|
||||||
// read one record from email file
|
for( ubCnt=0; ubCnt<ubNumberOfRecords; ubCnt++)
|
||||||
LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE );
|
{
|
||||||
|
// read one record from email file
|
||||||
//Replace the $MERCNAME$ and $AMOUNT$ with the mercs name and the amountm if the string contains the keywords.
|
LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * usMessageId, MAIL_STRING_SIZE );
|
||||||
ReplaceMercNameAndAmountWithProperData( pString, pMail );
|
|
||||||
|
|
||||||
// add to list
|
//Replace the $MERCNAME$ and $AMOUNT$ with the mercs name and the amountm if the string contains the keywords.
|
||||||
AddEmailRecordToList( pString );
|
ReplaceMercNameAndAmountWithProperData( pString, pMail );
|
||||||
|
|
||||||
usMessageId++;
|
// add to list
|
||||||
|
AddEmailRecordToList( pString );
|
||||||
|
|
||||||
|
usMessageId++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
giPrevMessageId = giMessageId;
|
giPrevMessageId = giMessageId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Russian"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="RUSSIAN"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
||||||
@@ -34,7 +34,7 @@ bool TStringiLess::operator() (std::string const& s1, std::string const& s2) con
|
|||||||
++p2;
|
++p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*p1) return *p2;
|
if (!*p1) return *p2 != 0;
|
||||||
if (!*p2) return false;
|
if (!*p2) return false;
|
||||||
|
|
||||||
return toupper(*p1) < toupper(*p2);
|
return toupper(*p1) < toupper(*p2);
|
||||||
|
|||||||
@@ -814,6 +814,8 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
|||||||
{
|
{
|
||||||
citytableParseData * pData = (citytableParseData *) userData;
|
citytableParseData * pData = (citytableParseData *) userData;
|
||||||
|
|
||||||
|
memset( pData->szCharData, 0, sizeof( pData->szCharData) );
|
||||||
|
|
||||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -918,7 +920,7 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
|||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
|
|
||||||
pData->szCharData[0] = '\0';
|
//pData->szCharData[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
pData->currentDepth++;
|
pData->currentDepth++;
|
||||||
@@ -986,7 +988,8 @@ citytableEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
gfTownUsesLoyalty [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townUsesLoyalty;
|
gfTownUsesLoyalty [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townUsesLoyalty;
|
||||||
gubTownRebelSentiment [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townRebelSentiment;
|
gubTownRebelSentiment [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townRebelSentiment;
|
||||||
gfMilitiaAllowedInTown[pData->curCityInfo.uiIndex ] = pData->curCityInfo.townMilitiaAllowed;
|
gfMilitiaAllowedInTown[pData->curCityInfo.uiIndex ] = pData->curCityInfo.townMilitiaAllowed;
|
||||||
mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT);
|
//mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT);
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->curCityInfo.cityName, -1, pTownNames[pData->curCityInfo.uiIndex], MAX_TOWN_NAME_LENGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "uiIndex") == 0 && pData->curElement == CITYTABLE_ELEMENT_INDEX)
|
else if(strcmp(name, "uiIndex") == 0 && pData->curElement == CITYTABLE_ELEMENT_INDEX)
|
||||||
|
|||||||
@@ -1389,9 +1389,9 @@ int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT8 ubIt
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//Madd: sort by name (for now at least):
|
//Madd: sort by name (for now at least):
|
||||||
if (_stricmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) < 0 )
|
if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
else if (_stricmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) > 0 )
|
else if (_wcsicmp(Item[usItem1Index].szBRName,Item[usItem2Index].szBRName) > 0 )
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1081,8 +1081,8 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
|
|||||||
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */
|
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */
|
||||||
if( pSoldier->inv[ cnt ].ItemData.Gun.ubGunAmmoType >= MAXITEMS )
|
if( pSoldier->inv[ cnt ].ItemData.Gun.ubGunAmmoType >= MAXITEMS )
|
||||||
{
|
{
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" ));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : L"???" ));
|
||||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" );
|
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : L"???" );
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
AssertMsg( 0, "pObject corrupted! GetHelpTextForItem() can crash." );
|
AssertMsg( 0, "pObject corrupted! GetHelpTextForItem() can crash." );
|
||||||
}
|
}
|
||||||
@@ -7447,8 +7447,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
|||||||
if ( (pObject->ItemData.Gun.ubGunAmmoType >= MAXITEMS)
|
if ( (pObject->ItemData.Gun.ubGunAmmoType >= MAXITEMS)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%s) found in GetHelpTextForItem()", (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" ));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%S) found in GetHelpTextForItem()", (usItem<MAXITEMS) ? Item[usItem].szItemName : L"???" ));
|
||||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"corrupted pObject (%S) found in GetHelpTextForItem()" , (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" );
|
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"corrupted pObject (%s) found in GetHelpTextForItem()" , (usItem<MAXITEMS) ? Item[usItem].szItemName : L"???" );
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
AssertMsg( 0, "GetHelpTextForItem() would crash" );
|
AssertMsg( 0, "GetHelpTextForItem() would crash" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ typedef struct
|
|||||||
UINT16 fFlags;
|
UINT16 fFlags;
|
||||||
|
|
||||||
UINT32 uiIndex; // added
|
UINT32 uiIndex; // added
|
||||||
CHAR8 szItemName[80]; //+1 for the null terminator //added
|
CHAR16 szItemName[80]; //+1 for the null terminator //added
|
||||||
|
|
||||||
BOOLEAN damageable;
|
BOOLEAN damageable;
|
||||||
BOOLEAN repairable;
|
BOOLEAN repairable;
|
||||||
@@ -297,10 +297,10 @@ typedef struct
|
|||||||
BOOLEAN electronic;
|
BOOLEAN electronic;
|
||||||
BOOLEAN inseparable;
|
BOOLEAN inseparable;
|
||||||
|
|
||||||
CHAR8 szLongItemName[80];
|
CHAR16 szLongItemName[80];
|
||||||
CHAR8 szItemDesc[400];
|
CHAR16 szItemDesc[400];
|
||||||
CHAR8 szBRName[80];
|
CHAR16 szBRName[80];
|
||||||
CHAR8 szBRDesc[400];
|
CHAR16 szBRDesc[400];
|
||||||
|
|
||||||
//TODO: quest items, boosters, money
|
//TODO: quest items, boosters, money
|
||||||
|
|
||||||
|
|||||||
+36
-11
@@ -3551,20 +3551,45 @@ BOOLEAN AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pTargetObj, OBJECTTYP
|
|||||||
// count down through # of attaching items and add to status of item in position 0
|
// count down through # of attaching items and add to status of item in position 0
|
||||||
for (bLoop = pAttachment->ubNumberOfObjects - 1; bLoop >= 0; bLoop--)
|
for (bLoop = pAttachment->ubNumberOfObjects - 1; bLoop >= 0; bLoop--)
|
||||||
{
|
{
|
||||||
if (pTargetObj->ItemData.Generic.bStatus[0] + pAttachment->ItemData.Generic.bStatus[bLoop] <= ubLimit)
|
if ( Item[ pTargetObj->usItem ].usItemClass == IC_AMMO )
|
||||||
{
|
{
|
||||||
// consume this one totally and continue
|
// Cast to a bigger int to prevent overflow
|
||||||
pTargetObj->ItemData.Generic.bStatus[0] += pAttachment->ItemData.Generic.bStatus[bLoop];
|
UINT32 uiTotal = pTargetObj->ItemData.Ammo.ubShotsLeft[0] + pAttachment->ItemData.Ammo.ubShotsLeft[bLoop];
|
||||||
RemoveObjFrom( pAttachment, bLoop );
|
if ( uiTotal <= ubLimit)
|
||||||
// reset loop limit
|
{
|
||||||
bLoop = pAttachment->ubNumberOfObjects; // add 1 to counteract the -1 from the loop
|
// consume this one totally and continue
|
||||||
}
|
pTargetObj->ItemData.Ammo.ubShotsLeft[0] = (UINT8) uiTotal;
|
||||||
|
RemoveObjFrom( pAttachment, bLoop );
|
||||||
|
// reset loop limit
|
||||||
|
bLoop = pAttachment->ubNumberOfObjects; // add 1 to counteract the -1 from the loop
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add part of this one and then we're done
|
||||||
|
pAttachment->ItemData.Ammo.ubShotsLeft[bLoop] = (UINT8) (uiTotal - ubLimit);
|
||||||
|
pTargetObj->ItemData.Ammo.ubShotsLeft[0] = ubLimit;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// add part of this one and then we're done
|
// Cast to a bigger int to prevent overflow
|
||||||
pAttachment->ItemData.Generic.bStatus[bLoop] -= (ubLimit - pTargetObj->ItemData.Generic.bStatus[0]);
|
INT32 iTotal = pTargetObj->ItemData.Generic.bStatus[0] + pAttachment->ItemData.Generic.bStatus[bLoop];
|
||||||
pTargetObj->ItemData.Generic.bStatus[0] = ubLimit;
|
if ( iTotal <= ubLimit)
|
||||||
break;
|
{
|
||||||
|
// consume this one totally and continue
|
||||||
|
pTargetObj->ItemData.Generic.bStatus[0] = (INT8) iTotal;
|
||||||
|
RemoveObjFrom( pAttachment, bLoop );
|
||||||
|
// reset loop limit
|
||||||
|
bLoop = pAttachment->ubNumberOfObjects; // add 1 to counteract the -1 from the loop
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add part of this one and then we're done
|
||||||
|
pAttachment->ItemData.Generic.bStatus[bLoop] = (INT8) (iTotal - ubLimit);
|
||||||
|
pTargetObj->ItemData.Generic.bStatus[0] = (INT8) ubLimit;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+3
-1
@@ -2302,9 +2302,11 @@ void RestorePathAIToDefaults( void )
|
|||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMovementMode, INT8 bCopy, UINT8 fFlags )
|
INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMovementMode, INT8 bCopy, UINT8 fFlags )
|
||||||
{
|
{
|
||||||
|
s->sPlotSrcGrid = s->sGridNo;
|
||||||
|
|
||||||
#ifdef USE_ASTAR_PATHS
|
#ifdef USE_ASTAR_PATHS
|
||||||
int retVal = ASTAR::AStarPathfinder::GetInstance().GetPath(s, sDestination, ubLevel, usMovementMode, bCopy, fFlags);
|
int retVal = ASTAR::AStarPathfinder::GetInstance().GetPath(s, sDestination, ubLevel, usMovementMode, bCopy, fFlags);
|
||||||
if (retVal) {
|
if (retVal || sDestination == NOWHERE) {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+25
-2
@@ -113,22 +113,45 @@ INT16 TerrainActionPoints( SOLDIERTYPE *pSoldier, INT16 sGridno, INT8 bDir, INT8
|
|||||||
case TRAVELCOST_DEBRIS : sAPCost += AP_MOVEMENT_RUBBLE;
|
case TRAVELCOST_DEBRIS : sAPCost += AP_MOVEMENT_RUBBLE;
|
||||||
break;
|
break;
|
||||||
case TRAVELCOST_SHORE : sAPCost += AP_MOVEMENT_SHORE; // wading shallow water
|
case TRAVELCOST_SHORE : sAPCost += AP_MOVEMENT_SHORE; // wading shallow water
|
||||||
|
if (!IS_MERC_BODY_TYPE( pSoldier ))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TRAVELCOST_KNEEDEEP : sAPCost += AP_MOVEMENT_LAKE; // wading waist/chest deep - very slow
|
case TRAVELCOST_KNEEDEEP : sAPCost += AP_MOVEMENT_LAKE; // wading waist/chest deep - very slow
|
||||||
|
if (!IS_MERC_BODY_TYPE( pSoldier ))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRAVELCOST_DEEPWATER: sAPCost += AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading
|
case TRAVELCOST_DEEPWATER: sAPCost += AP_MOVEMENT_OCEAN; // can swim, so it's faster than wading
|
||||||
|
if (!IS_MERC_BODY_TYPE( pSoldier ))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case TRAVELCOST_VEINEND :
|
case TRAVELCOST_VEINEND :
|
||||||
case TRAVELCOST_VEINMID : sAPCost += AP_MOVEMENT_FLAT;
|
case TRAVELCOST_VEINMID : sAPCost += AP_MOVEMENT_FLAT;
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
case TRAVELCOST_DOOR : sAPCost += AP_MOVEMENT_FLAT + AP_OPEN_DOOR + AP_OPEN_DOOR; // Include open and close costs!
|
case TRAVELCOST_DOOR :
|
||||||
|
if (pSoldier->bTeam == gbPlayerNum)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
sAPCost += AP_MOVEMENT_FLAT + AP_OPEN_DOOR + AP_OPEN_DOOR; // Include open and close costs!
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// cost for jumping a fence REPLACES all other AP costs!
|
// cost for jumping a fence REPLACES all other AP costs!
|
||||||
case TRAVELCOST_FENCE : return( AP_JUMPFENCE );
|
case TRAVELCOST_FENCE :
|
||||||
|
if (!IS_MERC_BODY_TYPE( pSoldier ))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( AP_JUMPFENCE );
|
||||||
|
|
||||||
case TRAVELCOST_NONE : return( 0 );
|
case TRAVELCOST_NONE : return( 0 );
|
||||||
|
|
||||||
|
|||||||
@@ -2391,6 +2391,10 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
|
|
||||||
// CHECK IF THIS NEW STATE IS NON-INTERRUPTABLE
|
// CHECK IF THIS NEW STATE IS NON-INTERRUPTABLE
|
||||||
// IF SO - SET NON-INT FLAG
|
// IF SO - SET NON-INT FLAG
|
||||||
|
// 0verhaul: Okay, here is a question: Is the "non-interrupt" supposed to be transferrable to other anims?
|
||||||
|
// That is, if one anim is not interruptable but it chains to another anim, should the "not interruptable" flag
|
||||||
|
// remain? I'm going to try out the theory that new animations should reset the "don't interrupt" flag.
|
||||||
|
#if 0
|
||||||
if ( uiNewAnimFlags & ANIM_NONINTERRUPT )
|
if ( uiNewAnimFlags & ANIM_NONINTERRUPT )
|
||||||
{
|
{
|
||||||
pSoldier->fInNonintAnim = TRUE;
|
pSoldier->fInNonintAnim = TRUE;
|
||||||
@@ -2400,6 +2404,10 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
{
|
{
|
||||||
pSoldier->fRTInNonintAnim = TRUE;
|
pSoldier->fRTInNonintAnim = TRUE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
pSoldier->fInNonintAnim = (uiNewAnimFlags & ANIM_NONINTERRUPT) != 0;
|
||||||
|
pSoldier->fRTInNonintAnim = (uiNewAnimFlags & ANIM_RT_NONINTERRUPT) != 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// CHECK IF WE ARE NOT AIMING, IF NOT, RESET LAST TAGRET!
|
// CHECK IF WE ARE NOT AIMING, IF NOT, RESET LAST TAGRET!
|
||||||
if ( !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !(gAnimControl[ usNewState ].uiFlags & ANIM_FIREREADY ) )
|
if ( !(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !(gAnimControl[ usNewState ].uiFlags & ANIM_FIREREADY ) )
|
||||||
@@ -2653,6 +2661,9 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
|||||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->ubDirection ) );
|
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||||
|
|
||||||
|
pSoldier->sPlotSrcGrid = pSoldier->sGridNo;
|
||||||
|
pSoldier->fPastXDest = FALSE;
|
||||||
|
pSoldier->fPastYDest = FALSE;
|
||||||
pSoldier->usPathDataSize = 0;
|
pSoldier->usPathDataSize = 0;
|
||||||
pSoldier->usPathIndex = 0;
|
pSoldier->usPathIndex = 0;
|
||||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
||||||
@@ -8409,13 +8420,13 @@ InternalGivingSoldierCancelServices( pSoldier, FALSE );
|
|||||||
|
|
||||||
void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange )
|
void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange )
|
||||||
{
|
{
|
||||||
INT16 dDegAngle;
|
//INT16 dDegAngle;
|
||||||
FLOAT dDeltaPos;
|
FLOAT dDeltaPos;
|
||||||
FLOAT dXPos , dYPos;
|
FLOAT dXPos , dYPos;
|
||||||
BOOLEAN fStop = FALSE;
|
BOOLEAN fStop = FALSE;
|
||||||
|
|
||||||
|
|
||||||
dDegAngle = (INT16)( dAngle * 180 / PI );
|
//dDegAngle = (INT16)( dAngle * 180 / PI );
|
||||||
//sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle );
|
//sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle );
|
||||||
|
|
||||||
// Find delta Movement for X pos
|
// Find delta Movement for X pos
|
||||||
@@ -8588,7 +8599,7 @@ UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 )
|
|||||||
DOUBLE test_x = sXPos2 - sXPos;
|
DOUBLE test_x = sXPos2 - sXPos;
|
||||||
DOUBLE test_y = sYPos2 - sYPos;
|
DOUBLE test_y = sYPos2 - sYPos;
|
||||||
UINT8 mFacing = WEST;
|
UINT8 mFacing = WEST;
|
||||||
INT16 dDegAngle;
|
//INT16 dDegAngle;
|
||||||
DOUBLE angle;
|
DOUBLE angle;
|
||||||
|
|
||||||
if ( test_x == 0 )
|
if ( test_x == 0 )
|
||||||
@@ -8599,7 +8610,7 @@ UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 )
|
|||||||
angle = atan2( test_x, test_y );
|
angle = atan2( test_x, test_y );
|
||||||
|
|
||||||
|
|
||||||
dDegAngle = (INT16)( angle * 180 / PI );
|
//dDegAngle = (INT16)( angle * 180 / PI );
|
||||||
//sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle );
|
//sprintf( gDebugStr, "Move Angle: %d", (int)dDegAngle );
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -11602,6 +11613,8 @@ void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
|||||||
// Remove any previous actions
|
// Remove any previous actions
|
||||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||||
|
|
||||||
|
pSoldier->sPlotSrcGrid = pSoldier->sGridNo;
|
||||||
|
|
||||||
// Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the
|
// Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the
|
||||||
// destination a lot of the time
|
// destination a lot of the time
|
||||||
pSoldier->fPastXDest = 0;
|
pSoldier->fPastXDest = 0;
|
||||||
@@ -11647,6 +11660,8 @@ void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
|||||||
// Remove any previous actions
|
// Remove any previous actions
|
||||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||||
|
|
||||||
|
pSoldier->sPlotSrcGrid = pSoldier->sGridNo;
|
||||||
|
|
||||||
// Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the
|
// Since we're manually setting our path, we have to reset these @#$@# flags too. Otherwise we don't reach the
|
||||||
// destination a lot of the time
|
// destination a lot of the time
|
||||||
pSoldier->fPastXDest = 0;
|
pSoldier->fPastXDest = 0;
|
||||||
@@ -11689,7 +11704,7 @@ void SetSoldierCowerState( SOLDIERTYPE *pSoldier, BOOLEAN fOn )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (pSoldier->uiStatusFlags & SOLDIER_COWERING) )
|
if ( (pSoldier->uiStatusFlags & SOLDIER_COWERING) || (gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND) )
|
||||||
{
|
{
|
||||||
EVENT_InitNewSoldierAnim( pSoldier, END_COWER, 0, FALSE );
|
EVENT_InitNewSoldierAnim( pSoldier, END_COWER, 0, FALSE );
|
||||||
|
|
||||||
|
|||||||
@@ -1073,6 +1073,8 @@ public:
|
|||||||
|
|
||||||
vector<int> bNewItemCount;
|
vector<int> bNewItemCount;
|
||||||
vector<int> bNewItemCycleCount;
|
vector<int> bNewItemCycleCount;
|
||||||
|
|
||||||
|
INT16 sPlotSrcGrid;
|
||||||
}; // SOLDIERTYPE;
|
}; // SOLDIERTYPE;
|
||||||
|
|
||||||
#define SIZEOF_SOLDIERTYPE_POD offsetof( SOLDIERTYPE, endOfPOD )
|
#define SIZEOF_SOLDIERTYPE_POD offsetof( SOLDIERTYPE, endOfPOD )
|
||||||
|
|||||||
@@ -950,6 +950,8 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
|
|||||||
pNewSoldier->bScientific = pSoldier->bScientific;
|
pNewSoldier->bScientific = pSoldier->bScientific;
|
||||||
pNewSoldier->bLastRenderVisibleValue = pSoldier->bLastRenderVisibleValue;
|
pNewSoldier->bLastRenderVisibleValue = pSoldier->bLastRenderVisibleValue;
|
||||||
pNewSoldier->bVisible = pSoldier->bVisible;
|
pNewSoldier->bVisible = pSoldier->bVisible;
|
||||||
|
// 0verhaul: Need to pass certain flags over. COWERING is one of them. Others to be determined.
|
||||||
|
pNewSoldier->uiStatusFlags |= pSoldier->uiStatusFlags & (SOLDIER_COWERING | SOLDIER_MUTE | SOLDIER_GASSED);
|
||||||
|
|
||||||
if ( ubTeam == gbPlayerNum )
|
if ( ubTeam == gbPlayerNum )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,11 +128,16 @@ ammoEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
if(pData->curIndex < pData->maxArraySize)
|
if(pData->curIndex < pData->maxArraySize)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
|
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
|
||||||
{
|
{
|
||||||
temp = pData->szCharData[i];
|
temp = pData->szCharData[i];
|
||||||
AmmoCaliber[pData->curIndex][i] = temp;
|
AmmoCaliber[pData->curIndex][i] = temp;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, AmmoCaliber[pData->curIndex], sizeof(AmmoCaliber[0])/sizeof(AmmoCaliber[0][0]) );
|
||||||
|
AmmoCaliber[pData->curIndex][sizeof(AmmoCaliber[0])/sizeof(AmmoCaliber[0][0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,11 +146,16 @@ ammoEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
if(pData->curIndex < pData->maxArraySize)
|
if(pData->curIndex < pData->maxArraySize)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
|
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
|
||||||
{
|
{
|
||||||
temp = pData->szCharData[i];
|
temp = pData->szCharData[i];
|
||||||
BobbyRayAmmoCaliber[pData->curIndex][i] = temp;
|
BobbyRayAmmoCaliber[pData->curIndex][i] = temp;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, BobbyRayAmmoCaliber[pData->curIndex], sizeof(BobbyRayAmmoCaliber[0])/sizeof(BobbyRayAmmoCaliber[0][0]) );
|
||||||
|
BobbyRayAmmoCaliber[pData->curIndex][sizeof(BobbyRayAmmoCaliber[0])/sizeof(BobbyRayAmmoCaliber[0][0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+345
-345
@@ -1957,73 +1957,73 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
|
|
||||||
void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, INT8 bOppLevel, UINT8 ubCaller, UINT8 ubCaller2)
|
void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, INT8 bOppLevel, UINT8 ubCaller, UINT8 ubCaller2)
|
||||||
{
|
{
|
||||||
INT8 bDoLocate = FALSE;
|
INT8 bDoLocate = FALSE;
|
||||||
BOOLEAN fNewOpponent = FALSE;
|
BOOLEAN fNewOpponent = FALSE;
|
||||||
BOOLEAN fNotAddedToList = TRUE;
|
BOOLEAN fNotAddedToList = TRUE;
|
||||||
INT8 bOldOppList = pSoldier->bOppList[pOpponent->ubID];
|
INT8 bOldOppList = pSoldier->bOppList[pOpponent->ubID];
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ManSeesMan");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ManSeesMan");
|
||||||
|
|
||||||
if (pSoldier->ubID >= TOTAL_SOLDIERS)
|
if (pSoldier->ubID >= TOTAL_SOLDIERS)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
NumMessage("ManSeesMan: ERROR - ptr->guynum = ",ptr->guynum);
|
NumMessage("ManSeesMan: ERROR - ptr->guynum = ",ptr->guynum);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOpponent->ubID >= TOTAL_SOLDIERS)
|
if (pOpponent->ubID >= TOTAL_SOLDIERS)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
NumMessage("ManSeesMan: ERROR - oppPtr->guynum = ",oppPtr->guynum);
|
NumMessage("ManSeesMan: ERROR - oppPtr->guynum = ",oppPtr->guynum);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're somehow looking while inactive, at base, dying or already dead
|
// if we're somehow looking while inactive, at base, dying or already dead
|
||||||
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->bLife < OKLIFE))
|
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->bLife < OKLIFE))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
sprintf(tempstr,"ManSeesMan: ERROR - %s is SEEING ManSeesMan while inactive/at base/dead/dying",ExtMen[ptr->guynum].name);
|
sprintf(tempstr,"ManSeesMan: ERROR - %s is SEEING ManSeesMan while inactive/at base/dead/dying",ExtMen[ptr->guynum].name);
|
||||||
PopMessage(tempstr);
|
PopMessage(tempstr);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're somehow seeing a guy who is inactive, at base, or already dead
|
// if we're somehow seeing a guy who is inactive, at base, or already dead
|
||||||
if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->bLife <= 0)
|
if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->bLife <= 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
sprintf(tempstr,"ManSeesMan: ERROR - %s sees %s, ManSeesMan, who is inactive/at base/dead",ExtMen[ptr->guynum].name,ExtMen[oppPtr->guynum].name);
|
sprintf(tempstr,"ManSeesMan: ERROR - %s sees %s, ManSeesMan, who is inactive/at base/dead",ExtMen[ptr->guynum].name,ExtMen[oppPtr->guynum].name);
|
||||||
PopMessage(tempstr);
|
PopMessage(tempstr);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if we're somehow seeing a guy who is on the same team
|
// if we're somehow seeing a guy who is on the same team
|
||||||
if (pSoldier->bTeam == pOpponent->bTeam)
|
if (pSoldier->bTeam == pOpponent->bTeam)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
sprintf(tempstr,"ManSeesMan: ERROR - on SAME TEAM. ptr->guynum = %d, oppPtr->guynum = %d",
|
sprintf(tempstr,"ManSeesMan: ERROR - on SAME TEAM. ptr->guynum = %d, oppPtr->guynum = %d",
|
||||||
ptr->guynum,oppPtr->guynum);
|
ptr->guynum,oppPtr->guynum);
|
||||||
PopMessage(tempstr);
|
PopMessage(tempstr);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're seeing a guy we didn't see on our last chance to look for him
|
// if we're seeing a guy we didn't see on our last chance to look for him
|
||||||
if (pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY)
|
if (pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY)
|
||||||
{
|
{
|
||||||
if ( pOpponent->bTeam == gbPlayerNum )
|
if ( pOpponent->bTeam == gbPlayerNum )
|
||||||
{
|
{
|
||||||
if ( pSoldier->ubProfile != NO_PROFILE )
|
if ( pSoldier->ubProfile != NO_PROFILE )
|
||||||
@@ -2048,95 +2048,95 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID );
|
AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID );
|
||||||
fNotAddedToList = FALSE;
|
fNotAddedToList = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fNotAddedToList )
|
if ( fNotAddedToList )
|
||||||
{
|
{
|
||||||
switch( pSoldier->ubProfile )
|
switch( pSoldier->ubProfile )
|
||||||
{
|
{
|
||||||
case CARMEN:
|
case CARMEN:
|
||||||
if (pOpponent->ubProfile == SLAY ) // 64
|
if (pOpponent->ubProfile == SLAY ) // 64
|
||||||
{
|
{
|
||||||
// Carmen goes to war (against Slay)
|
// Carmen goes to war (against Slay)
|
||||||
if ( pSoldier->bNeutral )
|
|
||||||
{
|
|
||||||
//SetSoldierNonNeutral( pSoldier );
|
|
||||||
pSoldier->bAttitude = ATTACKSLAYONLY;
|
|
||||||
TriggerNPCRecord( pSoldier->ubProfile, 28 );
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if ( ! gTacticalStatus.uiFlags & INCOMBAT )
|
|
||||||
{
|
|
||||||
EnterCombatMode( pSoldier->bTeam );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ELDIN:
|
|
||||||
if ( pSoldier->bNeutral )
|
if ( pSoldier->bNeutral )
|
||||||
{
|
{
|
||||||
UINT8 ubRoom = 0;
|
//SetSoldierNonNeutral( pSoldier );
|
||||||
// if player is in behind the ropes of the museum display
|
pSoldier->bAttitude = ATTACKSLAYONLY;
|
||||||
// or if alarm has gone off (status red)
|
TriggerNPCRecord( pSoldier->ubProfile, 28 );
|
||||||
InARoom( pOpponent->sGridNo, &ubRoom );
|
}
|
||||||
|
/*
|
||||||
|
if ( ! gTacticalStatus.uiFlags & INCOMBAT )
|
||||||
|
{
|
||||||
|
EnterCombatMode( pSoldier->bTeam );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ELDIN:
|
||||||
|
if ( pSoldier->bNeutral )
|
||||||
|
{
|
||||||
|
UINT8 ubRoom = 0;
|
||||||
|
// if player is in behind the ropes of the museum display
|
||||||
|
// or if alarm has gone off (status red)
|
||||||
|
InARoom( pOpponent->sGridNo, &ubRoom );
|
||||||
|
|
||||||
if ( ( CheckFact( FACT_MUSEUM_OPEN, 0 ) == FALSE && ubRoom >= 22 && ubRoom <= 41 ) || CheckFact( FACT_MUSEUM_ALARM_WENT_OFF, 0 ) || ( ubRoom == 39 || ubRoom == 40 ) || ( FindObj( pOpponent, CHALICE ) != NO_SLOT ) )
|
if ( ( CheckFact( FACT_MUSEUM_OPEN, 0 ) == FALSE && ubRoom >= 22 && ubRoom <= 41 ) || CheckFact( FACT_MUSEUM_ALARM_WENT_OFF, 0 ) || ( ubRoom == 39 || ubRoom == 40 ) || ( FindObj( pOpponent, CHALICE ) != NO_SLOT ) )
|
||||||
{
|
|
||||||
SetFactTrue( FACT_MUSEUM_ALARM_WENT_OFF );
|
|
||||||
AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case JIM:
|
|
||||||
case JACK:
|
|
||||||
case OLAF:
|
|
||||||
case RAY:
|
|
||||||
case OLGA:
|
|
||||||
case TYRONE:
|
|
||||||
// change orders, reset action!
|
|
||||||
if ( pSoldier->bOrders != SEEKENEMY )
|
|
||||||
{
|
{
|
||||||
pSoldier->bOrders = SEEKENEMY;
|
SetFactTrue( FACT_MUSEUM_ALARM_WENT_OFF );
|
||||||
if ( pSoldier->bOppCnt == 0 )
|
AddToShouldBecomeHostileOrSayQuoteList( pSoldier->ubID );
|
||||||
{
|
|
||||||
// didn't see anyone before!
|
|
||||||
CancelAIAction( pSoldier, TRUE );
|
|
||||||
SetNewSituation( pSoldier );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case ANGEL:
|
break;
|
||||||
if ( pOpponent->ubProfile == MARIA )
|
case JIM:
|
||||||
{
|
case JACK:
|
||||||
if ( CheckFact( FACT_MARIA_ESCORTED_AT_LEATHER_SHOP, MARIA ) == TRUE )
|
case OLAF:
|
||||||
{
|
case RAY:
|
||||||
// she was rescued! yay!
|
case OLGA:
|
||||||
TriggerNPCRecord( ANGEL, 12 );
|
case TYRONE:
|
||||||
}
|
// change orders, reset action!
|
||||||
}
|
if ( pSoldier->bOrders != SEEKENEMY )
|
||||||
else if ( ( CheckFact( FACT_ANGEL_LEFT_DEED, ANGEL ) == TRUE ) && ( CheckFact( FACT_ANGEL_MENTIONED_DEED, ANGEL ) == FALSE ) )
|
{
|
||||||
|
pSoldier->bOrders = SEEKENEMY;
|
||||||
|
if ( pSoldier->bOppCnt == 0 )
|
||||||
{
|
{
|
||||||
|
// didn't see anyone before!
|
||||||
CancelAIAction( pSoldier, TRUE );
|
CancelAIAction( pSoldier, TRUE );
|
||||||
pSoldier->sAbsoluteFinalDestination = NOWHERE;
|
SetNewSituation( pSoldier );
|
||||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
|
||||||
TriggerNPCRecord( ANGEL, 20 );
|
|
||||||
// trigger Angel to walk off afterwards
|
|
||||||
//TriggerNPCRecord( ANGEL, 24 );
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
//case QUEEN:
|
break;
|
||||||
case JOE:
|
case ANGEL:
|
||||||
case ELLIOT:
|
if ( pOpponent->ubProfile == MARIA )
|
||||||
if ( ! ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
{
|
||||||
|
if ( CheckFact( FACT_MARIA_ESCORTED_AT_LEATHER_SHOP, MARIA ) == TRUE )
|
||||||
{
|
{
|
||||||
if ( !AreInMeanwhile() )
|
// she was rescued! yay!
|
||||||
{
|
TriggerNPCRecord( ANGEL, 12 );
|
||||||
TriggerNPCRecord( pSoldier->ubProfile, 4 );
|
|
||||||
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
else if ( ( CheckFact( FACT_ANGEL_LEFT_DEED, ANGEL ) == TRUE ) && ( CheckFact( FACT_ANGEL_MENTIONED_DEED, ANGEL ) == FALSE ) )
|
||||||
break;
|
{
|
||||||
|
CancelAIAction( pSoldier, TRUE );
|
||||||
|
pSoldier->sAbsoluteFinalDestination = NOWHERE;
|
||||||
|
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||||
|
TriggerNPCRecord( ANGEL, 20 );
|
||||||
|
// trigger Angel to walk off afterwards
|
||||||
|
//TriggerNPCRecord( ANGEL, 24 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//case QUEEN:
|
||||||
|
case JOE:
|
||||||
|
case ELLIOT:
|
||||||
|
if ( ! ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
||||||
|
{
|
||||||
|
if ( !AreInMeanwhile() )
|
||||||
|
{
|
||||||
|
TriggerNPCRecord( pSoldier->ubProfile, 4 );
|
||||||
|
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2146,21 +2146,21 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
case MIKE:
|
case MIKE:
|
||||||
if ( gfPlayerTeamSawMike && !( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
if ( gfPlayerTeamSawMike && !( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
||||||
{
|
{
|
||||||
InitiateConversation( pSoldier, pOpponent, NPC_INITIAL_QUOTE, 0 );
|
InitiateConversation( pSoldier, pOpponent, NPC_INITIAL_QUOTE, 0 );
|
||||||
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
case IGGY:
|
case IGGY:
|
||||||
if ( ! ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
if ( ! ( gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) )
|
||||||
{
|
{
|
||||||
TriggerNPCRecord( pSoldier->ubProfile, 9 );
|
TriggerNPCRecord( pSoldier->ubProfile, 9 );
|
||||||
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE;
|
||||||
gbPublicOpplist[ gbPlayerNum ][ pSoldier->ubID ] = HEARD_THIS_TURN;
|
gbPublicOpplist[ gbPlayerNum ][ pSoldier->ubID ] = HEARD_THIS_TURN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2206,7 +2206,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
else if ( pSoldier->ubCivilianGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) == FALSE )
|
else if ( pSoldier->ubCivilianGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) == FALSE )
|
||||||
{
|
{
|
||||||
UINT32 uiTime;
|
UINT32 uiTime;
|
||||||
INT16 sX, sY;
|
INT16 sX, sY;
|
||||||
|
|
||||||
// if before 6:05 or after 22:00, make hostile and enter combat
|
// if before 6:05 or after 22:00, make hostile and enter combat
|
||||||
uiTime = GetWorldMinutesInDay();
|
uiTime = GetWorldMinutesInDay();
|
||||||
@@ -2218,99 +2218,99 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
{
|
{
|
||||||
EnterCombatMode( pSoldier->bTeam );
|
EnterCombatMode( pSoldier->bTeam );
|
||||||
|
|
||||||
LocateSoldier( pSoldier->ubID, TRUE );
|
LocateSoldier( pSoldier->ubID, TRUE );
|
||||||
GetSoldierScreenPos( pSoldier, &sX, &sY );
|
GetSoldierScreenPos( pSoldier, &sX, &sY );
|
||||||
// begin quote
|
// begin quote
|
||||||
BeginCivQuote( pSoldier, CIV_QUOTE_HICKS_SEE_US_AT_NIGHT, 0, sX, sY );
|
BeginCivQuote( pSoldier, CIV_QUOTE_HICKS_SEE_US_AT_NIGHT, 0, sX, sY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( pSoldier->bTeam == gbPlayerNum )
|
else if ( pSoldier->bTeam == gbPlayerNum )
|
||||||
{
|
{
|
||||||
if ( (pOpponent->ubProfile == MIKE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && !(pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MIKE) )
|
if ( (pOpponent->ubProfile == MIKE) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) && !(pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_MIKE) )
|
||||||
{
|
{
|
||||||
if (gfMikeShouldSayHi == FALSE)
|
if (gfMikeShouldSayHi == FALSE)
|
||||||
{
|
{
|
||||||
gfMikeShouldSayHi = TRUE;
|
gfMikeShouldSayHi = TRUE;
|
||||||
}
|
}
|
||||||
TacticalCharacterDialogue( pSoldier, QUOTE_AIM_SEEN_MIKE );
|
TacticalCharacterDialogue( pSoldier, QUOTE_AIM_SEEN_MIKE );
|
||||||
pSoldier->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_MIKE;
|
pSoldier->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_MIKE;
|
||||||
}
|
}
|
||||||
else if ( pOpponent->ubProfile == JOEY && gfPlayerTeamSawJoey == FALSE )
|
else if ( pOpponent->ubProfile == JOEY && gfPlayerTeamSawJoey == FALSE )
|
||||||
{
|
{
|
||||||
TacticalCharacterDialogue( pSoldier, QUOTE_SPOTTED_JOEY );
|
TacticalCharacterDialogue( pSoldier, QUOTE_SPOTTED_JOEY );
|
||||||
gfPlayerTeamSawJoey = TRUE;
|
gfPlayerTeamSawJoey = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// as soon as a bloodcat sees someone, it becomes hostile
|
// as soon as a bloodcat sees someone, it becomes hostile
|
||||||
// this is safe to do here because we haven't made this new person someone we've seen yet
|
// this is safe to do here because we haven't made this new person someone we've seen yet
|
||||||
// (so we are assured we won't count 'em twice for oppcnt purposes)
|
// (so we are assured we won't count 'em twice for oppcnt purposes)
|
||||||
if ( pSoldier->ubBodyType == BLOODCAT )
|
if ( pSoldier->ubBodyType == BLOODCAT )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bNeutral )
|
if ( pSoldier->bNeutral )
|
||||||
{
|
{
|
||||||
|
MakeBloodcatsHostile();
|
||||||
|
/*
|
||||||
|
SetSoldierNonNeutral( pSoldier );
|
||||||
|
RecalculateOppCntsDueToNoLongerNeutral( pSoldier );
|
||||||
|
if ( ( gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||||
|
{
|
||||||
|
CheckForPotentialAddToBattleIncrement( pSoldier );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
PlayJA2Sample( BLOODCAT_ROAR, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( pSoldier->bOppCnt == 0 )
|
||||||
|
{
|
||||||
|
if ( Random( 2 ) == 0 )
|
||||||
|
{
|
||||||
|
PlayJA2Sample( BLOODCAT_ROAR, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( pOpponent->ubBodyType == BLOODCAT && pOpponent->bNeutral)
|
||||||
|
{
|
||||||
MakeBloodcatsHostile();
|
MakeBloodcatsHostile();
|
||||||
/*
|
/*
|
||||||
SetSoldierNonNeutral( pSoldier );
|
SetSoldierNonNeutral( pOpponent );
|
||||||
RecalculateOppCntsDueToNoLongerNeutral( pSoldier );
|
RecalculateOppCntsDueToNoLongerNeutral( pOpponent );
|
||||||
if ( ( gTacticalStatus.uiFlags & INCOMBAT ) )
|
if ( ( gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||||
{
|
{
|
||||||
CheckForPotentialAddToBattleIncrement( pSoldier );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
PlayJA2Sample( BLOODCAT_ROAR, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( pSoldier->bOppCnt == 0 )
|
|
||||||
{
|
|
||||||
if ( Random( 2 ) == 0 )
|
|
||||||
{
|
|
||||||
PlayJA2Sample( BLOODCAT_ROAR, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( pOpponent->ubBodyType == BLOODCAT && pOpponent->bNeutral)
|
|
||||||
{
|
|
||||||
MakeBloodcatsHostile();
|
|
||||||
/*
|
|
||||||
SetSoldierNonNeutral( pOpponent );
|
|
||||||
RecalculateOppCntsDueToNoLongerNeutral( pOpponent );
|
|
||||||
if ( ( gTacticalStatus.uiFlags & INCOMBAT ) )
|
|
||||||
{
|
|
||||||
CheckForPotentialAddToBattleIncrement( pOpponent );
|
CheckForPotentialAddToBattleIncrement( pOpponent );
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// if both of us are not neutral, AND
|
// if both of us are not neutral, AND
|
||||||
// if this man is actually a true opponent (we're not on the same side)
|
// if this man is actually a true opponent (we're not on the same side)
|
||||||
if (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide))
|
if (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide))
|
||||||
{
|
{
|
||||||
AddOneOpponent(pSoldier);
|
AddOneOpponent(pSoldier);
|
||||||
|
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "ManSeesMan: ID %d(%S) to ID %d NEW TO ME",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "ManSeesMan: ID %d(%S) to ID %d NEW TO ME",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if we also haven't seen him earlier this turn
|
// if we also haven't seen him earlier this turn
|
||||||
if (pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN)
|
if (pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN)
|
||||||
{
|
{
|
||||||
fNewOpponent = TRUE;
|
fNewOpponent = TRUE;
|
||||||
pSoldier->bNewOppCnt++; // increment looker's NEW opponent count
|
pSoldier->bNewOppCnt++; // increment looker's NEW opponent count
|
||||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d sees soldier %d!", pSoldier->ubID, pOpponent->ubID );
|
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d sees soldier %d!", pSoldier->ubID, pOpponent->ubID );
|
||||||
|
|
||||||
//ExtMen[ptr->guynum].lastCaller = caller;
|
//ExtMen[ptr->guynum].lastCaller = caller;
|
||||||
//ExtMen[ptr->guynum].lastCaller2 = caller2;
|
//ExtMen[ptr->guynum].lastCaller2 = caller2;
|
||||||
|
|
||||||
IncrementWatchedLoc( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel );
|
IncrementWatchedLoc( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel );
|
||||||
|
|
||||||
if ( pSoldier->bTeam == OUR_TEAM && pOpponent->bTeam == ENEMY_TEAM )
|
if ( pSoldier->bTeam == OUR_TEAM && pOpponent->bTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
if ( CheckFact( FACT_FIRST_BATTLE_FOUGHT, 0 ) == FALSE )
|
if ( CheckFact( FACT_FIRST_BATTLE_FOUGHT, 0 ) == FALSE )
|
||||||
@@ -2320,182 +2320,182 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetWatchedLocAsUsed( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel );
|
SetWatchedLocAsUsed( pSoldier->ubID, pOpponent->sGridNo, pOpponent->bLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
// we already know the soldier isn't SEEN_CURRENTLY,
|
// we already know the soldier isn't SEEN_CURRENTLY,
|
||||||
// now check if he is really "NEW" ie. not expected to be there
|
// now check if he is really "NEW" ie. not expected to be there
|
||||||
|
|
||||||
// if the looker hasn't seen this opponent at all earlier this turn, OR
|
// if the looker hasn't seen this opponent at all earlier this turn, OR
|
||||||
// if the opponent is not where the looker last thought him to be
|
// if the opponent is not where the looker last thought him to be
|
||||||
if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN) ||
|
if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_THIS_TURN) ||
|
||||||
(gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID] != sOppGridno))
|
(gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID] != sOppGridno))
|
||||||
{
|
{
|
||||||
SetNewSituation( pSoldier ); // force the looker to re-evaluate
|
SetNewSituation( pSoldier ); // force the looker to re-evaluate
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we in a non-combat movement decision, presumably this is not
|
// if we in a non-combat movement decision, presumably this is not
|
||||||
// something we were quite expecting, so make a new decision. For
|
// something we were quite expecting, so make a new decision. For
|
||||||
// other (combat) movement decisions, we took his position into account
|
// other (combat) movement decisions, we took his position into account
|
||||||
// when we made it, so don't make us think again & slow things down.
|
// when we made it, so don't make us think again & slow things down.
|
||||||
switch (pSoldier->bAction)
|
switch (pSoldier->bAction)
|
||||||
{
|
{
|
||||||
case AI_ACTION_RANDOM_PATROL:
|
case AI_ACTION_RANDOM_PATROL:
|
||||||
case AI_ACTION_SEEK_OPPONENT:
|
case AI_ACTION_SEEK_OPPONENT:
|
||||||
case AI_ACTION_SEEK_FRIEND:
|
case AI_ACTION_SEEK_FRIEND:
|
||||||
case AI_ACTION_POINT_PATROL:
|
case AI_ACTION_POINT_PATROL:
|
||||||
case AI_ACTION_LEAVE_WATER_GAS:
|
case AI_ACTION_LEAVE_WATER_GAS:
|
||||||
case AI_ACTION_SEEK_NOISE:
|
case AI_ACTION_SEEK_NOISE:
|
||||||
SetNewSituation( pSoldier ); // force the looker to re-evaluate
|
SetNewSituation( pSoldier ); // force the looker to re-evaluate
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
else
|
else
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "ManSeesMan: ID %d(%S) to ID %d ALREADYSEENCURRENTLY",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "ManSeesMan: ID %d(%S) to ID %d ALREADYSEENCURRENTLY",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
//bOldOppValue = pSoldier->bOppList[ pOpponent->ubID ];
|
//bOldOppValue = pSoldier->bOppList[ pOpponent->ubID ];
|
||||||
// remember that the soldier is currently seen and his new location
|
// remember that the soldier is currently seen and his new location
|
||||||
UpdatePersonal(pSoldier,pOpponent->ubID,SEEN_CURRENTLY,sOppGridno,bOppLevel);
|
UpdatePersonal(pSoldier,pOpponent->ubID,SEEN_CURRENTLY,sOppGridno,bOppLevel);
|
||||||
|
|
||||||
if ( ubCaller2 == MANLOOKSFOROTHERTEAMS || ubCaller2 == OTHERTEAMSLOOKFORMAN || ubCaller2 == CALLER_UNKNOWN ) // unknown->hearing
|
if ( ubCaller2 == MANLOOKSFOROTHERTEAMS || ubCaller2 == OTHERTEAMSLOOKFORMAN || ubCaller2 == CALLER_UNKNOWN ) // unknown->hearing
|
||||||
{
|
|
||||||
|
|
||||||
if ( gubBestToMakeSightingSize != BEST_SIGHTING_ARRAY_SIZE_INCOMBAT && gTacticalStatus.bBoxingState == NOT_BOXING )
|
|
||||||
{
|
{
|
||||||
if ( fNewOpponent )
|
|
||||||
|
if ( gubBestToMakeSightingSize != BEST_SIGHTING_ARRAY_SIZE_INCOMBAT && gTacticalStatus.bBoxingState == NOT_BOXING )
|
||||||
{
|
{
|
||||||
if ( gTacticalStatus.uiFlags & INCOMBAT )
|
if ( fNewOpponent )
|
||||||
{
|
{
|
||||||
// presumably a door opening... we do require standard interrupt conditions
|
if ( gTacticalStatus.uiFlags & INCOMBAT )
|
||||||
if (StandardInterruptConditionsMet(pSoldier,pOpponent->ubID,bOldOppList))
|
{
|
||||||
|
// presumably a door opening... we do require standard interrupt conditions
|
||||||
|
if (StandardInterruptConditionsMet(pSoldier,pOpponent->ubID,bOldOppList))
|
||||||
|
{
|
||||||
|
ReevaluateBestSightingPosition( pSoldier, CalcInterruptDuelPts( pSoldier, pOpponent->ubID, TRUE ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// require the enemy not to be dying if we are the sighter; in other words,
|
||||||
|
// always add for AI guys, and always add for people with life >= OKLIFE
|
||||||
|
else if ( !(pSoldier->bTeam == gbPlayerNum && pOpponent->bLife < OKLIFE ) )
|
||||||
{
|
{
|
||||||
ReevaluateBestSightingPosition( pSoldier, CalcInterruptDuelPts( pSoldier, pOpponent->ubID, TRUE ) );
|
ReevaluateBestSightingPosition( pSoldier, CalcInterruptDuelPts( pSoldier, pOpponent->ubID, TRUE ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// require the enemy not to be dying if we are the sighter; in other words,
|
|
||||||
// always add for AI guys, and always add for people with life >= OKLIFE
|
|
||||||
else if ( !(pSoldier->bTeam == gbPlayerNum && pOpponent->bLife < OKLIFE ) )
|
|
||||||
{
|
|
||||||
ReevaluateBestSightingPosition( pSoldier, CalcInterruptDuelPts( pSoldier, pOpponent->ubID, TRUE ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if this man has never seen this opponent before in this sector
|
// if this man has never seen this opponent before in this sector
|
||||||
if (gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] == FALSE)
|
if (gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] == FALSE)
|
||||||
// remember that he is just seeing him now for the first time (-1)
|
// remember that he is just seeing him now for the first time (-1)
|
||||||
gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] = -1;
|
gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] = -1;
|
||||||
else
|
else
|
||||||
// man is seeing an opponent AGAIN whom he has seen at least once before
|
// man is seeing an opponent AGAIN whom he has seen at least once before
|
||||||
gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] = TRUE;
|
gbSeenOpponents[pSoldier->ubID][pOpponent->ubID] = TRUE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if looker is on local team, and the enemy was invisible or "maybe"
|
// if looker is on local team, and the enemy was invisible or "maybe"
|
||||||
// visible just prior to this
|
// visible just prior to this
|
||||||
#ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA
|
#ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA
|
||||||
if ( ( PTR_OURTEAM || (pSoldier->bTeam == MILITIA_TEAM) ) && (pOpponent->bVisible <= 0))
|
if ( ( PTR_OURTEAM || (pSoldier->bTeam == MILITIA_TEAM) ) && (pOpponent->bVisible <= 0))
|
||||||
#else
|
#else
|
||||||
if (PTR_OURTEAM && (pOpponent->bVisible <= 0))
|
if (PTR_OURTEAM && (pOpponent->bVisible <= 0))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// if opponent was truly invisible, not just turned off temporarily (FALSE)
|
// if opponent was truly invisible, not just turned off temporarily (FALSE)
|
||||||
if (pOpponent->bVisible == -1)
|
if (pOpponent->bVisible == -1)
|
||||||
{
|
|
||||||
// then locate to him and set his locator flag
|
|
||||||
bDoLocate = TRUE;
|
|
||||||
|
|
||||||
//rain
|
|
||||||
if( gfLightningInProgress ) gfHaveSeenSomeone = TRUE;
|
|
||||||
//end rain
|
|
||||||
}
|
|
||||||
|
|
||||||
// make opponent visible (to us)
|
|
||||||
// must do this BEFORE the locate since it checks for visibility
|
|
||||||
pOpponent->bVisible = TRUE;
|
|
||||||
|
|
||||||
//ATE: Cancel any fading going on!
|
|
||||||
// ATE: Added for fade in.....
|
|
||||||
if ( pOpponent->fBeginFade == 1 || pOpponent->fBeginFade == 2 )
|
|
||||||
{
|
|
||||||
pOpponent->fBeginFade = FALSE;
|
|
||||||
|
|
||||||
if ( pOpponent->bLevel > 0 && gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead != NULL )
|
|
||||||
{
|
{
|
||||||
pOpponent->ubFadeLevel = gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead->ubShadeLevel;
|
// then locate to him and set his locator flag
|
||||||
|
bDoLocate = TRUE;
|
||||||
|
|
||||||
|
//rain
|
||||||
|
if( gfLightningInProgress ) gfHaveSeenSomeone = TRUE;
|
||||||
|
//end rain
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// make opponent visible (to us)
|
||||||
|
// must do this BEFORE the locate since it checks for visibility
|
||||||
|
pOpponent->bVisible = TRUE;
|
||||||
|
|
||||||
|
//ATE: Cancel any fading going on!
|
||||||
|
// ATE: Added for fade in.....
|
||||||
|
if ( pOpponent->fBeginFade == 1 || pOpponent->fBeginFade == 2 )
|
||||||
{
|
{
|
||||||
pOpponent->ubFadeLevel = gpWorldLevelData[ pOpponent->sGridNo ].pLandHead->ubShadeLevel;
|
pOpponent->fBeginFade = FALSE;
|
||||||
|
|
||||||
|
if ( pOpponent->bLevel > 0 && gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead != NULL )
|
||||||
|
{
|
||||||
|
pOpponent->ubFadeLevel = gpWorldLevelData[ pOpponent->sGridNo ].pRoofHead->ubShadeLevel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pOpponent->ubFadeLevel = gpWorldLevelData[ pOpponent->sGridNo ].pLandHead->ubShadeLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set levelnode shade level....
|
||||||
|
if ( pOpponent->pLevelNode )
|
||||||
|
{
|
||||||
|
pOpponent->pLevelNode->ubShadeLevel = pOpponent->ubFadeLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set levelnode shade level....
|
|
||||||
if ( pOpponent->pLevelNode )
|
|
||||||
{
|
|
||||||
pOpponent->pLevelNode->ubShadeLevel = pOpponent->ubFadeLevel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("!!! ID %d (%S) MAKING %d VISIBLE",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("!!! ID %d (%S) MAKING %d VISIBLE",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update variable for STATUS screen
|
// update variable for STATUS screen
|
||||||
//pOpponent->bLastKnownLife = pOpponent->life;
|
//pOpponent->bLastKnownLife = pOpponent->life;
|
||||||
|
|
||||||
if (bDoLocate)
|
if (bDoLocate)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Change his anim speed!
|
// Change his anim speed!
|
||||||
SetSoldierAniSpeed( pOpponent );
|
SetSoldierAniSpeed( pOpponent );
|
||||||
|
|
||||||
// if show enemies is ON, then we must have already revealed these roofs
|
// if show enemies is ON, then we must have already revealed these roofs
|
||||||
// and we're also following his movements, so don't bother sliding
|
// and we're also following his movements, so don't bother sliding
|
||||||
if (!gbShowEnemies)
|
if (!gbShowEnemies)
|
||||||
{
|
{
|
||||||
//DoSoldierRoofs(pOpponent);
|
//DoSoldierRoofs(pOpponent);
|
||||||
|
|
||||||
// slide to the newly seen opponent, and if appropriate, start his locator
|
// slide to the newly seen opponent, and if appropriate, start his locator
|
||||||
//SlideToMe = oppPtr->guynum;
|
//SlideToMe = oppPtr->guynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
//LastOpponentLocatedTo = oppPtr->guynum;
|
//LastOpponentLocatedTo = oppPtr->guynum;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef RECORDNET
|
#ifdef RECORDNET
|
||||||
fprintf(NetDebugFile,"\tManSeesMan - LOCATE\n");
|
fprintf(NetDebugFile,"\tManSeesMan - LOCATE\n");
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ( gTacticalStatus.uiFlags & TURNBASED && ( ( gTacticalStatus.uiFlags & INCOMBAT ) | gTacticalStatus.fVirginSector ) )
|
if ( gTacticalStatus.uiFlags & TURNBASED && ( ( gTacticalStatus.uiFlags & INCOMBAT ) | gTacticalStatus.fVirginSector ) )
|
||||||
{
|
{
|
||||||
if (!pOpponent->bNeutral && (pSoldier->bSide != pOpponent->bSide))
|
if (!pOpponent->bNeutral && (pSoldier->bSide != pOpponent->bSide))
|
||||||
{
|
{
|
||||||
//SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATOR);
|
//SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATOR);
|
||||||
//rain
|
//rain
|
||||||
SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATORFAST);
|
SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATORFAST);
|
||||||
//end rain
|
//end rain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!PTR_OURTEAM)
|
else if (!PTR_OURTEAM)
|
||||||
{
|
{
|
||||||
// ATE: Check stance, change to threatending
|
// ATE: Check stance, change to threatending
|
||||||
ReevaluateEnemyStance( pSoldier, pSoldier->usAnimState );
|
ReevaluateEnemyStance( pSoldier, pSoldier->usAnimState );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1559,7 +1559,7 @@ INT16 ClosestReachableFriendInTrouble(SOLDIERTYPE *pSoldier, BOOLEAN * pfClimbin
|
|||||||
// civilians don't really have any "friends", so they don't bother with this
|
// civilians don't really have any "friends", so they don't bother with this
|
||||||
if (PTR_CIVILIAN)
|
if (PTR_CIVILIAN)
|
||||||
{
|
{
|
||||||
return(sClosestFriend);
|
return(NOWHERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// consider every friend of this soldier (locations assumed to be known)
|
// consider every friend of this soldier (locations assumed to be known)
|
||||||
|
|||||||
+25
-11
@@ -958,7 +958,8 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
|
|
||||||
//hide those suicidal militia on the roofs for better defensive positions
|
//hide those suicidal militia on the roofs for better defensive positions
|
||||||
if ( pSoldier->bTeam == MILITIA_TEAM )
|
// 0verhaul: If they are allowed at all to move
|
||||||
|
if ( pSoldier->bTeam == MILITIA_TEAM && iChance != 0)
|
||||||
iChance += 20;
|
iChance += 20;
|
||||||
|
|
||||||
// reduce chance for any injury, less likely to hop up if hurt
|
// reduce chance for any injury, less likely to hop up if hurt
|
||||||
@@ -1636,7 +1637,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
if (!fUp)
|
if (!fUp)
|
||||||
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d, is climbing down",pSoldier->ubID) );
|
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d, is climbing down",pSoldier->ubID) );
|
||||||
|
|
||||||
if ( CanClimbFromHere ( pSoldier, fUp ) )
|
// 0verhaul: the Closest Noise call returns the location of a climb. So 1) it's not necessary to
|
||||||
|
// ask if we can climb from here. And 2) It's not necessary to look for the climb point. We already
|
||||||
|
// have it.
|
||||||
|
// if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||||
|
if ( pSoldier->sGridNo == sNoiseGridNo)
|
||||||
{
|
{
|
||||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sNoiseGridNo, ADDTURNCOST)))
|
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sNoiseGridNo, ADDTURNCOST)))
|
||||||
{
|
{
|
||||||
@@ -1645,8 +1650,9 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp );
|
// pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp );
|
||||||
if ( pSoldier->usActionData != NOWHERE )
|
pSoldier->usActionData = sNoiseGridNo;
|
||||||
|
//if ( pSoldier->usActionData != NOWHERE )
|
||||||
{
|
{
|
||||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||||
}
|
}
|
||||||
@@ -1776,7 +1782,10 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
if (!fUp)
|
if (!fUp)
|
||||||
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d is climbing down",pSoldier->ubID) );
|
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d is climbing down",pSoldier->ubID) );
|
||||||
|
|
||||||
if ( CanClimbFromHere ( pSoldier, fUp ) )
|
// 0verhaul: Closest Friend call also returns the climb point if climbing is necessary. So don't
|
||||||
|
// climb the wrong building and don't search again
|
||||||
|
//if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||||
|
if (pSoldier->sGridNo == sClosestFriend)
|
||||||
{
|
{
|
||||||
if (IsActionAffordable(pSoldier) )
|
if (IsActionAffordable(pSoldier) )
|
||||||
{
|
{
|
||||||
@@ -1785,8 +1794,9 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
//pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
||||||
if ( pSoldier->usActionData != NOWHERE )
|
pSoldier->usActionData = sClosestFriend;
|
||||||
|
//if ( pSoldier->usActionData != NOWHERE )
|
||||||
{
|
{
|
||||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||||
}
|
}
|
||||||
@@ -3023,7 +3033,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
if (!fUp)
|
if (!fUp)
|
||||||
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d is climbing down",pSoldier->ubID) );
|
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("Soldier %d is climbing down",pSoldier->ubID) );
|
||||||
|
|
||||||
if ( CanClimbFromHere ( pSoldier, fUp ) )
|
// 0verhaul: Yet another chance to climb the wrong building and otherwise waste CPU power.
|
||||||
|
// We already know the climb point we want, which may not be here even if climbing is possible.
|
||||||
|
//if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||||
|
if (pSoldier->sGridNo == sClosestFriend)
|
||||||
{
|
{
|
||||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sClosestFriend, ADDTURNCOST)))
|
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sClosestFriend, ADDTURNCOST)))
|
||||||
{
|
{
|
||||||
@@ -3032,10 +3045,11 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INT16 sClimbPoint = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
pSoldier->usActionData = sClosestFriend;
|
||||||
if ( sClimbPoint != NOWHERE )
|
//INT16 sClimbPoint = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
||||||
|
//if ( sClimbPoint != NOWHERE )
|
||||||
{
|
{
|
||||||
pSoldier->usActionData = sClimbPoint;
|
//pSoldier->usActionData = sClimbPoint;
|
||||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -450,6 +450,7 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
|||||||
UINT8 ubDirection,ubDirsLeft,ubDirChecked[8],fFound = FALSE;
|
UINT8 ubDirection,ubDirsLeft,ubDirChecked[8],fFound = FALSE;
|
||||||
INT8 bAPsLeft, fPathFlags;
|
INT8 bAPsLeft, fPathFlags;
|
||||||
UINT8 ubRoomRequired = 0, ubTempRoom;
|
UINT8 ubRoomRequired = 0, ubTempRoom;
|
||||||
|
BOOLEAN fAllowDest = FALSE;
|
||||||
|
|
||||||
// 0verhaul: Make sure to clear the stored path since this always calculates a new one.
|
// 0verhaul: Make sure to clear the stored path since this always calculates a new one.
|
||||||
// This is needed if the path cannot be found.
|
// This is needed if the path cannot be found.
|
||||||
@@ -618,6 +619,13 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
|||||||
sGoToGrid = pSoldier->sGridNo; // start back where soldier is standing now
|
sGoToGrid = pSoldier->sGridNo; // start back where soldier is standing now
|
||||||
sAPCost = 0; // initialize path cost counter
|
sAPCost = 0; // initialize path cost counter
|
||||||
|
|
||||||
|
// 0verhaul: If the destination is within the patrol route, allow it. This is necessary to allow an errant soldier
|
||||||
|
// to return to his patrol route if flanking or other actions have pulled him beyond his allowed range from origin.
|
||||||
|
if (SpacesAway(sOrigin,sDesGrid) <= usMaxDist)
|
||||||
|
{
|
||||||
|
fAllowDest = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// we'll only go as far along the plotted route as is within our
|
// we'll only go as far along the plotted route as is within our
|
||||||
// permitted roaming range, and we'll stop as soon as we're down to <= 5 APs
|
// permitted roaming range, and we'll stop as soon as we're down to <= 5 APs
|
||||||
|
|
||||||
@@ -647,7 +655,8 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if this takes us beyond our permitted "roaming range"
|
// if this takes us beyond our permitted "roaming range"
|
||||||
if (SpacesAway(sOrigin,sTempDest) > usMaxDist)
|
// but if it brings us closer, then allow it!
|
||||||
|
if (SpacesAway(sOrigin,sTempDest) > usMaxDist && !fAllowDest)
|
||||||
break; // quit here, sGoToGrid is where we are going
|
break; // quit here, sGoToGrid is where we are going
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+26
-1
@@ -13,6 +13,7 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString )
|
|||||||
|
|
||||||
if (pNameString != NULL)
|
if (pNameString != NULL)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
j = -1;
|
j = -1;
|
||||||
for (int i=0;i<80;i++)
|
for (int i=0;i<80;i++)
|
||||||
{
|
{
|
||||||
@@ -189,10 +190,15 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString )
|
|||||||
pNameString[i] ='\0';
|
pNameString[i] ='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wcsncpy( pNameString, Item[ubIndex].szLongItemName, 80);
|
||||||
|
pNameString[79] ='\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pInfoString != NULL)
|
if(pInfoString != NULL)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
j = -1;
|
j = -1;
|
||||||
for (int i=0;i<400;i++)
|
for (int i=0;i<400;i++)
|
||||||
{
|
{
|
||||||
@@ -379,6 +385,10 @@ BOOLEAN LoadItemInfo(UINT16 ubIndex, STR16 pNameString, STR16 pInfoString )
|
|||||||
pInfoString[i] ='\0';
|
pInfoString[i] ='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wcsncpy( pInfoString, Item[ubIndex].szItemDesc, 400);
|
||||||
|
pInfoString[399] ='\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@@ -388,6 +398,7 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString )
|
|||||||
{
|
{
|
||||||
if (pNameString != NULL)
|
if (pNameString != NULL)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
|
||||||
for (int i=0;i<80;i++)
|
for (int i=0;i<80;i++)
|
||||||
@@ -564,6 +575,10 @@ BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString )
|
|||||||
pNameString[i] ='\0';
|
pNameString[i] ='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wcsncpy( pNameString, Item[ubIndex].szBRName, 80);
|
||||||
|
pNameString[79] ='\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -572,6 +587,7 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString )
|
|||||||
{
|
{
|
||||||
if (pDescString != NULL)
|
if (pDescString != NULL)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
|
||||||
for (int i=0;i<400;i++)
|
for (int i=0;i<400;i++)
|
||||||
@@ -749,6 +765,10 @@ BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString )
|
|||||||
pDescString[i] ='\0';
|
pDescString[i] ='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wcsncpy( pDescString, Item[ubIndex].szBRDesc, 400);
|
||||||
|
pDescString[399] ='\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -758,13 +778,14 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString )
|
|||||||
{
|
{
|
||||||
if(pNameString != NULL)
|
if(pNameString != NULL)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
|
||||||
for (int i=0;i<80;i++)
|
for (int i=0;i<80;i++)
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
if ( i<(int)strlen(Item[ubIndex].szItemName))
|
if ( i<(int)wcslen(Item[ubIndex].szItemName))
|
||||||
{
|
{
|
||||||
pNameString[i] = Item[ubIndex].szItemName [j];
|
pNameString[i] = Item[ubIndex].szItemName [j];
|
||||||
|
|
||||||
@@ -939,6 +960,10 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString )
|
|||||||
pNameString[i] ='\0';
|
pNameString[i] ='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wcsncpy( pNameString, Item[ubIndex].szItemName, 80 );
|
||||||
|
pNameString[79] ='\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|||||||
+30
-5
@@ -260,11 +260,11 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the item into the table
|
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the item into the table
|
||||||
else if ( sizeof(pData->curItem.szItemName)>0 && localizedTextOnly )
|
else if ( sizeof(pData->curItem.szItemName)>0 && localizedTextOnly )
|
||||||
{
|
{
|
||||||
strcpy(pData->curArray[pData->curItem.uiIndex].szItemName,pData->curItem.szItemName);
|
wcscpy(pData->curArray[pData->curItem.uiIndex].szItemName,pData->curItem.szItemName);
|
||||||
strcpy(pData->curArray[pData->curItem.uiIndex].szLongItemName,pData->curItem.szLongItemName);
|
wcscpy(pData->curArray[pData->curItem.uiIndex].szLongItemName,pData->curItem.szLongItemName);
|
||||||
strcpy(pData->curArray[pData->curItem.uiIndex].szBRName,pData->curItem.szBRName);
|
wcscpy(pData->curArray[pData->curItem.uiIndex].szBRName,pData->curItem.szBRName);
|
||||||
strcpy(pData->curArray[pData->curItem.uiIndex].szItemDesc,pData->curItem.szItemDesc);
|
wcscpy(pData->curArray[pData->curItem.uiIndex].szItemDesc,pData->curItem.szItemDesc);
|
||||||
strcpy(pData->curArray[pData->curItem.uiIndex].szBRDesc,pData->curItem.szBRDesc);
|
wcscpy(pData->curArray[pData->curItem.uiIndex].szBRDesc,pData->curItem.szBRDesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,6 +286,7 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
// pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0';
|
// pData->curItem.szItemName[MAX_CHAR_DATA_LENGTH] = '\0';
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
||||||
strcpy(pData->curItem.szItemName,pData->szCharData);
|
strcpy(pData->curItem.szItemName,pData->szCharData);
|
||||||
else
|
else
|
||||||
@@ -300,12 +301,17 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curItem.szItemName[i] = temp;
|
pData->curItem.szItemName[i] = temp;
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemname[%d] = %s, temp = %s",i,&pData->curItem.szItemName[i],&temp));
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemname[%d] = %s, temp = %s",i,&pData->curItem.szItemName[i],&temp));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemName, sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) );
|
||||||
|
pData->curItem.szItemName[sizeof(pData->curItem.szItemName)/sizeof(pData->curItem.szItemName[0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "szLongItemName") == 0)
|
else if(strcmp(name, "szLongItemName") == 0)
|
||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: longitemname");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: longitemname");
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
||||||
{
|
{
|
||||||
strcpy(pData->curItem.szLongItemName,pData->szCharData);
|
strcpy(pData->curItem.szLongItemName,pData->szCharData);
|
||||||
@@ -331,12 +337,17 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
// strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
|
// strncpy(pData->curItem.szLongItemName,pData->szCharData,MAX_CHAR_DATA_LENGTH);
|
||||||
// pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0';
|
// pData->curItem.szLongItemName[MAX_CHAR_DATA_LENGTH] = '\0';
|
||||||
//}
|
//}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szLongItemName, sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) );
|
||||||
|
pData->curItem.szLongItemName[sizeof(pData->curItem.szLongItemName)/sizeof(pData->curItem.szLongItemName[0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "szItemDesc") == 0)
|
else if(strcmp(name, "szItemDesc") == 0)
|
||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: itemdesc");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: itemdesc");
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
||||||
strcpy(pData->curItem.szItemDesc,pData->szCharData);
|
strcpy(pData->curItem.szItemDesc,pData->szCharData);
|
||||||
else
|
else
|
||||||
@@ -351,12 +362,17 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curItem.szItemDesc[i] = temp;
|
pData->curItem.szItemDesc[i] = temp;
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemdesc[%d] = %s, temp = %s",i,&pData->curItem.szItemDesc[i],&temp));
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: itemdesc[%d] = %s, temp = %s",i,&pData->curItem.szItemDesc[i],&temp));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szItemDesc, sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) );
|
||||||
|
pData->curItem.szItemDesc[sizeof(pData->curItem.szItemDesc)/sizeof(pData->curItem.szItemDesc[0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "szBRName") == 0)
|
else if(strcmp(name, "szBRName") == 0)
|
||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brname");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brname");
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
||||||
strcpy(pData->curItem.szBRName,pData->szCharData);
|
strcpy(pData->curItem.szBRName,pData->szCharData);
|
||||||
else
|
else
|
||||||
@@ -371,12 +387,17 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curItem.szBRName[i] = temp;
|
pData->curItem.szBRName[i] = temp;
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRname[%d] = %s, temp = %s",i,&pData->curItem.szBRName[i],&temp));
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRname[%d] = %s, temp = %s",i,&pData->curItem.szBRName[i],&temp));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRName, sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) );
|
||||||
|
pData->curItem.szBRName[sizeof(pData->curItem.szBRName)/sizeof(pData->curItem.szBRName[0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "szBRDesc") == 0)
|
else if(strcmp(name, "szBRDesc") == 0)
|
||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brdesc");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"itemEndElementHandle: brdesc");
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
if(MAX_CHAR_DATA_LENGTH >= strlen(pData->szCharData))
|
||||||
strcpy(pData->curItem.szBRDesc,pData->szCharData);
|
strcpy(pData->curItem.szBRDesc,pData->szCharData);
|
||||||
else
|
else
|
||||||
@@ -391,6 +412,10 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curItem.szBRDesc[i] = temp;
|
pData->curItem.szBRDesc[i] = temp;
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRdesc[%d] = %s, temp = %s",i,&pData->curItem.szBRDesc[i],&temp));
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: BRdesc[%d] = %s, temp = %s",i,&pData->curItem.szBRDesc[i],&temp));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curItem.szBRDesc, sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) );
|
||||||
|
pData->curItem.szBRDesc[sizeof(pData->curItem.szBRDesc)/sizeof(pData->curItem.szBRDesc[0]) - 1] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "usItemClass") == 0)
|
else if(strcmp(name, "usItemClass") == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user