DEADSOFTWARE

sdl2: fix build sdl2
[flatwaifu.git] / src / sdl2 / main.c
index 6044bfc7ecad9e6be1359b507714b3e2040a9422..98fb2cf84ef2506bf1cb839b31c1e0f46c275ce5 100644 (file)
@@ -1,3 +1,18 @@
+/* Copyright (C) 2020 SovietPony
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #ifdef __EMSCRIPTEN__
 #  include <emscripten.h>
 #endif
@@ -11,9 +26,6 @@
 #include "system.h"
 #include "input.h"
 
-#include "cp866.h"
-
-#include "my.h" // fexists
 #include "player.h" // pl1 pl2
 #include "menu.h" // G_keyf
 #include "error.h" // logo
@@ -28,6 +40,8 @@
 #include "music.h" // S_initmusic S_updatemusic S_donemusic
 #include "render.h" // R_init R_draw R_done
 
+#include "common/cp866.h"
+
 #define TITLE_STR "Doom 2D (SDL2)"
 
 static Uint32 ticks;
@@ -111,7 +125,7 @@ void ERR_failinit (char *s, ...) {
   vprintf(s, ap);
   va_end(ap);
   puts("");
-  exit(1);
+  abort();
 }
 
 void ERR_fatal (char *s, ...) {
@@ -119,14 +133,13 @@ void ERR_fatal (char *s, ...) {
   R_done();
   MUS_done();
   S_done();
-  M_shutdown();
   SDL_Quit();
-  puts("\nКРИТИЧЕСКАЯ ОШИБКА:");
+  puts("\nCRITICAL ERROR:");
   va_start(ap, s);
   vprintf(s, ap);
   va_end(ap);
   puts("");
-  exit(1);
+  abort();
 }
 
 void ERR_quit (void) {
@@ -553,7 +566,6 @@ static void step (void) {
 }
 
 int main (int argc, char **argv) {
-  char *pw;
   CFG_args(argc, argv);
   logo("system: initialize SDL2\n");
   if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS) == -1) {
@@ -581,21 +593,9 @@ int main (int argc, char **argv) {
   pl2.kwr = KEY_2;
   pl2.kp = KEY_E;
   srand(SDL_GetTicks());
-  F_startup();
   CFG_load();
-#ifndef WIN32
-  pw = "/usr/share/doom2d-rembo/doom2d.wad";
-#else
-  pw = "doom2d.wad";
-#endif
-  if (fexists(pw)) {
-    F_addwad(pw);
-  } else {
-    F_addwad("doom2d.wad");
-  }
+  F_addwad("doom2d.wad");
   F_initwads();
-  M_startup();
-  F_allocres();
   S_init();
   MUS_init();
   R_init();
@@ -612,7 +612,6 @@ int main (int argc, char **argv) {
   R_done();
   MUS_done();
   S_done();
-  M_shutdown();
   SDL_Quit();
   return 0;
 }