- added ini option to turn off eating sounds

- morale now influences surrender strength
- placing prisoners now accounts for missing xml values
- damaging a building with eplosives alters loyalty depending on attacker's team

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5899 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-03-05 21:26:58 +00:00
parent 88cb595c23
commit ce0a49e4b4
6 changed files with 60 additions and 25 deletions
+3 -2
View File
@@ -1445,9 +1445,10 @@ void LoadGameExternalOptions()
gGameExternalOptions.fFoodDecayInSectors = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_DECAY_IN_SECTORS", TRUE);
gGameExternalOptions.sFoodDecayModificator = iniReader.ReadFloat("Tactical Food Settings", "FOOD_DECAY_MODIFICATOR", 1.0f, 0.1f, 10.0f);
gGameExternalOptions.usFoodMaxPoisoning = iniReader.ReadInteger("Tactical Food Settings", "FOOD_MAX_POISONING", 5, 0, 100);
gGameExternalOptions.fFoodEatingSounds = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_EATING_SOUNDS", TRUE);
//################# Strategic Gamestart Settings ##################
//Lalien: Game starting time
+2
View File
@@ -420,6 +420,8 @@ typedef struct
FLOAT sFoodDecayModificator;
UINT8 usFoodMaxPoisoning;
BOOLEAN fFoodEatingSounds;
//Animation settings
FLOAT giPlayerTurnSpeedUpFactor;
+1 -1
View File
@@ -221,7 +221,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, BOOLEAN fForce, B
DeductPoints( pSoldier, APBPConstants[type], sBPAdjustment );
// let it be known that we are eating
if ( pSoldier->bTeam == gbPlayerNum )
if ( pSoldier->bTeam == gbPlayerNum && gGameExternalOptions.fFoodEatingSounds )
{
if ( type == AP_EAT )
{
+2
View File
@@ -15441,6 +15441,8 @@ UINT32 SOLDIERTYPE::GetSurrenderStrength()
value = (value * this->stats.bLife / this->stats.bLifeMax);
value = value * (5 + sqrt((double) max(1, this->aiData.bMorale))) / 15;
// adjust for type of soldier
if ( this->ubSoldierClass == SOLDIER_CLASS_ELITE || this->ubSoldierClass == SOLDIER_CLASS_ELITE_MILITIA )
value *= 1.5f;
+45 -21
View File
@@ -3170,6 +3170,41 @@ extern SECTOR_EXT_DATA SectorExternalData[256][4];
static UINT8 roomcnt = 0;
// For now, this is only used for prison cells
INT32 GetSittableGridNoInRoom(UINT16 usRoom, BOOLEAN fEnoughSpace)
{
INT32 insertiongridno = NOWHERE;
// get sector data and look fo a fitting room
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
if ( ubSectorId >= 0 && ubSectorId < 256 )
{
for ( UINT32 uiLoop = 0; uiLoop < WORLD_MAX; ++uiLoop )
{
if ( (gusWorldRoomInfo[ uiLoop ] == usRoom) )
{
if ( fEnoughSpace )
{
// we have to make sure that the gridno is deep in the room, as otherwise the gridno might be corrected to be on the other side of a wall
if ( ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(NORTH) ) ] != usRoom )
|| ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(EAST) ) ] != usRoom )
|| ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(SOUTH) ) ] != usRoom )
|| ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(WEST) ) ] != usRoom ) )
continue;
}
// check wether this location is sittable
if ( IsLocationSittable( uiLoop, 0 ) )
{
return uiLoop;
}
}
}
}
return NOWHERE;
}
void CreatePrisonerOfWar()
{
INT32 insertiongridno = NOWHERE;
@@ -3178,36 +3213,25 @@ void CreatePrisonerOfWar()
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
if ( ubSectorId >= 0 && ubSectorId < 256 )
{
// We need to 'condense' the room numbers, as some might be empty in the xml
UINT16 realrooms[MAX_PRISON_ROOMS];
UINT8 numrooms = 0;
for(UINT8 i = 0; i < MAX_PRISON_ROOMS; ++i)
{
if ( SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i] > 0)
++numrooms;
{
realrooms[numrooms++] = SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i];
}
}
++roomcnt;
if ( roomcnt >= numrooms )
roomcnt = 0;
UINT16 room = SectorExternalData[ubSectorId][0].usPrisonRoomNumber[roomcnt];
UINT16 room = realrooms[roomcnt];
for ( UINT32 uiLoop = 0; uiLoop < WORLD_MAX; ++uiLoop )
{
if ( (gusWorldRoomInfo[ uiLoop ] == room) )
{
// we have to make sure that the gridno is deep in the room, as otherwise the gridno might be corrected to be on the other side of a wall
if ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(NORTH) ) ] == room )
if ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(EAST) ) ] == room )
if ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(SOUTH) ) ] == room )
if ( gusWorldRoomInfo[ NewGridNo( uiLoop, DirectionInc(WEST) ) ] == room )
{
// check wether this location is sittable
if ( IsLocationSittable( uiLoop, 0 ) )
{
insertiongridno = uiLoop;
break;
}
}
}
}
insertiongridno = GetSittableGridNoInRoom(room, TRUE);
// invalid gridno? Get out of here
if ( TileIsOutOfBounds(insertiongridno) )
+7 -1
View File
@@ -273,7 +273,7 @@ void RecountExplosions( void )
}
extern void HandleLoyaltyForDemolitionOfBuilding( SOLDIERTYPE *pSoldier, INT16 sPointsDmg );
// GENERATE EXPLOSION
void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection )
@@ -357,6 +357,12 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32
GenerateExplosion( &ExpParams );
// Flugente: if the explosion occured in a building, this might lower loyalty in town
if ( Item[ usItem ].usItemClass & IC_EXPLOSV && ubOwner != NOBODY && ubOwner < 255 )
{
HandleLoyaltyForDemolitionOfBuilding( MercPtrs[ubOwner], Explosive[ Item[ usItem ].ubClassIndex ].ubDamage );
}
// HEADROCK HAM 5.1: Launch fragments from the explosion.
if (Explosive[ Item[ usItem ].ubClassIndex ].usNumFragments > 0 )
{