DEADSOFTWARE

81c257ce0a40d7914b6fb719f22923c53fbbbb01
[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"
40 #include <SDL.h>
42 void logo(const char *s,...) {
43 va_list ap;
44 int x,y;
46 va_start(ap,s);
47 vprintf(s,ap);
48 va_end(ap);
49 fflush(stdout);
50 }
52 void logo_gas(int cur,int all) {
53 }
55 void myrandomize(void);
57 int main(int argc, char *argv[]) {
58 if (SDL_Init(SDL_INIT_VIDEO)<0) ERR_failinit("Unable to init SDL: %s\n", SDL_GetError());
59 SDL_WM_SetCaption("Doom 2D v1.351", "Doom 2D");
60 int i;
62 pl1.ku=SDLK_KP8;
63 pl1.kd=SDLK_KP5;
64 pl1.kl=SDLK_KP4;
65 pl1.kr=SDLK_KP6;
66 pl1.kf=SDLK_PAGEDOWN;
67 pl1.kj=SDLK_DELETE;
68 pl1.kwl=SDLK_HOME;
69 pl1.kwr=SDLK_END;
70 pl1.kp=SDLK_KP8;
71 pl1.id=-1;
72 pl2.ku=SDLK_e;
73 pl2.kd=SDLK_d;
74 pl2.kl=SDLK_s;
75 pl2.kr=SDLK_f;
76 pl2.kf=SDLK_a;
77 pl2.kj=SDLK_q;
78 pl2.kwl=SDLK_1;
79 pl2.kwr=SDLK_2;
80 pl2.kp=SDLK_e;
81 pl2.id=-2;
82 myrandomize();
83 F_startup();
84 char *pw;
85 #ifndef WIN32
86 pw = "/usr/share/doom2d-rembo/doom2d.wad";
87 #else
88 pw = "doom2d.wad";
89 #endif
90 if (fexists(pw))
91 F_addwad(pw);
92 else
93 F_addwad("doom2d.wad");
94 CFG_args(argc, argv);
95 CFG_load();
96 F_initwads();
97 M_startup();
98 F_allocres();
99 G_init();
100 K_init();
101 logo("S_init: настройка звука\n");
102 S_init();
103 S_initmusic();
104 R_init();
105 GM_init();
106 F_loadmus("MENU");
107 S_startmusic(0);
109 Uint32 ticks = 0;
110 for(;;) {
112 updatee_keys();
114 S_updatemusic();
116 G_act();
118 R_draw();
120 Uint32 t;
121 while ((t = SDL_GetTicks())-ticks < DELAY) {
122 SDL_Delay(1);
124 ticks = t - t % DELAY;