summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9df860a)
raw | patch | inline | side by side (parent: 9df860a)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 7 Apr 2021 06:34:45 +0000 (09:34 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 7 Apr 2021 06:34:45 +0000 (09:34 +0300) |
19 files changed:
src/dots.c | patch | blob | history | |
src/files.c | patch | blob | history | |
src/files.h | patch | blob | history | |
src/fx.c | patch | blob | history | |
src/game.c | patch | blob | history | |
src/gl/render.c | patch | blob | history | |
src/items.c | patch | blob | history | |
src/kos32/main.c | patch | blob | history | |
src/monster.c | patch | blob | history | |
src/my.c | [deleted file] | patch | blob | history |
src/my.h | [deleted file] | patch | blob | history |
src/player.c | patch | blob | history | |
src/save.h | patch | blob | history | |
src/sdl/main.c | patch | blob | history | |
src/sdl2/main.c | patch | blob | history | |
src/smoke.c | patch | blob | history | |
src/switch.c | patch | blob | history | |
src/view.c | patch | blob | history | |
src/weapons.c | patch | blob | history |
diff --git a/src/dots.c b/src/dots.c
index 07f3d3b23dc066bf10b0e0de875d3357e09a4bb9..c529c818771d7c991a227ab4a2c60e477ca1ef1e 100644 (file)
--- a/src/dots.c
+++ b/src/dots.c
#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 704ca271b9f3c40f6fae889dec624f7ad6533f64..1141c3b308e41a06dc9c9e7e4665d33c811b41db 100644 (file)
--- a/src/files.c
+++ b/src/files.c
#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) {
diff --git a/src/files.h b/src/files.h
index 1dfd0cb2a902dcaa7ac86c674a1fa5668f67d044..e1b30b56609cc41dafc45b2b3cec5076beceb54d 100644 (file)
--- a/src/files.h
+++ b/src/files.h
#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]);
diff --git a/src/fx.c b/src/fx.c
index d3ffdb474fa9d3202e1366882d39937b4d5d893e..01e58a4e68fee1d7771776416636458be7294cd3 100644 (file)
--- a/src/fx.c
+++ b/src/fx.c
#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 202f0f2b15f3095c3bfa4682bcaf9c68d7e3133b..f43abd51d0f8e8cc7b797a58d98c95b9c4ddb954 100644 (file)
--- a/src/game.c
+++ b/src/game.c
#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 e29dd232c40cfd39ff164ab81e1483e17d710948..d0aab9fac9cc1386fa741f932367de0a703b72c3 100644 (file)
--- a/src/gl/render.c
+++ b/src/gl/render.c
#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
diff --git a/src/items.c b/src/items.c
index 18b83722793511a096f1c61798f48da3c2acd38a..64b766f1ef0d8f2b02ebba0aa764d537a60a512f 100644 (file)
--- a/src/items.c
+++ b/src/items.c
#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 557505df4a386b903e0a9df025574985df6b94a9..c9ebfffe31f0b4b22ba9f9d2e537b4700fb23012 100644 (file)
--- a/src/kos32/main.c
+++ b/src/kos32/main.c
#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 1d4743023c777807591226d1019440042a41c818..48bf8f411caa64c6449dbb20616bf5c3b6514b84 100644 (file)
--- a/src/monster.c
+++ b/src/monster.c
#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
--- 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 <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;
-}
diff --git a/src/my.h b/src/my.h
--- a/src/my.h
+++ /dev/null
@@ -1,40 +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 <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 */
diff --git a/src/player.c b/src/player.c
index 6a803a151b1588e206a404e9e5fcb57b66608c83..514c4e379aa0d675cb362fb2965ddee8ce9a10c2 100644 (file)
--- a/src/player.c
+++ b/src/player.c
#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 876b3acd789b5087656cc5a50c6e35c3bec78605..b3848ab293289e98ffc65de2f6b2ec75eadfb114 100644 (file)
--- a/src/save.h
+++ b/src/save.h
#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 2c229fb3c77942ba0c9e055821ee1ff8ccb05dfb..23f331175700a01b6a4522245248b166464d2b1c 100644 (file)
--- a/src/sdl/main.c
+++ b/src/sdl/main.c
#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();
diff --git a/src/sdl2/main.c b/src/sdl2/main.c
index e06ef5eada9df75fb6cbad6355f470de4da7f795..1c20e9ea746035dd0a8a49bec7beed072f86b99b 100644 (file)
--- a/src/sdl2/main.c
+++ b/src/sdl2/main.c
#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();
diff --git a/src/smoke.c b/src/smoke.c
index db8afc7e828d6609b5c00580befdfbf07cc7b1f6..326a76e2464fb0b1c182d1ad4603155cd28b1b22 100644 (file)
--- a/src/smoke.c
+++ b/src/smoke.c
#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 886bee934096b71df73538dbd69580096c898988..359aa50d6d8b51cf25fbded2b104d62d424bdd19 100644 (file)
--- a/src/switch.c
+++ b/src/switch.c
#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 7a90e1c2d48dada151c94195be558d8d8f37ecba..31d8337acfc0f0f1bf17fd706b782b89c5cf2bb3 100644 (file)
--- a/src/view.c
+++ b/src/view.c
#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 624fc7e8ef8f862d07c32669e2928066b00b780a..f29febf4b4f6c2827726a236005e93facab54ed2 100644 (file)
--- a/src/weapons.c
+++ b/src/weapons.c
#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};