Compare commits

..

2 Commits

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

@ -22,32 +22,32 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{C6900ECF-254F-4751-A968-DDA699CCD5A6}</ProjectGuid>
<RootNamespace>TrustFall</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
@ -144,6 +144,9 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cursor.cpp" />
<ClCompile Include="game.cpp" />
@ -163,19 +166,16 @@
<ClInclude Include="screen.h" />
<ClInclude Include="start_screen.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.7\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.7\build\native\Allegro.targets')" />
<Import Project="..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.4.0\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.4.0\build\native\Allegro.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.12.0\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.7\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.7\build\native\Allegro.targets'))" />
<Error Condition="!Exists('..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.7.0.0\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.4.0\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.4.0\build\native\Allegro.targets'))" />
</Target>
</Project>

@ -32,6 +32,9 @@
<UniqueIdentifier>{b26b82a2-f4cd-444a-923f-82aad7c96345}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
@ -81,7 +84,4 @@
<Filter>Header Files\Screens</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrustFall", "TrustFall\TrustFall.vcxproj", "{C6900ECF-254F-4751-A968-DDA699CCD5A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Debug|x64.ActiveCfg = Debug|x64
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Debug|x64.Build.0 = Debug|x64
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Debug|x86.ActiveCfg = Debug|Win32
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Debug|x86.Build.0 = Debug|Win32
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Release|x64.ActiveCfg = Release|x64
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Release|x64.Build.0 = Release|x64
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Release|x86.ActiveCfg = Release|Win32
{C6900ECF-254F-4751-A968-DDA699CCD5A6}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {33B495B4-3A19-4588-AA7F-6E664C8E0C19}
EndGlobalSection
EndGlobal

Binary file not shown.

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Allegro" version="5.2.7" targetFramework="native" />
<package id="AllegroDeps" version="1.12.0" targetFramework="native" />
</packages>

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

@ -33,16 +33,13 @@ void Game::init() {
sprites.insert(pair<string, ALLEGRO_BITMAP*>("MusicOff", al_load_bitmap("music_off.bmp")));
al_reserve_samples(4);
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Theme", al_load_sample("rasputin.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Move", al_load_sample("move.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Catch", al_load_sample("catch.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Fall", al_load_sample("fall.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("Place", al_load_sample("place.wav")));
samples.insert(pair<string, ALLEGRO_SAMPLE*>("LevelUp", al_load_sample("level.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Rasputin", al_load_sample("rasputin.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Guile", al_load_sample("guile.wav")));
themes.insert(pair<string, ALLEGRO_SAMPLE*>("Mine", al_load_sample("customtheme.wav")));
font = al_create_builtin_font();
}
@ -53,7 +50,7 @@ void Game::reset() {
//Run the game state machine
void Game::run() {
//Load screens
GameScreen game_screen(sprites, samples, themes);
GameScreen game_screen(sprites, samples);
StartScreen start_screen(sprites);
ResultScreen result_screen(sprites, 0, 0, Easy);
int difficulty = 1; //Difficulty to run
@ -115,8 +112,4 @@ void Game::run() {
for (it2 = samples.begin(); it2 != samples.end(); it2++) {
al_destroy_sample(it2->second);
}
map<string, ALLEGRO_SAMPLE*>::iterator it3;
for (it3 = themes.begin(); it3 != themes.end(); it3++) {
al_destroy_sample(it3->second);
}
}

@ -25,7 +25,6 @@ public:
std::map<std::string, ALLEGRO_BITMAP*> sprites;
std::map<std::string, ALLEGRO_SAMPLE*> samples;
std::map<std::string, ALLEGRO_SAMPLE*> themes;
Game();

@ -18,10 +18,9 @@ using std::ostringstream;
using std::map;
using std::pair;
GameScreen::GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples, std::map<std::string, ALLEGRO_SAMPLE*> _themes) {
GameScreen::GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples) {
sprites = _sprites;
samples = _samples;
themes = _themes;
srand(time(NULL)); //Seed random number generator with current time so sequence is unique each run
}
@ -76,21 +75,14 @@ void GameScreen::run(ALLEGRO_FONT* font) {
//Create map of sample instances. This is more memory efficient than play samples over and over again individually,
//and allows the anti-overlap functionality implemented above.
map<string, ALLEGRO_SAMPLE_INSTANCE*> instances;
map<string, ALLEGRO_SAMPLE_INSTANCE*> theme_instances;
map<string, ALLEGRO_SAMPLE*>::iterator it;
for (it = samples.begin(); it != samples.end(); it++) {
instances.insert(pair<string, ALLEGRO_SAMPLE_INSTANCE*>(it->first, al_create_sample_instance(it->second)));
al_attach_sample_instance_to_mixer(instances[it->first], al_get_default_mixer());
}
for (it = themes.begin(); it != themes.end(); it++) {
theme_instances.insert(pair<string, ALLEGRO_SAMPLE_INSTANCE*>(it->first, al_create_sample_instance(it->second)));
al_attach_sample_instance_to_mixer(theme_instances[it->first], al_get_default_mixer());
}
map<string, ALLEGRO_SAMPLE_INSTANCE*>::iterator theme_it = theme_instances.begin();
std::advance(theme_it, rand() % (theme_instances.size()));
al_set_sample_instance_playmode(theme_it->second, ALLEGRO_PLAYMODE_LOOP);
play(theme_it->second);
al_set_sample_instance_playmode(instances["Theme"], ALLEGRO_PLAYMODE_LOOP);
play(instances["Theme"]);
int ticks = 0; //Counts the number of ticks, this is used to determine when to move the lines
bool exit_screen = false;
@ -114,7 +106,6 @@ void GameScreen::run(ALLEGRO_FONT* font) {
for (in_it = instances.begin(); in_it != instances.end(); in_it++) {
al_stop_sample_instance(in_it->second);
}
al_stop_sample_instance(theme_it->second);
al_play_sample_instance(instances["Fall"]);
exit_screen = true;
al_clear_to_color(al_map_rgb(0, 0, 0));
@ -166,10 +157,10 @@ void GameScreen::run(ALLEGRO_FONT* font) {
//Toggle music
if (ctrl) {
if (music) {
al_stop_sample_instance(theme_it->second);
al_stop_sample_instance(instances["Theme"]);
}
else {
al_play_sample_instance(theme_it->second);
al_play_sample_instance(instances["Theme"]);
}
music = !music;
}

@ -7,7 +7,6 @@ class GameScreen : public Screen {
public:
std::map<std::string, ALLEGRO_BITMAP*> sprites;
std::map<std::string, ALLEGRO_SAMPLE*> samples;
std::map<std::string, ALLEGRO_SAMPLE*> themes;
std::vector<Line> lines;
unsigned int selected;
int max_catchers;
@ -16,7 +15,7 @@ public:
int difficulty;
bool music;
GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples, std::map<std::string, ALLEGRO_SAMPLE*> _themes);
GameScreen(std::map<std::string, ALLEGRO_BITMAP*> _sprites, std::map<std::string, ALLEGRO_SAMPLE*> _samples);
void reset(int _lines, int _max_catchers, int _difficulty);
void run(ALLEGRO_FONT* font);

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Allegro" version="5.2.4.0" targetFramework="native" />
<package id="AllegroDeps" version="1.7.0.0" targetFramework="native" />
</packages>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Loading…
Cancel
Save