Skip to content

Commit

Permalink
More progress
Browse files Browse the repository at this point in the history
  • Loading branch information
tatjam committed Mar 4, 2020
1 parent a720026 commit bf2b66f
Show file tree
Hide file tree
Showing 45 changed files with 3,125 additions and 252 deletions.
25 changes: 23 additions & 2 deletions 7DRL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\flight\Sonar.cpp" />
<ClCompile Include="src\flight\Gamemaster.cpp" />
<ClCompile Include="src\vehicle\workbench\Battery.cpp" />
<ClCompile Include="src\vehicle\workbench\Machines.cpp" />
<ClCompile Include="src\vehicle\workbench\Periscope.cpp" />
<ClCompile Include="src\vehicle\workbench\Maneouver.cpp" />
<ClCompile Include="src\vehicle\workbench\Listening.cpp" />
<ClCompile Include="src\vehicle\Crewmember.cpp" />
<ClCompile Include="src\vehicle\workbench\Radio.cpp" />
<ClCompile Include="src\vehicle\workbench\Sonar.cpp" />
<ClCompile Include="src\flight\FlightMap.cpp" />
<ClCompile Include="src\flight\FlightScene.cpp" />
<ClCompile Include="src\Main.cpp" />
Expand Down Expand Up @@ -191,6 +199,7 @@
<ClCompile Include="src\soloud\src\filter\soloud_robotizefilter.cpp" />
<ClCompile Include="src\soloud\src\filter\soloud_waveshaperfilter.cpp" />
<ClCompile Include="src\Status.cpp" />
<ClCompile Include="src\vehicle\Vehicle.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="libtcod.dll" />
Expand All @@ -199,8 +208,18 @@
<None Include="src\soloud\src\c_api\soloud.def" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\flight\Gamemaster.h" />
<ClInclude Include="src\vehicle\workbench\Battery.h" />
<ClInclude Include="src\vehicle\workbench\Machines.h" />
<ClInclude Include="src\vehicle\workbench\Periscope.h" />
<ClInclude Include="src\vehicle\workbench\Maneouver.h" />
<ClInclude Include="src\vehicle\workbench\Listening.h" />
<ClInclude Include="src\Speech.h" />
<ClInclude Include="src\vehicle\Crewmember.h" />
<ClInclude Include="src\Date.h" />
<ClInclude Include="src\vehicle\workbench\Radio.h" />
<ClInclude Include="src\Drawing.h" />
<ClInclude Include="src\flight\Sonar.h" />
<ClInclude Include="src\vehicle\workbench\Sonar.h" />
<ClInclude Include="src\flight\FlightMap.h" />
<ClInclude Include="src\defines.h" />
<ClInclude Include="src\flight\FlightScene.h" />
Expand All @@ -216,6 +235,8 @@
<ClInclude Include="src\soloud\src\audiosource\wav\dr_wav.h" />
<ClInclude Include="src\soloud\src\audiosource\wav\stb_vorbis.h" />
<ClInclude Include="src\Status.h" />
<ClInclude Include="src\vehicle\Vehicle.h" />
<ClInclude Include="src\vehicle\workbench\Workbench.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
71 changes: 67 additions & 4 deletions 7DRL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,34 @@
<ClCompile Include="src\soloud\src\core\soloud_thread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\flight\Sonar.cpp">
<ClCompile Include="src\vehicle\Vehicle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\Crewmember.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Sonar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Radio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Listening.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Maneouver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Periscope.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Machines.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicle\workbench\Battery.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\flight\Gamemaster.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
Expand Down Expand Up @@ -264,14 +291,50 @@
<ClInclude Include="src\soloud\src\audiosource\wav\stb_vorbis.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\flight\Sonar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Drawing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Help.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Date.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\Vehicle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\Crewmember.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Speech.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Workbench.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Sonar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Radio.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Listening.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Maneouver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Periscope.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Machines.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\vehicle\workbench\Battery.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\flight\Gamemaster.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Binary file added Test.xp
Binary file not shown.
Binary file added diesel.wav
Binary file not shown.
Binary file added distort.wav
Binary file not shown.
Binary file added engine_off.wav
Binary file not shown.
Binary file added engines_high.wav
Binary file not shown.
Binary file added engines_low.wav
Binary file not shown.
Binary file added moving_fast.wav
Binary file not shown.
Binary file added moving_slow.wav
Binary file not shown.
Binary file added radio.wav
Binary file not shown.
Binary file modified rc11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/Date.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

struct Date
{
int day;
int hour;
int minute;
int second;

int to_seconds()
{
return second + minute * 60 + hour * 60 * 60 + day * 24 * 60 * 60;
}

void from_seconds(int s)
{
day = s / (24 * 60 * 60);
s = s % (24 * 60 * 60);
hour = s / (60 * 60);
s = s % (60 * 60);
minute = s / 60;
s = s % 60;
second = s;
}

std::string format()
{
std::string str;
str += std::to_string(day);
str += ':';
str += std::to_string(hour);
str += ':';
str += std::to_string(minute);
str += ':';
str += std::to_string(second);

return str;
}

};
72 changes: 72 additions & 0 deletions src/Drawing.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,76 @@ class Drawing

return false;
}

static void draw_rectangle(TCODConsole* target, int x0, int y0, int w, int h, bool dline = false)
{
int hline = 196;
int vline = 179;
int ulc = 218;
int urc = 191;
int blc = 192;
int brc = 217;

if (dline)
{
hline = 205;
vline = 186;
ulc = 201;
urc = 187;
blc = 200;
brc = 188;
}

for (int x = x0; x < x0 + w; x++)
{
target->putChar(x, y0, hline);
target->putChar(x, y0 + h, hline);
}

for (int y = y0; y < y0 + h; y++)
{
target->putChar(x0, y, vline);
target->putChar(x0 + w, y, vline);
}

// Corners

target->putChar(x0, y0, ulc);
target->putChar(x0 + w, y0, urc);
target->putChar(x0, y0 + h, blc);
target->putChar(x0 + w, y0 + h, brc);
}

// Single letter hold button
static bool draw_button(TCODConsole* target, int x0, int y0, int rx, int ry, int ch)
{
TCOD_mouse_t pos = TCODMouse::getStatus();

int w = 2;
int h = 2;

bool clicked = false;
if (pos.cx - rx >= x0 && pos.cx - rx <= x0 + w && pos.cy - ry >= y0 && pos.cy - ry <= y0 + h && pos.lbutton)
{
clicked = true;
}

draw_rectangle(target, x0, y0, w, h, false);

if (clicked)
{
target->setDefaultForeground(TCODColor::lightGreen);
}
else
{
target->setDefaultForeground(TCODColor::white);
}

target->setChar(x0 + w / 2, y0 + h / 2, ch);


target->setDefaultForeground(TCODColor::white);

return clicked;
}
};
9 changes: 3 additions & 6 deletions src/Help.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ class Help
F11 - Open/Close this menu\n\
ESC - Close Menus\n\
Space - Pause\n\
\n\n\
This window shows contextual help depending on your currently open screen\n\
To open other screens, click on any of the machines in the submarine. \
If there is nobody operating the machine, click on a crewmember, rightclick \
the machine, and select \"move\".\n\n\
Left-click - Open Machines\n\
Right-click - Contextual Menu\n\
-------------------------------------\n\
What should I do?\n\n\
Wait for orders from central command, you will receive them on the radio\n\n\
Wait for orders from central command, you will receive them on the communicator\n\n\
-------------------------------------\n\
How can I interact with the crew?\n\n\
All orders are done via rightclicking, you can find further help on the \"Crewmember\" menu \
Expand Down
16 changes: 8 additions & 8 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "soloud/include/soloud_wav.h"

SoLoud::Soloud* g_soloud;
Status* g_status;
TCOD_key_t g_key;
TCODRandom* g_random;

int main(int argc, char** argv)
{
Expand All @@ -19,20 +22,17 @@ int main(int argc, char** argv)
g_soloud = new SoLoud::Soloud;
g_soloud->init();

Status status;
FlightScene flight_scene(&status);
g_status = new Status();
g_random = new TCODRandom();

FlightScene flight_scene = FlightScene();

TCODSystem::setFps(60);

while (!TCODConsole::isWindowClosed())
{
TCOD_key_t key;
TCOD_mouse_t mouse;
TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS | TCOD_EVENT_MOUSE, &key, &mouse);
if (key.vk != TCODK_NONE)
{
flight_scene.turn(key);
}
TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS | TCOD_EVENT_MOUSE, &g_key, &mouse);

flight_scene.update(TCODSystem::getLastFrameLength());

Expand Down
69 changes: 69 additions & 0 deletions src/Speech.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once
#include <string>

class Speech
{
public:

static std::string positive()
{
if (rand() % 2 == 0)
{
if (rand() % 2 == 0)
{
return "Affirmative, ";
}
else
{
return "Received, ";
}
}
else
{
if (rand() % 2 == 0)
{
return "Yes sir, ";
}
else
{
return "Solid copy sir, ";
}
}
}

static std::string heading()
{
if (rand() % 2 == 0)
{
return "setting heading to the ";
}
else
{
return "changing heading to the ";
}
}

static std::string heading_done()
{
if (rand() % 2 == 0)
{
return "Heading set, sir!";
}
else
{
return "Sir, heading is set";
}
}

static std::string speed_done()
{
if (rand() % 2 == 0)
{
return "Velocity set, sir!";
}
else
{
return "Sir, we are at the target velocity";
}
}
};
Loading

0 comments on commit bf2b66f

Please sign in to comment.