summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c603e0)
raw | patch | inline | side by side (parent: 5c603e0)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 6 Nov 2021 11:25:34 +0000 (14:25 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 6 Nov 2021 11:25:34 +0000 (14:25 +0300) |
16 files changed:
src/args.c | patch | blob | history | |
src/bmap.c | patch | blob | history | |
src/common/cp866.c | patch | blob | history | |
src/common/endianness.h | patch | blob | history | |
src/common/files.c | patch | blob | history | |
src/common/files.h | patch | blob | history | |
src/common/streams.c | patch | blob | history | |
src/common/wadres.c | patch | blob | history | |
src/common/wadres.h | patch | blob | history | |
src/config.c | patch | blob | history | |
src/map.c | patch | blob | history | |
src/menu.c | patch | blob | history | |
src/monster.c | patch | blob | history | |
src/save.c | patch | blob | history | |
src/stubsys/files.c | patch | blob | history | |
src/stubsys/main.c | patch | blob | history |
diff --git a/src/args.c b/src/args.c
index 00df73ae44c24f9a1cf66c3278f6427d2a9d3faf..99410f43cdf3eb8adf6d8c09ff7c9ca7be7b0cd1 100644 (file)
--- a/src/args.c
+++ b/src/args.c
#include <assert.h>
void ARG_parse (int argc, char **argv, int n, const cfg_t **list) {
+ int i, j;
+ char *key;
+ const cfg_t *c;
assert(argc >= 0);
assert(argv != NULL);
assert(n >= 0);
assert(list != NULL);
- int i, j;
- char *key;
- const cfg_t *c;
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-' && argv[i][1] != 0) {
j = 0;
diff --git a/src/bmap.c b/src/bmap.c
index 0b165f25ae6f90c0fc910396a9ffdcc080598721..89a36e290a94fa4153a8d90a84f760ac60efa9b2 100644 (file)
--- a/src/bmap.c
+++ b/src/bmap.c
void BM_remapfld(void)
{
- BM_clear(BM_WALL);
int x,y;
+ BM_clear(BM_WALL);
for(x=0; x<FLDW; x++)
for(y=0; y<FLDH; y++)
if (fld[y][x] == 1 || fld[y][x] == 2)
diff --git a/src/common/cp866.c b/src/common/cp866.c
index b8ce2a451b5c6e82f2b36779c7f3ca1ce391e63e..a28b297d5d36b2f367c893f1c9f35d1b1711e467 100644 (file)
--- a/src/common/cp866.c
+++ b/src/common/cp866.c
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "cp866.h"
+#include "common/cp866.h"
int cp866_isalpha (int ch) {
return (ch >= 0x41 && ch <= 0x5A) || (ch >= 0x61 && ch <= 0x7A) || (ch >= 0x80 && ch <= 0xAF) || (ch >= 0xE0 && ch <= 0xF7);
index f4708b2b0cf5dc67671bf97db231067ca2a4391c..a70e20bc9ad3a23b40f944041449f65641476a2f 100644 (file)
--- a/src/common/endianness.h
+++ b/src/common/endianness.h
#define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0)
-static inline int16_t short2swap (int16_t x) {
+static /*inline*/ int16_t short2swap (int16_t x) {
union {
uint8_t a[2];
int16_t x;
return y.x;
}
-static inline int32_t int2swap (int32_t x) {
+static /*inline*/ int32_t int2swap (int32_t x) {
union {
uint8_t a[4];
int32_t x;
#undef SWAP_VAR
-static inline int16_t short2host (int16_t x) {
+static /*inline*/ int16_t short2host (int16_t x) {
#if __BIG_ENDIAN__
return short2swap(x);
#else
#endif
}
-static inline int32_t int2host (int32_t x) {
+static /*inline*/ int32_t int2host (int32_t x) {
#if __BIG_ENDIAN__
return int2swap(x);
#else
diff --git a/src/common/files.c b/src/common/files.c
index 8961c0377f4053cfa982baf708333b90c778dc6b..f1eeb591f52abbaadbd93bcd9264d2786ef3b90c 100644 (file)
--- a/src/common/files.c
+++ b/src/common/files.c
-#include "files.h"
+#include "common/files.h"
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
static long FILE_Stream_GetPos (Stream *r) {
+ long pos;
FILE_Stream *rd = (FILE_Stream*)r;
assert(rd != NULL);
assert(rd->fp != NULL);
- long pos = ftell(rd->fp);
+ pos = ftell(rd->fp);
assert(pos != -1); // fail
return pos;
}
static void FILE_Stream_SetPos (Stream *r, long pos) {
+ int res;
FILE_Stream *rd = (FILE_Stream*)r;
assert(rd != NULL);
assert(rd->fp != NULL);
assert(pos >= 0);
- int res = fseek(rd->fp, pos, SEEK_SET);
+ res = fseek(rd->fp, pos, SEEK_SET);
assert(res == 0); // fail
}
static long FILE_Stream_GetLen (Stream *r) {
+ int res;
+ long pos, len;
FILE_Stream *rd = (FILE_Stream*)r;
assert(rd != NULL);
assert(rd->fp != NULL);
- long pos = ftell(rd->fp);
+ pos = ftell(rd->fp);
assert(pos != -1); // fail get cur pos
- int res = fseek(rd->fp, 0, SEEK_END);
+ res = fseek(rd->fp, 0, SEEK_END);
assert(res == 0); // fail jump to end
- long len = ftell(rd->fp);
+ len = ftell(rd->fp);
res = fseek(rd->fp, pos, SEEK_SET);
assert(res == 0); // fail return
assert(len != -1); // fail get length
}
static void FILE_Stream_Read (Stream *r, void *data, size_t size, size_t n) {
+ size_t res;
FILE_Stream *rd = (FILE_Stream*)r;
assert(rd != NULL);
assert(rd->fp != NULL);
- size_t res = fread(data, size, n, rd->fp);
+ res = fread(data, size, n, rd->fp);
assert(res == n); // fail
}
static void FILE_Stream_Write (Stream *w, const void *data, size_t size, size_t n) {
+ size_t res;
FILE_Stream *wr = (FILE_Stream*)w;
assert(wr != NULL);
assert(wr->fp != NULL);
- size_t res = fwrite(data, size, n, wr->fp);
+ res = fwrite(data, size, n, wr->fp);
assert(res == n); // fail
}
}
int FILE_Open (FILE_Stream *r, const char *name, const char *mode) {
+ FILE *fp;
assert(r != NULL);
assert(name != NULL);
- FILE *fp = fopen(name, mode);
+ fp = fopen(name, mode);
if (fp) {
FILE_Assign(r, fp);
}
diff --git a/src/common/files.h b/src/common/files.h
index a575ec1ce162f90871f06f2cb8b086acc7b26680..e10798d23c8e6bf5f0112fb6b0d6407675c256a2 100644 (file)
--- a/src/common/files.h
+++ b/src/common/files.h
#define COMMON_FILES_H_INCLUDED
#include <stdio.h>
-#include "streams.h"
+#include "common/streams.h"
typedef struct FILE_Stream {
Stream base;
diff --git a/src/common/streams.c b/src/common/streams.c
index 995dac55724a9e46c492e2da29114891fcc13e84..685ace15fa6d8ea62cfa017e6ccfb8ac6617cccd 100644 (file)
--- a/src/common/streams.c
+++ b/src/common/streams.c
-#include "streams.h"
-#include "endianness.h"
+#include "common/streams.h"
+#include "common/endianness.h"
#include <stddef.h>
#include <stdint.h>
diff --git a/src/common/wadres.c b/src/common/wadres.c
index 43251c8d9d00507d5a251e24e422400bbd2c034a..6ff943ab03d876ba682ab436f22bc6af66b29567 100644 (file)
--- a/src/common/wadres.c
+++ b/src/common/wadres.c
#include <stdlib.h>
#include <assert.h>
-#include "wadres.h"
-#include "streams.h"
-#include "cp866.h"
+#include "common/wadres.h"
+#include "common/streams.h"
+#include "common/cp866.h"
typedef struct Entry {
long offset, size;
static int s_start, s_end;
static int check_header (Stream *r) {
- assert(r != NULL);
char ident[4];
+ assert(r != NULL);
stream_setpos(r, 0); // !!!
stream_read(ident, 4, 1, r);
return (memcmp(ident, "IWAD", 4) == 0) || (memcmp(ident, "PWAD", 4) == 0);
}
static int WADRES_addresource (const Entry *e) {
+ int i;
assert(e != NULL);
- for (int i = 0; i < n_resources; ++i) {
+ for (i = 0; i < n_resources; ++i) {
if (cp866_strncasecmp(resources[i].name, e->name, 8) == 0) {
memcpy(&resources[i], e, sizeof(Entry));
return i;
}
static int WADRES_read (int f) {
+ int ok = 1;
+ int32_t n, dir, i;
Stream *r = wads[f];
stream_setpos(r, 4); // skip magic
- int32_t n = stream_read32(r);
- int32_t dir = stream_read32(r);
+ n = stream_read32(r);
+ dir = stream_read32(r);
stream_setpos(r, dir);
- int ok = 1;
- for (int32_t i = 0; ok && i < n; ++i) {
+ for (i = 0; ok && i < n; ++i) {
Entry e;
e.offset = stream_read32(r);
e.size = stream_read32(r);
}
int WADRES_rehash (void) {
+ int i;
int ok = 1;
- for (int i = 0; i < n_wads; ++i) {
+ for (i = 0; i < n_wads; ++i) {
if (!WADRES_read(i)) {
ok = 0;
}
}
int WADRES_findsprite (const char n[4], int s, int d, char *dir) {
+ int i;
s += 'A';
d += '0';
- for (int i = s_start + 1; i < s_end; i++) {
+ for (i = s_start + 1; i < s_end; i++) {
char a, b;
char *wn = resources[i].name;
if (cp866_strncasecmp(wn, n, 4) == 0 && (wn[4] == s || wn[6] == s)) {
}
void WADRES_getdata (int id, void *data) {
+ long pos;
+ Stream *r;
assert(id >= 0 && id < n_resources);
- Stream *r = wads[resources[id].f];
- long pos = stream_getpos(r);
+ r = wads[resources[id].f];
+ pos = stream_getpos(r);
stream_setpos(r, resources[id].offset);
stream_read(data, resources[id].size, 1, r);
stream_setpos(r, pos);
}
void WADRES_unlock (void *data) {
+ int id;
+ Block *x;
if (data) {
- Block *x = data - sizeof(Block);
- int id = x->id;
+ x = (Block*)((uintptr_t)data - sizeof(Block));
+ id = x->id;
assert(id >= 0 && id < MAX_RESOURCES);
x->ref -= 1;
assert(x->ref >= 0);
diff --git a/src/common/wadres.h b/src/common/wadres.h
index c1be63a8e13dc61095bcf8fc84815454f764202f..8ca38358e1505f40ed3b4c13c3010e3102fe59b2 100644 (file)
--- a/src/common/wadres.h
+++ b/src/common/wadres.h
#ifndef COMMON_WADRES_H_INCLUDED
#define COMMON_WADRES_H_INCLUDED
-#include "streams.h"
+#include "common/streams.h"
#define MAX_WADS 20
#define MAX_RESOURCES 2000
diff --git a/src/config.c b/src/config.c
index 86b6d227c96893cbc7cde91cdc83ca5c31a7f406..78664aafcbd529d4d6c3f2eec6fbdcb66c2e72be 100644 (file)
--- a/src/config.c
+++ b/src/config.c
}
int CFG_update_key (const char *key, const char *value, const cfg_t *cfg) {
+ const cfg_t *entry;
assert(key != NULL);
assert(value != NULL);
- const cfg_t *entry = CFG_find_entry(key, cfg);
+ entry = CFG_find_entry(key, cfg);
if (entry != NULL) {
void *p = entry->p;
switch (entry->t) {
}
int CFG_scan_iterator (char *key, int keylen, char *value, int valuelen) {
+ int i;
+ int found = 0;
assert(key != NULL);
assert(keylen > 0);
assert(value != NULL);
assert(valuelen > 0);
- int i;
- int found = 0;
while (feof(f) == 0 && found == 0) {
CFG_skip_space();
if (ch == ';') {
/* --- reader --- */
int CFG_read_config (const char *name, int n, const cfg_t **cfg) {
- assert(name != NULL);
- assert(n >= 0);
- assert(cfg != NULL);
int i;
char key[64];
char value[64];
assert(name != NULL);
+ assert(n >= 0);
+ assert(cfg != NULL);
+ assert(name != NULL);
if (CFG_open_iterator(name)) {
while (CFG_scan_iterator(key, 64, value, 64)) {
i = 0;
@@ -178,11 +179,12 @@ static void CFG_write_key_value (FILE *f, const char *key, const char *value) {
}
static int CFG_write_entry (FILE *f, const cfg_t *entry) {
- assert(f != NULL);
- assert(entry != NULL);
char buf[16];
const char *str;
- const char *key = entry->cfg;
+ const char *key;
+ assert(f != NULL);
+ assert(entry != NULL);
+ key = entry->cfg;
if (key != NULL) {
switch (entry->t) {
case Y_BYTE:
}
int CFG_update_config (const char *old, const char *new, int n, const cfg_t **cfg, const char *msg) {
+ int i, j;
+ char key[64];
+ char value[64];
+ FILE *nf;
assert(old != NULL);
assert(new != NULL);
assert(n >= 0);
assert(cfg != NULL);
- int i, j;
- char key[64];
- char value[64];
- FILE *nf = fopen(new, "wb");
+ nf = fopen(new, "wb");
if (nf != NULL) {
if (msg != NULL) {
fwrite("; ", 2, 1, nf);
diff --git a/src/map.c b/src/map.c
index 8f1fb68328006b9178b18ca1b9efcc0b794bec6d..d70a4fb3cce021c46cf39b16140f794106ddf0c7 100644 (file)
--- a/src/map.c
+++ b/src/map.c
}
int MAP_load (Stream *r) {
- assert(r != NULL);
int ok = 0;
+ long off;
map_header_t hdr;
+ assert(r != NULL);
W_init(); // reset all game data
stream_read(hdr.id, 8, 1, r);
hdr.ver = stream_read16(r);
blk.t = stream_read16(r);
blk.st = stream_read16(r);
blk.sz = stream_read32(r);
- long off = stream_getpos(r) + blk.sz;
+ off = stream_getpos(r) + blk.sz;
switch (blk.t) {
case MB_MUSIC:
ok = G_load(r);
diff --git a/src/menu.c b/src/menu.c
index 688fc25bf255bc87a7a1749d9e882329cce36926..037782a7f7d5e1125a7b81c7709d3e72eaca7c01 100644 (file)
--- a/src/menu.c
+++ b/src/menu.c
static int new_game_menu_handler (menu_msg_t *msg, const menu_t *m, int i) {
static int cur;
- enum { ONEPLAYER, TWOPLAYERS, DEATHMATCH, __NUM__ };
+ enum { ONEPLAYER, TWOPLAYERS, DEATHMATCH, NG__NUM__ };
static const simple_menu_t sm = {
GM_BIG, "New Game", "_NEWGAME",
{
// GM_say("_COOP");
}
}
- return simple_menu_handler(msg, i, __NUM__, &sm, &cur);
+ return simple_menu_handler(msg, i, NG__NUM__, &sm, &cur);
}
static int load_game_menu_handler (menu_msg_t *msg, const menu_t *m, int i) {
case GM_GETCAPTION:
return GM_init_str(msg, (char*)captions[i], strlen(captions[i]));
case GM_GETSTR:
- str = state == 0 || i != cur ? I_key_to_string(mm->pl_keys[i]) : "...";
+ if (state == 0 || i != cur) {
+ str = I_key_to_string(mm->pl_keys[i]);
+ } else {
+ str = "...";
+ }
return GM_init_str(msg, (char*)str, strlen(str));
case GM_SELECT:
state = state == 0 ? 1 : 0;
static int options_menu_handler (menu_msg_t *msg, const menu_t *m, int i) {
static int cur;
const menu_t *mm;
- enum { VIDEO, SOUND, MUSIC, CONTROLS_1, CONTROLS_2, __NUM__ };
+ enum { VIDEO, SOUND, MUSIC, CONTROLS_1, CONTROLS_2, OPT__NUM__ };
static const controls_menu_t c1 = {
{ controls_menu_handler },
&pl1.ku
return GM_push(mm);
}
}
- return simple_menu_handler(msg, i, __NUM__, &sm, &cur);
+ return simple_menu_handler(msg, i, OPT__NUM__, &sm, &cur);
}
static int exit_menu_handler (menu_msg_t *msg, const menu_t *m, int i) {
static int cur;
- enum { YES, NO, __NUM__ };
+ enum { YES, NO, EXIT__NUM__ };
static const simple_menu_t sm = {
GM_SMALL, "You are sure?", NULL,
{
return GM_pop();
}
}
- return simple_menu_handler(msg, i, __NUM__, &sm, &cur);
+ return simple_menu_handler(msg, i, EXIT__NUM__, &sm, &cur);
}
static int main_menu_handler (menu_msg_t *msg, const menu_t *m, int i) {
- enum { NEWGAME, OLDGAME, SAVEGAME, OPTIONS, EXIT, __NUM__ };
- assert(i >= 0 && i < __NUM__);
+ enum { NEWGAME, OLDGAME, SAVEGAME, OPTIONS, EXIT, MAIN__NUM__ };
static int cur;
- static const menu_t hm[__NUM__] = {
+ static const menu_t hm[MAIN__NUM__] = {
{ new_game_menu_handler },
{ load_game_menu_handler },
{ save_game_menu_handler },
{ "Exit", &hm[EXIT] }
}
};
- return simple_menu_handler(msg, i, __NUM__, &sm, &cur);
+ assert(i >= 0 && i < MAIN__NUM__);
+ return simple_menu_handler(msg, i, MAIN__NUM__, &sm, &cur);
}
static const menu_t main_menu = { &main_menu_handler };
int GM_push (const menu_t *m) {
+ menu_msg_t msg;
assert(m != NULL);
assert(stack_p >= -1);
assert(stack_p < MAX_STACK - 1);
- menu_msg_t msg;
stack_p += 1;
stack[stack_p].m = m;
msg.type = GM_ENTER;
}
int GM_pop (void) {
- assert(stack_p >= 0);
menu_msg_t msg;
+ assert(stack_p >= 0);
stack_p -= 1;
msg.type = GM_LEAVE;
GM_send_this(stack[stack_p + 1].m, &msg);
diff --git a/src/monster.c b/src/monster.c
index 48bf8f411caa64c6449dbb20616bf5c3b6514b84..77a161df669ab9f8dd217f37b42d6d7f0e255e97 100644 (file)
--- a/src/monster.c
+++ b/src/monster.c
@@ -91,28 +91,28 @@ static void *snd[MN_TN][5],*impsitsnd[2],*impdthsnd[2],*firsnd,*slopsnd,*gsnd[4]
static void *swgsnd,*pchsnd,*telesnd;
static void *positsnd[3],*podthsnd[3];
static mnsz_t mnsz[MN_TN+1]={
-//rad ht life pain rv jv slop min_pn
- 0, 0, 0, 0, 0, 0, 0, 0, // none
- 15, 28, 60, 20, 7,10, 0, 10, // demon
- 10, 28, 25, 15, 3,10, 30, 0, // imp
- 10, 28, 15, 10, 3,10, 30, 0, // zomby
- 10, 28, 20, 10, 3,10, 30, 0, // sergeant
- 20, 55, 500, 70, 5,10, 0, 50, // cyberdemon
- 12, 28, 60, 20, 3,10, 30, 10, // chaingunner
- 12, 32, 150, 40, 3,10, 0, 30, // baron of hell
- 12, 32, 75, 40, 3,10, 0, 30, // hell knight
- 15, 28, 100, 10, 4, 4, 0, 0, // cacodemon
- 8, 18, 60, 10, 4, 4, 0, 0, // lost soul
- 15, 28, 100, 10, 4, 4, 0, 0, // pain elemental
- 64, 50, 500, 70, 4,10, 0, 50, // spider mastermind
- 25, 27, 150, 20, 4,10, 0, 0, // arachnotron
- 18, 30, 200, 40, 3, 7, 0, 20, // mancubus
- 17, 36, 200, 40, 6,11, 0, 20, // revenant
- 17, 36, 150, 30, 7,12, 0, 10, // archvile
- 5, 5, 35, 20,14, 6, 0, 10, // fish
- 5, 17, 20, 0, 7, 6, 0, 0, // barrel
- 17, 38, 20, 40, 3, 6, 0, 20, // robot
- 8, 26, 400, 70, 8,10, 30, 50 // man
+ /* rad ht life pain rv jv slop min_pn */
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, // none
+ { 15, 28, 60, 20, 7, 10, 0, 10 }, // demon
+ { 10, 28, 25, 15, 3, 10, 30, 0 }, // imp
+ { 10, 28, 15, 10, 3, 10, 30, 0 }, // zomby
+ { 10, 28, 20, 10, 3, 10, 30, 0 }, // sergeant
+ { 20, 55, 500, 70, 5, 10, 0, 50 }, // cyberdemon
+ { 12, 28, 60, 20, 3, 10, 30, 10 }, // chaingunner
+ { 12, 32, 150, 40, 3, 10, 0, 30 }, // baron of hell
+ { 12, 32, 75, 40, 3, 10, 0, 30 }, // hell knight
+ { 15, 28, 100, 10, 4, 4, 0, 0 }, // cacodemon
+ { 8, 18, 60, 10, 4, 4, 0, 0 }, // lost soul
+ { 15, 28, 100, 10, 4, 4, 0, 0 }, // pain elemental
+ { 64, 50, 500, 70, 4, 10, 0, 50 }, // spider mastermind
+ { 25, 27, 150, 20, 4, 10, 0, 0 }, // arachnotron
+ { 18, 30, 200, 40, 3, 7, 0, 20 }, // mancubus
+ { 17, 36, 200, 40, 6, 11, 0, 20 }, // revenant
+ { 17, 36, 150, 30, 7, 12, 0, 10 }, // archvile
+ { 5, 5, 35, 20, 14, 6, 0, 10 }, // fish
+ { 5, 17, 20, 0, 7, 6, 0, 0 }, // barrel
+ { 17, 38, 20, 40, 3, 6, 0, 20 }, // robot
+ { 8, 26, 400, 70, 8, 10, 30, 50 } // man
};
void setst (int i, int st) {
diff --git a/src/save.c b/src/save.c
index a219fdf234bccbcd40c189b3d4cae54b40b1d763..1fc44415cf329780581292c7d95eb48c66b2df72 100644 (file)
--- a/src/save.c
+++ b/src/save.c
}
static void G_savegame (Stream *h) {
+ int i = 0;
stream_write8(_2pl, h);
stream_write8(g_dm, h);
stream_write8(g_exit, h);
stream_write32(dm_pl1p, h);
stream_write32(dm_pl2p, h);
stream_write32(dm_pnum, h);
- int i = 0;
while (i < dm_pnum) {
stream_write32(dm_pos[i].x, h);
stream_write32(dm_pos[i].y, h);
}
static void G_loadgame (Stream *h) {
+ int i = 0;
_2pl = stream_read8(h);
g_dm = stream_read8(h);
g_exit = stream_read8(h);
dm_pl1p = stream_read32(h);
dm_pl2p = stream_read32(h);
dm_pnum = stream_read32(h);
- int i = 0;
while (i < dm_pnum) {
dm_pos[i].x = stream_read32(h);
dm_pos[i].y = stream_read32(h);
}
int SAVE_getname (Stream *r, char name[24]) {
+ int16_t version;
stream_read(name, 24, 1, r);
- int16_t version = stream_read16(r);
+ version = stream_read16(r);
return version == 3;
}
diff --git a/src/stubsys/files.c b/src/stubsys/files.c
index 7ccfe4e951025064b24804f2d042f35cdc39e3a5..54005440ef2dd8ef34dc7169c9d8bcfe0f70fa2f 100644 (file)
--- a/src/stubsys/files.c
+++ b/src/stubsys/files.c
void F_getsavnames (void) {
int i;
+ char *p;
FILE_Stream rd;
for (i = 0; i < SAVE_MAX; ++i) {
savok[i] = 0;
- char *p = getsavfpname(i, 1);
+ p = getsavfpname(i, 1);
if (FILE_Open(&rd, p, "rb")) {
savok[i] = SAVE_getname(&rd.base, savname[i]);
FILE_Close(&rd);
diff --git a/src/stubsys/main.c b/src/stubsys/main.c
index 75ddd86ab9df9c323397df5feea91f3367a35635..c3e1b40eb9f6f21b7398b3f3c628ecdb6db15af2 100644 (file)
--- a/src/stubsys/main.c
+++ b/src/stubsys/main.c
};
static void CFG_args (int argc, char **argv) {
- const cfg_t *list[] = { arg, R_args(), S_args(), MUS_args() };
+ const cfg_t *list[4];
+ list[0] = arg;
+ list[1] = R_args();
+ list[2] = S_args();
+ list[3] = MUS_args();
ARG_parse(argc, argv, 4, list);
}
static void CFG_load (void) {
- const cfg_t *list[] = { cfg, R_conf(), S_conf(), MUS_conf() };
+ const cfg_t *list[4];
+ list[0] = cfg;
+ list[1] = R_conf();
+ list[2] = S_conf();
+ list[3] = MUS_conf();
CFG_read_config("default.cfg", 4, list);
CFG_read_config("doom2d.cfg", 4, list);
}
static void CFG_save (void) {
- const cfg_t *list[] = { cfg, R_conf(), S_conf(), MUS_conf() };
+ const cfg_t *list[4];
+ list[0] = cfg;
+ list[1] = R_conf();
+ list[2] = S_conf();
+ list[3] = MUS_conf();
CFG_update_config("doom2d.cfg", "doom2d.cfg", 4, list, "generated by doom2d, do not modify");
}
}
int Y_set_videomode_software (int w, int h, int fullscreen) {
+ void *buf;
assert(w > 0);
assert(h > 0);
- void *buf = softbuffer ? realloc(softbuffer, w * h) : malloc(w * h);
+ buf = softbuffer ? realloc(softbuffer, w * h) : malloc(w * h);
if (buf) {
mode = MODE_SOFTWARE;
softbuffer = buf;
void Y_get_buffer (byte **buf, int *w, int *h, int *pitch) {
assert(mode == MODE_SOFTWARE);
- // *buf = surf->pixels;
- *buf = NULL; // fix this
+ *buf = softbuffer;
*w = width;
*h = height;
*pitch = width;
void Y_set_vga_palette (byte *vgapal) {
int i;
- byte *p = vgapal;
+ //byte *p = vgapal;
assert(vgapal != NULL);
assert(mode == MODE_SOFTWARE);
}
}
static void step (void) {
+ clock_t t;
poll_events();
MUS_update();
- clock_t t = clock();
+ t = clock();
if ((t - ticks) * 1000 / CLOCKS_PER_SEC > DELAY) {
ticks = t;
G_act();