install: add install sources and resources
[doom2d-restoration.git] / GAME / ERROR.C
blob884a8a7dbbd0c431d753c5b8488e8e8a41b89a86
1 #include "glob.h"
2 #include <stdio.h>
3 #include <string.h>
4 #include <conio.h>
5 #include <stdarg.h>
6 #include <stdlib.h>
7 #include <malloc.h>
8 #include "keyb.h"
9 #include "sound.h"
10 #include "vga.h"
11 #include "memory.h"
12 #include "files.h"
13 #include "error.h"
15 void CFG_save(void);
17 void K_fast(void);
19 void gotoxy(int,int);
21 void error(void) {}
23 void close_all(void) {
24   S_done();
25   K_done();K_fast();
26   V_done();
27   M_shutdown();
30 void ERR_failinit(char *s,...) {
31   va_list ap;
33   close_all();
34   va_start(ap,s);
35   vprintf(s,ap);
36   va_end(ap);
37   puts("");
38   exit(1);
41 void ERR_fatal(char *s,...) {
42   va_list ap;
44   close_all();
45   puts("\nКРИТИЧЕСКАЯ ОШИБКА:");
46   va_start(ap,s);
47   vprintf(s,ap);
48   va_end(ap);
49   puts("");
50   exit(2);
53 void ERR_quit(void) {
54   void *p;
56   V_done();
57   if(!(p=malloc(4000)))
58     puts("Спасибо за то, что вы играли в Операцию \"Смятка\"!");
59   else {
60     F_loadres(F_getresid("ENDOOM"),p,0,4000);
61     memcpy((void*)0xB8000,p,4000);free(p);gotoxy(1,24);
62   }
63   close_all();
64   CFG_save();
65   exit(0);