Many new settings to support the new state machine functionality.
This commit is contained in:
parent
908bdbba35
commit
47822bbdec
11 changed files with 84 additions and 21 deletions
|
@ -226,13 +226,11 @@ void HandleBLETagPacket(const BLE_TagPacket_T *const packet)
|
|||
else if (packet->damage < 0)
|
||||
{
|
||||
Health_In_Percent -= packet->damage;
|
||||
if (Health_In_Percent > MAX_HEALTH)
|
||||
if (Health_In_Percent > Get_Max_Health())
|
||||
{
|
||||
Health_In_Percent = MAX_HEALTH;
|
||||
Health_In_Percent = Get_Max_Health();
|
||||
}
|
||||
|
||||
Health_In_Percent = MAX_HEALTH;
|
||||
|
||||
Set_Health(Health_In_Percent);
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PRONOUNCE_NUMBER_0_TO_100, .Play_To_Completion = true, .Data = (void *)&Health_In_Percent};
|
||||
Perform_Audio_Action(&audio_action);
|
||||
|
|
|
@ -22,6 +22,22 @@
|
|||
/* Include Files */
|
||||
#include "SystemK.h"
|
||||
|
||||
static const char *KLOG_TAG = "STATE_PLAYING__TAGGED_OUT";
|
||||
|
||||
static void Reset_Bombs()
|
||||
{
|
||||
uint8_t n_bombs;
|
||||
if (SETTINGS_get_uint8_t(SYSTEMK_SETTING_N_SPECIAL_WEAPONS_ON_REENTRY, &n_bombs) == SYSTEMK_RESULT_SUCCESS)
|
||||
{
|
||||
Set_Available_Bombs(n_bombs);
|
||||
}
|
||||
else
|
||||
{
|
||||
Set_Available_Bombs(0);
|
||||
KLOG_ERROR(KLOG_TAG, "Error getting available bombs!");
|
||||
}
|
||||
}
|
||||
|
||||
static void Playing__Tagged_Out_Entry(StateMachineContext_T * context);
|
||||
static void Playing__Tagged_Out_Do(StateMachineContext_T * context);
|
||||
static void Playing__Tagged_Out_Exit(StateMachineContext_T * context);
|
||||
|
@ -78,8 +94,7 @@ static void Playing__Tagged_Out_Do(StateMachineContext_T * context)
|
|||
|
||||
if (Back_In() == true)
|
||||
{
|
||||
// TODO: Get this from settings.
|
||||
Set_Available_Bombs(1);
|
||||
Reset_Bombs();
|
||||
Transition_For_Event(context, STATE_PLAYING__INTERACTING, &Event);
|
||||
}
|
||||
}
|
||||
|
@ -101,9 +116,8 @@ static void Playing__Tagged_Out_Do(StateMachineContext_T * context)
|
|||
// Was it a "long" press?
|
||||
if (duration_of_press_in_ms > 5000)
|
||||
{
|
||||
Set_Health(MAX_HEALTH);
|
||||
// TODO: Get this from settings.
|
||||
Set_Available_Bombs(1);
|
||||
Set_Health(Get_Max_Health());
|
||||
Reset_Bombs();
|
||||
Transition_For_Event(context, STATE_PLAYING__INTERACTING, &Event);
|
||||
}
|
||||
}
|
||||
|
@ -118,9 +132,8 @@ static void Playing__Tagged_Out_Do(StateMachineContext_T * context)
|
|||
break;
|
||||
|
||||
case KEVENT_PLAY_PRESSED_ON_REMOTE:
|
||||
Set_Health(MAX_HEALTH);
|
||||
// TODO: Get this from settings.
|
||||
Set_Available_Bombs(1);
|
||||
Set_Health(Get_Max_Health());
|
||||
Reset_Bombs();
|
||||
Transition_For_Event(context, STATE_PLAYING__INTERACTING, &Event);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue