From 10bdd396f0cd0ff1fc0a504cd41949ff39937b30 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Wed, 7 Apr 2021 09:34:45 +0300 Subject: [PATCH] files: remove my.h --- src/dots.c | 1 - src/files.c | 34 +----------- src/files.h | 3 -- src/fx.c | 1 - src/game.c | 1 - src/gl/render.c | 3 +- src/items.c | 2 +- src/kos32/main.c | 1 - src/monster.c | 1 - src/my.c | 137 ----------------------------------------------- src/my.h | 40 -------------- src/player.c | 1 - src/save.h | 3 -- src/sdl/main.c | 13 +---- src/sdl2/main.c | 17 ++---- src/smoke.c | 1 - src/switch.c | 1 - src/view.c | 1 - src/weapons.c | 1 - 19 files changed, 9 insertions(+), 253 deletions(-) delete mode 100644 src/my.c delete mode 100644 src/my.h diff --git a/src/dots.c b/src/dots.c index 07f3d3b..c529c81 100644 --- a/src/dots.c +++ b/src/dots.c @@ -21,7 +21,6 @@ #include "view.h" #include "dots.h" #include "misc.h" -#include "my.h" #define MAXINI 50 #define MAXSR 20 diff --git a/src/files.c b/src/files.c index 704ca27..1141c3b 100644 --- a/src/files.c +++ b/src/files.c @@ -20,25 +20,12 @@ #include #include #include -#ifdef UNIX -# include -#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" @@ -159,23 +146,6 @@ void F_randmus (char *s) { } } -// 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) { diff --git a/src/files.h b/src/files.h index 1dfd0cb..e1b30b5 100644 --- a/src/files.h +++ b/src/files.h @@ -19,8 +19,6 @@ #define FILES_H_INCLUDED #include "glob.h" -#include // FILE -#include "map.h" // map_block_t extern int d_start, d_end; @@ -36,7 +34,6 @@ int F_getsprid (const char n[4], int s, int d, char *dir); 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]); diff --git a/src/fx.c b/src/fx.c index d3ffdb4..01e58a4 100644 --- a/src/fx.c +++ b/src/fx.c @@ -22,7 +22,6 @@ #include "view.h" #include "fx.h" #include "misc.h" -#include "my.h" enum{NONE,TFOG,IFOG,BUBL}; diff --git a/src/game.c b/src/game.c index 202f0f2..f43abd5 100644 --- a/src/game.c +++ b/src/game.c @@ -35,7 +35,6 @@ #include "menu.h" #include "misc.h" #include "map.h" -#include "my.h" #include "game.h" #include "config.h" #include "music.h" diff --git a/src/gl/render.c b/src/gl/render.c index e29dd23..d0aab9f 100644 --- a/src/gl/render.c +++ b/src/gl/render.c @@ -45,9 +45,10 @@ #else # include #endif -#include +#include #include #include +#include #include #define VGA_TRANSPARENT_COLOR 0 diff --git a/src/items.c b/src/items.c index 18b8372..64b766f 100644 --- a/src/items.c +++ b/src/items.c @@ -26,9 +26,9 @@ #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]; diff --git a/src/kos32/main.c b/src/kos32/main.c index 557505d..c9ebfff 100644 --- a/src/kos32/main.c +++ b/src/kos32/main.c @@ -23,7 +23,6 @@ #include "system.h" #include "input.h" -#include "my.h" // fexists #include "player.h" // pl1 pl2 #include "menu.h" // G_keyf #include "error.h" // logo diff --git a/src/monster.c b/src/monster.c index 1d47430..48bf8f4 100644 --- a/src/monster.c +++ b/src/monster.c @@ -30,7 +30,6 @@ #include "misc.h" #include "fx.h" #include "smoke.h" -#include "my.h" #include "player.h" #include "error.h" #include "game.h" diff --git a/src/my.c b/src/my.c deleted file mode 100644 index a7adf3c..0000000 --- a/src/my.c +++ /dev/null @@ -1,137 +0,0 @@ -/* 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 . - */ - - -#include "glob.h" -#include "error.h" -#include "common/endianness.h" - -#include -#include -#include - -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. - */ - -#ifndef MY_H_INCLUDED -#define MY_H_INCLUDED - -#include // int16_t int32_t -#include // 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 */ diff --git a/src/player.c b/src/player.c index 6a803a1..514c4e3 100644 --- a/src/player.c +++ b/src/player.c @@ -28,7 +28,6 @@ #include "switch.h" #include "player.h" #include "misc.h" -#include "my.h" #include "game.h" #include "input.h" diff --git a/src/save.h b/src/save.h index 876b3ac..b3848ab 100644 --- a/src/save.h +++ b/src/save.h @@ -18,9 +18,6 @@ #ifndef SAVE_H_INCLUDED #define SAVE_H_INCLUDED -#include "glob.h" -#include "my.h" - #include "common/streams.h" #define SAVE_MAX 7 diff --git a/src/sdl/main.c b/src/sdl/main.c index 2c229fb..23f3311 100644 --- a/src/sdl/main.c +++ b/src/sdl/main.c @@ -25,7 +25,6 @@ #include "system.h" #include "input.h" -#include "my.h" // fexists #include "player.h" // pl1 pl2 #include "menu.h" // G_keyf #include "error.h" // logo @@ -482,7 +481,6 @@ static void step (void) { } 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()); @@ -511,16 +509,7 @@ int main (int argc, char *argv[]) { 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(); diff --git a/src/sdl2/main.c b/src/sdl2/main.c index e06ef5e..1c20e9e 100644 --- a/src/sdl2/main.c +++ b/src/sdl2/main.c @@ -28,7 +28,6 @@ #include "cp866.h" -#include "my.h" // fexists #include "player.h" // pl1 pl2 #include "menu.h" // G_keyf #include "error.h" // logo @@ -126,7 +125,7 @@ void ERR_failinit (char *s, ...) { vprintf(s, ap); va_end(ap); puts(""); - exit(1); + abort() } void ERR_fatal (char *s, ...) { @@ -141,7 +140,7 @@ void ERR_fatal (char *s, ...) { vprintf(s, ap); va_end(ap); puts(""); - exit(1); + abort(); } void ERR_quit (void) { @@ -568,7 +567,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) { @@ -598,16 +596,7 @@ int main (int argc, char **argv) { 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(); diff --git a/src/smoke.c b/src/smoke.c index db8afc7..326a76e 100644 --- a/src/smoke.c +++ b/src/smoke.c @@ -22,7 +22,6 @@ #include "game.h" #include "fx.h" #include "misc.h" -#include "my.h" #include "monster.h" #define MAXSR 20 diff --git a/src/switch.c b/src/switch.c index 886bee9..359aa50 100644 --- a/src/switch.c +++ b/src/switch.c @@ -25,7 +25,6 @@ #include "map.h" #include "files.h" #include "game.h" -#include "my.h" #include "monster.h" #include "render.h" diff --git a/src/view.c b/src/view.c index 7a90e1c..31d8337 100644 --- a/src/view.c +++ b/src/view.c @@ -33,7 +33,6 @@ #include "misc.h" #include "map.h" #include "sound.h" -#include "my.h" #include "render.h" int sky_type=1; diff --git a/src/weapons.c b/src/weapons.c index 624fc7e..f29febf 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -28,7 +28,6 @@ #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}; -- 2.29.2