From 19f8b51be992aad100cd8217475696e412683f47 Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 30 Aug 2024 03:26:32 -0400 Subject: [PATCH] medal adjustments...hopefully final fix before jam deadline --- src/game/input/control.c | 3 ++ src/game/input/control.h | 5 ++-- src/game/resource/RESOURCE_COMMON.h | 8 +++-- src/game/state/state.c | 7 +++++ src/game/state/state.h | 45 ++++++++++++++++++++++++----- 5 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/game/input/control.c b/src/game/input/control.c index bc1efd0..2ab365f 100644 --- a/src/game/input/control.c +++ b/src/game/input/control.c @@ -53,6 +53,9 @@ control_tick(Control* self, Input* input) if (input->keyboard.current[KEYBOARD_KEY_M]) self->current[CONTROL_MUTE] = true; + + if (input->keyboard.current[KEYBOARD_KEY_RCTRL] || input->keyboard.current[KEYBOARD_KEY_LCTRL]) + self->current[CONTROL_CHEAT] = true; } bool diff --git a/src/game/input/control.h b/src/game/input/control.h index e275a6a..ed23a87 100644 --- a/src/game/input/control.h +++ b/src/game/input/control.h @@ -2,7 +2,7 @@ #include "input.h" -#define CONTROL_COUNT CONTROL_MUTE + 1 +#define CONTROL_COUNT CONTROL_CHEAT + 1 typedef enum ControlType { CONTROL_NONE, @@ -21,7 +21,8 @@ typedef enum ControlType CONTROL_PAUSE, CONTROL_RETRY, CONTROL_ESCAPE, - CONTROL_MUTE + CONTROL_MUTE, + CONTROL_CHEAT } ControlType; typedef struct Control diff --git a/src/game/resource/RESOURCE_COMMON.h b/src/game/resource/RESOURCE_COMMON.h index 2a488e9..941fe62 100644 --- a/src/game/resource/RESOURCE_COMMON.h +++ b/src/game/resource/RESOURCE_COMMON.h @@ -182,7 +182,7 @@ static const u32 FONT_SIZES[FONT_COUNT] = 48 }; -#define SOUND_COUNT (SOUND_CANCEL + 1) +#define SOUND_COUNT (SOUND_CHEAT + 1) #define SOUND_BURP_COUNT 3 #define SOUND_GURGLE_COUNT 3 #define SOUND_LUNGE_COUNT 3 @@ -222,7 +222,8 @@ typedef enum SoundType SOUND_EXTEND, SOUND_FORESIGHT, SOUND_INVIGORATE, - SOUND_CANCEL + SOUND_CANCEL, + SOUND_CHEAT } SoundType; static const char* SOUND_PATHS[SOUND_COUNT] = @@ -260,7 +261,8 @@ static const char* SOUND_PATHS[SOUND_COUNT] = "res/sound/extend.ogg", "res/sound/foresight.ogg", "res/sound/invigorate.ogg", - "res/sound/cancel.ogg" + "res/sound/cancel.ogg", + "res/sound/cheat.ogg", }; #define MUSIC_COUNT MUSIC_VICTORY + 1 diff --git a/src/game/state/state.c b/src/game/state/state.c index 62dd152..c05861f 100644 --- a/src/game/state/state.c +++ b/src/game/state/state.c @@ -195,6 +195,13 @@ state_tick(State* self) if (self->states.title.isLevelSelected) _state_set(self, STATE_CUTSCENE_ONE + self->states.title.levelSelected); + if (control_released(self->ecs->control, CONTROL_CHEAT)) + { + memcpy(self->levelData, LEVEL_DATA_CHEAT, sizeof(LEVEL_DATA_CHEAT)); + sound_play(&self->ecs->resources->sounds[SOUND_CHEAT]); + _state_set(self, STATE_TITLE); + } + break; case STATE_CUTSCENE_ONE: cutscene_tick(&self->states.cutscene); diff --git a/src/game/state/state.h b/src/game/state/state.h index 44ad91b..4ca868e 100644 --- a/src/game/state/state.h +++ b/src/game/state/state.h @@ -40,7 +40,7 @@ static const Scene CUTSCENE_TWO_SCENES[CUTSCENE_TWO_COUNT] = }, { .texture = TEXTURE_CUTSCENE_TWO_SCENE_FOUR, - .string = "Although...one instinct did claw at the creature...hunger. Though the creature's body pleaded to consume the fruits of its labor..every morsel must be delivered to the matriarch at all costs, as she insisted!" + .string = "Although...one instinct did claw at the creature...hunger. Though the creature's body pleaded to consume the fruits of its labor...every morsel must be delivered to the matriarch at all costs, as she insisted!" }, { .texture = TEXTURE_CUTSCENE_TWO_SCENE_FIVE, @@ -65,7 +65,7 @@ static const Scene CUTSCENE_THREE_SCENES[CUTSCENE_THREE_COUNT] = }, { .texture = TEXTURE_CUTSCENE_THREE_SCENE_FOUR, - .string = "As the creature scampers off with its newfound prize, the frilled matriarch eyes glide over to her underling and its plunder in between one of her many gorging sessions." + .string = "As the creature scampers off with its newfound prize, the frilled matriarch's eyes glide over to her underling and its plunder in between one of her many gorging sessions." }, { .texture = TEXTURE_CUTSCENE_THREE_SCENE_FIVE, @@ -98,7 +98,7 @@ static const Scene CUTSCENE_FOUR_SCENES[CUTSCENE_FOUR_COUNT] = }, { .texture = TEXTURE_CUTSCENE_FOUR_SCENE_FIVE, - .string = "It seemed that the amulet's abilities were increasing, The frilled runt's power continued to grow. What other secrets might it hold?" + .string = "It seemed that the amulet's abilities were increasing, and the frilled runt's power was continuing to grow. What other secrets might it hold?" }, { .texture = TEXTURE_CUTSCENE_FOUR_SCENE_SIX, @@ -232,7 +232,7 @@ static const SceneCollection CUTSCENE_FINAL = static const LevelSettings LEVEL_SETTINGS[LEVEL_COUNT] = { { - .medalThresholds = {200, 275, 325}, + .medalThresholds = {200, 250, 300}, .time = 7200, .colorCover = {-0.05f, -0.05f, -0.05f, 0.0f}, .collectibleMax = 30, @@ -260,7 +260,7 @@ static const LevelSettings LEVEL_SETTINGS[LEVEL_COUNT] = .isTutorialFinal = false }, { - .medalThresholds = {300, 500, 600}, + .medalThresholds = {300, 400, 500}, .time = 10800, .colorCover = {-0.10f, -0.10f, -0.05f, 0.0f}, .collectibleMax = 35, @@ -288,7 +288,7 @@ static const LevelSettings LEVEL_SETTINGS[LEVEL_COUNT] = .isTutorialFinal = false }, { - .medalThresholds = {400, 550, 625}, + .medalThresholds = {350, 450, 550}, .time = 10800, .colorCover = {0.15f, 0.05f, 0.00f, 0.0f}, .collectibleMax = 40, @@ -316,7 +316,7 @@ static const LevelSettings LEVEL_SETTINGS[LEVEL_COUNT] = .isTutorialFinal = false }, { - .medalThresholds = {500, 600, 700}, + .medalThresholds = {400, 500, 600}, .time = 10800, .colorCover = {0.3f, 0.15f, 0.0f, 0.0f}, .collectibleMax = 45, @@ -344,7 +344,7 @@ static const LevelSettings LEVEL_SETTINGS[LEVEL_COUNT] = .isTutorialFinal = false }, { - .medalThresholds = {750, 900, 1150}, + .medalThresholds = {750, 1000, 1250}, .time = 18000, .colorCover = {-0.25f, -0.50f, -0.10f, 0.0f}, .collectibleMax = 50, @@ -402,6 +402,35 @@ static const LevelData LEVEL_DATA_DEFAULT[LEVEL_COUNT] = }, }; +static const LevelData LEVEL_DATA_CHEAT[LEVEL_COUNT] = +{ + { + .status = LEVEL_STATUS_UNLOCKED, + .score = -1, + .time = -1 + }, + { + .status = LEVEL_STATUS_UNLOCKED, + .score = -1, + .time = -1 + }, + { + .status = LEVEL_STATUS_UNLOCKED, + .score = -1, + .time = -1 + }, + { + .status = LEVEL_STATUS_UNLOCKED, + .score = -1, + .time = -1 + }, + { + .status = LEVEL_STATUS_UNLOCKED, + .score = -1, + .time = -1 + }, +}; + void state_change(State* self, StateType type); void state_init(State* self, ECS* ecs, StateType type); void state_free(State* self);