DEADSOFTWARE

ef9c388774b7c453b30ffb65dd63be6bb80edfc4
[flatwaifu.git] / src / error.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 <string.h>
26 #include <stdarg.h>
27 #include <stdlib.h>
28 #include "keyb.h"
29 #include "sound.h"
30 #include "render.h"
31 #include "memory.h"
32 #include "error.h"
33 #include "config.h"
35 static void close_all (void) {
36 S_done();
37 S_donemusic();
38 K_done();
39 R_done();
40 M_shutdown();
41 }
43 void ERR_failinit (char *s, ...) {
44 va_list ap;
45 close_all();
46 va_start(ap, s);
47 vprintf(s, ap);
48 va_end(ap);
49 puts("");
50 exit(1);
51 }
53 void ERR_fatal(char *s,...) {
54 va_list ap;
55 close_all();
56 puts("\nКРИТИЧЕСКАЯ ОШИБКА:");
57 va_start(ap, s);
58 vprintf(s, ap);
59 va_end(ap);
60 puts("");
61 exit(2);
62 }
64 void ERR_quit (void) {
65 void *p;
66 //V_done();
67 //if(!(p=malloc(4000)))
68 puts("Спасибо за то, что вы играли в Операцию \"Смятка\"!");
69 //else {
70 // F_loadres(F_getresid("ENDOOM"),p,0,4000);
71 // memcpy((void*)0xB8000,p,4000);free(p);gotoxy(1,24);
72 //}
73 close_all();
74 CFG_save();
75 exit(0);
76 }