DEADSOFTWARE

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