From 058ab3b9675bbcca3f8a8a20bcefce1d9f572bc0 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 3 Jan 2013 01:33:29 +0000 Subject: [PATCH] - enemy assassin feature is 'off' per default, in order not to freak out unwary new players - spies are uncovered near corpses only if their uniforms indicate they were allies of the observer - added helpful comments, should anyone ever want to use pits git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5756 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 2 +- Tactical/Soldier Control.cpp | 58 ++++++++++++++++++++++++++++++++++-- TileEngine/pits.cpp | 7 +++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 05edb8e0..913e374d 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1063,7 +1063,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fAssassinsAreDisguised = iniReader.ReadBoolean("Tactical Difficulty Settings", "ASSASSINS_DISGUISED", TRUE); // Flugente: does the queen send out assassins that mix among your militia? - gGameExternalOptions.fEnemyAssassins = iniReader.ReadBoolean("Tactical Difficulty Settings", "ENEMY_ASSASSINS", TRUE); + gGameExternalOptions.fEnemyAssassins = iniReader.ReadBoolean("Tactical Difficulty Settings", "ENEMY_ASSASSINS", FALSE); gGameExternalOptions.usAssassinMinimumProgress = iniReader.ReadInteger("Tactical Difficulty Settings", "ASSASSIN_MINIMUM_PROGRESS", 30, 0, 100); gGameExternalOptions.usAssassinMinimumMilitia = iniReader.ReadInteger("Tactical Difficulty Settings", "ASSASSIN_MINIMUM_MILITIA", 10, 0, 64); gGameExternalOptions.usAssassinPropabilityModifier = iniReader.ReadInteger("Tactical Difficulty Settings", "ASSASSIN_PROPABILITY_MODIFIER", 100, 0, 1000); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e595f348..368330d1 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -15096,8 +15096,35 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID ) if ( pCorpse && pCorpse->fActivated && pCorpse->def.ubAIWarningValue > 0 && PythSpacesAway( this->sGridNo, pCorpse->def.sGridNo ) <= 5 ) { + // check: is this corpse that of an ally of the observing soldier? + BOOLEAN fCorpseOFAlly = FALSE; + if ( pSoldier->bTeam == ENEMY_TEAM ) + { + // check wether corpse was one of soldier's allies + for ( UINT8 i = UNIFORM_ENEMY_ADMIN; i <= UNIFORM_ENEMY_ELITE; ++i ) + { + if ( COMPARE_PALETTEREP_ID(pCorpse->def.VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pCorpse->def.PantsPal, gUniformColors[ i ].pants) ) + { + fCorpseOFAlly = TRUE; + break; + } + } + } + else if ( pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM ) + { + // check wether corpse was one of soldier's allies + for ( UINT8 i = UNIFORM_MILITIA_ROOKIE; i <= UNIFORM_MILITIA_ELITE; ++i ) + { + if ( COMPARE_PALETTEREP_ID(pCorpse->def.VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pCorpse->def.PantsPal, gUniformColors[ i ].pants) ) + { + fCorpseOFAlly = TRUE; + break; + } + } + } + // a corpse was found near our position. If the soldier observing us can see it, he will be alarmed - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) ) + if ( fCorpseOFAlly && SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_NEAR_CORPSE], this->name ); return FALSE; @@ -15140,8 +15167,35 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID ) if ( pCorpse && pCorpse->fActivated && pCorpse->def.ubAIWarningValue > 0 && PythSpacesAway( this->sGridNo, pCorpse->def.sGridNo ) <= 5 ) { + // check: is this corpse that of an ally of the observing soldier? + BOOLEAN fCorpseOFAlly = FALSE; + if ( pSoldier->bTeam == ENEMY_TEAM ) + { + // check wether corpse was one of soldier's allies + for ( UINT8 i = UNIFORM_ENEMY_ADMIN; i <= UNIFORM_ENEMY_ELITE; ++i ) + { + if ( COMPARE_PALETTEREP_ID(pCorpse->def.VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pCorpse->def.PantsPal, gUniformColors[ i ].pants) ) + { + fCorpseOFAlly = TRUE; + break; + } + } + } + else if ( pSoldier->bTeam == OUR_TEAM || pSoldier->bTeam == MILITIA_TEAM ) + { + // check wether corpse was one of soldier's allies + for ( UINT8 i = UNIFORM_MILITIA_ROOKIE; i <= UNIFORM_MILITIA_ELITE; ++i ) + { + if ( COMPARE_PALETTEREP_ID(pCorpse->def.VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pCorpse->def.PantsPal, gUniformColors[ i ].pants) ) + { + fCorpseOFAlly = TRUE; + break; + } + } + } + // a corpse was found near our position. If the soldier observing us can see it, he will be alarmed - if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) ) + if ( fCorpseOFAlly && SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_NEAR_CORPSE], this->name ); return FALSE; diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index f8b699e7..ba1adb2f 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -24,6 +24,13 @@ BOOLEAN gfShowPits = FALSE; BOOLEAN gfLoadPitsWithoutArming = FALSE; +// Flugente: while I don't really see a use to the pit mechanism at the moment, I tested it a bit. I highly recommend to use +// AddStructToHead(...) and AddObjectToHead(...) along the existing AddObjectToTail(...)-calls. Otherwise the water tiles disappear when reloading the map. +// It is also highly advisable to perform CompileWorldTerrainIDs() (but only for each relevant gridno, this needs a separate function), otherwise the water tiles +// do not behave like water tiles at all (they are still treated like normal floor tiles). +// An issue remaining for me is that after calling this function, mercs standing on new water tiles do not use the water aniamtions - one has ti move them to anothe tile, or save and reload. +// It might be useful to do SearchForOtherMembersWithinPitRadiusAndMakeThemFall() but instead reset their animations in there. +// The pit mechnism is notable for its exitgrid mechanism however, that allows painless creation of new exitgrids, and sends mercs somewhere else. void Add3X3Pit( INT32 iMapIndex ) { EXITGRID ExitGrid;