Unverified Commit 7920e0c6 authored by Javidx9's avatar Javidx9 Committed by GitHub
Browse files

Added Role Playing Game (at last)

It is what it is :D
parent 1bf93cad
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="olcConsoleGameEngineOOP.cpp" />
<ClCompile Include="RPG_Assets.cpp" />
<ClCompile Include="RPG_Commands.cpp" />
<ClCompile Include="RPG_Dynamics.cpp" />
<ClCompile Include="RPG_Engine.cpp" />
<ClCompile Include="RPG_Items.cpp" />
<ClCompile Include="RPG_Maps.cpp" />
<ClCompile Include="RPG_Quests.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="olcConsoleGameEngineOOP.h" />
<ClInclude Include="RPG_Assets.h" />
<ClInclude Include="RPG_Commands.h" />
<ClInclude Include="RPG_Dynamics.h" />
<ClInclude Include="RPG_Engine.h" />
<ClInclude Include="RPG_Items.h" />
<ClInclude Include="RPG_Maps.h" />
<ClInclude Include="RPG_Quests.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{73460557-14A0-4160-8A8F-BCBC4B271238}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>RPGVideo</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.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>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="RPG_Maps.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="olcConsoleGameEngineOOP.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Assets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Dynamics.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Commands.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Engine.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Quests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RPG_Items.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RPG_Maps.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="olcConsoleGameEngineOOP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Assets.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Dynamics.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Commands.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Engine.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Quests.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RPG_Items.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
/*
+-------------------------------------------------------------+
| OneLoneCoder RPG Game Engine |
| "The Legend of WittyBit, Fantasy Quest VI" - javidx9 |
+-------------------------------------------------------------+
What is this?
~~~~~~~~~~~~~
This is the code I created as part of my
"Code-It-Yourself! Role Playing Game" series on YouTube. This is
NOT a game. The project will compile and demonstrate several
systems developed as part of that series. My original intention
was to develop a small yet complete RPG, alas real life got in
the way. After several months, I've decided to just open the source
"as is", so it will contain bugs, be confusing and all round not
up to the usual "quality" I strive for.
Part 1: https://youtu.be/xXXt3htgDok
Part 2: https://youtu.be/AWY_ITpldRk
Part 3: https://youtu.be/UcNSb-m4YQU
Part 4: https://youtu.be/AnyoUfeNZ1Y
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2018, 2019 OneLoneCoder.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions or derivations of source code must retain the above
copyright notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce
the above copyright notice. This list of conditions and the following
disclaimer must be reproduced in the documentation and/or other
materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Links
~~~~~
YouTube: https://www.youtube.com/javidx9
Discord: https://discord.gg/WhwHUMV
Twitter: https://www.twitter.com/javidx9
Twitch: https://www.twitch.tv/javidx9
GitHub: https://www.github.com/onelonecoder
Homepage: https://www.onelonecoder.com
Patreon: https://www.patreon.com/javidx9
Author
~~~~~~
David Barr, aka javidx9, OneLoneCoder 2018, 2019
*/
#include "RPG_Assets.h"
#include "RPG_Maps.h"
#include "RPG_Items.h"
RPG_Assets::RPG_Assets()
{
}
RPG_Assets::~RPG_Assets()
{
}
void RPG_Assets::LoadSprites()
{
auto load = [&](string sName, wstring sFileName)
{
olcSprite* s = new olcSprite(sFileName);
m_mapSprites[sName] = s;
};
load("village", L"rpgdata/gfx/toml_spritesheetdark.spr");
load("skelly", L"rpgdata/gfx/toml_Char001.png.spr");
load("player", L"rpgdata/gfx/toml_CharacterSprites.spr");
load("font", L"rpgdata/gfx/javidx9_nesfont8x8.spr");
load("worldmap", L"rpgdata/gfx/worldmap1.png.spr");
load("skymap", L"rpgdata/gfx/sky1.png.spr");
load("title", L"rpgdata/gfx/title3.png.spr");
load("balloon", L"rpgdata/gfx/balloon1.png.spr");
load("sword", L"rpgdata/gfx/Sword.spr");
load("hitech", L"rpgdata/gfx/toml_modernish.spr");
load("purple", L"rpgdata/gfx/toml_purple.spr");
load("health", L"rpgdata/gfx/item_health.spr");
load("healthboost", L"rpgdata/gfx/item_healthboost.spr");
load("Basic Sword", L"rpgdata/gfx/weapon_basic_sword.spr");
}
void RPG_Assets::LoadMaps()
{
auto load = [&](cMap* m)
{
m_mapMaps[m->sName] = m;
};
load(new cMap_Village1());
load(new cMap_Home1());
}
void RPG_Assets::LoadItems()
{
auto load = [&](cItem* i)
{
m_mapItems[i->sName] = i;
};
load(new cItem_Health());
load(new cItem_HealthBoost());
load(new cWeapon_Sword());
}
/*
+-------------------------------------------------------------+
| OneLoneCoder RPG Game Engine |
| "The Legend of WittyBit, Fantasy Quest VI" - javidx9 |
+-------------------------------------------------------------+
What is this?
~~~~~~~~~~~~~
This is the code I created as part of my
"Code-It-Yourself! Role Playing Game" series on YouTube. This is
NOT a game. The project will compile and demonstrate several
systems developed as part of that series. My original intention
was to develop a small yet complete RPG, alas real life got in
the way. After several months, I've decided to just open the source
"as is", so it will contain bugs, be confusing and all round not
up to the usual "quality" I strive for.
Part 1: https://youtu.be/xXXt3htgDok
Part 2: https://youtu.be/AWY_ITpldRk
Part 3: https://youtu.be/UcNSb-m4YQU
Part 4: https://youtu.be/AnyoUfeNZ1Y
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2018, 2019 OneLoneCoder.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions or derivations of source code must retain the above
copyright notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce
the above copyright notice. This list of conditions and the following
disclaimer must be reproduced in the documentation and/or other
materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Links
~~~~~
YouTube: https://www.youtube.com/javidx9
Discord: https://discord.gg/WhwHUMV
Twitter: https://www.twitter.com/javidx9
Twitch: https://www.twitch.tv/javidx9
GitHub: https://www.github.com/onelonecoder
Homepage: https://www.onelonecoder.com
Patreon: https://www.patreon.com/javidx9
Author
~~~~~~
David Barr, aka javidx9, ©OneLoneCoder 2018, 2019
*/
#pragma once
#include "olcConsoleGameEngineOOP.h"
#include <map>
class cMap;
class cItem;
class RPG_Assets
{
public:
static RPG_Assets& get()
{
static RPG_Assets me;
return me;
}
RPG_Assets(RPG_Assets const&) = delete;
void operator=(RPG_Assets const&) = delete;
olcSprite* GetSprite(string name)
{
return m_mapSprites[name];
}
cMap* GetMap(string name)
{
return m_mapMaps[name];
}
cItem* GetItem(string name)
{
return m_mapItems[name];
}
void LoadSprites();
void LoadMaps();
void LoadItems();
private:
RPG_Assets();
~RPG_Assets();
map<string, olcSprite*> m_mapSprites;
map<string, cMap*> m_mapMaps;
map<string, cItem*> m_mapItems;
};
/*
+-------------------------------------------------------------+
| OneLoneCoder RPG Game Engine |
| "The Legend of WittyBit, Fantasy Quest VI" - javidx9 |
+-------------------------------------------------------------+
What is this?
~~~~~~~~~~~~~
This is the code I created as part of my
"Code-It-Yourself! Role Playing Game" series on YouTube. This is
NOT a game. The project will compile and demonstrate several
systems developed as part of that series. My original intention
was to develop a small yet complete RPG, alas real life got in
the way. After several months, I've decided to just open the source
"as is", so it will contain bugs, be confusing and all round not
up to the usual "quality" I strive for.
Part 1: https://youtu.be/xXXt3htgDok
Part 2: https://youtu.be/AWY_ITpldRk
Part 3: https://youtu.be/UcNSb-m4YQU
Part 4: https://youtu.be/AnyoUfeNZ1Y
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2018, 2019 OneLoneCoder.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions or derivations of source code must retain the above
copyright notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce
the above copyright notice. This list of conditions and the following
disclaimer must be reproduced in the documentation and/or other
materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Links
~~~~~
YouTube: https://www.youtube.com/javidx9
Discord: https://discord.gg/WhwHUMV
Twitter: https://www.twitter.com/javidx9
Twitch: https://www.twitch.tv/javidx9
GitHub: https://www.github.com/onelonecoder
Homepage: https://www.onelonecoder.com
Patreon: https://www.patreon.com/javidx9
Author
~~~~~~
David Barr, aka javidx9, OneLoneCoder 2018, 2019
*/
#include "RPG_Commands.h"
#include "RPG_Engine.h"
#include "RPG_Quests.h"
RPG_Engine* cCommand::g_engine = nullptr;
cScriptProcessor::cScriptProcessor()
{
bUserControlEnabled = true;
}
void cScriptProcessor::AddCommand(cCommand *cmd)
{
m_listCommands.push_back(cmd);
}
void cScriptProcessor::ProcessCommands(float fElapsedTime)
{
// If command are available, halt user control
bUserControlEnabled = m_listCommands.empty();
if (!m_listCommands.empty())
{
// A command is available
if (!m_listCommands.front()->bCompleted)
{
// Command has not been started
if (!m_listCommands.front()->bStarted)
{
m_listCommands.front()->Start();
m_listCommands.front()->bStarted = true;