diff --git a/src/config.c b/src/config.c
index 9ad78cb2037bc09deb995d76d6258b07fc9f0ff2..c51e9eeb65d3b435004c299acc12bbf26d014fc4 100644 (file)
--- a/src/config.c
+++ b/src/config.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "config.h"
-//#include "vga.h"
-#include "error.h"
+#include "map.h"
#include "sound.h"
#include "sound.h"
-#include "files.h"
+#include "music.h"
#include "view.h"
#include "view.h"
+#include "monster.h"
#include "player.h"
#include "player.h"
+#include "menu.h"
+#include "files.h"
+#include "render.h"
+#include "error.h"
+#include "input.h"
#include "my.h"
#include "my.h"
-#include <SDL_keyboard.h>
-
-extern byte _warp,fastdraw,nomon;
-extern int mem_chk_sz;
-
enum{NONE,BYTE,WORD,DWORD,STRING,SW_ON,SW_OFF,FILES,KEY};
typedef struct{
enum{NONE,BYTE,WORD,DWORD,STRING,SW_ON,SW_OFF,FILES,KEY};
typedef struct{
byte t,o;
}cfg_t;
byte t,o;
}cfg_t;
-
byte cheat=0;
byte cheat=0;
-
byte shot_vga=0;
byte shot_vga=0;
-
-
char cd_path[128]="";
char cd_path[128]="";
+char cfg_file[128]="default.cfg";
+
+static char buf[256];
static cfg_t cfg[]={
{"file",NULL,NULL,FILES,0},
static cfg_t cfg[]={
{"file",NULL,NULL,FILES,0},
{NULL,NULL,NULL,NONE,0}
};
{NULL,NULL,NULL,NONE,0}
};
-
-char cfg_file[128]="default.cfg";
-
-static char buf[256];
-
void CFG_args(int argc, char *argv[]) {
int j;
dword n;
void CFG_args(int argc, char *argv[]) {
int j;
dword n;
}
}
}
}
-int get_key(char *name)
-{
- int i;
- for(i=1; i<SDLK_LAST; i++) {
- char* s = SDL_GetKeyName(i);
- if (s && strcasecmp(name,s) == 0) {
-
- return i;
- }
- }
- return 0;
-}
-
void CFG_load(void) {
int j;
FILE *h;
void CFG_load(void) {
int j;
FILE *h;
break;
case KEY:
{
break;
case KEY:
{
- int k = get_key(p2);
- if (k) {
- *((int *)cfg[j].p)=k;
+ int k = I_string_to_key(p2);
+ if (k != KEY_UNKNOWN) {
+ *((int *)cfg[j].p)=k;
} else {
} else {
+ int i;
logo("Unknown key in cfg: %s=%s\n",p1,p2);
logo("List available key names:\n");
logo("Unknown key in cfg: %s=%s\n",p1,p2);
logo("List available key names:\n");
- int i;
- for(i=1; i<SDLK_LAST; i++) {
- char* s = SDL_GetKeyName(i);
-
- if (!strcasecmp(s,"unknown key") == 0) {
- logo("%s\n", s);
- }
+ for(i = 1; i <= KEY__LAST; i++) {
+ logo(" %s\n", I_key_to_string(i));
}
}
}
}
}
}