mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Externalizations (by Buggler)
- creature xml to use other insertion directions if per-determined direction is invalid - swapped East and South Insertion_Code enum to be align with Strategic_Move enum - option for crepitus to attack a random player-controlled town, not just the originating town - externalized creatures spreading hardcoded defines to Creatures_Settings.ini git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6732 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -60,18 +60,18 @@
|
||||
//This is how often the creatures spread, once the quest begins. The smaller the gap,
|
||||
//the faster the creatures will advance. This is also directly related to the reproduction
|
||||
//rates which are applied each time the creatures spread.
|
||||
#define EASY_SPREAD_TIME_IN_MINUTES 510 //easy spreads every 8.5 hours
|
||||
#define NORMAL_SPREAD_TIME_IN_MINUTES 450 //normal spreads every 7.5 hours
|
||||
#define HARD_SPREAD_TIME_IN_MINUTES 390 //hard spreads every 6.5 hours
|
||||
#define INSANE_SPREAD_TIME_IN_MINUTES 150 //insane spreads every 2.5 hours
|
||||
#define EASY_SPREAD_TIME_IN_MINUTES gCreaturesSettings.usCreatureSpreadTimeNovice //easy spreads every 8.5 hours
|
||||
#define NORMAL_SPREAD_TIME_IN_MINUTES gCreaturesSettings.usCreatureSpreadTimeExperienced //normal spreads every 7.5 hours
|
||||
#define HARD_SPREAD_TIME_IN_MINUTES gCreaturesSettings.usCreatureSpreadTimeExpert //hard spreads every 6.5 hours
|
||||
#define INSANE_SPREAD_TIME_IN_MINUTES gCreaturesSettings.usCreatureSpreadTimeInsane //insane spreads every 2.5 hours
|
||||
|
||||
//Once the queen is added to the game, we can instantly let her spread x number of times
|
||||
//to give her a head start. This can also be a useful tool for having slow reproduction rates
|
||||
//but quicker head start to compensate to make the creatures less aggressive overall.
|
||||
#define EASY_QUEEN_INIT_BONUS_SPREADS 1
|
||||
#define NORMAL_QUEEN_INIT_BONUS_SPREADS 2
|
||||
#define HARD_QUEEN_INIT_BONUS_SPREADS 3
|
||||
#define INSANE_QUEEN_INIT_BONUS_SPREADS 5
|
||||
#define EASY_QUEEN_INIT_BONUS_SPREADS gCreaturesSettings.ubQueenInitBonusSpreadsNovice //1
|
||||
#define NORMAL_QUEEN_INIT_BONUS_SPREADS gCreaturesSettings.ubQueenInitBonusSpreadsExperienced //2
|
||||
#define HARD_QUEEN_INIT_BONUS_SPREADS gCreaturesSettings.ubQueenInitBonusSpreadsExpert //3
|
||||
#define INSANE_QUEEN_INIT_BONUS_SPREADS gCreaturesSettings.ubQueenInitBonusSpreadsInsane //5
|
||||
|
||||
//This value modifies the chance to populate a given sector. This is different from the previous definition.
|
||||
//This value gets applied to a potentially complicated formula, using the creature habitat to modify
|
||||
@@ -79,30 +79,30 @@
|
||||
//population increases), etc. I would recommend not tweaking the value too much in either direction from
|
||||
//zero due to the fact that this can greatly effect spread times and maximum populations. Basically, if the
|
||||
//creatures are spreading too quickly, increase the value, otherwise decrease it to a negative value
|
||||
#define EASY_POPULATION_MODIFIER 0
|
||||
#define NORMAL_POPULATION_MODIFIER 0
|
||||
#define HARD_POPULATION_MODIFIER 0
|
||||
#define INSANE_POPULATION_MODIFIER 0
|
||||
#define EASY_POPULATION_MODIFIER gCreaturesSettings.bCreaturePopulationModifierNovice //0
|
||||
#define NORMAL_POPULATION_MODIFIER gCreaturesSettings.bCreaturePopulationModifierExperienced //0
|
||||
#define HARD_POPULATION_MODIFIER gCreaturesSettings.bCreaturePopulationModifierExpert //0
|
||||
#define INSANE_POPULATION_MODIFIER gCreaturesSettings.bCreaturePopulationModifierInsane //0
|
||||
|
||||
//Augments the chance that the creatures will attack a town. The conditions for attacking a town
|
||||
//are based strictly on the occupation of the creatures in each of the four mine exits. For each creature
|
||||
//there is a base chance of 10% that the creatures will feed sometime during the night.
|
||||
#define EASY_CREATURE_TOWN_AGGRESSIVENESS -10
|
||||
#define NORMAL_CREATURE_TOWN_AGGRESSIVENESS 0
|
||||
#define HARD_CREATURE_TOWN_AGGRESSIVENESS 10
|
||||
#define INSANE_CREATURE_TOWN_AGGRESSIVENESS 50
|
||||
#define EASY_CREATURE_TOWN_AGGRESSIVENESS gCreaturesSettings.bCreatureTownAggressivenessNovice //-10
|
||||
#define NORMAL_CREATURE_TOWN_AGGRESSIVENESS gCreaturesSettings.bCreatureTownAggressivenessExperienced //0
|
||||
#define HARD_CREATURE_TOWN_AGGRESSIVENESS gCreaturesSettings.bCreatureTownAggressivenessExpert //10
|
||||
#define INSANE_CREATURE_TOWN_AGGRESSIVENESS gCreaturesSettings.bCreatureTownAggressivenessInsane //50
|
||||
|
||||
|
||||
//This is how many creatures the queen produces for each cycle of spreading. The higher
|
||||
//the numbers the faster the creatures will advance.
|
||||
#define EASY_QUEEN_REPRODUCTION_BASE 6 //6-7
|
||||
#define EASY_QUEEN_REPRODUCTION_BONUS 1
|
||||
#define NORMAL_QUEEN_REPRODUCTION_BASE 7 //7-9
|
||||
#define NORMAL_QUEEN_REPRODUCTION_BONUS 2
|
||||
#define HARD_QUEEN_REPRODUCTION_BASE 9 //9-12
|
||||
#define HARD_QUEEN_REPRODUCTION_BONUS 3
|
||||
#define INSANE_QUEEN_REPRODUCTION_BASE 15 //15-20
|
||||
#define INSANE_QUEEN_REPRODUCTION_BONUS 5
|
||||
#define EASY_QUEEN_REPRODUCTION_BASE gCreaturesSettings.ubQueenReproductionBaseNovice //6 //6-7
|
||||
#define EASY_QUEEN_REPRODUCTION_BONUS gCreaturesSettings.ubQueenReproductionBonusNovice //1
|
||||
#define NORMAL_QUEEN_REPRODUCTION_BASE gCreaturesSettings.ubQueenReproductionBaseExperienced //7 //7-9
|
||||
#define NORMAL_QUEEN_REPRODUCTION_BONUS gCreaturesSettings.ubQueenReproductionBonusExperienced //2
|
||||
#define HARD_QUEEN_REPRODUCTION_BASE gCreaturesSettings.ubQueenReproductionBaseExpert //9 //9-12
|
||||
#define HARD_QUEEN_REPRODUCTION_BONUS gCreaturesSettings.ubQueenReproductionBonusExpert //3
|
||||
#define INSANE_QUEEN_REPRODUCTION_BASE gCreaturesSettings.ubQueenReproductionBaseInsane //15 //15-20
|
||||
#define INSANE_QUEEN_REPRODUCTION_BONUS gCreaturesSettings.ubQueenReproductionBonusInsane //5
|
||||
|
||||
//When either in a cave level with blue lights or there is a creature presence, then
|
||||
//we override the normal music with the creature music. The conditions are maintained
|
||||
@@ -816,6 +816,7 @@ void ChooseTownSectorToAttack( UINT8 ubSectorID, BOOLEAN fOverrideTest )
|
||||
{
|
||||
INT32 iRandom, i;
|
||||
UINT8 ubSectorX, ubSectorY;
|
||||
UINT8 ubAttackSectorX, ubAttackSectorY;
|
||||
INT8 bTownId, bTownSize;
|
||||
UINT8 ubAttackSectorID;
|
||||
|
||||
@@ -943,23 +944,38 @@ void ChooseTownSectorToAttack( UINT8 ubSectorID, BOOLEAN fOverrideTest )
|
||||
// determine the sector to attack
|
||||
if( !fOverrideTest )
|
||||
{
|
||||
bTownId = StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX ( ubSectorID )].bNameId;
|
||||
bTownSize = GetTownSectorSize( bTownId );
|
||||
iRandom = PreRandom( bTownSize + 1 ) + 1;
|
||||
// attack a random player-controlled town sector
|
||||
if( gGameExternalOptions.fCrepitusAttackAllTowns )
|
||||
{
|
||||
do
|
||||
{
|
||||
i = Random( SEC_P16 + 1 );
|
||||
} while ( !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX ( i ) ].bNameId ||
|
||||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX ( i ) ].fEnemyControlled );
|
||||
|
||||
// originating sector has double the chance
|
||||
if( iRandom == bTownSize + 1 )
|
||||
ubAttackSectorID = ubSectorID;
|
||||
ubAttackSectorID = i;
|
||||
}
|
||||
// attack only the creature originating town, nothing will happen if sector is enemy-controlled
|
||||
else
|
||||
{
|
||||
INT32 j=0;
|
||||
for( i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ )
|
||||
bTownId = StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX ( ubSectorID )].bNameId;
|
||||
bTownSize = GetTownSectorSize( bTownId );
|
||||
iRandom = PreRandom( bTownSize + 1 ) + 1;
|
||||
|
||||
// originating sector has double the chance
|
||||
if( iRandom == bTownSize + 1 )
|
||||
ubAttackSectorID = ubSectorID;
|
||||
else
|
||||
{
|
||||
if( StrategicMap[ i ].bNameId == bTownId )
|
||||
INT32 j=0;
|
||||
for( i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ )
|
||||
{
|
||||
j++;
|
||||
if( iRandom == j )
|
||||
ubAttackSectorID = STRATEGIC_INDEX_TO_SECTOR_INFO( i );
|
||||
if( StrategicMap[ i ].bNameId == bTownId )
|
||||
{
|
||||
j++;
|
||||
if( iRandom == j )
|
||||
ubAttackSectorID = STRATEGIC_INDEX_TO_SECTOR_INFO( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -967,27 +983,107 @@ void ChooseTownSectorToAttack( UINT8 ubSectorID, BOOLEAN fOverrideTest )
|
||||
else
|
||||
ubAttackSectorID = ubSectorID;
|
||||
|
||||
ubAttackSectorX = (UINT8)((ubAttackSectorID % 16) + 1);
|
||||
ubAttackSectorY = (UINT8)((ubAttackSectorID / 16) + 1);
|
||||
|
||||
// determine the attack sector insertion code
|
||||
if( ubAttackSectorID == ubSectorID )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
gsCreatureInsertionGridNo = gCreaturePlacements[ giLairID ].iAttackSourceGridNo;
|
||||
}
|
||||
else if ( ubAttackSectorID - ubSectorID < -15 )
|
||||
// attack sector north of source sector
|
||||
else if( ubAttackSectorX < ubSectorX )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_SOUTH;
|
||||
// valid entry
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ SOUTH_STRATEGIC_MOVE ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < THROUGH_STRATEGIC_MOVE; i++ )
|
||||
{
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( ubAttackSectorID - ubSectorID < 0 )
|
||||
// attack sector south of source sector
|
||||
else if ( ubAttackSectorX > ubSectorX )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_EAST;
|
||||
// valid entry
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ NORTH_STRATEGIC_MOVE ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_NORTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < THROUGH_STRATEGIC_MOVE; i++ )
|
||||
{
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( ubAttackSectorID - ubSectorID < 16 )
|
||||
// attack sector west of source sector
|
||||
else if( ubAttackSectorY < ubSectorY )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_WEST;
|
||||
// valid entry
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ EAST_STRATEGIC_MOVE ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ EAST_STRATEGIC_MOVE ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_EAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < THROUGH_STRATEGIC_MOVE; i++ )
|
||||
{
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// attack sector east of source sector
|
||||
else if( ubAttackSectorY > ubSectorY )
|
||||
{
|
||||
// valid entry
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ WEST_STRATEGIC_MOVE ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ WEST_STRATEGIC_MOVE ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_WEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < THROUGH_STRATEGIC_MOVE; i++ )
|
||||
{
|
||||
if( SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != GROUNDBARRIER &&
|
||||
SectorInfo[ ubAttackSectorID ].ubTraversability[ i ] != EDGEOFWORLD )
|
||||
{
|
||||
gsCreatureInsertionCode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gsCreatureInsertionCode = INSERTION_CODE_NORTH;
|
||||
Assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
gubSectorIDOfCreatureAttack = ubAttackSectorID;
|
||||
@@ -1181,8 +1277,8 @@ void EndCreatureQuest()
|
||||
}
|
||||
|
||||
//Remove the creatures that are trapped underneath Tixa
|
||||
pSector = FindUnderGroundSector( gModSettings.ubCrepitusFeedingSectorX, gModSettings.ubCrepitusFeedingSectorY,
|
||||
gModSettings.ubCrepitusFeedingSectorZ ); // (9, 10, 2)
|
||||
pSector = FindUnderGroundSector( gCreaturesSettings.ubCrepitusFeedingSectorX, gCreaturesSettings.ubCrepitusFeedingSectorY,
|
||||
gCreaturesSettings.ubCrepitusFeedingSectorZ ); // (9, 10, 2)
|
||||
if( pSector )
|
||||
{
|
||||
pSector->ubNumCreatures = 0;
|
||||
@@ -1383,7 +1479,7 @@ BOOLEAN PrepareCreaturesForBattle()
|
||||
{
|
||||
ubNumColors = LightGetColors( LColors );
|
||||
|
||||
if (! gbWorldSectorZ )
|
||||
if ( !gbWorldSectorZ )
|
||||
{
|
||||
UseCreatureMusic(LColors->peBlue);
|
||||
return FALSE; //Creatures don't attack overworld with this battle code.
|
||||
@@ -1610,6 +1706,7 @@ void CreatureNightPlanning()
|
||||
{
|
||||
//Check the populations of the mine exits, and factor a chance for them to attack at night.
|
||||
UINT8 ubNumCreatures;
|
||||
INT32 i;
|
||||
|
||||
/* // externalize to xml data
|
||||
ubNumCreatures = CreaturesInUndergroundSector( SEC_H3, 1 );
|
||||
@@ -1639,10 +1736,42 @@ void CreatureNightPlanning()
|
||||
// Attacksource B1 underground sector must be a valid creature habitat!
|
||||
ubNumCreatures = CreaturesInUndergroundSector( ubSectorID , 1 );
|
||||
|
||||
if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) )
|
||||
{ //10% chance for each creature to decide it's time to attack.
|
||||
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 +PreRandom( 429 ), ubSectorID );
|
||||
//10% chance for each creature with difficulty modifier to decide it's time to attack.
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
{
|
||||
case DIF_LEVEL_EASY:
|
||||
i = EASY_CREATURE_TOWN_AGGRESSIVENESS;
|
||||
if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) )
|
||||
{
|
||||
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
|
||||
}
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
i = NORMAL_CREATURE_TOWN_AGGRESSIVENESS;
|
||||
if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) )
|
||||
{
|
||||
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
|
||||
}
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
i = HARD_CREATURE_TOWN_AGGRESSIVENESS;
|
||||
if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) )
|
||||
{
|
||||
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
|
||||
}
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
i = INSANE_CREATURE_TOWN_AGGRESSIVENESS;
|
||||
if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) )
|
||||
{
|
||||
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) )
|
||||
//{ //10% chance for each creature to decide it's time to attack.
|
||||
// AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ struct strategicmapelement{
|
||||
enum
|
||||
{
|
||||
INSERTION_CODE_NORTH,
|
||||
INSERTION_CODE_SOUTH,
|
||||
INSERTION_CODE_EAST,
|
||||
INSERTION_CODE_SOUTH,
|
||||
INSERTION_CODE_WEST,
|
||||
INSERTION_CODE_GRIDNO,
|
||||
INSERTION_CODE_ARRIVING_GAME,
|
||||
|
||||
@@ -2174,8 +2174,8 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
#ifdef JA2UB
|
||||
/* Ja25 no creatures */
|
||||
#else
|
||||
if( gWorldSectorX == gModSettings.ubCrepitusFeedingSectorX && gWorldSectorY == gModSettings.ubCrepitusFeedingSectorY
|
||||
&& gbWorldSectorZ == gModSettings.ubCrepitusFeedingSectorZ ) // (9, 10, 2)
|
||||
if( gWorldSectorX == gCreaturesSettings.ubCrepitusFeedingSectorX && gWorldSectorY == gCreaturesSettings.ubCrepitusFeedingSectorY
|
||||
&& gbWorldSectorZ == gCreaturesSettings.ubCrepitusFeedingSectorZ ) // (9, 10, 2)
|
||||
{
|
||||
InitCreatureQuest(); //Ignored if already active.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user