- [NEW] Habitació de prova de parts
- [NEW] Templates de les parts - [NEW] Mòdul de debug - [NEW] Debug info de la posicio dels actors - [FIX] Al reiniciar partida el heroi estava en posició incorrecta - [NEW] Mòdul de config - [NEW] El joc ja permet canviar zoom i ficar fullscreen - [NEW] F1, F2 i F3 per a zoom i fullscreen - [NEW] Ja es guarda en arxiu de config el zoom, fullscreen, musica i só. - [FIX] Al eixir prematurament del logo de vegades la paleta estava loca - [NEW] Menú de configuració del àudio - [NEW] Menú de pausa dins del joc (es veu peces que falten per arreplegar) - [ONGOING] Comença l'implementació de tecles redefinides
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "room.h"
|
||||
#include "actor.h"
|
||||
#include "jgame.h"
|
||||
#include "debug.h"
|
||||
|
||||
namespace console
|
||||
{
|
||||
@@ -41,8 +42,9 @@ namespace console
|
||||
const char scancode_to_ascii(uint8_t scancode)
|
||||
{
|
||||
if (scancode == SDL_SCANCODE_SPACE) return ' ';
|
||||
if (scancode == SDL_SCANCODE_0) return '0';
|
||||
if (scancode == SDL_SCANCODE_0 || scancode == SDL_SCANCODE_KP_0) return '0';
|
||||
if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_9) return scancode+19;
|
||||
if (scancode >= SDL_SCANCODE_KP_1 && scancode <= SDL_SCANCODE_KP_9) return scancode-40;
|
||||
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z) return scancode+61;
|
||||
|
||||
if (scancode == SDL_SCANCODE_MINUS) return '-';
|
||||
@@ -130,9 +132,11 @@ namespace console
|
||||
#define CMD_GOTO 2
|
||||
#define CMD_MOVE 3
|
||||
#define CMD_EXIT 4
|
||||
#define NUM_CMDS 5
|
||||
#define CMD_SHOW 5
|
||||
#define CMD_HIDE 6
|
||||
#define NUM_CMDS 7
|
||||
|
||||
const char *command_text[NUM_CMDS] = { "GIVE", "DROP", "GOTO", "MOVE", "EXIT" };
|
||||
const char *command_text[NUM_CMDS] = { "GIVE", "DROP", "GOTO", "MOVE", "EXIT", "SHOW", "HIDE" };
|
||||
|
||||
#define PARAM_UNKNOWN -1
|
||||
#define PARAM_RUN 0
|
||||
@@ -165,6 +169,19 @@ namespace console
|
||||
return SDL_atoi(tokens[index]);
|
||||
}
|
||||
|
||||
const int getIndexFromString(char *str, std::vector<const char*> list)
|
||||
{
|
||||
//static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
|
||||
for (int i=0;i<list.size();++i)
|
||||
{
|
||||
if (strcmp(str, list[i])==0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void execute_command()
|
||||
{
|
||||
tokenize();
|
||||
@@ -241,6 +258,30 @@ namespace console
|
||||
case CMD_EXIT:
|
||||
game::exit();
|
||||
break;
|
||||
case CMD_SHOW:
|
||||
if (!tokens[1]) {
|
||||
strcpy(msg, "ERROR: Nothing to show.");
|
||||
} else {
|
||||
strcpy(msg, "Ok.");
|
||||
const int value = getIndexFromString(tokens[1], {"NOTHING", "ACTOR-POS"});
|
||||
if (value==-1)
|
||||
strcpy(msg, "ERROR: Cannot show that.");
|
||||
else
|
||||
debug::enable(value);
|
||||
}
|
||||
break;
|
||||
case CMD_HIDE:
|
||||
if (!tokens[1]) {
|
||||
strcpy(msg, "ERROR: Nothing to hide.");
|
||||
} else {
|
||||
strcpy(msg, "Ok.");
|
||||
const int value = getIndexFromString(tokens[1], {"NOTHING", "ACTOR-POS"});
|
||||
if (value==-1)
|
||||
strcpy(msg, "ERROR: Cannot hide that.");
|
||||
else
|
||||
debug::disable(value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
cmd_size=0;
|
||||
cmd[cmd_size] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user