Skip to content

Commit

Permalink
non-ufo crash and recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
Istrebitel committed Oct 9, 2017
1 parent 4fab37d commit 95a0546
Show file tree
Hide file tree
Showing 29 changed files with 1,843 additions and 608 deletions.
Binary file added OpenApoc - Extract.lnk
Binary file not shown.
Binary file added OpenApoc - Play.lnk
Binary file not shown.
17 changes: 8 additions & 9 deletions framework/framework.cpp
Expand Up @@ -221,26 +221,25 @@ ConfigOptionBool optionEnableAgentTemplates("OpenApoc.NewFeature", "EnableAgentT
ConfigOptionBool optionStoreDroppedEquipment("OpenApoc.NewFeature", "StoreDroppedEquipment",
"Attempt to recover agent equipment dropped in city",
true);
ConfigOptionBool optionAbsorbingVehicles("OpenApoc.NewFeature", "AbsorbingVehicles",
"Ground vehicles absorb damage dealt to roads under them",
false);
ConfigOptionBool
optionRecoverGroundVehicles("OpenApoc.NewFeature", "RecoverGroundVehicles",
"Ground vehicles crash when road dies and can be recovered", true);
ConfigOptionBool optionFallingGroundVehicles("OpenApoc.NewFeature", "CrashingGroundVehicles",
"Unsupported ground vehicles crash", true);

ConfigOptionBool optionEnforceCargoLimits("OpenApoc.NewFeature", "EnforceCargoLimits",
"Enforce vehicle cargo limits", false);
ConfigOptionBool optionAllowNearbyVehicleLootPickup("OpenApoc.NewFeature",
"AllowNearbyVehicleLootPickup",
"Allow nearby vehicles to pick up loot", true);
ConfigOptionBool optionAllowBuildingLootDeposit("OpenApoc.NewFeature", "AllowBuildingLootDeposit",
"Allow loot to be stashed in the building", true);
ConfigOptionBool optionArmoredRoads("OpenApoc.NewFeature", "ArmoredRoads", "Armored roads", false);
ConfigOptionBool optionBSKLauncherSound("OpenApoc.Mod", "BSKLauncherSound",
"(MOD) Original Brainsucker Launcher SFX", true);
ConfigOptionBool optionArmoredRoads("OpenApoc.Mod", "ArmoredRoads", "(MOD) Armored roads", false);
ConfigOptionBool optionInvulnerableRoads("OpenApoc.Mod", "InvulnerableRoads",
"(MOD) Invulnerable roads", false);
ConfigOptionBool optionATVTank("OpenApoc.Mod", "ATVTank",
"(MOD) Griffon becomes an All-Terrain Vehicle", true);
ConfigOptionBool optionATVTank("OpenApoc.Mod", "ATVTank", "(MOD) Griffon becomes All-Terrain",
true);
ConfigOptionBool optionCrashingVehicles("OpenApoc.Mod", "CrashingVehicles",
"Vehicles crash on low HP", false);

} // anonymous namespace

Expand Down
6 changes: 3 additions & 3 deletions game/state/city/agentmission.cpp
Expand Up @@ -70,8 +70,8 @@ bool AgentTileHelper::canEnterTile(Tile *from, Tile *to, bool, bool &, float &co
}

// Agents can only move to and from scenery
sp<Scenery> sceneryFrom = from->intactScenery;
sp<Scenery> sceneryTo = to->intactScenery;
sp<Scenery> sceneryFrom = from->presentScenery;
sp<Scenery> sceneryTo = to->presentScenery;
if (!sceneryFrom || !sceneryTo)
{
return false;
Expand Down Expand Up @@ -116,7 +116,7 @@ bool AgentTileHelper::canEnterTile(Tile *from, Tile *to, bool, bool &, float &co
continue;
}
auto checkedTile = map.getTile(checkedPos);
sp<Scenery> checkedScenery = checkedTile->intactScenery;
sp<Scenery> checkedScenery = checkedTile->presentScenery;
if (checkedScenery &&
checkedScenery->type->tile_type == SceneryTileType::TileType::PeopleTubeJunction)
{
Expand Down
25 changes: 25 additions & 0 deletions game/state/city/scenery.cpp
@@ -1,4 +1,5 @@
#include "game/state/city/scenery.h"
#include "framework/configfile.h"
#include "framework/framework.h"
#include "framework/logger.h"
#include "framework/sound.h"
Expand Down Expand Up @@ -65,6 +66,18 @@ bool Scenery::applyDamage(GameState &state, int power)

int damage = randDamage050150(state.rng, power);

if (type->tile_type == SceneryTileType::TileType::Road)
{
if (config().getBool("OpenApoc.Mod.InvulnerableRoads"))
{
return false;
}
if (config().getBool("OpenApoc.NewFeature.ArmoredRoads"))
{
damage -= ROAD_ARMOR;
}
}

if (damage <= type->constitution)
{
return false;
Expand Down Expand Up @@ -92,6 +105,18 @@ void Scenery::die(GameState &state)
if (!this->damaged && type->damagedTile)
{
this->damaged = true;
if (this->overlayDoodad)
this->overlayDoodad->remove(state);
this->overlayDoodad = nullptr;
type = type->damagedTile;
if (type->overlaySprite)
{
this->overlayDoodad =
mksp<Doodad>(this->getPosition(), type->imageOffset, false, 1, type->overlaySprite);
city->map->addObjectToMap(this->overlayDoodad);
}
// Reapply tile params
tileObject->setPosition(currentPosition);
}
else
{
Expand Down
4 changes: 3 additions & 1 deletion game/state/city/scenery.h
Expand Up @@ -8,6 +8,8 @@
namespace OpenApoc
{

static const int ROAD_ARMOR = 20;

class TileObjectScenery;
class SceneryTileType;
class Building;
Expand Down Expand Up @@ -41,7 +43,7 @@ class Scenery : public std::enable_shared_from_this<Scenery>
bool handleCollision(GameState &state, Collision &c);
// Returns true if sound and doodad were handled by it
bool applyDamage(GameState &state, int power);
// Handles mappart ceasing to exist (fatal damage or fell on something)
// Handles scenery ceasing to exist (fatal damage or fell on something)
void die(GameState &state);

void update(GameState &state, unsigned int ticks);
Expand Down

0 comments on commit 95a0546

Please sign in to comment.