/* Copyright (C) Prikol Software 1996-1997 Copyright (C) Aleksey Volynskov 1996-1997 Copyright (C) 2011 This file is part of the Doom2D:Rembo project. Doom2D:Rembo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. Doom2D:Rembo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "glob.h" #include #include #include #include "config.h" #include "vga.h" #include "error.h" #include "sound.h" #include "files.h" #include "view.h" #include "player.h" #include "my.h" #include extern byte _warp,fastdraw,nomon; extern int mem_chk_sz; enum{NONE,BYTE,WORD,DWORD,STRING,SW_ON,SW_OFF,FILES,KEY}; typedef struct{ char *par,*cfg; void *p; byte t,o; }cfg_t; byte cheat=0; byte shot_vga=0; char cd_path[128]=""; static cfg_t cfg[]={ {"file",NULL,NULL,FILES,0}, {"cheat",NULL,&cheat,SW_ON,0}, {"vga","screenshot",&shot_vga,SW_ON,0}, {"sndvol","sound_volume",&snd_vol,WORD,0}, {"musvol","music_volume",&mus_vol,WORD,0}, {"fullscr","fullscreen",&fullscreen,SW_ON,0}, {"window",NULL,&fullscreen,SW_OFF,0}, {NULL,"sky",&w_horiz,SW_ON,0}, {"mon",NULL,&nomon,SW_OFF,0}, {"gamma","gamma",&gammaa,DWORD,0}, {"warp",NULL,&_warp,BYTE,0}, {"width","screen_width",&SCRW,DWORD,0}, {"height","screen_height",&SCRH,DWORD,0}, {NULL,"music_random",&music_random,SW_ON,0}, {NULL,"music_time",&music_time,DWORD,0}, {NULL,"music_fade",&music_fade,DWORD,0}, {NULL,"pl1_left", &pl1.kl,KEY,0}, {NULL,"pl1_right",&pl1.kr,KEY,0}, {NULL,"pl1_up", &pl1.ku,KEY,0}, {NULL,"pl1_down", &pl1.kd,KEY,0}, {NULL,"pl1_jump", &pl1.kj,KEY,0}, {NULL,"pl1_fire", &pl1.kf,KEY,0}, {NULL,"pl1_next", &pl1.kwr,KEY,0}, {NULL,"pl1_prev", &pl1.kwl,KEY,0}, {NULL,"pl1_use", &pl1.kp,KEY,0}, {NULL,"pl2_left", &pl2.kl,KEY,0}, {NULL,"pl2_right",&pl2.kr,KEY,0}, {NULL,"pl2_up", &pl2.ku,KEY,0}, {NULL,"pl2_down", &pl2.kd,KEY,0}, {NULL,"pl2_jump", &pl2.kj,KEY,0}, {NULL,"pl2_fire", &pl2.kf,KEY,0}, {NULL,"pl2_next", &pl2.kwr,KEY,0}, {NULL,"pl2_prev", &pl2.kwl,KEY,0}, {NULL,"pl2_use", &pl2.kp,KEY,0}, {"config",NULL,cfg_file,STRING,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; char *s; logo("CFG_args: проверка командной строки\n"); int i; char *pbuf = buf; for (i=1;i0) if(cfg[j-1].t==SW_OFF && cfg[j-1].p==cfg[j].p) cfg[j-1].o=1; break; case SW_OFF: *((byte *)cfg[j].p)=OFF; if(cfg[j+1].t==SW_ON && cfg[j+1].p==cfg[j].p) cfg[j+1].o=1; if(j>0) if(cfg[j-1].t==SW_ON && cfg[j-1].p==cfg[j].p) cfg[j-1].o=1; break; case FILES: for(s=strtok(NULL," \r\n\t");s;s=strtok(NULL," \r\n\t")) { if(*s=='/' || *s=='-') goto next; #ifdef DEMO logo(" %s НЕ подключен!\n",s); #else F_addwad(s); #endif }break; default: ERR_failinit("!!! Неизвестный тип в cfg !!!"); } cfg[j].o=1;break; } } } int get_key(char *name) { int i; for(i=1; i