Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sokobokobanaban Instructions #332

Merged
merged 127 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
68cbcf4
copy over previous sokoban
hunterdyar May 4, 2024
fa378f9
pango initial sprites
hunterdyar May 4, 2024
a763f86
soko Tools from previous year
hunterdyar May 4, 2024
de301a8
spelling fix
hunterdyar May 5, 2024
6488709
start soko readme
hunterdyar May 5, 2024
cde475f
tinting crates when on goal
hunterdyar May 5, 2024
5866a61
remove old sprites, pango for player
hunterdyar May 5, 2024
0bda925
placeholders for saving solving a level
hunterdyar May 5, 2024
57646ed
Pre-process tmx files into .bin files during make.
hunterdyar May 5, 2024
5189b3b
Remembering overworld position for player
hunterdyar May 5, 2024
6c9b072
python binary packing
hunterdyar May 6, 2024
83f3703
Soko documentation on how levels and compression works
hunterdyar May 7, 2024
57f44a9
Cleanup
hunterdyar May 7, 2024
428a5ab
Saving + Loading Level Progress
hunterdyar May 7, 2024
1df9642
Saving code + gross refactor
hunterdyar May 7, 2024
7dc5366
tmx converter chases tsx files down, uses type names for tiles
hunterdyar May 7, 2024
d343bd1
Conversion output cleanup and skip unchanged files.
hunterdyar May 7, 2024
168243a
portal drawing, saving ish
hunterdyar May 7, 2024
4e1f09b
portal draw bug fix
hunterdyar May 8, 2024
fffc52e
Euler levels, loaded levels now set by index correctly
hunterdyar May 11, 2024
41bb7c3
Crate level encoded/decode bug fix
hunterdyar May 11, 2024
4bd54b3
Sticky trails as entity type
hunterdyar May 11, 2024
f885a4e
black background for euler
hunterdyar May 11, 2024
40c66a1
Undo Support
hunterdyar May 12, 2024
68c7ba1
missing semicolon oops
hunterdyar May 12, 2024
0cce550
Saving and loading
hunterdyar May 12, 2024
c590a18
flag for when to load new level data
hunterdyar May 13, 2024
79d7c0a
Soko Level Compression
hunterdyar May 14, 2024
1af316a
Art!
hunterdyar May 25, 2024
409c5ff
render bg under bg tile
hunterdyar May 25, 2024
1bd5b25
Merge branch 'main' into sokobokobanaban
hunterdyar Jul 20, 2024
1a75e9a
menu fix and bug fix
hunterdyar Jul 20, 2024
74d2ed3
removing normal soko, maybe?
hunterdyar Jul 20, 2024
0146a90
soko levels
hunterdyar Jul 20, 2024
1568690
remove test level and clean up a single entire error
hunterdyar Jul 20, 2024
2d409a1
floor color to theme struct.
hunterdyar Jul 21, 2024
c0fabd6
copy over previous sokoban
hunterdyar May 4, 2024
8f94571
pango initial sprites
hunterdyar May 4, 2024
ec553d1
soko Tools from previous year
hunterdyar May 4, 2024
bffc8c5
spelling fix
hunterdyar May 5, 2024
909ca82
start soko readme
hunterdyar May 5, 2024
24c155e
tinting crates when on goal
hunterdyar May 5, 2024
3d5dc20
remove old sprites, pango for player
hunterdyar May 5, 2024
4930586
placeholders for saving solving a level
hunterdyar May 5, 2024
1df5cbe
Pre-process tmx files into .bin files during make.
hunterdyar May 5, 2024
cfa7a9f
Remembering overworld position for player
hunterdyar May 5, 2024
3c1a29e
python binary packing
hunterdyar May 6, 2024
a05ed53
Soko documentation on how levels and compression works
hunterdyar May 7, 2024
03963d0
Cleanup
hunterdyar May 7, 2024
cfdcacb
Saving + Loading Level Progress
hunterdyar May 7, 2024
9a5b730
Saving code + gross refactor
hunterdyar May 7, 2024
5ae6b8b
tmx converter chases tsx files down, uses type names for tiles
hunterdyar May 7, 2024
a44b734
Conversion output cleanup and skip unchanged files.
hunterdyar May 7, 2024
f10291e
portal drawing, saving ish
hunterdyar May 7, 2024
ecbaec6
portal draw bug fix
hunterdyar May 8, 2024
1c5a9e8
Euler levels, loaded levels now set by index correctly
hunterdyar May 11, 2024
9e2a648
Crate level encoded/decode bug fix
hunterdyar May 11, 2024
c36a41f
Sticky trails as entity type
hunterdyar May 11, 2024
e640af5
black background for euler
hunterdyar May 11, 2024
1ca4267
Undo Support
hunterdyar May 12, 2024
b32ce25
missing semicolon oops
hunterdyar May 12, 2024
8d95c7c
Saving and loading
hunterdyar May 12, 2024
1425f81
flag for when to load new level data
hunterdyar May 13, 2024
b1b59ac
Soko Level Compression
hunterdyar May 14, 2024
3531252
Art!
hunterdyar May 25, 2024
3bdd76b
render bg under bg tile
hunterdyar May 25, 2024
39cf290
menu fix and bug fix
hunterdyar Jul 20, 2024
b88d8b3
removing normal soko, maybe?
hunterdyar Jul 20, 2024
fc45cc8
soko levels
hunterdyar Jul 20, 2024
479b848
remove test level and clean up a single entire error
hunterdyar Jul 20, 2024
1bda28c
floor color to theme struct.
hunterdyar Jul 21, 2024
48dd593
background experiments
hunterdyar Jul 21, 2024
85e84bf
preprocessor fix, warnings fix
hunterdyar Jul 21, 2024
fc4ecc6
Merge branch 'sokobokobanaban' of https://github.com/AEFeinstein/Supe…
hunterdyar Jul 21, 2024
0189d15
remove unused dependency
hunterdyar Sep 9, 2024
5bde606
Merge branch 'main' into sokobokobanaban
hunterdyar Sep 9, 2024
3c8b93e
Fix CMake for firmware build
AEFeinstein Sep 13, 2024
42e33e9
Formatting!
AEFeinstein Sep 22, 2024
6509c6f
Fix firmware warnings
AEFeinstein Sep 22, 2024
a291317
Fix cppcheck warning
AEFeinstein Sep 22, 2024
d607589
Add soko to modes list
AEFeinstein Sep 22, 2024
e3a8718
Fix out of bounds memory accesses, leaks
AEFeinstein Sep 22, 2024
7f40816
Squash merge origin/main into soko
AEFeinstein Sep 22, 2024
58bd8f3
Squashed commit of the following:
AEFeinstein Sep 22, 2024
ae6da4f
Add curly braces for switch cases
AEFeinstein Sep 22, 2024
1436da2
remove compression
hunterdyar Oct 12, 2024
247ccb8
Merge branch 'sokobokobanaban' of https://github.com/AEFeinstein/Supe…
hunterdyar Oct 12, 2024
3b4a74f
Level fix, patch out broken resume for now
hunterdyar Oct 12, 2024
165a82f
New eulerian (soko) Level
hunterdyar Oct 15, 2024
2500974
Rename game and return to previous spot on overworld
hunterdyar Oct 29, 2024
fbf46ed
Level Fix
hunterdyar Oct 30, 2024
5c547dd
allSolved and simplify BG
hunterdyar Oct 30, 2024
7754f92
fix overworld initial load bug
hunterdyar Nov 2, 2024
ea5425d
removed some laser code I felt safe removing
hunterdyar Nov 24, 2024
61dfa09
Level Titles and random victory messages
hunterdyar Nov 24, 2024
6450002
Merge branch 'main' into sokobokobanaban
hunterdyar Nov 24, 2024
1237ebf
New player sprite design
hunterdyar Nov 24, 2024
90834f3
sticky trail to match player color
hunterdyar Nov 24, 2024
5fc9146
Fix fw compilation, warning, debugging
AEFeinstein Nov 30, 2024
84889d6
Formatting
AEFeinstein Nov 30, 2024
bb36b31
Fix crash on load
AEFeinstein Nov 30, 2024
2d32cdf
Shorten name, use consistent font
AEFeinstein Nov 30, 2024
dce7dbc
use SPIRAM
AEFeinstein Nov 30, 2024
4ee2477
Remove double newline from debugging
AEFeinstein Nov 30, 2024
39b1127
Add centered player wsg
AEFeinstein Nov 30, 2024
85346f8
Add soko help page infrastructure
AEFeinstein Dec 1, 2024
b32d398
Write instructions
AEFeinstein Dec 1, 2024
d6c1005
Fix leak
AEFeinstein Dec 1, 2024
14dd5c1
Press start to return to menu
AEFeinstein Dec 1, 2024
9f6c6b4
Merge remote-tracking branch 'origin/main' into sokobokobanaban
AEFeinstein Dec 1, 2024
ff1f830
Add ability to not draw menu rings
AEFeinstein Dec 3, 2024
fce1112
Turn off rings for other instructions
AEFeinstein Dec 3, 2024
f76086f
Uttt pass and play (#334)
AEFeinstein Dec 2, 2024
78559bc
Added newmajoe's 2048 theme
johnnywycliffe Nov 3, 2024
4c97de4
Updated to include sound mapping for BGM
johnnywycliffe Nov 8, 2024
2686f96
#329 Add tilt controls
AEFeinstein Dec 2, 2024
e7e3873
Clean up pyFlashGui instructions
AEFeinstein Dec 3, 2024
5af1767
Always start pass & play on p1
AEFeinstein Dec 3, 2024
60d7742
Fix memory leak
AEFeinstein Dec 3, 2024
69ce902
Recolor UTTT menu
AEFeinstein Dec 3, 2024
4f0a7b4
UTTT Fixes
AEFeinstein Dec 4, 2024
4af0fa6
#331 Play drum funcs to match sampling rate
AEFeinstein Dec 4, 2024
5ad2bf5
#331 Fix drumkit sampling rates
AEFeinstein Dec 4, 2024
83e7fee
#224 Add note about speaker fuzz
AEFeinstein Dec 5, 2024
5f693a2
Make and use build config for production hotdog
AEFeinstein Dec 5, 2024
203b8ca
Merge remote-tracking branch 'origin/main' into sokobokobanaban
AEFeinstein Dec 5, 2024
5cf38b5
mild text updates
hunterdyar Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ idf_component_register(SRCS "asset_loaders/common/heatshrink_encoder.c"
"modes/games/bigbug/soundManager_bigbug.c"
"modes/games/bigbug/tilemap_bigbug.c"
"modes/games/bigbug/worldGen_bigbug.c"
"modes/games/cGrove/cg_Chowa.c"
"modes/games/cGrove/cg_Items.c"
"modes/games/cGrove/Garden/cg_GroveAI.c"
"modes/games/cGrove/Garden/cg_Grove.c"
"modes/games/cGrove/Garden/cg_GroveDraw.c"
"modes/games/cGrove/Garden/cg_GroveItems.c"
"modes/games/cGrove/mode_cGrove.c"
"modes/games/cGrove/Sparring/cg_Match.c"
"modes/games/cGrove/Sparring/cg_Spar.c"
"modes/games/cGrove/Sparring/cg_SparDraw.c"
"modes/games/pango/paEntity.c"
"modes/games/pango/paEntityManager.c"
"modes/games/pango/paGameData.c"
Expand All @@ -47,6 +57,7 @@ idf_component_register(SRCS "asset_loaders/common/heatshrink_encoder.c"
"modes/games/soko/soko.c"
"modes/games/soko/soko_game.c"
"modes/games/soko/soko_gamerules.c"
"modes/games/soko/sokoHelp.c"
"modes/games/soko/soko_input.c"
"modes/games/soko/soko_save.c"
"modes/games/soko/soko_undo.c"
Expand All @@ -61,21 +72,11 @@ idf_component_register(SRCS "asset_loaders/common/heatshrink_encoder.c"
"modes/games/ultimateTTT/ultimateTTTmarkerSelect.c"
"modes/games/ultimateTTT/ultimateTTTp2p.c"
"modes/games/ultimateTTT/ultimateTTTresult.c"
"modes/games/cGrove/mode_cGrove.c"
"modes/games/cGrove/cg_Chowa.c"
"modes/games/cGrove/cg_Items.c"
"modes/games/cGrove/Garden/cg_Grove.c"
"modes/games/cGrove/Garden/cg_GroveAI.c"
"modes/games/cGrove/Garden/cg_GroveDraw.c"
"modes/games/cGrove/Garden/cg_GroveItems.c"
"modes/games/cGrove/Sparring/cg_Match.c"
"modes/games/cGrove/Sparring/cg_Spar.c"
"modes/games/cGrove/Sparring/cg_SparDraw.c"
"modes/music/colorchord/colorchord.c"
"modes/music/jukebox/jukebox.c"
"modes/music/sequencer/sequencerGrid.c"
"modes/music/sequencer/sequencerHelp.c"
"modes/music/sequencer/sequencerMode.c"
"modes/music/sequencer/sequencerGrid.c"
"modes/music/tunernome/tunernome.c"
"modes/music/usbsynth/mode_synth.c"
"modes/system/credits/credits_utils.c"
Expand Down
27 changes: 21 additions & 6 deletions main/menu/menuManiaRenderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ menuManiaRenderer_t* initMenuManiaRenderer(font_t* titleFont, font_t* titleFontO
ringDir = (ringDir == 1) ? -1 : 1;
ring->color = ringColors[i];
}
renderer->drawRings = true;

// LEDs on by default
renderer->ledsOn = true;
Expand Down Expand Up @@ -476,13 +477,16 @@ void drawMenuMania(menu_t* menu, menuManiaRenderer_t* renderer, int64_t elapsedU
// Clear the background
fillDisplayArea(0, 0, TFT_WIDTH, TFT_HEIGHT, renderer->bgColor);

// Draw the rings
for (int16_t i = 0; i < ARRAY_SIZE(renderer->rings); i++)
if (renderer->drawRings)
{
maniaRing_t* ring = &renderer->rings[i];
int16_t ringRadius = (MIN_RING_RADIUS + MAX_RING_RADIUS) / 2
+ (((MAX_RING_RADIUS - MIN_RING_RADIUS) * getSin1024(ring->diameterAngle)) / 1024);
drawManiaRing(ringRadius, ring->orbitAngle, ring->color, renderer->bgColor);
// Draw the rings
for (int16_t i = 0; i < ARRAY_SIZE(renderer->rings); i++)
{
maniaRing_t* ring = &renderer->rings[i];
int16_t ringRadius = (MIN_RING_RADIUS + MAX_RING_RADIUS) / 2
+ (((MAX_RING_RADIUS - MIN_RING_RADIUS) * getSin1024(ring->diameterAngle)) / 1024);
drawManiaRing(ringRadius, ring->orbitAngle, ring->color, renderer->bgColor);
}
}

// Find the start of the 'page'
Expand Down Expand Up @@ -651,6 +655,17 @@ void setManiaLedsOn(menuManiaRenderer_t* renderer, bool ledsOn)
}
}

/**
* @brief Set if the rings should be drawn
*
* @param renderer The renderer to set
* @param ringsOn true to draw rings, false to not
*/
void setManiaDrawRings(menuManiaRenderer_t* renderer, bool ringsOn)
{
renderer->drawRings = ringsOn;
}

/**
* @brief Recolor a menu renderer
*
Expand Down
2 changes: 2 additions & 0 deletions main/menu/menuManiaRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ typedef struct
wsg_t batt[4]; ///< Images for the battery levels

maniaRing_t rings[2];
bool drawRings;

int32_t ledDecayTimer; ///< Timer to decay LEDs
int32_t ledExciteTimer; ///< Timer to excite LEDs
Expand Down Expand Up @@ -101,6 +102,7 @@ menuManiaRenderer_t* initMenuManiaRenderer(font_t* titleFont, font_t* titleFontO
void deinitMenuManiaRenderer(menuManiaRenderer_t* renderer);
void drawMenuMania(menu_t* menu, menuManiaRenderer_t* renderer, int64_t elapsedUs);
void setManiaLedsOn(menuManiaRenderer_t* renderer, bool ledsOn);
void setManiaDrawRings(menuManiaRenderer_t* renderer, bool ringsOn);
void recolorMenuManiaRenderer(menuManiaRenderer_t* renderer, paletteColor_t titleBgColor, paletteColor_t titleTextColor,
paletteColor_t textOutlineColor, paletteColor_t bgColor, paletteColor_t outerRingColor,
paletteColor_t innerRingColor, paletteColor_t rowColor, paletteColor_t rowTextColor,
Expand Down
77 changes: 73 additions & 4 deletions main/modes/games/soko/soko.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "soko_game.h"
#include "soko_gamerules.h"
#include "soko_save.h"
#include "sokoHelp.h"
#include "mainMenu.h"

static void sokoMainLoop(int64_t elapsedUs);
static void sokoEnterMode(void);
Expand All @@ -15,7 +17,10 @@ static void sokoExtractLevelNamesAndIndices(soko_abs_t* self);
// strings
const char sokoModeName[] = "Hunter's Puzzles";
static const char sokoPlayGameLabel[] = "Play";
const char SOKO_TAG[] = "SB";
static const char sokoHelpLabel[] = "Instructions";
static const char sokoExitLabel[] = "Exit";

const char SOKO_TAG[] = "SB";

extern const char key_sk_overworldPos[];

Expand Down Expand Up @@ -44,7 +49,13 @@ static void sokoEnterMode(void)
{
soko = heap_caps_calloc(1, sizeof(soko_abs_t), MALLOC_CAP_SPIRAM);
// Load a font
loadFont("ibm_vga8.font", &soko->ibm, false);
loadFont("ibm_vga8.font", &soko->ibm, true);
loadFont("rodin_eb.font", &soko->font_rodin, true);
makeOutlineFont(&soko->font_rodin, &soko->font_rodin_outline, true);
loadFont("righteous_150.font", &soko->font_righteous, true);
makeOutlineFont(&soko->font_righteous, &soko->font_righteous_outline, true);

soko->allSolved = false;

soko->allSolved = false;

Expand Down Expand Up @@ -106,15 +117,35 @@ static void sokoEnterMode(void)
soko->eulerTheme.altFloorColor = c433; // painted tiles color.

// Initialize the menu
soko->menu = initMenu(sokoModeName, sokoMenuCb);
soko->menuManiaRenderer = initMenuManiaRenderer(NULL, NULL, NULL);
soko->menu = initMenu(sokoModeName, sokoMenuCb);
soko->bgMenu = initMenu(sokoModeName, NULL);
soko->menuManiaRenderer
= initMenuManiaRenderer(&soko->font_righteous, &soko->font_righteous_outline, &soko->font_rodin);

// Color the menu
led_t menuColor = {
.r = 0xFF,
.g = 0xCC,
.b = 0x00,
};
static const paletteColor_t shadowColors[] = {c103, c213, c224, c334, c445, c555, c445, c334, c224, c213};
recolorMenuManiaRenderer(soko->menuManiaRenderer, //
c401, c554, c522, // titleBgColor, titleTextColor, textOutlineColor
c444, // bgColor
c433, c334, // outerRingColor, innerRingColor
c111, c555, // rowColor, rowTextColor
shadowColors, ARRAY_SIZE(shadowColors), menuColor);

// addSingleItemToMenu(soko->menu, sokoResumeGameLabel);
addSingleItemToMenu(soko->menu, sokoPlayGameLabel);
addSingleItemToMenu(soko->menu, sokoHelpLabel);
addSingleItemToMenu(soko->menu, sokoExitLabel);

// Set the mode to menu mode
soko->screen = SOKO_MENU;
soko->state = SKS_INIT;
setManiaLedsOn(soko->menuManiaRenderer, true);
setManiaDrawRings(soko->menuManiaRenderer, true);

// load up the level list.
soko->levelFileText = loadTxt("SK_LEVEL_LIST.txt", true);
Expand All @@ -135,10 +166,15 @@ static void sokoExitMode(void)
}
// Deinitialize the menu
deinitMenu(soko->menu);
deinitMenu(soko->bgMenu);
deinitMenuManiaRenderer(soko->menuManiaRenderer);

// Free the font
freeFont(&soko->ibm);
freeFont(&soko->font_rodin);
freeFont(&soko->font_rodin_outline);
freeFont(&soko->font_righteous);
freeFont(&soko->font_righteous_outline);

// free the level name file
freeTxt(soko->levelFileText);
Expand Down Expand Up @@ -193,6 +229,17 @@ static void sokoMenuCb(const char* label, bool selected, uint32_t settingVal)
sokoInitGameBin(soko);
soko->screen = SOKO_LEVELPLAY;
}
else if (sokoHelpLabel == label)
{
soko->helpIdx = 0;
soko->screen = SOKO_HELP;
setManiaLedsOn(soko->menuManiaRenderer, false);
setManiaDrawRings(soko->menuManiaRenderer, false);
}
else if (sokoExitLabel == label)
{
switchToSwadgeMode(&mainMenuMode);
}
}
}

Expand All @@ -217,6 +264,10 @@ static void sokoMainLoop(int64_t elapsedUs)
}
case SOKO_LEVELPLAY:
{
// Turn LEDs off
led_t offLeds[CONFIG_NUM_LEDS] = {0};
setLeds(offLeds, CONFIG_NUM_LEDS);

// pass along to other gameplay, in other file
// Always process button events, regardless of control scheme, so the main menu button can be captured
buttonEvt_t evt = {0};
Expand All @@ -236,11 +287,29 @@ static void sokoMainLoop(int64_t elapsedUs)
}
case SOKO_LOADNEWLEVEL:
{
// Turn LEDs off
led_t offLeds[CONFIG_NUM_LEDS] = {0};
setLeds(offLeds, CONFIG_NUM_LEDS);

sokoLoadGameplay(soko, soko->loadNewLevelIndex, soko->loadNewLevelFlag);
sokoInitNewLevel(soko, soko->currentLevel.gameMode);
ESP_LOGD(SOKO_TAG, "Go to gameplay");
soko->loadNewLevelFlag = false; // reset flag.
soko->screen = SOKO_LEVELPLAY;
break;
}
case SOKO_HELP:
{
// Turn LEDs off
led_t offLeds[CONFIG_NUM_LEDS] = {0};
setLeds(offLeds, CONFIG_NUM_LEDS);

buttonEvt_t evt = {0};
while (checkButtonQueueWrapper(&evt))
{
buttonSokoHelp(soko, &evt);
}
drawSokoHelp(soko, elapsedUs);
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions main/modes/games/soko/soko.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ typedef enum
{
SOKO_MENU,
SOKO_LEVELPLAY,
SOKO_LOADNEWLEVEL
SOKO_LOADNEWLEVEL,
SOKO_HELP,
} sokoScreen_t;

typedef enum
Expand Down Expand Up @@ -181,9 +182,14 @@ typedef struct soko_abs_s
{
// meta
menu_t* menu; ///< The menu structure
menu_t* bgMenu; ///< The menu structure
menuManiaRenderer_t* menuManiaRenderer; ///< Renderer for the menu
font_t ibm; ///< The font used in the menu and game
sokoScreen_t screen; ///< The screen being displayed
font_t font_rodin;
font_t font_rodin_outline;
font_t font_righteous;
font_t font_righteous_outline;
sokoScreen_t screen; ///< The screen being displayed

char* levelFileText;
char* levelNames[SOKO_LEVEL_COUNT];
Expand Down Expand Up @@ -261,6 +267,10 @@ typedef struct soko_abs_s
soko_var_t loadNewLevelVariant;

int chosen_victory_message;

// Help page
uint32_t helpIdx;
uint32_t arrowBlinkTimer;
} soko_abs_t;

extern const char SOKO_TAG[];
Expand Down
Loading
Loading