DEADSOFTWARE

headers describes that c-files implements
[flatwaifu.git] / src / main.c
1 /*
2 Copyright (C) Prikol Software 1996-1997
3 Copyright (C) Aleksey Volynskov 1996-1997
4 Copyright (C) <ARembo@gmail.com> 2011
6 This file is part of the Doom2D:Rembo project.
8 Doom2D:Rembo is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as
10 published by the Free Software Foundation.
12 Doom2D:Rembo is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/> or
19 write to the Free Software Foundation, Inc.,
20 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
23 #include "glob.h"
24 #include <stdio.h>
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include "error.h"
29 #include "config.h"
30 #include "memory.h"
31 #include "keyb.h"
32 #include "sound.h"
33 #include "files.h"
34 #include "view.h"
35 #include "menu.h"
36 #include "player.h"
37 #include "my.h"
38 #include "render.h"
39 #include "game.h"
40 #include "music.h"
42 #include <SDL.h>
44 int main(int argc, char *argv[]) {
45 if (SDL_Init(SDL_INIT_VIDEO)<0) ERR_failinit("Unable to init SDL: %s\n", SDL_GetError());
46 SDL_WM_SetCaption("Doom 2D v1.351", "Doom 2D");
47 int i;
49 pl1.ku=SDLK_KP8;
50 pl1.kd=SDLK_KP5;
51 pl1.kl=SDLK_KP4;
52 pl1.kr=SDLK_KP6;
53 pl1.kf=SDLK_PAGEDOWN;
54 pl1.kj=SDLK_DELETE;
55 pl1.kwl=SDLK_HOME;
56 pl1.kwr=SDLK_END;
57 pl1.kp=SDLK_KP8;
58 pl1.id=-1;
59 pl2.ku=SDLK_e;
60 pl2.kd=SDLK_d;
61 pl2.kl=SDLK_s;
62 pl2.kr=SDLK_f;
63 pl2.kf=SDLK_a;
64 pl2.kj=SDLK_q;
65 pl2.kwl=SDLK_1;
66 pl2.kwr=SDLK_2;
67 pl2.kp=SDLK_e;
68 pl2.id=-2;
69 myrandomize();
70 F_startup();
71 char *pw;
72 #ifndef WIN32
73 pw = "/usr/share/doom2d-rembo/doom2d.wad";
74 #else
75 pw = "doom2d.wad";
76 #endif
77 if (fexists(pw))
78 F_addwad(pw);
79 else
80 F_addwad("doom2d.wad");
81 CFG_args(argc, argv);
82 CFG_load();
83 F_initwads();
84 M_startup();
85 F_allocres();
86 G_init();
87 K_init();
88 logo("S_init: настройка звука\n");
89 S_init();
90 S_initmusic();
91 R_init();
92 GM_init();
93 F_loadmus("MENU");
94 S_startmusic(0);
96 Uint32 ticks = 0;
97 for(;;) {
99 updatee_keys();
101 S_updatemusic();
103 G_act();
105 R_draw();
107 Uint32 t;
108 while ((t = SDL_GetTicks())-ticks < DELAY) {
109 SDL_Delay(1);
111 ticks = t - t % DELAY;