mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
*************************************************************************
** Merged source code from development (MP+BMP) trunk (Revision: 3352) ** ** https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP ** ************************************************************************* 1 (Rev. 3343) Changes: Control hardcoded list of unclickable ("bad") sectors via XML file. (by Realist) On the strategic map, the player cannot click or highlight specific sectors (e.g. A4, A5). Introduce a <BadSector> tag in MovementCosts.xml that flags a sector as "bad". (<BadSector>1</BadSector>) Files: /branches/Wanne/JA2 1.13 MP/Build/Strategic/Map Screen Interface Map.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Strategic Movement Costs.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/mapscreen.cpp /branches/Wanne/JA2 1.13 MP/GameDir/Data/TableData/Map /branches/Wanne/JA2 1.13 MP/GameDir/Data/TableData/Map/MovementCosts.xml /branches/Wanne/JA2 1.13 MP/GameDir/Data-1.13/TableData/Map /branches/Wanne/JA2 1.13 MP/GameDir/Data-1.13/TableData/Map/MovementCosts.xml 2 (Rev. 3344) Changes: Move hardcoded underground sectors initialization to Lua script file. (by Realist) Locate "initunderground.lua" at data-xyz\scripts ("xyz" subject to change). Lua script allows easily adding underground sectors at arbitrary locations and defining enemy garrisons and creature population. Also enables underground bloodcat population. Files: /branches/Wanne/JA2 1.13 MP/Build/Strategic/Campaign Init.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Campaign Types.h /branches/Wanne/JA2 1.13 MP/Build/Strategic/Queen Command.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Strategic AI.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Strategic_2005Express.vcproj /branches/Wanne/JA2 1.13 MP/Build/Strategic/Strategic_VS2008.vcproj /branches/Wanne/JA2 1.13 MP/Build/Strategic/UndergroundInit.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/UndergroundInit.h /branches/Wanne/JA2 1.13 MP/Build/Strategic/strategicmap.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Soldier Init List.cpp /branches/Wanne/JA2 1.13 MP/GameDir/Data/Scripts /branches/Wanne/JA2 1.13 MP/GameDir/Data/Scripts/initunderground.lua /branches/Wanne/JA2 1.13 MP/GameDir/Data-1.13/Scripts /branches/Wanne/JA2 1.13 MP/GameDir/Data-1.13/Scripts/initunderground.lua 3 (Rev. 3345) Changes: Bugfix: In Method CreateDestroyMouseRegionsForFacilityAssignmentMenu() (by Headrock) Files: /branches/Wanne/JA2 1.13 MP/Build/Strategic/Assignments.cpp 4 (Rev. 3346) Changes: Changed order of properties in GameSettings.cpp (by Headrock) HAM 3.6 fixes (by Headrock) Sorted Data-1.13\ja2_options.ini (by Headrock) Files: /branches/Wanne/JA2 1.13 MP/Build/GameSettings.cpp /branches/Wanne/JA2 1.13 MP/Build/GameSettings.h /branches/Wanne/JA2 1.13 MP/Build/Laptop/BobbyRGuns.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Assignments.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/MilitiaSquads.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Strategic Mines.cpp /branches/Wanne/JA2 1.13 MP/Build/Strategic/Town Militia.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Campaign.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Interface Enhanced.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Interface Items.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Items.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Items.h /branches/Wanne/JA2 1.13 MP/Build/Tactical/Overhead.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Soldier Control.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Soldier Profile.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Weapons.cpp /branches/Wanne/JA2 1.13 MP/Build/TileEngine/Explosion Control.cpp /branches/Wanne/JA2 1.13 MP/GameDir/Data-1.13/Ja2_Options.INI /branches/Wanne/JA2 1.13 MP/GameDir/INIEditorJA2Options.xml 5 (Rev. 3347) Changes: Bugfix: Turns out that the program is saving the number of used Placement Slots to the temp file fine, but if that number is equal to the limit of how many enemies/civvies are allowed in a sector by the INI settings, it leads to an assertion error instead when trying to re-load that sector. (by Headrock) Re-ordered Data/Ja2_Options.INI (by Headrock) Files: /branches/Wanne/JA2 1.13 MP/Build/Tactical/Enemy Soldier Save.cpp /branches/Wanne/JA2 1.13 MP/GameDir/Data/Ja2_Options.INI 6 (Rev. 3348) Changes: Translated missing HAM 3.6 German Texts (by systemfehler) Files: /branches/Wanne/JA2 1.13 MP/Build/Utils/_GermanText.cpp 7 (Rev. 3351) Changes: PlusAI 1.0 Patch (by Headrock) Files: /branches/Wanne/JA2 1.13 MP/Build/Tactical/Points.cpp /branches/Wanne/JA2 1.13 MP/Build/Tactical/Points.h /branches/Wanne/JA2 1.13 MP/Build/TacticalAI/Attacks.cpp /branches/Wanne/JA2 1.13 MP/Build/TacticalAI/DecideAction.cpp /branches/Wanne/JA2 1.13 MP/Build/TacticalAI/FindLocations.cpp /branches/Wanne/JA2 1.13 MP/Build/TacticalAI/ai.h 8 (Rev. 3352) Changes: Bugfix: The DEBUG only setting "fEnableInventoryPoolQ" is now only enabled in a DEBUG version. In all other builds it is set to FALSE. Files: /branches/Wanne/JA2 1.13 MP/Build/GameSettings.cpp git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3354 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -14828,7 +14828,8 @@ void CreateDestroyMouseRegionsForFacilityAssignmentMenu( void )
|
||||
}
|
||||
if (!fFoundVehicle)
|
||||
{
|
||||
uiMenuLine++; // Skip this line, it'll always be shaded anyway.
|
||||
// WANNE: This is a fix by Headrock
|
||||
//uiMenuLine++; // Skip this line, it'll always be shaded anyway.
|
||||
}
|
||||
}
|
||||
else if ( iCounter == FAC_REPAIR_ROBOT )
|
||||
@@ -15032,21 +15033,21 @@ void FacilityAssignmentMenuBtnCallback ( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
break;
|
||||
case FAC_REPAIR_ITEMS:
|
||||
MakeSureToolKitIsInHand( pSoldier );
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
pSoldier->flags.fFixingRobot = FALSE;
|
||||
pSoldier->bVehicleUnderRepairID = -1;
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
break;
|
||||
case FAC_REPAIR_VEHICLE:
|
||||
MakeSureToolKitIsInHand( pSoldier );
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
pSoldier->flags.fFixingRobot = FALSE;
|
||||
pSoldier->bVehicleUnderRepairID = (INT8)ubVehicleID;
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
break;
|
||||
case FAC_REPAIR_ROBOT:
|
||||
MakeSureToolKitIsInHand( pSoldier );
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
pSoldier->flags.fFixingRobot = TRUE;
|
||||
pSoldier->bVehicleUnderRepairID = -1;
|
||||
ChangeSoldiersAssignment( pSoldier, REPAIR );
|
||||
break;
|
||||
case FAC_DOCTOR:
|
||||
MakeSureMedKitIsInHand( pSoldier );
|
||||
|
||||
+37
-29
@@ -23,6 +23,8 @@
|
||||
#include "VFS/vfs.h"
|
||||
#include "XMLWriter.h"
|
||||
|
||||
#include "UndergroundInit.h"
|
||||
|
||||
extern BOOLEAN InitStrategicMovementCosts();
|
||||
void InitKnowFacilitiesFlags( );
|
||||
|
||||
@@ -432,6 +434,15 @@ void BuildUndergroundSectorInfoList()
|
||||
|
||||
TrashUndergroundSectorInfo();
|
||||
|
||||
if (LetLuaBuildUndergroundSectorInfoList())
|
||||
// lua script succeeded
|
||||
return;
|
||||
|
||||
// If lua script had any errors
|
||||
// reset whatever the script may have done
|
||||
// and use hardcoded underground initialization.
|
||||
TrashUndergroundSectorInfo();
|
||||
|
||||
//********************
|
||||
//* BASEMENT LEVEL 1 *
|
||||
//********************
|
||||
@@ -476,7 +487,6 @@ void BuildUndergroundSectorInfoList()
|
||||
curr = NewUndergroundNode( 3, 15, 1 );
|
||||
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
|
||||
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//P3
|
||||
curr = NewUndergroundNode( 3, 16, 1 );
|
||||
@@ -495,99 +505,97 @@ void BuildUndergroundSectorInfoList()
|
||||
curr->ubNumElites = 20;
|
||||
break;
|
||||
}
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//Do all of the mandatory underground mine sectors
|
||||
|
||||
//Drassen's mine
|
||||
//D13_B1
|
||||
curr = NewUndergroundNode( 13, 4, 1 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//E13_B1
|
||||
curr = NewUndergroundNode( 13, 5, 1 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//E13_B2
|
||||
curr = NewUndergroundNode( 13, 5, 2 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//F13_B2
|
||||
curr = NewUndergroundNode( 13, 6, 2 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR | SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//G13_B2
|
||||
curr = NewUndergroundNode( 13, 7, 2 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//G13_B3
|
||||
curr = NewUndergroundNode( 13, 7, 3 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//F13_B3
|
||||
curr = NewUndergroundNode( 13, 6, 3 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
|
||||
//Cambria's mine
|
||||
//H8_B1
|
||||
curr = NewUndergroundNode( 8, 8, 1 );
|
||||
curr->ubAdjacentSectors |= EAST_ADJACENT_SECTOR;
|
||||
|
||||
//H9_B1
|
||||
curr = NewUndergroundNode( 9, 8, 1 );
|
||||
curr->ubAdjacentSectors |= WEST_ADJACENT_SECTOR;
|
||||
|
||||
//H9_B2
|
||||
curr = NewUndergroundNode( 9, 8, 2 );
|
||||
curr->ubAdjacentSectors |= WEST_ADJACENT_SECTOR;
|
||||
|
||||
//H8_B2
|
||||
curr = NewUndergroundNode( 8, 8, 2 );
|
||||
curr->ubAdjacentSectors |= EAST_ADJACENT_SECTOR;
|
||||
|
||||
//H8_B3
|
||||
curr = NewUndergroundNode( 8, 8, 3 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//I8_B3
|
||||
curr = NewUndergroundNode( 8, 9, 3 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR | SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//J8_B3
|
||||
curr = NewUndergroundNode( 8, 10, 3 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
|
||||
//Alma's mine
|
||||
//I14_B1
|
||||
curr = NewUndergroundNode( 14, 9, 1 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//J14_B1
|
||||
curr = NewUndergroundNode( 14, 10, 1 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//J14_B2
|
||||
curr = NewUndergroundNode( 14, 10, 2 );
|
||||
curr->ubAdjacentSectors |= WEST_ADJACENT_SECTOR;
|
||||
|
||||
//J13_B2
|
||||
curr = NewUndergroundNode( 13, 10, 2 );
|
||||
curr->ubAdjacentSectors |= EAST_ADJACENT_SECTOR;
|
||||
|
||||
//J13_B3
|
||||
curr = NewUndergroundNode( 13, 10, 3 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//K13_B3
|
||||
curr = NewUndergroundNode( 13, 11, 3 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
|
||||
//Grumm's mine
|
||||
//H3_B1
|
||||
curr = NewUndergroundNode( 3, 8, 1 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
|
||||
//I3_B1
|
||||
curr = NewUndergroundNode( 3, 9, 1 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//I3_B2
|
||||
curr = NewUndergroundNode( 3, 9, 2 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//H3_B2
|
||||
curr = NewUndergroundNode( 3, 8, 2 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR | EAST_ADJACENT_SECTOR;
|
||||
|
||||
//H4_B2
|
||||
curr = NewUndergroundNode( 4, 8, 2 );
|
||||
curr->ubAdjacentSectors |= WEST_ADJACENT_SECTOR;
|
||||
curr->uiFlags |= SF_PENDING_ALTERNATE_MAP;
|
||||
|
||||
//H4_B3
|
||||
curr = NewUndergroundNode( 4, 8, 3 );
|
||||
curr->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
|
||||
//G4_B3
|
||||
curr = NewUndergroundNode( 4, 7, 3 );
|
||||
curr->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
}
|
||||
|
||||
// Lesh: this function creates randomized world
|
||||
|
||||
@@ -475,7 +475,8 @@ typedef struct UNDERGROUND_SECTORINFO
|
||||
//a sector.
|
||||
UINT32 uiTimeCurrentSectorWasLastLoaded; //Specifies the last time the player was in the sector
|
||||
struct UNDERGROUND_SECTORINFO *next;
|
||||
UINT8 ubAdjacentSectors; //mask containing which sectors are adjacent
|
||||
|
||||
UINT8 ubNumBloodcats; // Bloodcat population
|
||||
UINT8 ubCreatureHabitat; //determines how creatures live in this sector (see creature spreading.c)
|
||||
UINT8 ubElitesInBattle, ubTroopsInBattle, ubAdminsInBattle, ubCreaturesInBattle;
|
||||
|
||||
|
||||
@@ -3871,49 +3871,6 @@ BOOLEAN IsTheCursorAllowedToHighLightThisSector( INT16 sSectorX, INT16 sSectorY
|
||||
}
|
||||
}
|
||||
|
||||
void SetUpBadSectorsList( void )
|
||||
{
|
||||
// initalizes all sectors to highlighable and then the ones non highlightable are marked as such
|
||||
INT8 bY;
|
||||
|
||||
memset( &sBadSectorsList, 0, sizeof( sBadSectorsList ) );
|
||||
|
||||
// the border regions
|
||||
for( bY = 0; bY < WORLD_MAP_X; bY++ )
|
||||
{
|
||||
sBadSectorsList[ 0 ][ bY ] = sBadSectorsList[ WORLD_MAP_X - 1 ][ bY ] = sBadSectorsList[ bY ][ 0 ] = sBadSectorsList[ bY ][ WORLD_MAP_X - 1 ] = TRUE;
|
||||
}
|
||||
|
||||
|
||||
sBadSectorsList[ 4 ][ 1 ] = TRUE;
|
||||
sBadSectorsList[ 5 ][ 1 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 1 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 5 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 6 ] = TRUE;
|
||||
|
||||
|
||||
sBadSectorsList[ 16 ][ 10 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 11 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 12 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 13 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 14 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 15 ] = TRUE;
|
||||
sBadSectorsList[ 16 ][ 16 ] = TRUE;
|
||||
|
||||
sBadSectorsList[ 15 ][ 13 ] = TRUE;
|
||||
sBadSectorsList[ 15 ][ 14 ] = TRUE;
|
||||
sBadSectorsList[ 15 ][ 15 ] = TRUE;
|
||||
sBadSectorsList[ 15 ][ 16 ] = TRUE;
|
||||
|
||||
sBadSectorsList[ 14 ][ 14 ] = TRUE;
|
||||
sBadSectorsList[ 14 ][ 15 ] = TRUE;
|
||||
sBadSectorsList[ 14 ][ 16 ] = TRUE;
|
||||
|
||||
sBadSectorsList[ 13 ][ 14 ] = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RestoreBackgroundForMapGrid( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
|
||||
// Upgrade points for replacing militia with better ones.
|
||||
UINT8 ubUpgradePoints;
|
||||
// Calculate default number of militia to place in Target Sector.
|
||||
UINT8 ubMilitiaToTrain = gGameExternalOptions.iMaxMilitiaPerSector / gGameExternalOptions.guiDivOfOriginalMilitia;
|
||||
UINT8 ubMilitiaToTrain = gGameExternalOptions.guiNumMobileMilitiaTrained;
|
||||
// Percentage of troops that should be of any one type:
|
||||
UINT8 ubTargetElitePercent = 0;
|
||||
UINT8 ubTargetRegularPercent = 0;
|
||||
|
||||
+36
-28
@@ -1224,40 +1224,48 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
break;
|
||||
case SOLDIER_CLASS_CREATURE:
|
||||
#ifdef JA2BETAVERSION
|
||||
if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle ||
|
||||
!pSector->ubNumCreatures || !pSector->ubCreaturesInBattle ||
|
||||
pSector->ubNumCreatures > gGameExternalOptions.ubGameMaximumNumberOfCreatures || pSector->ubCreaturesInBattle > gGameExternalOptions.ubGameMaximumNumberOfCreatures )
|
||||
if (pSoldier->ubBodyType == BLOODCAT)
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Underground sector creature counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
if( pSector->ubNumBloodcats > 0 )
|
||||
pSector->ubNumBloodcats--;
|
||||
}
|
||||
#endif
|
||||
if( pSector->ubNumCreatures )
|
||||
else
|
||||
{
|
||||
pSector->ubNumCreatures--;
|
||||
}
|
||||
if( pSector->ubCreaturesInBattle )
|
||||
{
|
||||
pSector->ubCreaturesInBattle--;
|
||||
}
|
||||
#ifdef JA2BETAVERSION
|
||||
if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle ||
|
||||
!pSector->ubNumCreatures || !pSector->ubCreaturesInBattle ||
|
||||
pSector->ubNumCreatures > gGameExternalOptions.ubGameMaximumNumberOfCreatures || pSector->ubCreaturesInBattle > gGameExternalOptions.ubGameMaximumNumberOfCreatures )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Underground sector creature counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
#endif
|
||||
if( pSector->ubNumCreatures )
|
||||
{
|
||||
pSector->ubNumCreatures--;
|
||||
}
|
||||
if( pSector->ubCreaturesInBattle )
|
||||
{
|
||||
pSector->ubCreaturesInBattle--;
|
||||
}
|
||||
|
||||
if( !pSector->ubNumCreatures && gWorldSectorX != 9 && gWorldSectorY != 10 )
|
||||
{ //If the player has successfully killed all creatures in ANY underground sector except J9
|
||||
//then cancel any pending creature town attack.
|
||||
DeleteAllStrategicEventsOfType( EVENT_CREATURE_ATTACK );
|
||||
}
|
||||
if( !pSector->ubNumCreatures && gWorldSectorX != 9 && gWorldSectorY != 10 )
|
||||
{ //If the player has successfully killed all creatures in ANY underground sector except J9
|
||||
//then cancel any pending creature town attack.
|
||||
DeleteAllStrategicEventsOfType( EVENT_CREATURE_ATTACK );
|
||||
}
|
||||
|
||||
// a monster has died. Post an event to immediately check whether a mine has been cleared.
|
||||
AddStrategicEventUsingSeconds( EVENT_CHECK_IF_MINE_CLEARED, GetWorldTotalSeconds() + 15, 0);
|
||||
// a monster has died. Post an event to immediately check whether a mine has been cleared.
|
||||
AddStrategicEventUsingSeconds( EVENT_CHECK_IF_MINE_CLEARED, GetWorldTotalSeconds() + 15, 0);
|
||||
|
||||
if( pSoldier->ubBodyType == QUEENMONSTER )
|
||||
{
|
||||
//Need to call this, as the queen is really big, and killing her leaves a bunch
|
||||
//of bad tiles in behind her. Calling this function cleans it up.
|
||||
InvalidateWorldRedundency();
|
||||
//Now that the queen is dead, turn off the creature quest.
|
||||
EndCreatureQuest();
|
||||
EndQuest( QUEST_CREATURES, gWorldSectorX, gWorldSectorY );
|
||||
if( pSoldier->ubBodyType == QUEENMONSTER )
|
||||
{
|
||||
//Need to call this, as the queen is really big, and killing her leaves a bunch
|
||||
//of bad tiles in behind her. Calling this function cleans it up.
|
||||
InvalidateWorldRedundency();
|
||||
//Now that the queen is dead, turn off the creature quest.
|
||||
EndCreatureQuest();
|
||||
EndQuest( QUEST_CREATURES, gWorldSectorX, gWorldSectorY );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3673,20 +3673,6 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
|
||||
pSector->ubNumTroops -= 2;
|
||||
}
|
||||
}
|
||||
if( ubSAIVersion < 16 )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSector;
|
||||
pSector = FindUnderGroundSector( 3, 15, 1 );
|
||||
if( pSector )
|
||||
{
|
||||
pSector->ubAdjacentSectors |= SOUTH_ADJACENT_SECTOR;
|
||||
}
|
||||
pSector = FindUnderGroundSector( 3, 16, 1 );
|
||||
if( pSector )
|
||||
{
|
||||
pSector->ubAdjacentSectors |= NORTH_ADJACENT_SECTOR;
|
||||
}
|
||||
}
|
||||
if( ubSAIVersion < 17 )
|
||||
{ //Patch all groups that have this flag set
|
||||
gubNumGroupsArrivedSimultaneously = 0;
|
||||
|
||||
@@ -204,17 +204,14 @@ void InitializeMines( void )
|
||||
} while (gMineStatus[ubDepletedMineIndex].fEmpty || (ubDepletedMineIndex == MINE_ALMA));
|
||||
|
||||
// HEADROCK HAM 3.1: We can now select which mine runs out, or disable mine shutdown.
|
||||
if (gGameExternalOptions.fManuallySelectMineShutdown)
|
||||
// Make sure selection isn't 0 (no mine runs out) or invalid (San Mona, Alma)
|
||||
if (gGameExternalOptions.bWhichMineRunsOut > 0 &&
|
||||
gGameExternalOptions.bWhichMineRunsOut < MAX_NUMBER_OF_MINES &&
|
||||
gGameExternalOptions.bWhichMineRunsOut-1 != MINE_SAN_MONA &&
|
||||
gGameExternalOptions.bWhichMineRunsOut-1 != MINE_ALMA )
|
||||
{
|
||||
// Make sure selection isn't 0 (no mine runs out) or invalid (San Mona, Alma)
|
||||
if (gGameExternalOptions.ubWhichMineRunsOut > 0 &&
|
||||
gGameExternalOptions.ubWhichMineRunsOut < MAX_NUMBER_OF_MINES &&
|
||||
gGameExternalOptions.ubWhichMineRunsOut-1 != MINE_SAN_MONA &&
|
||||
gGameExternalOptions.ubWhichMineRunsOut-1 != MINE_ALMA )
|
||||
{
|
||||
// Set depleted mine index.
|
||||
ubDepletedMineIndex = (gGameExternalOptions.ubWhichMineRunsOut-1);
|
||||
}
|
||||
// Set depleted mine index.
|
||||
ubDepletedMineIndex = (gGameExternalOptions.bWhichMineRunsOut-1);
|
||||
}
|
||||
|
||||
for( ubMineIndex = 0; ubMineIndex < MAX_NUMBER_OF_MINES; ubMineIndex++ )
|
||||
@@ -222,8 +219,7 @@ void InitializeMines( void )
|
||||
pMineStatus = &(gMineStatus[ ubMineIndex ]);
|
||||
|
||||
// HEADROCK HAM 3.1: We can disable mine shutdown, so make sure the settings aren't telling us to do so.
|
||||
if (!(gGameExternalOptions.fManuallySelectMineShutdown && gGameExternalOptions.ubWhichMineRunsOut == 0) &&
|
||||
(ubMineIndex == ubDepletedMineIndex))
|
||||
if (gGameExternalOptions.bWhichMineRunsOut != 0 && ubMineIndex == ubDepletedMineIndex)
|
||||
{
|
||||
if ( ubDepletedMineIndex == MINE_DRASSEN )
|
||||
{
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include "Debug Control.h"
|
||||
#include "Tactical Save.h"
|
||||
#endif
|
||||
#include "Map Screen Interface Map.h"
|
||||
|
||||
extern BOOLEAN sBadSectorsList[ WORLD_MAP_X ][ WORLD_MAP_X ];
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -115,6 +118,11 @@ smctableStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
//fprintf (outfile, "Entering Traversal Rating\n");
|
||||
}
|
||||
else if(strcmp(name, "BadSector") == 0 && pData->curElement == SMCTABLE_ELEMENT_SECTOR)
|
||||
{
|
||||
pData->curElement = SMCTABLE_ELEMENT_TRAVELTYPE;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
pData->currentDepth++;
|
||||
@@ -317,6 +325,11 @@ smctableEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
pData->travHere = trav_type;
|
||||
}
|
||||
else if(strcmp(name, "BadSector") == 0)
|
||||
{
|
||||
bool fBadSector = atoi(pData->szCharData) > 0;
|
||||
sBadSectorsList[pData->uiColNumber][pData->uiRowNumber] = fBadSector;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bogus Traversal Reference
|
||||
|
||||
@@ -510,6 +510,10 @@
|
||||
RelativePath=".\Town Militia.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\UndergroundInit.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
@@ -692,6 +696,10 @@
|
||||
RelativePath=".\Town Militia.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\UndergroundInit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Army.cpp"
|
||||
>
|
||||
|
||||
@@ -511,6 +511,10 @@
|
||||
RelativePath="Town Militia.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\UndergroundInit.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
@@ -691,6 +695,10 @@
|
||||
RelativePath="Town Militia.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\UndergroundInit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="XML_Army.cpp"
|
||||
>
|
||||
|
||||
@@ -1965,7 +1965,7 @@ UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership, BOOLEAN fMobile)
|
||||
else
|
||||
{
|
||||
// Default Squad Size for Mobiles, read from INI.
|
||||
ubMilitiaToTrain = (gGameExternalOptions.iMaxMilitiaPerSector / gGameExternalOptions.guiDivOfOriginalMilitia);
|
||||
ubMilitiaToTrain = gGameExternalOptions.guiNumMobileMilitiaTrained;
|
||||
|
||||
// Is affected by Leadership?
|
||||
if (gGameExternalOptions.fLeadershipAffectsMobileMilitiaQuantity &&
|
||||
@@ -1993,7 +1993,7 @@ UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership, BOOLEAN fMobile)
|
||||
// exceeding the range (latter shouldn't happen) will train a full squad. Others will train less. If
|
||||
// leadership was the minimum required, only 3 militia are trained.
|
||||
ubMilitiaToTrain = ((ubBestLeadership * ubMilitiaToTrain) / ubLeadershipRange) + 1;
|
||||
ubMilitiaToTrain = __min(ubMilitiaToTrain, gGameExternalOptions.iMaxMilitiaPerSector / gGameExternalOptions.guiDivOfOriginalMilitia);
|
||||
ubMilitiaToTrain = __min(ubMilitiaToTrain, gGameExternalOptions.guiNumMobileMilitiaTrained);
|
||||
ubMilitiaToTrain = __max(3, ubMilitiaToTrain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "UndergroundInit.h"
|
||||
#include "Campaign Init.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "FileMan.h"
|
||||
#include "GameSettings.h"
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
}
|
||||
|
||||
|
||||
extern UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ );
|
||||
|
||||
static int l_addSector(lua_State *L);
|
||||
static int lh_getIntegerFromTable(lua_State *L, char * fieldname);
|
||||
static std::string lh_getStringFromTable(lua_State *L, char * fieldname);
|
||||
static std::wstring lh_getWStringFromTable(lua_State *L, char * fieldname);
|
||||
static bool locationStringToCoordinates(std::string loc, UINT8* x, UINT8* y, UINT8* z);
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
BOOLEAN LetLuaBuildUndergroundSectorInfoList()
|
||||
{
|
||||
char * filename = "scripts\\initunderground.lua";
|
||||
UINT32 size, bytesRead;
|
||||
char* buffer;
|
||||
|
||||
HWFILE file = FileOpen(filename, FILE_ACCESS_READ, FALSE);
|
||||
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
size = FileSize(filename);
|
||||
buffer = new char[size+1];
|
||||
buffer[size] = 0;
|
||||
FileRead(file, buffer, size, &bytesRead);
|
||||
FileClose(file);
|
||||
|
||||
|
||||
lua_State *L = lua_open();
|
||||
luaL_openlibs(L);
|
||||
|
||||
lua_register(L, "addSector", l_addSector);
|
||||
|
||||
lua_pushinteger(L, gGameOptions.ubDifficultyLevel);
|
||||
lua_setglobal(L, "difficultyLevel");
|
||||
|
||||
lua_pushinteger(L, gGameOptions.ubGameStyle);
|
||||
lua_setglobal(L, "gameStyle");
|
||||
|
||||
if (luaL_dostring(L, buffer))
|
||||
{
|
||||
// oh noes, error
|
||||
// TODO: write to log or something
|
||||
return false;
|
||||
}
|
||||
|
||||
lua_close(L);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int l_addSector(lua_State *L)
|
||||
{
|
||||
UNDERGROUND_SECTORINFO* curr = NULL;
|
||||
|
||||
std::string sector_id = lh_getStringFromTable(L, "location");
|
||||
|
||||
UINT8 x, y, z;
|
||||
if (locationStringToCoordinates(sector_id, &x, &y, &z))
|
||||
{
|
||||
curr = NewUndergroundNode(x, y, z);
|
||||
|
||||
curr->ubNumAdmins = lh_getIntegerFromTable(L, "numAdmins");
|
||||
curr->ubNumTroops = lh_getIntegerFromTable(L, "numTroops");
|
||||
curr->ubNumElites = lh_getIntegerFromTable(L, "numElites");
|
||||
|
||||
curr->ubCreatureHabitat = lh_getIntegerFromTable(L, "creatureHabitat");
|
||||
curr->ubNumCreatures = lh_getIntegerFromTable(L, "numCreatures");
|
||||
|
||||
curr->ubNumBloodcats = lh_getIntegerFromTable(L, "numBloodcats");
|
||||
}
|
||||
|
||||
return 0; // number of results
|
||||
}
|
||||
|
||||
|
||||
static int lh_getIntegerFromTable(lua_State *L, char * fieldname)
|
||||
{
|
||||
lua_getfield(L, -1, fieldname);
|
||||
int i = lua_tointeger(L, -1);
|
||||
lua_pop(L, 1);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
static std::string lh_getStringFromTable(lua_State *L, char * fieldname)
|
||||
{
|
||||
lua_getfield(L, -1, fieldname);
|
||||
string s = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
// extract x,y,z from strings like "D13-1"
|
||||
static bool locationStringToCoordinates(std::string loc, UINT8* x, UINT8* y, UINT8* z)
|
||||
{
|
||||
int length = loc.length();
|
||||
|
||||
// gather row
|
||||
if (length < 4 || length > 5)
|
||||
return false;
|
||||
|
||||
char row = loc[0];
|
||||
if (row >= 'A' && row <= 'P')
|
||||
*y = row - 'A' + 1;
|
||||
else if (row >= 'a' && row <= 'p')
|
||||
*y = row - 'a' + 1;
|
||||
else
|
||||
return false;
|
||||
|
||||
// gather column
|
||||
loc = loc.substr(1);
|
||||
stringstream ss = stringstream();
|
||||
if (loc[0] >= '0' && loc[0] <= '9')
|
||||
{
|
||||
ss << loc[0];
|
||||
loc = loc.substr(1);
|
||||
}
|
||||
if (loc[0] >= '0' && loc[0] <= '9')
|
||||
{
|
||||
ss << loc[0];
|
||||
loc = loc.substr(1);
|
||||
}
|
||||
int col;
|
||||
ss >> col;
|
||||
if (col >= 1 && col <= 16)
|
||||
*x = col;
|
||||
else
|
||||
return false;
|
||||
|
||||
// gather level
|
||||
char lvl = loc[loc.length() - 1];
|
||||
if (lvl >= '1' && lvl <= '3')
|
||||
*z = lvl - '0';
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _UNDERGROUNDINIT_H
|
||||
#define _UNDERGROUNDINIT_H
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
extern BOOLEAN LetLuaBuildUndergroundSectorInfoList();
|
||||
|
||||
#endif
|
||||
@@ -4448,8 +4448,6 @@ UINT32 MapScreenInit(void)
|
||||
{
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
SetUpBadSectorsList( );
|
||||
|
||||
// setup message box system
|
||||
InitGlobalMessageList( );
|
||||
|
||||
|
||||
@@ -3035,7 +3035,10 @@ void GetSectorIDString( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , STR16 zS
|
||||
swprintf( zString, L"P3: %s", pLandTypeStrings[ SHELTER ] );
|
||||
break;
|
||||
default:
|
||||
swprintf( zString, L"%c%d: %s", 'A' + sSectorY - 1, sSectorX, pLandTypeStrings[ CREATURE_LAIR ] );
|
||||
if (pUnderground->ubNumCreatures)
|
||||
swprintf( zString, L"%c%d: %s", 'A' + sSectorY - 1, sSectorX, pLandTypeStrings[ CREATURE_LAIR ] );
|
||||
else
|
||||
swprintf( zString, L"%c%d-%d", 'A' + sSectorY - 1, sSectorX, bSectorZ );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user