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

Shooter #122

Merged
merged 5 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified assets/menu/jingle.mid
Binary file not shown.
Binary file added assets/ray/HW_PORTRAIT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/ray/HW_PORTRAIT_S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions main/modes/mainMenu/mainMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef struct
int32_t lastSfxVol;
int32_t cheatCodeIdx;
bool debugMode;
bool fanfarePlaying;
} mainMenu_t;

//==============================================================================
Expand Down Expand Up @@ -222,6 +223,7 @@ static void mainMenuMainLoop(int64_t elapsedUs)
mainMenu->cheatCodeIdx = 0;
mainMenu->debugMode = true;
bzrPlayBgm(&mainMenu->fanfare, BZR_STEREO);
mainMenu->fanfarePlaying = true;

// Return to the top level menu
while (mainMenu->menu->parentMenu)
Expand Down Expand Up @@ -270,8 +272,11 @@ static void mainMenuCb(const char* label, bool selected, uint32_t settingVal)
// Stop the buzzer first no matter what, so that it turns off
// if we scroll away from the BGM or SFX settings.

// Always stop the buzzer unless we're on one of the SFX settings
bzrStop(true);
// Stop the buzzer when changing volume, not for fanfare
if (false == mainMenu->fanfarePlaying)
{
bzrStop(true);
}

if (selected)
{
Expand Down Expand Up @@ -363,6 +368,7 @@ static void mainMenuCb(const char* label, bool selected, uint32_t settingVal)
mainMenu->lastBgmVol = settingVal;
setBgmVolumeSetting(settingVal);
bzrPlayBgm(&mainMenu->jingle, BZR_STEREO);
mainMenu->fanfarePlaying = false;
}
}
else if (sfxVolSettingLabel == label)
Expand All @@ -372,6 +378,7 @@ static void mainMenuCb(const char* label, bool selected, uint32_t settingVal)
mainMenu->lastSfxVol = settingVal;
setSfxVolumeSetting(settingVal);
bzrPlaySfx(&mainMenu->jingle, BZR_STEREO);
mainMenu->fanfarePlaying = false;
}
}
else if (micSettingLabel == label)
Expand Down
4 changes: 3 additions & 1 deletion main/modes/ray/mode_ray.h
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ typedef struct
uint8_t* typeToIdxMap; ///< A map of rayMapCellType_t to respective textures
wsg_t envTex[NUM_ENVS][NUM_ENV_TEXES]; ///< The environment textures
wsg_t guns[NUM_LOADOUTS]; ///< Textures for the HUD guns
wsg_t portrait; ///< A portrait used for text dialogs
wsg_t cho_portrait; ///< A portrait used for text dialogs
wsg_t hw_portrait; ///< A portrait used for text dialogs
wsg_t hw_s_portrait; ///< A portrait used for text dialogs
wsg_t missileHUDicon; ///< A missile icon drawn in the HUD
wsg_t enemyTex[NUM_ENEMIES][E_NUM_STATES][NUM_ANIM_FRAMES]; ///< The enemy textures
wsg_t hiddenXRTex[E_NUM_STATES][NUM_ANIM_FRAMES]; ///< The textures for X-Ray hidden enemies
Expand Down
2 changes: 1 addition & 1 deletion main/modes/ray/ray_death_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
static const char* const deathTexts[] = {
"GG no re",
"Skill Issue",
"F",
"Press F",
"YOUR HEAD ASPLODE",
"You may have died, but you are not safe from taxes",
"Pro Tip: Shoot the enemies until they die",
Expand Down
69 changes: 59 additions & 10 deletions main/modes/ray/ray_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "fill.h"
#include "ray_dialog.h"
#include "esp_wifi.h"
#include "ray_script.h"
#include "ray_pause.h"

//==============================================================================
// Defines
Expand All @@ -22,17 +24,49 @@
// Constant text
//==============================================================================

/// @brief Replacement text for the MAC-randomized puzzle
const char* const macPuzzleText[] = {
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n4! is too excited, subtract 12 from "
"it\n[=/+._?@\n}+&)(/&?\n+[:&${)}",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n.?%?-}{;\nTake the next answer, like a "
"tree find the square\n&,?:)/&:\n:/{#_!&,",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n:#:$/{)]\n{?$-}*].\nArgon's number is "
"nice, but in two it must split\n/}%-%?}%",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n{@#??_[!\n#,;{(;-{\n]#_!]=,.\nAverage "
"two prior, that's it, almost there",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n"
"4! is too excited, subtract 12 from it\n"
"[=/+._?@\n"
"}+&)(/&?\n"
"+[:&${)}",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n"
".?%?-}{;\n"
"Take the next answer, like a tree find the square\n"
"&,?:)/&:\n"
":/{#_!&,",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n"
":#:$/{)]\n"
"{?$-}*].\n"
"Argon's number is nice, but in two it must split\n"
"/}%-%?}%",
"WARNING DATA CORRUPTED. Seek other bounty hunters to reconstruct data.\n\n"
"{@#??_[!\n"
"#,;{(;-{\n"
"]#_!]=,.\n"
"Average two prior, that's it, almost there",
};

/// @brief First part of the 100% dialog
const char* finalDialog100_0 = "C - cc - chh - CHO - do you read me? Good, glad this channel works.\n\n...";

/// @brief Second part of the 100% dialog
const char* finalDialog100_1
= "Hank Waddle here, your lawyer-turned-ex-lawyer-turned-megalomaniacal super villain. Looks like Meta Studley "
"wasn't able to take you out, eh? He should have taken a few more reps at the space gym...\nAnyway, I'm with the "
"baddies now. They took my brain and fused it with some supercomputer they were building, which is kinda weird, "
"but hey - now I can shoot lasers out of my eyes. What a twist, right? Anyway, nice job getting 100% completion, "
"you NERD. I'll get you next time, Cho!";

/// @brief Second part of the 50% dialog
const char* finalDialog50_1
= "Hank Waddle here, your lawyer-turned-ex-lawyer-turned-megalomaniacal super villain. Looks like Meta Studley "
"wasn't able to take you out, eh? He should have taken a few more reps at the space gym...\nAnyway, I'm with the "
"baddies now. They took my brain and fused it with some supercomputer they were building, which is kinda weird, "
"but hey - now I can shoot lasers out of my eye. What a twist, right? Anyway, nice job getting through the game "
"with so few upgrades, you MASOCHIST. I'll get you next time, Cho!";

//==============================================================================
// Functions
//==============================================================================
Expand Down Expand Up @@ -86,8 +120,23 @@ void rayDialogCheckButtons(ray_t* ray)
}
else
{
// Dialog over, return to game
raySwitchToScreen(RAY_GAME);
// If this is the first part of the 100% dialog, show the second
if (finalDialog100_0 == ray->dialogText)
{
if (100 == getItemCompletePct(ray))
{
rayShowDialog(ray, finalDialog100_1, &ray->hw_portrait);
}
else if (50 > getItemCompletePct(ray))
{
rayShowDialog(ray, finalDialog50_1, &ray->hw_portrait);
}
}
// Otherwise the dialog is over, return to game mode
else
{
raySwitchToScreen(RAY_GAME);
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions main/modes/ray/ray_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "mode_ray.h"

extern const char* finalDialog100_0;

void rayShowDialog(ray_t* ray, const char* dialogText, wsg_t* dialogPortrait);
void rayDialogCheckButtons(ray_t* ray);
void rayDialogRender(ray_t* ray, uint32_t elapsedUs);
Expand Down
16 changes: 4 additions & 12 deletions main/modes/ray/ray_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static void checkScriptCell(ray_t* ray, list_t* scriptList, int32_t x, int32_t y
if (shouldExecute)
{
// Do it
executeScriptEvent(ray, script, &ray->portrait);
executeScriptEvent(ray, script, &ray->cho_portrait);

// Mark it as inactive if this is a one time script and the reset timer is inactive
script->isActive = (ALWAYS == script->ifArgs.cellList.oneTime) && (0 == script->resetTimerSec);
Expand Down Expand Up @@ -589,7 +589,7 @@ void checkScriptTime(ray_t* ray, uint32_t elapsedUs)
if (script->ifArgs.time <= ray->secondsSinceStart)
{
// Do it
executeScriptEvent(ray, script, &ray->portrait);
executeScriptEvent(ray, script, &ray->cho_portrait);

// Mark it as inactive
script->isActive = false;
Expand Down Expand Up @@ -831,17 +831,9 @@ static void executeScriptEvent(ray_t* ray, rayScript_t* script, wsg_t* portrait)
// Unlock zip on the menu
writeNvs32(MAGTROID_UNLOCK_KEY, 1);
// Show bonus dialog for 100%
if (100 == getItemCompletePct(ray))
if ((100 == getItemCompletePct(ray)) || (50 > getItemCompletePct(ray)))
{
rayShowDialog(ray,
"\"C - cc - chh - CHO - do you read me? Good, glad this channel works.\n\n...\n\nHank "
"Waddle here, your lawyer-turned-ex-lawyer-turned-megalomaniacal super villain. Looks "
"like Meta Studley wasn't able to take you out, eh? I should have listened to the "
"testers who kept saying to make him harder...\n\nAnyway, I'm with the baddies now. They "
"took my brain and fused it with some supercomputer they were building, which is kinda "
"weird, but hey - now I can shoot lasers out of my eye. What a twist, right? Anyway, "
"nice job getting 100% completion, you NERD. I'll get you next time, Cho!\"",
getTexByType(ray, OBJ_SCENERY_TERMINAL));
rayShowDialog(ray, finalDialog100_0, &ray->hw_s_portrait);
}
// Jump to credits! This is either immediate or after the aforementioned dialog
ray->shouldShowCredits = true;
Expand Down
8 changes: 6 additions & 2 deletions main/modes/ray/ray_tex_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
void loadEnvTextures(ray_t* ray)
{
// Load a portrait for dialogs
loadWsg("CHO_PORTRAIT.wsg", &ray->portrait, true);
loadWsg("CHO_PORTRAIT.wsg", &ray->cho_portrait, true);
loadWsg("HW_PORTRAIT.wsg", &ray->hw_portrait, true);
loadWsg("HW_PORTRAIT_S.wsg", &ray->hw_s_portrait, true);

// Load HUD textures
loadWsg("GUN_NORMAL.wsg", &ray->guns[LO_NORMAL], true);
Expand Down Expand Up @@ -229,7 +231,9 @@ wsg_t* getTexByType(ray_t* ray, rayMapCellType_t type)
*/
void freeAllTex(ray_t* ray)
{
freeWsg(&ray->portrait);
freeWsg(&ray->cho_portrait);
freeWsg(&ray->hw_portrait);
freeWsg(&ray->hw_s_portrait);
freeWsg(&ray->guns[LO_NORMAL]);
freeWsg(&ray->guns[LO_MISSILE]);
freeWsg(&ray->guns[LO_ICE]);
Expand Down
4 changes: 2 additions & 2 deletions tools/pyFlashGui/pyFlashGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def run(self):
"--flash_freq", "80m",
"--flash_size", "4MB",
"0x1000", "bootloader.bin",
"0x10000", "swadge2024.bin",
"0x8000", "partition-table.bin",
"0x110000", "storage.bin"])
"0x10000", "swadge2024.bin",
"0x208000", "storage.bin"])

# It worked! Display a nice green message
self.labelText = "Flash succeeded on " + str(self.serialPort.device)
Expand Down
Loading