La targeta d'ajuda ja ix amb els mandos i s'ha de deixar apretat el botó
This commit is contained in:
@@ -19,20 +19,21 @@
|
||||
#include "asset.h" // for Asset, assetType
|
||||
#include "dbgtxt.h" // for dbg_init
|
||||
#include "game.h" // for Game, GAME_MODE_DEMO_OFF, GAME_...
|
||||
#include "hiscore_table.h" // for HiScoreTable
|
||||
#include "input.h" // for inputs_e, Input
|
||||
#include "instructions.h" // for Instructions
|
||||
#include "intro.h" // for Intro
|
||||
#include "jail_audio.h" // for JA_DeleteMusic, JA_DeleteSound
|
||||
#include "logo.h" // for Logo
|
||||
#include "manage_hiscore_table.h" // for ManageHiScoreTable
|
||||
#include "on_screen_help.h" // for OnScreenHelp
|
||||
#include "options.h" // for options, loadOptionsFile, saveO...
|
||||
#include "param.h" // for param, loadParamsFromFile
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name_e, name, options, options_e
|
||||
#include "title.h" // for Title
|
||||
#include "utils.h" // for music_file_t, sound_file_t, opt...
|
||||
#include "global_inputs.h"
|
||||
#include "hiscore_table.h" // for HiScoreTable
|
||||
#include "input.h" // for inputs_e, Input
|
||||
#include "instructions.h" // for Instructions
|
||||
#include "intro.h" // for Intro
|
||||
#include "jail_audio.h" // for JA_DeleteMusic, JA_DeleteSound
|
||||
#include "logo.h" // for Logo
|
||||
#include "manage_hiscore_table.h" // for ManageHiScoreTable
|
||||
#include "on_screen_help.h" // for OnScreenHelp
|
||||
#include "options.h" // for options, loadOptionsFile, saveO...
|
||||
#include "param.h" // for param, loadParamsFromFile
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name_e, name, options, options_e
|
||||
#include "title.h" // for Title
|
||||
#include "utils.h" // for music_file_t, sound_file_t, opt...
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h> // for getpwuid, passwd
|
||||
@@ -106,6 +107,8 @@ Director::Director(int argc, char *argv[])
|
||||
|
||||
// Carga las musicas del juego
|
||||
loadMusics();
|
||||
|
||||
globalInputs::init();
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni...
|
||||
#include "explosions.h" // for Explosions
|
||||
#include "fade.h" // for Fade, FADE_RANDOM_SQUARE, FADE_VEN...
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO...
|
||||
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
|
||||
#include "jail_audio.h" // for JA_PlaySound, JA_DeleteSound, JA_L...
|
||||
@@ -2306,7 +2306,7 @@ void Game::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Pinta diferentes mensajes en la pantalla
|
||||
|
||||
@@ -9,86 +9,129 @@
|
||||
#include "section.h" // for options_e, name, name_e, options
|
||||
#include "utils.h" // for op_audio_t, options_t, op_music_t, boolToOnOff
|
||||
|
||||
// Termina
|
||||
void quit(section::options_e code)
|
||||
namespace globalInputs
|
||||
{
|
||||
if (Screen::get()->notificationsAreActive())
|
||||
{
|
||||
section::name = section::NAME_QUIT;
|
||||
section::options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::get()->showNotification(lang::getText(94));
|
||||
}
|
||||
}
|
||||
// Variables
|
||||
std::vector<int> servicePressedCounter;
|
||||
|
||||
// Reinicia
|
||||
void reset()
|
||||
{
|
||||
section::name = section::NAME_INIT;
|
||||
Screen::get()->showNotification("Reset");
|
||||
}
|
||||
|
||||
// Activa o desactiva el audio
|
||||
void switchAudio()
|
||||
{
|
||||
options.audio.sound.enabled = options.audio.music.enabled = !options.audio.music.enabled;
|
||||
JA_EnableMusic(options.audio.music.enabled);
|
||||
JA_EnableSound(options.audio.sound.enabled);
|
||||
Screen::get()->showNotification("Audio " + boolToOnOff(options.audio.music.enabled));
|
||||
}
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void checkGlobalInputs()
|
||||
{
|
||||
// Comprueba si se sale con el teclado
|
||||
if (Input::get()->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
// Inicializa variables
|
||||
void init()
|
||||
{
|
||||
quit(section::OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
else if (Input::get()->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_service, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (Input::get()->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
const int numInputs = Input::get()->getNumControllers() + 1;
|
||||
servicePressedCounter.reserve(numInputs);
|
||||
for (int i = 0; i < numInputs; ++i)
|
||||
{
|
||||
quit(section::OPTIONS_QUIT_SHUTDOWN);
|
||||
servicePressedCounter.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Termina
|
||||
void quit(section::options_e code)
|
||||
{
|
||||
if (Screen::get()->notificationsAreActive())
|
||||
{
|
||||
section::name = section::NAME_QUIT;
|
||||
section::options = code;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::get()->showNotification(lang::getText(94));
|
||||
}
|
||||
}
|
||||
|
||||
// Reinicia
|
||||
void reset()
|
||||
{
|
||||
section::name = section::NAME_INIT;
|
||||
Screen::get()->showNotification("Reset");
|
||||
}
|
||||
|
||||
// Activa o desactiva el audio
|
||||
void switchAudio()
|
||||
{
|
||||
options.audio.sound.enabled = options.audio.music.enabled = !options.audio.music.enabled;
|
||||
JA_EnableMusic(options.audio.music.enabled);
|
||||
JA_EnableSound(options.audio.sound.enabled);
|
||||
Screen::get()->showNotification("Audio " + boolToOnOff(options.audio.music.enabled));
|
||||
}
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void check()
|
||||
{
|
||||
// Comprueba si se sale con el teclado
|
||||
if (Input::get()->checkInput(input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
quit(section::OPTIONS_QUIT_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
else if (Input::get()->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
else if (Input::get()->checkInput(input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a activar o desactivar el audio
|
||||
else if (Input::get()->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
else if (Input::get()->checkInput(input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (Input::get()->checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||
{
|
||||
servicePressedCounter[0]++;
|
||||
|
||||
if (servicePressedCounter[0] == 3000)
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
servicePressedCounter[0] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
servicePressedCounter[0] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
||||
{
|
||||
// Comprueba si se sale con el mando
|
||||
if (Input::get()->checkModInput(input_service, input_exit, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
quit(section::OPTIONS_QUIT_SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a resetear el juego
|
||||
else if (Input::get()->checkModInput(input_service, input_reset, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba si se va a activar o desactivar el audio
|
||||
else if (Input::get()->checkModInput(input_service, input_mute, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
switchAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input::get()->checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||
{
|
||||
servicePressedCounter[i + 1]++;
|
||||
|
||||
if (servicePressedCounter[i + 1] == 3000)
|
||||
{
|
||||
OnScreenHelp::get()->toggleState();
|
||||
servicePressedCounter[i + 1] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
servicePressedCounter[i + 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,9 @@
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void checkGlobalInputs();
|
||||
namespace globalInputs
|
||||
{
|
||||
|
||||
// Inicializa variables
|
||||
void init();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void check();
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
#include "hiscore_table.h"
|
||||
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
|
||||
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <algorithm> // for max
|
||||
#include <vector> // for vector
|
||||
#include "asset.h" // for Asset
|
||||
#include "background.h" // for Background
|
||||
#include "fade.h" // for Fade, FADE_IN, FADE_OUT, FADE_RANDOM...
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
#include "options.h" // for options
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW, TXT_COLOR
|
||||
#include "utils.h" // for param_t, paramGame_t, hiScoreEntry_t
|
||||
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
|
||||
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <algorithm> // for max
|
||||
#include <vector> // for vector
|
||||
#include "asset.h" // for Asset
|
||||
#include "background.h" // for Background
|
||||
#include "fade.h" // for Fade, FADE_IN, FADE_OUT, FADE_RANDOM...
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
#include "options.h" // for options
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW, TXT_COLOR
|
||||
#include "utils.h" // for param_t, paramGame_t, hiScoreEntry_t
|
||||
|
||||
// Constructor
|
||||
HiScoreTable::HiScoreTable(JA_Music_t *music)
|
||||
@@ -220,7 +220,7 @@ void HiScoreTable::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
#include "instructions.h"
|
||||
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
|
||||
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <algorithm> // for max
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "fade.h" // for Fade, FADE_FULLSCREEN, FADE_IN
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
#include "tiled_bg.h" // for Tiledbg, TILED_MODE_STATIC
|
||||
#include "utils.h" // for param_t, paramGame_t, color_t, shdwT...
|
||||
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
|
||||
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <algorithm> // for max
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "fade.h" // for Fade, FADE_FULLSCREEN, FADE_IN
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||
#include "lang.h" // for getText
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
#include "tiled_bg.h" // for Tiledbg, TILED_MODE_STATIC
|
||||
#include "utils.h" // for param_t, paramGame_t, color_t, shdwT...
|
||||
struct JA_Music_t;
|
||||
|
||||
// Constructor
|
||||
@@ -353,7 +353,7 @@ void Instructions::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#include "intro.h"
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic, JA_PlayMusic
|
||||
#include "lang.h" // for getText
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "smart_sprite.h" // for SmartSprite
|
||||
#include "text.h" // for Text
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for paramGame_t, param_t, zone_t, BLOCK
|
||||
#include "writer.h" // for Writer
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic, JA_PlayMusic
|
||||
#include "lang.h" // for getText
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "smart_sprite.h" // for SmartSprite
|
||||
#include "text.h" // for Text
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for paramGame_t, param_t, zone_t, BLOCK
|
||||
#include "writer.h" // for Writer
|
||||
struct JA_Music_t;
|
||||
|
||||
// Constructor
|
||||
@@ -221,7 +221,7 @@ void Intro::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Actualiza las escenas de la intro
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#include "logo.h"
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <string> // for basic_string
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for name, name_e, options, options_e
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
|
||||
// Constructor
|
||||
Logo::Logo()
|
||||
@@ -126,7 +126,7 @@ void Logo::checkInput()
|
||||
screen->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Gestiona el logo de JAILGAME
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "define_buttons.h" // for DefineButtons
|
||||
#include "fade.h" // for Fade, FADE_RANDOM_SQUARE
|
||||
#include "game_logo.h" // for GameLogo
|
||||
#include "global_inputs.h" // for checkGlobalInputs
|
||||
#include "global_inputs.h" // for globalInputs::check
|
||||
#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_RE...
|
||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_P...
|
||||
#include "lang.h" // for getText
|
||||
@@ -318,7 +318,7 @@ void Title::checkInput()
|
||||
defineButtons->checkInput();
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
checkGlobalInputs();
|
||||
globalInputs::check();
|
||||
}
|
||||
|
||||
// Bucle para el titulo del juego
|
||||
|
||||
Reference in New Issue
Block a user