DEADSOFTWARE

8c8eee9d4890a3f8956a73224b3ab117ee4bc53e
[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 <conio.h>
27 #include <stdarg.h>
28 #include <stdlib.h>
29 #include <malloc.h>
30 #include "keyb.h"
31 #include "sound.h"
32 #include "vga.h"
33 #include "memory.h"
34 #include "files.h"
35 #include "error.h"
36 #include "config.h"
38 #include <SDL.h>
41 void close_all(void) {
42 S_done();
43 S_donemusic();
44 K_done();
45 V_done();
46 M_shutdown();
47 }
49 void ERR_failinit(char *s,...) {
50 va_list ap;
52 close_all();
53 va_start(ap,s);
54 vprintf(s,ap);
55 va_end(ap);
56 puts("");
57 exit(1);
58 }
60 void ERR_fatal(char *s,...) {
61 va_list ap;
63 close_all();
64 puts("\nКРИТИЧЕСКАЯ ОШИБКА:");
65 va_start(ap,s);
66 vprintf(s,ap);
67 va_end(ap);
68 puts("");
69 exit(2);
70 }
72 void ERR_quit(void) {
73 void *p;
74 //V_done();
75 //if(!(p=malloc(4000)))
76 puts("Спасибо за то, что вы играли в Операцию \"Смятка\"!");
77 //else {
78 // F_loadres(F_getresid("ENDOOM"),p,0,4000);
79 // memcpy((void*)0xB8000,p,4000);free(p);gotoxy(1,24);
80 //}
81 close_all();
82 CFG_save();
83 exit(0);
84 }