Skip to content

Commit

Permalink
# - creator mode, layer tool
Browse files Browse the repository at this point in the history
  • Loading branch information
en-software committed Nov 26, 2023
1 parent 39d3e28 commit 960dca5
Show file tree
Hide file tree
Showing 31 changed files with 511 additions and 56 deletions.
12 changes: 12 additions & 0 deletions blooDot.vcxproj
Expand Up @@ -815,6 +815,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
</Media>
<Media Include="res\floor.wav">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
</Media>
<Media Include="res\projectile-decay.wav">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Xassy|Win32'">true</ExcludedFromBuild>
Expand All @@ -823,6 +827,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Xassy|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</Media>
<Media Include="res\rooof.wav">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
</Media>
<Media Include="res\selchg.wav">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
Expand All @@ -831,6 +839,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
</Media>
<Media Include="res\walls.wav">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
</Media>
</ItemGroup>
<ItemGroup>
<None Include="planning\sfx.ligma">
Expand Down
9 changes: 9 additions & 0 deletions blooDot.vcxproj.filters
Expand Up @@ -682,6 +682,15 @@
<Media Include="res\cricket-franz.wav">
<Filter>Resource Files\sfx</Filter>
</Media>
<Media Include="res\floor.wav">
<Filter>Resource Files\sfx</Filter>
</Media>
<Media Include="res\rooof.wav">
<Filter>Resource Files\sfx</Filter>
</Media>
<Media Include="res\walls.wav">
<Filter>Resource Files\sfx</Filter>
</Media>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="blooDot.rc">
Expand Down
49 changes: 26 additions & 23 deletions chunk-constants.h
Expand Up @@ -25,26 +25,29 @@ constexpr int const CHUNK_KEY_SFX_BUMP = 21;
constexpr int const CHUNK_KEY_SFX_SELCHG = 22;
constexpr int const CHUNK_KEY_SFX_SELCONF = 23;
constexpr int const CHUNK_KEY_SFX_ASTERISK = 24;
constexpr int const CHUNK_KEY_UI_ICON_MODEX = 25;
constexpr int const CHUNK_KEY_UI_ICON_DIVINE = 26;
constexpr int const CHUNK_KEY_UI_ICON_HERC = 27;
constexpr int const CHUNK_KEY_UI_ICON_HD = 28;
constexpr int const CHUNK_KEY_UI_MENU_EMPTY = 29;
constexpr int const CHUNK_KEY_SFX_CRICKET_FRITZ = 30;
constexpr int const CHUNK_KEY_SFX_CRICKET_FRANZ = 31;
constexpr int const CHUNK_KEY_MOBS_PLAYER1 = 32;
constexpr int const CHUNK_KEY_MOBS_PLAYER2 = 33;
constexpr int const CHUNK_KEY_MOBS_PLAYER3 = 34;
constexpr int const CHUNK_KEY_MOBS_PLAYER4 = 35;
constexpr int const CHUNK_KEY_DLG_MANUFACTURER = 36;
constexpr int const CHUNK_KEY_DING_DESCRIPTIONS_1 = 37;
constexpr int const CHUNK_KEY_CONVO_1 = 38;
constexpr int const CHUNK_KEY_SAMPLE_MAP = 39;
constexpr int const CHUNK_KEY_GAME_CONTROLLER_DB_TXT = 40;
constexpr int const CHUNK_KEY_LANG_FLAG_AM_PNG = 41;
constexpr int const CHUNK_KEY_LANG_FLAG_DE_PNG = 42;
constexpr int const CHUNK_KEY_LANG_FLAG_FI_PNG = 43;
constexpr int const CHUNK_KEY_LANG_FLAG_UA_PNG = 44;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_HEAD_ROOOF = 45;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_FLOOR = 46;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_COLLISION = 47;
constexpr int const CHUNK_KEY_SFX_FLOOR = 25;
constexpr int const CHUNK_KEY_SFX_WALLS = 26;
constexpr int const CHUNK_KEY_SFX_ROOOF = 27;
constexpr int const CHUNK_KEY_UI_ICON_MODEX = 28;
constexpr int const CHUNK_KEY_UI_ICON_DIVINE = 29;
constexpr int const CHUNK_KEY_UI_ICON_HERC = 30;
constexpr int const CHUNK_KEY_UI_ICON_HD = 31;
constexpr int const CHUNK_KEY_UI_MENU_EMPTY = 32;
constexpr int const CHUNK_KEY_SFX_CRICKET_FRITZ = 33;
constexpr int const CHUNK_KEY_SFX_CRICKET_FRANZ = 34;
constexpr int const CHUNK_KEY_MOBS_PLAYER1 = 35;
constexpr int const CHUNK_KEY_MOBS_PLAYER2 = 36;
constexpr int const CHUNK_KEY_MOBS_PLAYER3 = 37;
constexpr int const CHUNK_KEY_MOBS_PLAYER4 = 38;
constexpr int const CHUNK_KEY_DLG_MANUFACTURER = 39;
constexpr int const CHUNK_KEY_DING_DESCRIPTIONS_1 = 40;
constexpr int const CHUNK_KEY_CONVO_1 = 41;
constexpr int const CHUNK_KEY_SAMPLE_MAP = 42;
constexpr int const CHUNK_KEY_GAME_CONTROLLER_DB_TXT = 43;
constexpr int const CHUNK_KEY_LANG_FLAG_AM_PNG = 44;
constexpr int const CHUNK_KEY_LANG_FLAG_DE_PNG = 45;
constexpr int const CHUNK_KEY_LANG_FLAG_FI_PNG = 46;
constexpr int const CHUNK_KEY_LANG_FLAG_UA_PNG = 47;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_HEAD_ROOOF = 48;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_FLOOR = 49;
constexpr int const CHUNK_KEY_DINGS_SNURCH_SNAVIOR_COLLISION = 50;
13 changes: 8 additions & 5 deletions chunk-sizes.h
Expand Up @@ -26,21 +26,24 @@ size_t chunkSizes[] = {
3448, // CHUNK_KEY_SFX_SELCHG
3354, // CHUNK_KEY_SFX_SELCONF
6732, // CHUNK_KEY_SFX_ASTERISK
7490, // CHUNK_KEY_SFX_FLOOR
7524, // CHUNK_KEY_SFX_WALLS
7538, // CHUNK_KEY_SFX_ROOOF
17164, // CHUNK_KEY_UI_ICON_MODEX
13515, // CHUNK_KEY_UI_ICON_DIVINE
9137, // CHUNK_KEY_UI_ICON_HERC
13312, // CHUNK_KEY_UI_ICON_HD
14865, // CHUNK_KEY_UI_MENU_EMPTY
32451, // CHUNK_KEY_SFX_CRICKET_FRITZ
68754, // CHUNK_KEY_SFX_CRICKET_FRANZ
3796, // CHUNK_KEY_MOBS_PLAYER1
3757, // CHUNK_KEY_MOBS_PLAYER2
3797, // CHUNK_KEY_MOBS_PLAYER1
3758, // CHUNK_KEY_MOBS_PLAYER2
3870, // CHUNK_KEY_MOBS_PLAYER3
3787, // CHUNK_KEY_MOBS_PLAYER4
3775, // CHUNK_KEY_MOBS_PLAYER4
1217, // CHUNK_KEY_DLG_MANUFACTURER
1424, // CHUNK_KEY_DING_DESCRIPTIONS_1
4392, // CHUNK_KEY_CONVO_1
976719, // CHUNK_KEY_SAMPLE_MAP
4389, // CHUNK_KEY_CONVO_1
977292, // CHUNK_KEY_SAMPLE_MAP
424379, // CHUNK_KEY_GAME_CONTROLLER_DB_TXT
3685, // CHUNK_KEY_LANG_FLAG_AM_PNG
1941, // CHUNK_KEY_LANG_FLAG_DE_PNG
Expand Down
1 change: 1 addition & 0 deletions constants.h
Expand Up @@ -13,6 +13,7 @@ constexpr SDL_Color const AlienTextColor = { 250,200,200,222 };
constexpr SDL_Color const ButtonTextColor = { 250, 230, 230, 245 };
constexpr SDL_Color const ChapterTextColor = { 25, 23, 23, 245 };
constexpr SDL_Color const DialogTextColor = { 250, 250, 250, 255 };
constexpr SDL_Color const DialogTextDisabledColor = { 80, 80, 81, 255 };
constexpr SDL_Color const DialogTextShadowColor = { 65, 56, 56, 200 };

constexpr char const* SettingsFileName = "blooDot.ligma";
Expand Down
24 changes: 24 additions & 0 deletions dialogcontrols.cpp
Expand Up @@ -28,6 +28,30 @@ cairo_pattern_t* selPatternRed = NULL; // use in main menu
cairo_pattern_t* selPatternBlue = NULL; // used in-game
cairo_pattern_t* selPatternYellow = NULL; // used in creator mode

cairo_t* DrawSelectedLayerTool(cairo_t* context, int x, double baseY, double yStride, double xExtent, double xSlantExtent, int yExtent, double padding, int etage)
{
auto const& intendedX = x + 2 * padding;
auto const& intendedY = baseY - padding - yStride * etage;

/* we shift over the pattern so it appears darker the further down we get */
auto const& patternX = 45 * (2 - etage);

_PrepareSelPatterns();
cairo_translate(context, intendedX - patternX, intendedY - 100);
cairo_set_source(context, selPatternYellow); // this is always only in the design mode
cairo_pattern_set_extend(cairo_get_source(context), CAIRO_EXTEND_REFLECT);
cairo_move_to(context, patternX, 100);
cairo_rel_line_to(context, xExtent - 2 * padding, 0.);
cairo_rel_line_to(context, xSlantExtent - 2 * padding, -yExtent + 2 * padding);
cairo_rel_line_to(context, -xExtent + 2 * padding, 0.);
cairo_line_to(context, patternX, 100);
cairo_translate(context, -intendedX, -intendedY);
cairo_fill(context);
cairo_translate(context, patternX, 100);

return context;
}

cairo_t* DrawButton(cairo_t* context, double x, double y, double w, double h, ControlHighlight highlight)
{
if (highlight > CH_NONE)
Expand Down
1 change: 1 addition & 0 deletions dialogcontrols.h
Expand Up @@ -3,6 +3,7 @@
#include <SDL2/SDL.h>
#include <cairo/cairo.h>

cairo_t* DrawSelectedLayerTool(cairo_t* context, int x, double baseY, double yStride, double xExtent, double xSlantExtent, int yExtent, double padding, int etage);
cairo_t* DrawButton(cairo_t* context, double x, double y, double w, double h, ControlHighlight highlight);
void DrawLabel(SDL_Renderer* renderer, int x, int y, SDL_Texture* texture, SDL_Rect* frame);
void CenterLabel(SDL_Renderer* renderer, int x, int y, SDL_Texture* texture, SDL_Rect* frame);
Expand Down
14 changes: 14 additions & 0 deletions drawing.cpp
Expand Up @@ -97,6 +97,20 @@ cairo_t* GetDrawingSink()
return drawingSink;
}

cairo_t* SetSourceColor(cairo_t* context, SDL_Color color)
{
cairo_set_source_rgba
(
context,
color.r / 255.,
color.g / 255.,
color.b / 255.,
color.a / 255.
);

return context;
}

void EndRenderDrawing(SDL_Renderer* renderTarget, SDL_Texture* targetTexture, SDL_Rect* destRect)
{
SDL_UnlockTexture(targetTexture);
Expand Down
1 change: 1 addition & 0 deletions drawing.h
Expand Up @@ -8,6 +8,7 @@ SDL_Texture* NewTexture(SDL_Renderer* renderer, int w, int h, bool transparentAb
cairo_t* BeginTextureDrawing(SDL_Texture* targetTexture, const int canvasWidth, const int canvasHeight);
SDL_Texture* BeginRenderDrawing(SDL_Renderer* renderTarget, const int canvasWidth, const int canvasHeight);
cairo_t* GetDrawingSink();
cairo_t* SetSourceColor(cairo_t* context, SDL_Color color);
void EndTextureDrawing(SDL_Texture* targetTexture, cairo_t* drawer);
void EndRenderDrawing(SDL_Renderer* renderTarget, SDL_Texture* targetTexture, SDL_Rect* destRect);
void DestroyTexture(SDL_Texture** texture);
5 changes: 4 additions & 1 deletion enums.h
Expand Up @@ -17,7 +17,10 @@ enum SoundEffect {
SFX_SELCONF,
SFX_ASTERISK,
SFX_CRICKET_FRITZ,
SFX_CRICKET_FRANZ
SFX_CRICKET_FRANZ,
SFX_FLOOR,
SFX_WALLS,
SFX_ROOOF
};

enum UserInterfaceLanguages : char {
Expand Down
1 change: 0 additions & 1 deletion flap.cpp
Expand Up @@ -119,7 +119,6 @@ void PopulateFlap(int flapIndex, int flapInWorldX, int flapInWorldY)
const auto cellPieces = GetPiecesRelative(worldX, worldY);
if (!cellPieces->empty())
{
std::cout << "\n\nNOT-EMPTY! " << worldX << "," << worldY << "\n\n";
for (auto& ding : *cellPieces)
{
const auto dingLocator = GetDing(ding->ding);
Expand Down
3 changes: 3 additions & 0 deletions gameres.xassy.recipe
Expand Up @@ -23,6 +23,9 @@ bump.wav CHUNK_KEY_SFX_BUMP
selchg.wav CHUNK_KEY_SFX_SELCHG
selconf.wav CHUNK_KEY_SFX_SELCONF
asterisk.wav CHUNK_KEY_SFX_ASTERISK
floor.wav CHUNK_KEY_SFX_FLOOR
walls.wav CHUNK_KEY_SFX_WALLS
rooof.wav CHUNK_KEY_SFX_ROOOF
icon-modex.png CHUNK_KEY_UI_ICON_MODEX
icon-divine.png CHUNK_KEY_UI_ICON_DIVINE
icon-herc.png CHUNK_KEY_UI_ICON_HERC
Expand Down
18 changes: 18 additions & 0 deletions gameres.xlation.recipe
Expand Up @@ -162,6 +162,24 @@ MakerMenuTeleport
[am] Quantum move
[de] Quantensprung

DesignLayerFloorLabel
[am] floor
[de] Boden
[fi] pohja
[ua] днооо

DesignLayerWallsLabel
[am] walls
[de] Wände
[fi] seinä
[ua] стіни

DesignLayerRooofLabel
[am] rooof
[de] Daach
[fi] katto
[ua] стеля

SettingsMenuScreensize
[am] Screen size
[de] Grafikmodus
Expand Down
34 changes: 28 additions & 6 deletions orchestrator.cpp
@@ -1,16 +1,10 @@
#include "pch.h"
#include "orchestrator.h"
#include "menu-ingame.h"
#include "settings.h"
#include "savegame.h"
#include "constants.h"
#include "physics-render-binding.h"

#ifndef NDEBUG
#include "physicsdebugdraw.h"
#endif
#include "geom2d.h"
#include "newworld.h"

using namespace blooDot::Dings;
using namespace blooDot::World;
Expand Down Expand Up @@ -157,6 +151,34 @@ namespace blooDot::Orchestrator

break;

case SDL_KEYDOWN:
if (isCreatorMode)
{
if (mainEvent.key.keysym.sym == SDL_KeyCode::SDLK_1)
{
if (Hud::SetDesignLayer(DingProps::Floor))
{
Sfx::Play(SFX_FLOOR);
}
}
else if (mainEvent.key.keysym.sym == SDL_KeyCode::SDLK_2)
{
if (Hud::SetDesignLayer(DingProps::Walls))
{
Sfx::Play(SFX_WALLS);
}
}
else if (mainEvent.key.keysym.sym == SDL_KeyCode::SDLK_3)
{
if (Hud::SetDesignLayer(DingProps::Rooof))
{
Sfx::Play(SFX_ROOOF);
}
}
}

break;

#endif
case SDL_CONTROLLERDEVICEADDED:
{
Expand Down
8 changes: 8 additions & 0 deletions orchestrator.h
@@ -1,6 +1,14 @@
#pragma once
#include <SDL2/SDL.h>
#include <box2d/box2d.h>
#include "playerhud.h"
#include "geom2d.h"
#include "newworld.h"
#include "menu-ingame.h"
#include "settings.h"
#include "savegame.h"
#include "constants.h"
#include "sfx.h"

extern bool GameviewEnterWorld();
extern void EnsurePlayers();
Expand Down
43 changes: 39 additions & 4 deletions planning/creatormode.ligma
Expand Up @@ -30,18 +30,53 @@
[ ] An item can be added to the ding palette by loading the images,
and a collision geometry csv if it is a non-orthogonal geometry

4. Positioning
4. Placement
└──────────────

[ ] There is a layer selection and a ding selection.
[ ] The layer is selected by moving a selection rectangle between
the floor-walls-rooof thingy on the left letterbox.
[ ] When a layer is selected, the ding palette reduces to
only the dings that are potentially placeable on that layer
[ ] In that context, a go-under wall is a wall-only component
that cannot be selected from the rooof palette, but which can be
placed on the wall layer and subsequently lifted up to become
a rooof tile. The capability to do this is a property of the
wall ding definition.
[ ] Tiles that are part of a clumsy pack get their packing evaluated
even if they are in different layers, so that the "go-under" wall
is not discernible from the "wall-walls" by simply looking at
them merge or not merge, respectively. Non-gridlocked walls don't merge
except when they are placed first and then rotated as a compound.


5. Positioning
└────────────────

[ ] The editor can be rotated arbitrarily to create slanted and tapering
designs. The default rotation is NSEW-locked square.

[ ] Grid-lock can be switched on and off.
Placed elements can be taken and locked/unlocked from the grid:
- unlock by switching gridlock off and taking them and moving them
- unlock by nudging them with the pixelwise movement shift
- lock them by switching gridlock on and taking them and moving them

[ ] Coalesceing can be switched on and off.
- Coalescable elements will only coalesce when they are placed in gridllock
- Coalesced elements will rotate/lose gridlock as a compound
- Coalesced, no-longer-gridlocked compounds will move as a compound
- A single element taken away from a coalesced compound in gridlock will
decoalesce the element

[ ] Players can shit a brick by pressing (A) on the controller. An instance
of the currently selected palette ding is added to the placements
list of the edited region.
list of the edited region. Moving the player whilst shitting bricks
will make straight lines in gridlocked mode, and drop droppings if in non-
gridlocked mode

5. Properties
6. Properties
└───────────────

[ ] Property editor dialog pages are accessible using the controller,
and hotkeys.
and hotkeys and keyboard key combinations.

0 comments on commit 960dca5

Please sign in to comment.