Skip to content

Commit 912a120

Browse files
committed
skyblue water color, in Math.h, common for game and editor
1 parent 2a87320 commit 912a120

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

src/caveexpress/client/CaveExpressClientMap.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
namespace caveexpress {
2929

30-
static const Color waterLineColor = { 0.99f, 0.99f, 1.0f, 1.0f };
31-
static const Color color = { (float)WATERCOLOR[0] / 255.0f, (float)WATERCOLOR[1] / 255.0f, (float)WATERCOLOR[2] / 255.0f, WATER_ALPHA
32-
/ 255.0f };
33-
3430
CaveExpressClientMap::CaveExpressClientMap (int x, int y, int width, int height, IFrontend *frontend,
3531
ServiceProvider& serviceProvider, int referenceTileWidth) :
3632
ClientMap(x, y, width, height, frontend, serviceProvider, referenceTileWidth), _waterHeight(0.0), _target(nullptr)
@@ -58,7 +54,7 @@ void CaveExpressClientMap::renderWater (int x, int y) const
5854
const SDL_Rect& rect = getWaterRect(x, y);
5955
Log::trace(LOG_GAMEIMPL, "rect:(%i,%i,%i,%i), x:%i, y:%i, water:(w:%i, h:%i, surf:%i, grnd:%i, wh:%f, scale:%i)",
6056
_x, _y, _width, _height, x, y, rect.w, rect.h, rect.y, rect.y + rect.h, _waterHeight, _scale);
61-
_frontend->renderWaterPlane(rect.x, rect.y, rect.w, rect.h, color, waterLineColor);
57+
_frontend->renderWaterPlane(rect.x, rect.y, rect.w, rect.h, waterColor, waterLineColor);
6258
if (Config.isDebug()) {
6359
const int waterGround = rect.y + rect.h;
6460
_frontend->renderLine(rect.x, rect.y, rect.x + rect.w, rect.y, colorRed);

src/caveexpress/client/ui/nodes/UINodeBackgroundScene.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "UINodeBackgroundScene.h"
2+
#include "common/Math.h"
23
#include "ui/UI.h"
34
#include "client/ClientMap.h"
45
#include "caveexpress/shared/CaveExpressMapFailedReasons.h"
@@ -86,9 +87,7 @@ int UINodeBackgroundScene::renderGround (int x, int y) const
8687

8788
void UINodeBackgroundScene::renderWater (int x, int y) const
8889
{
89-
static const Color color = { WATERCOLOR[0] / 255.0f, WATERCOLOR[1] / 255.0f, WATERCOLOR[2] / 255.0f, WATER_ALPHA
90-
/ 255.0f };
91-
_frontend->renderFilledRect(x, y, _frontend->getWidth() - x, _frontend->getHeight() - y, color);
90+
_frontend->renderFilledRect(x, y, _frontend->getWidth() - x, _frontend->getHeight() - y, waterColor);
9291
}
9392

9493
void UINodeBackgroundScene::renderFailedOnGround (int x, int y, const MapFailedReason& reason, float offsetY) const

src/caveexpress/client/ui/nodes/UINodeMapEditor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ void UINodeMapEditor::renderWater (int x, int y) const
102102
const int waterPixelHeight = _waterHeight * tileHeight;
103103
const int waterPixelWidth = getScreenMapGridWidth() * tileWidth;
104104

105-
Color waterColor = { 0.7f, 0.7f, 1.0f, 0.8f };
106-
renderLine(x, waterPixelSurface, x + waterPixelWidth, waterPixelSurface, waterColor);
107-
waterColor[3] = 0.4;
105+
renderLine(x, waterPixelSurface, x + waterPixelWidth, waterPixelSurface, waterLineColor);
108106
renderFilledRect(x, waterPixelSurface + 1, waterPixelWidth, waterPixelHeight, waterColor);
109107
}
110108

src/modules/client/ClientMap.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
#include <vector>
1818
#include <unordered_map>
1919

20-
namespace {
21-
const uint8_t WATER_ALPHA = 120;
22-
const uint8_t WATERCOLOR[] = { 178, 178, 255, WATER_ALPHA };
23-
}
24-
2520
class ClientMap: public IMap, public IClientCallback, public IEventObserver, public IParticleEnvironment {
2621
public:
2722
typedef std::unordered_map<uint16_t, ClientEntityPtr> ClientEntityMap;

src/modules/common/Math.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ static const Color highlightColor = { 1.0f, 1.0f, 1.0f, 0.5f };
9696
static const Color colorYellow = { 1.0f, 1.0f, 0.0f, 1.0f };
9797
static const Color colorCyan = { 0.2313f, 0.7372f, 0.8274f, 1.0f };
9898

99+
// water color
100+
// const uint8_t WATER_ALPHA = 80, WATERCOLOR[] = { 26, 45, 71, WATER_ALPHA }; // dark blue
101+
// const uint8_t WATER_ALPHA = 120, WATERCOLOR[] = { 56, 85, 121, WATER_ALPHA }; // dark cyan
102+
// const uint8_t WATER_ALPHA = 130, WATERCOLOR[] = { 56, 95, 151, WATER_ALPHA }; // cyan
103+
static const uint8_t WATER_ALPHA = 150, WATERCOLOR[] = { 58, 118, 181, WATER_ALPHA }; // skyblue
104+
105+
static const Color waterLineColor =
106+
{ (float)WATERCOLOR[0] / 255.0f * 1.2f,
107+
(float)WATERCOLOR[1] / 255.0f * 1.2f,
108+
(float)WATERCOLOR[2] / 255.0f * 1.2f, 1.f };
109+
static const Color waterColor =
110+
{ (float)WATERCOLOR[0] / 255.0f,
111+
(float)WATERCOLOR[1] / 255.0f,
112+
(float)WATERCOLOR[2] / 255.0f, WATER_ALPHA / 255.0f };
113+
99114
inline void FadeIn (float& value, float frac)
100115
{
101116
value *= frac;

0 commit comments

Comments
 (0)