Skip to content

Commit

Permalink
- add itemCount to Inventory
Browse files Browse the repository at this point in the history
- apply light radius from items to player
- update BUILD.txt
- update lighting
- update project
- use override instead of virtual
- update gamefiles
  • Loading branch information
dgengin committed Sep 29, 2019
1 parent 5667905 commit 9374028
Show file tree
Hide file tree
Showing 118 changed files with 823 additions and 684 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -19,7 +19,8 @@
/Debug
/Debug Clang
/Debug Code Analysis
/Debug VS2015
/Debug NoDiabloFormatSupport
/Debug NoMovie
/DGEngine
/DIABDAT
/DIABDAT.*
Expand All @@ -40,7 +41,9 @@
/obj
/PhysicsFS
/Release
/Release NoMovie
/Release Static
/Release Static NoMovie
/sfeMovie
/SFML
/Win32
38 changes: 5 additions & 33 deletions BUILD.txt
@@ -1,51 +1,23 @@
Windows

To compile in Windows, you need Visual Studio 2017, since this project
uses C++ features that are present only in VS2017.
To compile in Windows, you can use CMake or the Visual Studio 2019 project.

The provided project expects the following folders in the root of the
project to build properly.
The easiest way to get the required dependencies is to use vcpkg.

vcpkg install physfs:x86-windows sfml:x86-windows ffmpeg:x86-windows
vcpkg install physfs:x86-windows-static sfml:x86-windows-static ffmpeg:x86-windows-static

/PhysicsFS - https://icculus.org/physfs
version >= 2.1
Compile using MinSizeRel.

/SFML - http://www.sfml-dev.org/
SFML 2.5.0

/FFmpeg - http://ffmpeg.zeranoe.com/builds/
Get both 32 bit shared and dev packages (version 2.x or 3.x)

DGEngine now bundles a modified version of sfeMovie (no subtitle support,
FFmpeg 3.x API suport), so you only need FFmpeg >= 2.8 now.

If you want to skip movie playback support, use the preprocessor define
USE_SFML_MOVIE_STUB which uses a stub class that does nothing instead.
The provided project uses sfeMovie and will fail to compile if you don't have
sfeMovie with OpenFromStream support installed. Use this to fix that.

To prevent missing DLL errors when running from Visual Studio,
place the following in the root of the project:

avcodec-56.dll (FFmpeg 2)
avdevice-56.dll (FFmpeg 2)
avfilter-5.dll (FFmpeg 2)
avformat-56.dll (FFmpeg 2)
avutil-54.dll (FFmpeg 2)
openal32.dll (SFML)
physfs.dll (PhysicsFS)
sfml-audio-2.dll (SFML)
sfml-audio-d-2.dll (SFML)
sfml-graphics-2.dll (SFML)
sfml-graphics-d-2.dll (SFML)
sfml-network-2.dll (SFML)
sfml-network-d-2.dll (SFML)
sfml-system-2.dll (SFML)
sfml-system-d-2.dll (SFML)
sfml-window-2.dll (SFML)
sfml-window-d-2.dll (SFML)
swresample-1.dll (FFmpeg 2)
swscale-3.dll (FFmpeg 2)

Linux

Expand Down
3 changes: 3 additions & 0 deletions DGEngine.sln
Expand Up @@ -13,6 +13,7 @@ Global
Debug NoMovie|Win32 = Debug NoMovie|Win32
Debug|Win32 = Debug|Win32
Release NoMovie|Win32 = Release NoMovie|Win32
Release Static NoMovie|Win32 = Release Static NoMovie|Win32
Release Static|Win32 = Release Static|Win32
Release|Win32 = Release|Win32
EndGlobalSection
Expand All @@ -29,6 +30,8 @@ Global
{B30255A6-E921-4847-9FB1-26842AB465A4}.Debug|Win32.Build.0 = Debug|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release NoMovie|Win32.ActiveCfg = Release NoMovie|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release NoMovie|Win32.Build.0 = Release NoMovie|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release Static NoMovie|Win32.ActiveCfg = Release Static NoMovie|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release Static NoMovie|Win32.Build.0 = Release Static NoMovie|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release Static|Win32.ActiveCfg = Release Static|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release Static|Win32.Build.0 = Release Static|Win32
{B30255A6-E921-4847-9FB1-26842AB465A4}.Release|Win32.ActiveCfg = Release|Win32
Expand Down
187 changes: 138 additions & 49 deletions DGEngine.vcxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions gamefilesd/level/item/descriptions.json
Expand Up @@ -78,6 +78,13 @@
{ "min": 1, "max": "max", "value": "Chance to Hit : +%toHit%%" }
]
},
{
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -1, "value": "%toLightRadius%% to Light Radius" },
{ "min": 1, "max": "max", "value": "+%toLightRadius%% to Light Radius" }
]
},
{
"property": "toArmor",
"value": [
Expand Down
4 changes: 2 additions & 2 deletions gamefilesd/level/item/suffixes.json
Expand Up @@ -192,7 +192,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -40, "value": "Of The Dark" },
{ "min": -39, "max": -20, "value": "Of The Night" },
Expand Down Expand Up @@ -308,7 +308,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -40, "value": "Of The Dark" },
{ "min": -39, "max": -20, "value": "Of The Night" },
Expand Down
4 changes: 2 additions & 2 deletions gamefilesd/level/item/suffixesPriceB.json
Expand Up @@ -148,7 +148,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -20, "value": 0 },
{ "min": 20, "max": 39, "value": 750 },
Expand Down Expand Up @@ -249,7 +249,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -20, "value": 0 },
{ "min": 20, "max": 39, "value": 750 },
Expand Down
4 changes: 2 additions & 2 deletions gamefilesd/level/item/suffixesPriceM.json
Expand Up @@ -175,7 +175,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -40, "value": -3 },
{ "min": -39, "max": -20, "value": -2 },
Expand Down Expand Up @@ -291,7 +291,7 @@
]
},
{
"property": "lightRadius",
"property": "toLightRadius",
"value": [
{ "min": "min", "max": -40, "value": -3 },
{ "min": -39, "max": -20, "value": -2 },
Expand Down
1 change: 1 addition & 0 deletions gamefilesd/level/loadBaseLevel.json
Expand Up @@ -3,6 +3,7 @@
"id": "level",
"anchor": "all",
"size": [640, 352],
"lightRadius": 64,
"automapPlayerDirectionIndex": 1024,
"playerClassClearIndex": 1,
"playerClearIndex": 1,
Expand Down
6 changes: 5 additions & 1 deletion gamefilesd/level/map/town/items.json
Expand Up @@ -91,7 +91,11 @@
},
{
"class": "club",
"mapPosition": [59, 74]
"mapPosition": [59, 74],
"properties": {
"toLightRadius": 20,
"magical": true
}
},
{
"class": "compositeBow",
Expand Down
9 changes: 5 additions & 4 deletions gamefilesd/res/shaders/level/default.frag
Expand Up @@ -2,9 +2,9 @@
uniform sampler2D texture;
uniform vec4 visibleRect;
uniform int numberOfLights;
uniform float lights[256];
uniform float lights[512];
uniform float defaultLight;
uniform float radiusSize;
uniform float lightRadius;
uniform float elapsedTime;

void main()
Expand All @@ -15,9 +15,10 @@ void main()
{
for(int i = 0; i < numberOfLights; i += 4)
{
vec2 pixelPos = visibleRect.xy + (visibleRect.zw * gl_TexCoord[0].xy);
vec2 coord = vec2(gl_TexCoord[0].x, 1.0 - gl_TexCoord[0].y);
vec2 pixelPos = visibleRect.xy + (visibleRect.zw * coord);
float dist = distance(pixelPos, vec2(lights[i], lights[i+1]));
dist = clamp(dist / radiusSize, 0.0, lights[i+3]) / lights[i+3];
dist = clamp(dist / lightRadius, 0.0, lights[i+3]) / lights[i+3];
light = clamp(dist, 0.0, light);
if (light == 0.0)
{
Expand Down
10 changes: 7 additions & 3 deletions gamefilesd/ui/settingsShaders.json
Expand Up @@ -112,13 +112,13 @@
"position": [319, 277],
"anchor": "none",
"horizontalAlign": "center",
"text": "Max Lights: 64",
"text": "Max Lights: 128",
"onClick": {
"name": "switch",
"param": "%maxLights.text%",
"case": [
{
"value": "Max Lights: 64",
"value": "Max Lights: 128",
"action": { "name": "text.setText", "id": "maxLights", "text": "Max Lights: 0" }
},
{
Expand All @@ -136,9 +136,13 @@
{
"value": "Max Lights: 16",
"action": { "name": "text.setText", "id": "maxLights", "text": "Max Lights: 64" }
},
{
"value": "Max Lights: 64",
"action": { "name": "text.setText", "id": "maxLights", "text": "Max Lights: 128" }
}
],
"default": { "name": "text.setText", "id": "maxLights", "text": "Max Lights: 64" }
"default": { "name": "text.setText", "id": "maxLights", "text": "Max Lights: 128" }
},
"onFocus": "anchorPentagrams"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/ActAction.h
Expand Up @@ -15,7 +15,7 @@ class ActActionSet : public Action
ActActionSet(const std::string& key_, const std::shared_ptr<Action>& action_)
: key(key_), action(action_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
if (key.empty() == false)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Actions/ActAnimation.h
Expand Up @@ -13,7 +13,7 @@ class ActAnimationPause : public Action
public:
ActAnimationPause(const std::string& id_, bool pause_) : id(id_), pause(pause_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto animation = game.Resources().getDrawable<Animation>(id);
if (animation != nullptr)
Expand Down Expand Up @@ -45,7 +45,7 @@ class ActAnimationSetAnimation : public Action
resetAnimation(resetAnimation_), updateAnimationType(updateAnimationType_),
setCompositeTexture(setCompositeTexture_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto animation = game.Resources().getDrawable<Animation>(id);
if (animation != nullptr)
Expand Down Expand Up @@ -103,7 +103,7 @@ class ActAnimationSetRefresh : public Action
ActAnimationSetRefresh(const std::string& id_, sf::Time refresh_)
: id(id_), refresh(refresh_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
if (refresh.asMicroseconds() > 0)
{
Expand Down
16 changes: 8 additions & 8 deletions src/Actions/ActAudio.h
Expand Up @@ -12,7 +12,7 @@ class ActAudioPause : public Action
public:
ActAudioPause(const std::string& id_) : id(id_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto song = game.Resources().getSong(id);
if (song != nullptr)
Expand All @@ -26,7 +26,7 @@ class ActAudioPause : public Action
class ActAudioPauseAll : public Action
{
public:
virtual bool execute(Game& game)
bool execute(Game& game) override
{
game.Resources().pauseSongs();
return true;
Expand All @@ -52,7 +52,7 @@ class ActAudioPlay : public Action
hasLoop = true;
}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
if (clear == true)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ class ActAudioResumeAll : public Action
public:
ActAudioResumeAll(bool restart_) noexcept : restart(restart_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
game.Resources().playPaused(restart);
return true;
Expand All @@ -110,7 +110,7 @@ class ActAudioSeek : public Action
public:
ActAudioSeek(const std::string& id_, const sf::Time& time_) : id(id_), time(time_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto song = game.Resources().getSong(id);
if (song != nullptr)
Expand All @@ -131,7 +131,7 @@ class ActAudioSetVolume : public Action
ActAudioSetVolume(const std::string& id_, const Variable& volume_)
: id(id_), volume(volume_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto song = game.Resources().getSong(id);
if (song != nullptr)
Expand All @@ -155,7 +155,7 @@ class ActAudioStop : public Action
public:
ActAudioStop(const std::string& id_) : id(id_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto song = game.Resources().getSong(id);
if (song != nullptr)
Expand All @@ -169,7 +169,7 @@ class ActAudioStop : public Action
class ActAudioStopAll : public Action
{
public:
virtual bool execute(Game& game)
bool execute(Game& game) override
{
game.Resources().stopSongs();
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/Actions/ActButton.h
Expand Up @@ -15,7 +15,7 @@ class ActButtonClick : public Action
ActButtonClick(const std::string& id_, bool playSound_)
: id(id_), playSound(playSound_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto button = game.Resources().getDrawable<Button>(id);
if (button != nullptr)
Expand All @@ -36,7 +36,7 @@ class ActButtonEnable : public Action
ActButtonEnable(const std::string& id_, bool enable_)
: id(id_), enable(enable_) {}

virtual bool execute(Game& game) noexcept
bool execute(Game& game) noexcept override
{
auto button = game.Resources().getDrawable<Button>(id);
if (button != nullptr)
Expand All @@ -57,7 +57,7 @@ class ActButtonSetColor : public Action
ActButtonSetColor(const std::string& id_, const sf::Color& color_)
: id(id_), color(color_) {}

virtual bool execute(Game& game)
bool execute(Game& game) override
{
auto button = game.Resources().getDrawable<Button>(id);
if (button != nullptr)
Expand Down

0 comments on commit 9374028

Please sign in to comment.