mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fix for mouse movement when clicking on mercs. In windowed mode would move the cursor to odd places on screen
Enemy group invasion tactics fixed. Now reinforcements come from all directions, same as from surrounding stationary reinforcements Removed shuriken check Fix for mercs turing lame git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1154 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -28,8 +28,6 @@
|
||||
#include "Reinforcement.h"
|
||||
#include "MilitiaSquads.h"
|
||||
|
||||
#define IS_ONLY_IN_CITIES ( gGameExternalOptions.gfAllowReinforcementsOnlyInCity ? TRUE: FALSE )
|
||||
|
||||
UINT8 gubReinforcementMinEnemyStaticGroupSize = 12;
|
||||
|
||||
void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites )
|
||||
@@ -248,6 +246,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
UINT16 pusMoveDir[4][3];
|
||||
UINT8 ubDirNumber = 0, ubIndex;
|
||||
GROUP *pGroup;
|
||||
ENEMYGROUP *pEnemyGroup;
|
||||
SECTORINFO *pThisSector, *pSector;
|
||||
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
@@ -261,6 +260,9 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
GenerateDirectionInfos( sMapX, sMapY, &ubDirNumber, pusMoveDir,
|
||||
( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
|
||||
|
||||
|
||||
#if 0
|
||||
// Combine this with the next part so that reinforcements from enemy groups can also come in from random sides
|
||||
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||
if( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||
{
|
||||
@@ -274,6 +276,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
|
||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||
}
|
||||
#endif
|
||||
|
||||
if( NumEnemiesInFiveSectors( sMapX, sMapY ) - NumEnemiesInSector( sMapX, sMapY ) == 0 )
|
||||
{
|
||||
@@ -282,6 +285,51 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
|
||||
for(;;)
|
||||
{
|
||||
ubIndex = Random(ubDirNumber);
|
||||
if( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||
{
|
||||
UINT8 numElite;
|
||||
UINT8 numTroop;
|
||||
UINT8 numAdmin;
|
||||
|
||||
pGroup = GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) );
|
||||
pEnemyGroup = pGroup->pEnemyGroup;
|
||||
numElite = pEnemyGroup->ubNumElites - pEnemyGroup->ubElitesInBattle;
|
||||
numTroop = pEnemyGroup->ubNumTroops - pEnemyGroup->ubTroopsInBattle;
|
||||
numAdmin = pEnemyGroup->ubNumAdmins - pEnemyGroup->ubAdminsInBattle;
|
||||
|
||||
if (numElite + numTroop + numAdmin <= 1)
|
||||
{
|
||||
// The entire group has finally moved into the sector.
|
||||
pGroup->ubPrevX = pGroup->ubSectorX;
|
||||
pGroup->ubPrevY = pGroup->ubSectorY;
|
||||
|
||||
pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX;
|
||||
pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY;
|
||||
|
||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||
}
|
||||
|
||||
if (numAdmin + numTroop + numElite)
|
||||
{
|
||||
// Otherwise we move a soldier into the sector from the group
|
||||
if( numElite )
|
||||
{
|
||||
(pThisSector->ubNumElites)++;
|
||||
(pEnemyGroup->ubElitesInBattle)++;
|
||||
}else if( numTroop )
|
||||
{
|
||||
(pThisSector->ubNumTroops)++;
|
||||
(pEnemyGroup->ubTroopsInBattle)++;
|
||||
}else if( numAdmin )
|
||||
{
|
||||
(pThisSector->ubNumAdmins)++;
|
||||
(pEnemyGroup->ubAdminsInBattle)++;
|
||||
}
|
||||
|
||||
return (UINT8)pusMoveDir[ ubIndex ][ 2 ];
|
||||
}
|
||||
}
|
||||
|
||||
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
|
||||
{
|
||||
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
|
||||
@@ -380,8 +428,13 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
static UINT8 ubPredefinedInsertionCode = 255;
|
||||
static UINT8 ubPredefinedRank = 255;
|
||||
|
||||
if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
|
||||
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
||||
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
|
||||
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
||||
if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 )
|
||||
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|
||||
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY )
|
||||
)
|
||||
return;
|
||||
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
|
||||
ubSlots = NumFreeMilitiaSlots();
|
||||
if( !ubSlots )
|
||||
|
||||
Reference in New Issue
Block a user