#include "view.h"
#include "dots.h"
#include "misc.h"
-#include "my.h"
#define MAXINI 50
#define MAXSR 20
#include <string.h>
#include <stdlib.h>
#include <assert.h>
-#ifdef UNIX
-# include <sys/stat.h>
-#endif
#include "files.h"
-#include "map.h"
-#include "my.h"
-#include "game.h"
-#include "view.h"
-#include "dots.h"
-#include "smoke.h"
-#include "fx.h"
-#include "items.h"
-#include "monster.h"
-#include "player.h"
-#include "switch.h"
-#include "weapons.h"
#include "error.h"
#include "cp866.h"
+#include "map.h" // MAP_load
+
#include "common/streams.h"
#include "common/files.h"
#include "common/wadres.h"
}
}
-// reads bytes from file until CR
-void F_readstr (FILE* h, char *s, int m) {
- int i = 0;
- size_t len = 0;
- static char c = 0;
- while (i < m) {
- c = 13;
- len = myfreadc(&c, 1, 1, h);
- if (len == 0 || c == 13 || c == 10) {
- break;
- }
- s[i] = c;
- i++;
- }
- s[i] = 0;
-}
-
void F_loadmap (char n[8]) {
int id = F_getresid(n);
if (id != -1) {
#define FILES_H_INCLUDED
#include "glob.h"
-#include <stdio.h> // FILE
-#include "map.h" // map_block_t
extern int d_start, d_end;
int F_getreslen (int r);
void F_nextmus (char *s);
void F_randmus (char *s);
-void F_readstr (FILE* h, char *s, int m);
void F_loadmap (char n[8]);
#include "view.h"
#include "fx.h"
#include "misc.h"
-#include "my.h"
enum{NONE,TFOG,IFOG,BUBL};
#include "menu.h"
#include "misc.h"
#include "map.h"
-#include "my.h"
#include "game.h"
#include "config.h"
#include "music.h"
#else
# include <GL/gl.h>
#endif
-#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <assert.h>
#define VGA_TRANSPARENT_COLOR 0
#include "things.h"
#include "misc.h"
#include "map.h"
-#include "my.h"
#include "files.h"
#include "game.h"
+
item_t it[MAXITEM];
static void *snd[4];
#include "system.h"
#include "input.h"
-#include "my.h" // fexists
#include "player.h" // pl1 pl2
#include "menu.h" // G_keyf
#include "error.h" // logo
#include "misc.h"
#include "fx.h"
#include "smoke.h"
-#include "my.h"
#include "player.h"
#include "error.h"
#include "game.h"
+++ /dev/null
-/* Copyright (C) 1996-1997 Aleksey Volynskov
- * Copyright (C) 2011 Rambo
- * 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/>.
- */
-
-
-#include "glob.h"
-#include "error.h"
-#include "common/endianness.h"
-
-#include <stdio.h>
-#include <stdint.h>
-#include <assert.h>
-
-void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext) {
- const char* end; /* end of processed string */
- const char* p; /* search pointer */
- const char* s; /* copy pointer */
-
- /* extract drive name */
- if (path[0] && path[1]==':') {
- if (drv) {
- *drv++ = *path++;
- *drv++ = *path++;
- *drv = '\0';
- }
- } else if (drv)
- *drv = '\0';
-
- /* search for end of string or stream separator */
- for(end=path; *end && *end!=':'; )
- end++;
-
- /* search for begin of file extension */
- for(p=end; p>path && *--p!='\\' && *p!='/'; )
- if (*p == '.') {
- end = p;
- break;
- }
-
- if (ext)
- for(s=end; (*ext=*s++); )
- ext++;
-
- /* search for end of directory name */
- for(p=end; p>path; )
- if (*--p=='\\' || *p=='/') {
- p++;
- break;
- }
-
- if (name) {
- for(s=p; s<end; )
- *name++ = *s++;
-
- *name = '\0';
- }
-
- if (dir) {
- for(s=path; s<p; )
- *dir++ = *s++;
-
- *dir = '\0';
- }
-}
-
-size_t myfreadc (void *ptr, size_t size, size_t n, FILE *f) {
- return fread(ptr, size, n, f);
-}
-
-void myfread (void *ptr, size_t size, size_t n, FILE *f) {
-#if 1
- myfreadc(ptr, size, n, f);
-#else
- if (myfreadc(ptr, size, n, f) != n) {
- ERR_fatal("File reading error (readed %u, required %u)\n", m, n);
- }
-#endif
-}
-
-int8_t myfread8 (FILE *f) {
- int8_t x;
- myfread(&x, 1, 1, f);
- return x;
-}
-
-int16_t myfread16 (FILE *f) {
- int16_t x;
- myfread(&x, 2, 1, f);
- return short2host(x);
-}
-
-int32_t myfread32 (FILE *f) {
- int32_t x;
- myfread(&x, 4, 1, f);
- return int2host(x);
-}
-
-void myfwrite (void *ptr, size_t size, size_t n, FILE *f) {
- assert(fwrite(ptr, size, n, f) == n);
-}
-
-void myfwrite8 (int8_t x, FILE *f) {
- myfwrite(&x, 1, 1, f);
-}
-
-void myfwrite16 (int16_t x, FILE *f) {
- x = short2host(x);
- myfwrite(&x, 2, 1, f);
-}
-
-void myfwrite32 (int32_t x, FILE *f) {
- x = int2host(x);
- myfwrite(&x, 4, 1, f);
-}
-
-int fexists (char *filename) {
- FILE *f;
- if ((f = fopen(filename, "r")))
- {
- fclose(f);
- return 1;
- }
- return 0;
-}
+++ /dev/null
-/* Copyright (C) 1996-1997 Aleksey Volynskov
- * Copyright (C) 2011 Rambo
- * 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/>.
- */
-
-#ifndef MY_H_INCLUDED
-#define MY_H_INCLUDED
-
-#include <stdint.h> // int16_t int32_t
-#include <stdio.h> // FILE
-
-void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext);
-
-size_t myfreadc (void *ptr, size_t size, size_t n, FILE *f);
-
-void myfread (void *ptr, size_t size, size_t n, FILE *f);
-int8_t myfread8 (FILE *f);
-int16_t myfread16 (FILE *f);
-int32_t myfread32 (FILE *f);
-
-void myfwrite (void *ptr, size_t size, size_t n, FILE *f);
-void myfwrite8 (int8_t x, FILE *f);
-void myfwrite16 (int16_t x, FILE *f);
-void myfwrite32 (int32_t x, FILE *f);
-
-int fexists (char *filename);
-
-#endif /* MY_H_INCLUDED */
#include "switch.h"
#include "player.h"
#include "misc.h"
-#include "my.h"
#include "game.h"
#include "input.h"
#ifndef SAVE_H_INCLUDED
#define SAVE_H_INCLUDED
-#include "glob.h"
-#include "my.h"
-
#include "common/streams.h"
#define SAVE_MAX 7
#include "system.h"
#include "input.h"
-#include "my.h" // fexists
#include "player.h" // pl1 pl2
#include "menu.h" // G_keyf
#include "error.h" // logo
}
int main (int argc, char *argv[]) {
- char *pw;
logo("main: initialize SDL\n");
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) {
logo("main: failed to init SDL: %s\n", SDL_GetError());
pl2.kp = KEY_E;
srand(SDL_GetTicks());
F_startup();
-#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");
CFG_args(argc, argv);
CFG_load();
F_initwads();
#include "cp866.h"
-#include "my.h" // fexists
#include "player.h" // pl1 pl2
#include "menu.h" // G_keyf
#include "error.h" // logo
vprintf(s, ap);
va_end(ap);
puts("");
- exit(1);
+ abort()
}
void ERR_fatal (char *s, ...) {
vprintf(s, ap);
va_end(ap);
puts("");
- exit(1);
+ abort();
}
void ERR_quit (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) {
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();
#include "game.h"
#include "fx.h"
#include "misc.h"
-#include "my.h"
#include "monster.h"
#define MAXSR 20
#include "map.h"
#include "files.h"
#include "game.h"
-#include "my.h"
#include "monster.h"
#include "render.h"
#include "misc.h"
#include "map.h"
#include "sound.h"
-#include "my.h"
#include "render.h"
int sky_type=1;
#include "player.h"
#include "monster.h"
#include "switch.h"
-#include "my.h"
enum{NONE=0,ROCKET,PLASMA,APLASMA,BALL1,BALL2,BALL7,BFGBALL,BFGHIT,
MANF,REVF,FIRE};