Permalink
Browse files

agent equipment multiselect, options

- implemented options (notifications and misc)
- changed checkbox to not stretch image
- began implementing organisation missions and vehicle parks
- aequipment multiselect
- shift and alt modifiers now work when used on icons
- fixed aequip screen to work w/o agent
- extracting org vehicle parks
- fixed drawing destinations for agents who are in vehicles
  • Loading branch information...
Istrebitel committed Oct 2, 2017
1 parent 17a9fc3 commit 2fa6dbca18976854101299e58776ef1c83c9cc4d
View
@@ -196,7 +196,6 @@ Global
{D7563548-254B-46EF-A911-999CEE6BCDD8}.Release|Win32.ActiveCfg = Release|Win32
{D7563548-254B-46EF-A911-999CEE6BCDD8}.Release|Win32.Build.0 = Release|Win32
{D7563548-254B-46EF-A911-999CEE6BCDD8}.Release|x64.ActiveCfg = Release|x64
{D7563548-254B-46EF-A911-999CEE6BCDD8}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -82,8 +82,8 @@
<position x="463" y="70"/>
<size width="98" height="260"/>
<item size="0" spacing="5"/>
<hovercolour r="255" g="255" b="255" a="255"/>
<selcolour r="0" g="255" b="0" a="255"/>
<hovercolour r="255" g="255" b="255" a="0"/>
<selcolour r="255" g="255" b="255" a="0"/>
</listbox>
<graphicbutton id="AGENT_SCROLL_UP" scrollprev="AGENT_SELECT_SCROLL">
<position x="568" y="56"/>
@@ -28,27 +28,27 @@
</graphicbutton>
<textbutton id="BUTTON_SAVEGAME" text="Save Game">
<position x="18" y="48"/>
<size width="260" height="28"/>
<size width="259" height="28"/>
<font>smalfont</font>
</textbutton>
<textbutton id="BUTTON_LOADGAME" text="Load Game">
<position x="18" y="76"/>
<size width="260" height="28"/>
<size width="259" height="28"/>
<font>smalfont</font>
</textbutton>
<textbutton id="BUTTON_DELETESAVEDGAME" text="Delete Old Saved Game">
<position x="18" y="113"/>
<size width="260" height="28"/>
<position x="18" y="112"/>
<size width="259" height="28"/>
<font>smalfont</font>
</textbutton>
<textbutton id="BUTTON_ABANDONGAME" text="Abandon and Restart Game">
<position x="18" y="167"/>
<size width="260" height="28"/>
<size width="259" height="28"/>
<font>smalfont</font>
</textbutton>
<textbutton id="BUTTON_QUIT" text="Quit X-COM Apocalypse">
<position x="18" y="195"/>
<size width="260" height="28"/>
<size width="259" height="28"/>
<font>smalfont</font>
</textbutton>
<scroll id="GLOBAL_GAIN_SLIDER">
@@ -107,80 +107,107 @@
<position x="305" y="52"/>
<font>smallset</font>
<size width="270" height="16"/>
<alignment horizontal="centre" vertical="centre"/>
<alignment horizontal="centre" vertical="centre"/>
</label>
<scroll id="NOTIFICATIONS_SCROLL">
<position x="555" y="101"/>
<size width="16" height="281"/>
</scroll>
<listbox id="NOTIFICATIONS_LIST" scrollbarid="NOTIFICATIONS_SCROLL">
<position x="311" y="76"/>
<size width="244" height="334"/>
<item size="0" spacing="4"/>
<hovercolour r="255" g="255" b="255" a="0"/>
<selcolour r="255" g="255" b="255" a="0"/>
</listbox>
<graphicbutton id="NOTIFICATIONS_SCROLL_UP" scrollprev="NOTIFICATIONS_SCROLL">
<position x="555" y="76"/>
<size width="22" height="21"/>
<image/>
<imagedepressed>BUTTON_SCROLL_UP_DEPRESSED</imagedepressed>
</graphicbutton>
<graphicbutton id="NOTIFICATIONS_SCROLL_UP" scrollnext="NOTIFICATIONS_SCROLL">
<position x="555" y="388"/>
<size width="22" height="21"/>
<image/>
<imagedepressed>BUTTON_SCROLL_DOWN_DEPRESSED</imagedepressed>
</graphicbutton>
<label text="Options">
<position x="305" y="410"/>
<font>smallset</font>
<size width="270" height="16"/>
<alignment horizontal="centre" vertical="centre"/>
<alignment horizontal="centre" vertical="centre"/>
</label>
<graphic>
<image>city/menu-hr.png</image>
<position x="309" y="425"/>
<size width="252" height="1"/>
</graphic>
<graphic>
<image>city/menu-hr.png</image>
<position x="309" y="425"/>
<size width="252" height="1"/>
</graphic>
<checkbox id="AUTO_SCROLL">
<position x="310" y="430"/>
<size width="19" height="16"/>
<size width="120" height="16"/>
<image>BUTTON_CHECKBOX_FALSE</image>
<imagechecked>BUTTON_CHECKBOX_TRUE</imagechecked>
</checkbox>
<label text="Auto Scroll">
<position x="330" y="430"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
<label text="Auto Scroll">
<position x="20" y="0"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
</checkbox>
<checkbox id="TOOL_TIPS">
<position x="310" y="450"/>
<size width="19" height="16"/>
<size width="120" height="16"/>
<image>BUTTON_CHECKBOX_FALSE</image>
<imagechecked>BUTTON_CHECKBOX_TRUE</imagechecked>
</checkbox>
<label text="Tool tips">
<position x="330" y="450"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
<label text="Tool tips">
<position x="20" y="0"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
</checkbox>
<checkbox id="ACTION_MUSIC">
<position x="440" y="430"/>
<size width="19" height="16"/>
<size width="120" height="16"/>
<image>BUTTON_CHECKBOX_FALSE</image>
<imagechecked>BUTTON_CHECKBOX_TRUE</imagechecked>
<label text="Action music">
<position x="20" y="0"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
</checkbox>
<label text="Action music">
<position x="460" y="430"/>
<font>smallset</font>
<size width="90" height="16"/>
</label>
<checkbox id="AUTO_EXECUTE_ORDERS">
<position x="440" y="450"/>
<size width="19" height="16"/>
<size width="150" height="16"/>
<image>BUTTON_CHECKBOX_FALSE</image>
<imagechecked>BUTTON_CHECKBOX_TRUE</imagechecked>
</checkbox>
<label text="Exec. rem. orders">
<position x="460" y="450"/>
<font>smallset</font>
<size width="100" height="16"/>
</label>
<label text="Exec. rem. orders">
<position x="20" y="0"/>
<font>smallset</font>
<size width="120" height="16"/>
</label>
</checkbox>
<textbutton text="Give all research" id="BUTTON_GIVE_ALL_RESEARCH">
<position x="310" y="140"/>
<font>smallset</font>
<size width="200" height="32"/>
<position x="18" y="379"/>
<size width="259" height="28"/>
</textbutton>
<textbutton id="BUTTON_PLACEHOLDER">
<font>smallset</font>
<position x="18" y="407"/>
<size width="259" height="28"/>
</textbutton>
<textbutton id="BUTTON_BATTLE">
<position x="310" y="172"/>
<textbutton id="BUTTON_BATTLE">
<font>smallset</font>
<size width="200" height="32"/>
<position x="18" y="435"/>
<size width="259" height="28"/>
</textbutton>
</graphic>
</style>
View
@@ -62,15 +62,7 @@ void CheckBox::onRender()
if (useimage != nullptr)
{
if (useimage->size == Vec2<unsigned int>{Size.x, Size.y})
{
fw().renderer->draw(useimage, Vec2<float>{0, 0});
}
else
{
fw().renderer->drawScaled(useimage, Vec2<float>{0, 0},
Vec2<float>{this->Size.x, this->Size.y});
}
fw().renderer->draw(useimage, Vec2<float>{0, 0});
}
}
View
@@ -89,16 +89,55 @@ ConfigOptionInt frameLimit("Framework", "FrameLimit", "Quit after this many fram
ConfigOptionInt swapInterval("Framework", "SwapInterval",
"Swap interval (0 = tear, 1 = wait for vsync", 0);
ConfigOptionBool autoScrollOption("Framework.Misc", "AutoScroll", "Enable scrolling with mouse",
ConfigOptionBool autoScrollOption("Options.Misc", "AutoScroll", "Enable scrolling with mouse",
true);
ConfigOptionBool actionMusicOption("Framework.Misc", "ActionMusic",
ConfigOptionBool actionMusicOption("Options.Misc", "ActionMusic",
"Music changes according to action in battle", true);
ConfigOptionBool autoExecuteOption("Framework.Misc", "AutoExecute",
ConfigOptionBool autoExecuteOption("Options.Misc", "AutoExecute",
"Execute remaining orders when player presses end turn button",
false);
ConfigOptionBool toolTipsOption("Framework.Misc", "ToolTips",
ConfigOptionBool toolTipsOption("Options.Misc", "ToolTips",
"Show tool tips when hovering over controls", true);
;
ConfigOptionBool optionPauseOnUfoSpotted("Notifications.City","UfoSpotted", "UFO spotted", true);
ConfigOptionBool optionPauseOnVehicleLightDamage("Notifications.City","VehicleLightDamage", "Vehicle lightly damaged", true);
ConfigOptionBool optionPauseOnVehicleModerateDamage("Notifications.City","VehicleModerateDamage", "Vehicle moderately damaged", true);
ConfigOptionBool optionPauseOnVehicleHeavyDamage("Notifications.City","VehicleHeavyDamage", "Vehicle heavily damaged", true);
ConfigOptionBool optionPauseOnVehicleDestroyed("Notifications.City","VehicleDestroyed", "Vehicle destroyed", true);
ConfigOptionBool optionPauseOnVehicleEscaping("Notifications.City","VehicleEscaping", "Vehicle damaged and returning to base", true);
ConfigOptionBool optionPauseOnVehicleNoAmmo("Notifications.City","VehicleNoAmmo", "Weapon out of ammo", true);
ConfigOptionBool optionPauseOnVehicleLowFuel("Notifications.City","VehicleLowFuel", "Vehicle low on fuel", true);
ConfigOptionBool optionPauseOnAgentDiedCity("Notifications.City", "AgentDiedCity", "Agent died", true);
ConfigOptionBool optionPauseOnAgentArrived("Notifications.City", "AgentArrived", "Agent arrived at base", true);
ConfigOptionBool optionPauseOnCargoArrived("Notifications.City", "CargoArrived", "Cargo has arrived at base", true);
ConfigOptionBool optionPauseOnTransferArrived("Notifications.City", "TransferArrived", "Transfer arrived at base", true);
ConfigOptionBool optionPauseOnRecoveryArrived("Notifications.City", "RecoveryArrived", "Crash recovery arrived at base", true);
ConfigOptionBool optionPauseOnVehicleRepaired("Notifications.City","VehicleRepaired", "Vehicle repaired", true);
ConfigOptionBool optionPauseOnVehicleRearmed("Notifications.City","VehicleRearmed", "Vehicle rearmed", true);
ConfigOptionBool optionPauseOnNotEnoughAmmo("Notifications.City", "NotEnoughAmmo", "Not enough ammo to rearm vehicle", true);
ConfigOptionBool optionPauseOnVehicleRefuelled("Notifications.City","VehicleRefuelled", "Vehicle refuelled", true);
ConfigOptionBool optionPauseOnNotEnoughFuel("Notifications.City","NotEnoughFuel", "Not enough fuel to refuel vehicle", true);
ConfigOptionBool optionPauseOnUnauthorizedVehicle("Notifications.City", "UnauthorizedVehicle", "Unauthorized vehicle detected", true);
ConfigOptionBool optionPauseOnHostileSpotted("Notifications.Battle","HostileSpotted", "Hostile unit spotted", true);
ConfigOptionBool optionPauseOnHostileDied("Notifications.Battle","HostileDied", "Hostile unit has died", true);
ConfigOptionBool optionPauseOnUnknownDied("Notifications.Battle", "UnknownDied", "Unknown Unit has died", true);
ConfigOptionBool optionPauseOnAgentDiedBattle("Notifications.Battle","AgentDiedBattle", "Unit has died", true);
ConfigOptionBool optionPauseOnAgentBrainsucked("Notifications.Battle","AgentBrainsucked", "Unit Brainsucked", true);
ConfigOptionBool optionPauseOnAgentCriticallyWounded("Notifications.Battle","AgentCriticallyWounded", "Unit critically wounded", true);
ConfigOptionBool optionPauseOnAgentBadlyInjured("Notifications.Battle","AgentBadlyInjured", "Unit badly injured", true);
ConfigOptionBool optionPauseOnAgentInjured("Notifications.Battle","AgentInjured", "Unit injured", true);
ConfigOptionBool optionPauseOnAgentUnderFire("Notifications.Battle","AgentUnderFire", "Unit under fire", true);
ConfigOptionBool optionPauseOnAgentUnconscious("Notifications.Battle","AgentUnconscious", "Unit has lost consciousness", true);
ConfigOptionBool optionPauseOnAgentLeftCombat("Notifications.Battle","AgentLeftCombat", "Unit has left combat zone", true);
ConfigOptionBool optionPauseOnAgentFrozen("Notifications.Battle","AgentFrozen", "Unit has frozen", true);
ConfigOptionBool optionPauseOnAgentBerserk("Notifications.Battle","AgentBerserk", "Unit has gone beserk", true);
ConfigOptionBool optionPauseOnAgentPanicked("Notifications.Battle","AgentPanicked", "Unit has panicked", true);
ConfigOptionBool optionPauseOnAgentPanicOver("Notifications.Battle","AgentPanicOver", "Unit has stopped panicking", true);
ConfigOptionBool optionPauseOnAgentPsiAttacked("Notifications.Battle","AgentPsiAttacked", "Psionic attack on unit", true);
ConfigOptionBool optionPauseOnAgentPsiControlled("Notifications.Battle","AgentPsiControlled", "Unit under Psionic control", true);
ConfigOptionBool optionPauseOnAgentPsiOver("Notifications.Battle","AgentPsiOver", "Unit freed from Psionic control", true);
} // anonymous namespace
namespace OpenApoc
@@ -1044,4 +1083,4 @@ UString Framework::textGetClipboard()
void Framework::threadPoolTaskEnqueue(std::function<void()> task) { p->threadPool->enqueue(task); }
}; // namespace OpenApoc
}; // namespace OpenApoc
@@ -4701,7 +4701,7 @@ void BattleUnit::die(GameState &state, StateRef<BattleUnit> attacker, bool viole
// Events
if (owner == state.current_battle->currentPlayer)
{
sendAgentEvent(state, GameEventType::AgentDied);
sendAgentEvent(state, GameEventType::AgentDiedBattle);
}
else if (state.current_battle->currentPlayer->isRelatedTo(owner) ==
Organisation::Relation::Hostile)
@@ -21,7 +21,7 @@
namespace OpenApoc
{
AgentTileHelper::AgentTileHelper(TileMap &map, Agent &a) : map(map), a(a) {}
AgentTileHelper::AgentTileHelper(TileMap &map) : map(map) {}
bool AgentTileHelper::canEnterTile(Tile *from, Tile *to, bool ignoreStaticUnits,
bool ignoreAllUnits) const
@@ -278,6 +278,11 @@ bool AgentMission::teleportCheck(GameState &state, Agent &a)
return false;
}
void AgentMission::clearPathCache(StateRef<City> city)
{
//agentPathCache[city].clear();
}
bool AgentMission::getNextDestination(GameState &state, Agent &a, Vec3<float> &destPos)
{
if (cancelled)
@@ -431,7 +436,21 @@ void AgentMission::setPathTo(GameState &state, Agent &a, StateRef<Building> b)
{
this->currentPlannedPath.clear();
auto &map = *a.city->map;
auto path = map.findShortestPath(a.position, b->crewQuarters, 1000, AgentTileHelper{map, a});
std::list<Vec3<int>> path;
static std::map<StateRef<City>, std::map<Vec3<int>, std::list<Vec3<int>>>> pathCache;
auto key = Vec3<int>{ (Vec3<int>)a.position * map.size + b->crewQuarters };
// disbles path as if city gets amaged this is not good
pathCache[a.city].clear();
if (pathCache[a.city].find(key) != pathCache[a.city].end())
{
path = pathCache[a.city][key];
}
else
{
path = map.findShortestPath(a.position, b->crewQuarters, 2000, AgentTileHelper{ map });
pathCache[a.city][key] = path;
}
if (path.empty())
{
cancelled = true;
@@ -469,7 +488,7 @@ bool AgentMission::advanceAlongPath(GameState &state, Agent &a, Vec3<float> &des
if (tFrom->position != pos &&
(std::abs(tFrom->position.x - pos.x) > 1 || std::abs(tFrom->position.y - pos.y) > 1 ||
std::abs(tFrom->position.z - pos.z) > 1 ||
!AgentTileHelper{tFrom->map, a}.canEnterTile(tFrom, tTo)))
!AgentTileHelper{tFrom->map}.canEnterTile(tFrom, tTo)))
{
// Next tile became impassable, pick a new path
currentPlannedPath.clear();
@@ -490,7 +509,7 @@ bool AgentMission::advanceAlongPath(GameState &state, Agent &a, Vec3<float> &des
(tFrom->position == *it ||
(std::abs(tFrom->position.x - it->x) <= 1 && std::abs(tFrom->position.y - it->y) <= 1 &&
std::abs(tFrom->position.z - it->z) <= 1 &&
AgentTileHelper{tFrom->map, a}.canEnterTile(tFrom, tFrom->map.getTile(*it)))))
AgentTileHelper{tFrom->map}.canEnterTile(tFrom, tFrom->map.getTile(*it)))))
{
currentPlannedPath.pop_front();
pos = currentPlannedPath.front();
@@ -18,15 +18,15 @@ class TileMap;
class Building;
class UString;
class SceneryTileType;
class City;
class AgentTileHelper : public CanEnterTileHelper
{
private:
TileMap &map;
Agent &a;
public:
AgentTileHelper(TileMap &map, Agent &a);
AgentTileHelper(TileMap &map);
bool canEnterTile(Tile *from, Tile *to, bool ignoreStaticUnits = false,
bool ignoreAllUnits = false) const override;
@@ -59,6 +59,9 @@ class AgentMission
public:
AgentMission() = default;
static std::map<StateRef<City>, std::map<Vec3<int>, std::list<Vec3<int>>>> agentPathCache;
static void clearPathCache(StateRef<City> city);
// Methods used in pathfinding etc.
bool getNextDestination(GameState &state, Agent &a, Vec3<float> &destPos);
void update(GameState &state, Agent &a, unsigned int ticks, bool finished = false);
Oops, something went wrong.

0 comments on commit 2fa6dbc

Please sign in to comment.