Permalink
Browse files

progress on location screen #1

  • Loading branch information...
Istrebitel committed Sep 27, 2017
1 parent 712fc26 commit 7f989d4068fac7aa9aaff73227d14e4a40605f45
Showing with 212,501 additions and 263 deletions.
  1. +3 −1 clang_format_win.bat
  2. +52 −0 data/forms/city/agentassignment.form
  3. +6 −0 data/forms/city/alert.form
  4. +6 −0 data/forms/city/building.form
  5. +49 −0 data/forms/city/location.form
  6. +37 −0 data/forms/city/tab3.form
  7. +2 −2 forms/control.h
  8. +43 −0 game/state/agent.cpp
  9. +23 −2 game/state/agent.h
  10. +1 −0 game/state/battle/battle.cpp
  11. +2 −2 game/state/battle/battlemap.cpp
  12. +2 −1 game/state/battle/battlemappart.cpp
  13. +1 −0 game/state/battle/battlemappart.h
  14. +6 −1 game/state/city/building.h
  15. +53 −4 game/state/city/city.cpp
  16. +10 −0 game/state/city/city.h
  17. +28 −23 game/state/city/vehicle.cpp
  18. +9 −6 game/state/city/vehicle.h
  19. +10 −10 game/state/city/vehiclemission.cpp
  20. +47 −92 game/state/gamestate.cpp
  21. +1 −0 game/state/gamestate.h
  22. +13 −3 game/state/gamestate_serialize.xml
  23. +4 −17 game/state/research.cpp
  24. +2 −3 game/state/tileview/tileobject_battleunit.cpp
  25. +2 −2 game/state/tileview/tileobject_vehicle.cpp
  26. +4 −0 game/ui/CMakeLists.txt
  27. +424 −0 game/ui/agentassignment.cpp
  28. +55 −0 game/ui/agentassignment.h
  29. +11 −41 game/ui/base/aequipscreen.cpp
  30. +2 −1 game/ui/base/researchscreen.cpp
  31. +4 −7 game/ui/base/vequipscreen.cpp
  32. +3 −3 game/ui/battle/battleview.cpp
  33. +14 −1 game/ui/city/alertscreen.cpp
  34. +2 −0 game/ui/city/alertscreen.h
  35. +1 −0 game/ui/city/basebuyscreen.cpp
  36. +14 −1 game/ui/city/buildingscreen.cpp
  37. +2 −0 game/ui/city/buildingscreen.h
  38. +23 −11 game/ui/city/cityview.cpp
  39. +118 −0 game/ui/city/locationscreen.cpp
  40. +40 −0 game/ui/city/locationscreen.h
  41. +4 −0 game/ui/gameui.vcxproj
  42. +18 −4 game/ui/gameui.vcxproj.filters
  43. +1 −0 game/ui/general/difficultymenu.cpp
  44. +6 −6 game/ui/general/skirmish.cpp
  45. +211,337 −0 openapoc.trace
  46. +1 −0 tests/test_serialize.cpp
  47. +2 −18 tools/extractors/docs/video.txt
  48. +1 −1 tools/extractors/extract_buildings.cpp
  49. +2 −0 tools/extractors/extractors.cpp
View
@@ -14,4 +14,6 @@ for /R forms %%f in (*.cpp,*.h) do clang-format -i "%%f"
for /R framework %%f in (*.cpp,*.h) do clang-format -i "%%f"
for /R game %%f in (*.cpp,*.h) do clang-format -i "%%f"
for /R library %%f in (*.cpp,*.h) do clang-format -i "%%f"
for /R tools %%f in (*.cpp,*.h) do clang-format -i "%%f"
for /R tools %%f in (*.cpp,*.h) do clang-format -i "%%f"
del *.TMP /F /S
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<openapoc>
<form id="FORM_AGENT_ASSIGNMENT">
<style minwidth="529" minheight="373">
<size width="529" height="373"/>
<label text="Unassigned Agents">
<position x="45" y="3"/>
<size width="167" height="15"/>
<alignment horizontal="centre" vertical="centre"/>
<font>smalfont</font>
</label>
<label text="Vehicle Assignments">
<position x="299" y="3"/>
<size width="167" height="15"/>
<alignment horizontal="centre" vertical="centre"/>
<font>smalfont</font>
</label>
<scroll id="AGENT_SELECT_SCROLL">
<position x="509" y="27"/>
<size width="13" height="320"/>
</scroll>
<listbox id="AGENT_SELECT_BOX" scrollbarid="AGENT_SELECT_SCROLL">
<position x="16" y="32"/>
<size width="228" height="328"/>
<item size="0" spacing="5"/>
<hovercolour r="255" g="255" b="255" a="255"/>
<selcolour r="0" g="255" b="0" a="255"/>
</listbox>
<graphicbutton id="AGENT_SCROLL_UP" scrollprev="AGENT_SELECT_SCROLL">
<position x="505" y="3"/>
<size width="22" height="21"/>
<image/>
<imagedepressed>BUTTON_SCROLL_UP_DEPRESSED</imagedepressed>
</graphicbutton>
<graphicbutton id="AGENT_SCROLL_DOWN" scrollnext="AGENT_SELECT_SCROLL">
<position x="505" y="350"/>
<size width="22" height="21"/>
<image/>
<imagedepressed>BUTTON_SCROLL_DOWN_DEPRESSED</imagedepressed>
</graphicbutton>
<listbox id="VEHICLE_SELECT_BOX" >
<position x="291" y="32"/>
<size width="203" height="328"/>
<item size="0" spacing="5"/>
<hovercolour r="255" g="255" b="255" a="255"/>
<selcolour r="0" g="255" b="0" a="255"/>
</listbox>
</style>
</form>
</openapoc>
@@ -40,6 +40,12 @@
<alignment horizontal="left" vertical="centre"/>
<font>smalfont</font>
</label>
<graphic id="AGENT_ASSIGNMENT">
<position x="39" y="98"/>
<size width="529" height="373"/>
<imageposition>tile</imageposition>
<image/>
</graphic>
<graphicbutton id="BUTTON_QUIT">
<position x="602" y="443"/>
<size width="40" height="40"/>
@@ -45,6 +45,12 @@
<alignment horizontal="left" vertical="centre"/>
<font>smalfont</font>
</label>
<graphic id="AGENT_ASSIGNMENT">
<position x="37" y="96"/>
<size width="529" height="373"/>
<imageposition>tile</imageposition>
<image/>
</graphic>
<graphicbutton id="BUTTON_QUIT">
<position x="602" y="443"/>
<size width="40" height="40"/>
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<openapoc>
<form id="FORM_LOCATION_SCREEN">
<style minwidth="640" minheight="480">
<position x="centre" y="centre"/>
<size width="640" height="480"/>
<graphic id="BG">
<position x="0" y="0"/>
<size width="640" height="480"/>
</graphic>
<label id="TEXT_FUNDS">
<position x="572" y="11"/>
<size width="60" height="10"/>
<alignment horizontal="left" vertical="centre"/>
<font>smalfont</font>
</label>
<label id="CAPTION">
<position x="20" y="0"/>
<size width="600" height="40"/>
<alignment horizontal="centre" vertical="centre"/>
<font>bigfont</font>
</label>
<label text="Owner&gt;">
<position x="97" y="54"/>
<size width="60" height="23"/>
<alignment horizontal="left" vertical="centre"/>
<font>smalfont</font>
</label>
<label id="TEXT_OWNER_NAME">
<position x="147" y="54"/>
<size width="140" height="23"/>
<alignment horizontal="left" vertical="centre"/>
<font>smalfont</font>
</label>
<graphic id="AGENT_ASSIGNMENT">
<position x="37" y="96"/>
<size width="529" height="373"/>
<imageposition>tile</imageposition>
<image/>
</graphic>
<graphicbutton id="BUTTON_QUIT">
<position x="602" y="443"/>
<size width="40" height="40"/>
<image/>
<imagedepressed>BUTTON_OK_DEPRESSED</imagedepressed>
</graphicbutton>
</style>
</form>
</openapoc>
View
@@ -9,6 +9,43 @@
<size width="640" height="128"/>
<image>RAW:xcom3/ufodata/isobord3.dat:640:128:xcom3/ufodata/pal_01.dat</image>
</graphic>
<graphicbutton id="BUTTON_GOTO_BUILDING">
<size width="27" height="46"/>
<position x="334" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:0:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
<graphicbutton id="BUTTON_GOTO_BASE">
<size width="27" height="46"/>
<position x="369" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:7:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
<graphicbutton id="BUTTON_EQUIP_AGENT">
<size width="27" height="46"/>
<position x="408" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:45:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
<graphicbutton id="BUTTON_AGENT_BUILDING">
<size width="27" height="46"/>
<position x="443" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:9:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
<graphicbutton id="BUTTON_AGENT_PHYSICAL">
<size width="27" height="46"/>
<position x="482" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:48:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
<graphicbutton id="BUTTON_AGENT_PSI">
<size width="27" height="46"/>
<position x="517" y="75"/>
<image/>
<imagedepressed>PCK:xcom3/ufodata/icon_m.pck:xcom3/ufodata/icon_m.tab:49:xcom3/ufodata/pal_01.dat</imagedepressed>
</graphicbutton>
</style>
</form>
</openapoc>
View
@@ -60,8 +60,6 @@ class Control : public std::enable_shared_from_this<Control>
sp<Control> getRootControl();
void copyControlData(sp<Control> CopyOf);
void pushFormEvent(FormEventType type, Event *parentEvent);
void triggerEventCallbacks(FormsEvent *e);
@@ -85,6 +83,8 @@ class Control : public std::enable_shared_from_this<Control>
std::map<UString, sp<RadioButtonGroup>> radiogroups;
void copyControlData(sp<Control> CopyOf);
Control(bool takesFocus = true);
virtual ~Control();
View
@@ -2,6 +2,8 @@
#include "game/state/aequipment.h"
#include "game/state/battle/ai/aitype.h"
#include "game/state/battle/battleunit.h"
#include "game/state/city/building.h"
#include "game/state/city/vehicle.h"
#include "game/state/gamestate.h"
#include "game/state/organisation.h"
#include "game/state/rules/aequipment_type.h"
@@ -415,6 +417,47 @@ UString Agent::getRankName() const
return "";
}
void Agent::leaveBuilding(GameState &state, Vec3<float> initialPosition)
{
if (currentBuilding)
{
currentBuilding->currentAgents.erase({&state, shared_from_this()});
currentBuilding = nullptr;
}
if (currentVehicle)
{
currentVehicle->currentAgents.erase({&state, shared_from_this()});
currentVehicle = nullptr;
}
position = initialPosition;
goalPosition = initialPosition;
}
void Agent::enterBuilding(GameState &state, StateRef<Building> b)
{
if (currentVehicle)
{
currentVehicle->currentAgents.erase({&state, shared_from_this()});
currentVehicle = nullptr;
}
currentBuilding = b;
currentBuilding->currentAgents.insert({&state, shared_from_this()});
// FIXME: Implement crew quarters coordinate
LogWarning("Implement crew quarters coordinate for agents");
position = {(b->bounds.p0.x + b->bounds.p1.x) / 2, (b->bounds.p0.y + b->bounds.p1.y) / 2, 3};
}
void Agent::enterVehicle(GameState &state, StateRef<Vehicle> v)
{
if (currentBuilding)
{
currentBuilding->currentAgents.erase({&state, shared_from_this()});
currentBuilding = nullptr;
}
currentVehicle = v;
currentVehicle->currentAgents.insert({&state, shared_from_this()});
}
sp<AEquipment> Agent::getArmor(BodyPart bodyPart) const
{
auto a = getFirstItemInSlot(AgentType::getArmorSlotType(bodyPart));
View
@@ -14,7 +14,6 @@
namespace OpenApoc
{
class Base;
class Organisation;
class AEquipment;
class BattleUnitAnimationPack;
@@ -24,7 +23,10 @@ class AgentBodyType;
class BattleUnit;
class DamageModifier;
class DamageType;
class Building;
class Vehicle;
class VoxelMap;
class City;
enum class AIType;
enum class BodyPart
@@ -311,9 +313,28 @@ class Agent : public StateObject,
int getTULimit(int reactionValue) const;
UString getRankName() const;
StateRef<Base> home_base;
StateRef<Organisation> owner;
StateRef<City> city;
StateRef<Building> homeBuilding;
// Building the agent is currently stored inside, nullptr if it's in the city or a vehicle
StateRef<Building> currentBuilding;
// Vehicle the agent is currently stored inside, nullptr if it's in the city in a building
StateRef<Vehicle> currentVehicle;
/* leave the building and put agent into the city */
void leaveBuilding(GameState &state, Vec3<float> initialPosition);
/* 'enter' the agent in a building from city or vehicle*/
void enterBuilding(GameState &state, StateRef<Building> b);
/* 'enter' the agent in a vehicle from building*/
void enterVehicle(GameState &state, StateRef<Vehicle> v);
// Note that agent cannot ever leave vehicle into city, or enter vehicle from citu
// Agent's position in the city
Vec3<float> position;
// Position agent is moving towards
Vec3<float> goalPosition;
bool assigned_to_lab = false;
StateRef<BattleUnit> unit;
@@ -1128,6 +1128,7 @@ sp<BattleUnit> Battle::spawnUnit(GameState &state, StateRef<Organisation> owner,
Vec2<int> facing, BodyState curState, BodyState tarState)
{
auto agent = state.agent_generator.createAgent(state, owner, agentType);
agent->city = state.current_city;
auto unit = state.current_battle->placeUnit(state, agent, position);
unit->falling = true;
if (facing.x == 0 && facing.y == 0)
@@ -210,7 +210,7 @@ sp<Battle> BattleMap::createBattle(GameState &state, StateRef<Organisation> oppo
int playerAgentsCount = 0;
for (auto &agent : state.agents)
{
if (agent.second->home_base != base)
if (agent.second->homeBuilding->base != base)
{
continue;
}
@@ -229,7 +229,7 @@ sp<Battle> BattleMap::createBattle(GameState &state, StateRef<Organisation> oppo
{
for (auto &agent : state.agents)
{
if (agent.second->home_base != base)
if (agent.second->homeBuilding->base != base)
{
continue;
}
@@ -40,7 +40,8 @@ void BattleMapPart::die(GameState &state, bool explosive, bool violently)
for (auto &u : tileObject->getOwningTile()->getUnits(false, true))
{
// FIXME: Ensure falling damage is correct
u->applyDamage(state, 50, {&state, "DAMAGETYPE_FALLING_OBJECT"}, BodyPart::Helmet,
u->applyDamage(state, FALLING_MAP_PART_DAMAGE_TO_UNIT,
{&state, "DAMAGETYPE_FALLING_OBJECT"}, BodyPart::Helmet,
DamageSource::Impact);
}
this->tileObject->removeFromMap();
@@ -10,6 +10,7 @@
//#define MAP_PART_LINK_DEBUG_OUTPUT
#define TICKS_PER_FRAME_MAP_PART 8
#define FALLING_ACCELERATION_MAP_PART 0.16666667f // 1/6th
#define FALLING_MAP_PART_DAMAGE_TO_UNIT 50
namespace OpenApoc
{
@@ -19,12 +19,14 @@ static const unsigned int TICKS_PER_DETECTION_ATTEMPT[5] = {
static const unsigned int TICKS_DETECTION_TIMEOUT = 6 * TICKS_PER_HOUR;
class BuildingDef;
class Agent;
class Organisation;
class Vehicle;
class AgentType;
class Base;
class BattleMap;
class BaseLayout;
class City;
class UfopaediaEntry;
class BuildingFunction : public StateObject
@@ -42,16 +44,19 @@ class Building : public StateObject, public std::enable_shared_from_this<Buildin
STATE_OBJECT(Building)
public:
UString name;
StateRef<City> city;
StateRef<BuildingFunction> function;
StateRef<Organisation> owner;
Rect<int> bounds;
StateRef<BaseLayout> base_layout;
StateRef<Base> base;
StateRef<BattleMap> battle_map;
std::map<StateRef<AgentType>, int> preset_crew;
std::map<StateRef<AgentType>, int> current_crew;
std::vector<Vec3<int>> landingPadLocations;
std::set<StateRef<Vehicle>> landed_vehicles;
std::set<StateRef<Vehicle>> currentVehicles;
std::set<StateRef<Agent>> currentAgents;
unsigned ticksDetectionTimeOut = 0;
unsigned ticksDetectionAttemptAccumulated = 0;
Oops, something went wrong.

0 comments on commit 7f989d4

Please sign in to comment.