DEADSOFTWARE

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