From: DeaDDooMER Date: Wed, 11 Mar 2020 12:27:12 +0000 (+0300) Subject: fix some warnings X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=c46b82f5794be555af272740e67ead316b9b1f90;p=flatwaifu.git fix some warnings --- diff --git a/src/dots.c b/src/dots.c index 4f52130..e318172 100644 --- a/src/dots.c +++ b/src/dots.c @@ -26,6 +26,7 @@ #include "view.h" #include "dots.h" #include "misc.h" +#include "my.h" #define MAXINI 50 #define MAXSR 20 @@ -84,18 +85,18 @@ void DOT_savegame (FILE *h) { void DOT_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread32(&dot[i].o.x, h); - myfread32(&dot[i].o.y, h); - myfread32(&dot[i].o.xv, h); - myfread32(&dot[i].o.yv, h); - myfread32(&dot[i].o.vx, h); - myfread32(&dot[i].o.vy, h); - myfread32(&dot[i].o.r, h); - myfread32(&dot[i].o.h, h); - myfread8(&dot[i].c, h); - myfread8(&dot[i].t, h); + dot[i].o.x = myfread32(h); + dot[i].o.y = myfread32(h); + dot[i].o.xv = myfread32(h); + dot[i].o.yv = myfread32(h); + dot[i].o.vx = myfread32(h); + dot[i].o.vy = myfread32(h); + dot[i].o.r = myfread32(h); + dot[i].o.h = myfread32(h); + dot[i].c = myfread8(h); + dot[i].t = myfread8(h); } } diff --git a/src/files.c b/src/files.c index ef33a03..f6ef6b5 100644 --- a/src/files.c +++ b/src/files.c @@ -31,6 +31,7 @@ #include "switch.h" #include "files.h" #include "map.h" +#include "my.h" char *S_getinfo(void); @@ -116,7 +117,7 @@ void F_getsavnames (void) { if (h != NULL) { ver = -1; myfread(savname[i], 24, 1, h); - myfread16(&ver, h); + ver = myfread16(h); savname[i][23] = 0; savok[i] = (ver == 3) ? 1 : 0; fclose(h); @@ -150,7 +151,7 @@ void F_loadgame (int n) { FILE *h = fopen(p, "rb"); if (h != NULL) { fseek(h, 24, SEEK_SET); // skip name - myfread16(&ver, h); // version + ver = myfread16(h); // version if (ver == 3) { G_loadgame(h); W_loadgame(h); @@ -188,12 +189,6 @@ int myfilelength(FILE *h) extern void mysplitpath(const char* path, char* drv, char* dir, char* name, char* ext); -static int myread_int32 (FILE *f) { - int x; - myfread(&x, 4, 1, f); - return int2host(x); -} - // build wad directory void F_initwads (void) { int i, j, k, p; @@ -219,12 +214,12 @@ void F_initwads (void) { } p = 0; // wad number - n = myread_int32(h); // num - o = myread_int32(h); // offset + n = myfread32(h); // num + o = myfread32(h); // offset fseek(h, o, SEEK_SET); for (j = 0; j < n; ++j) { - w.o = myread_int32(h); // offset - w.l = myread_int32(h); // len + w.o = myfread32(h); // offset + w.l = myfread32(h); // len myfread(w.n, 1, 8, h); // name if (p >= MAX_WAD) { ERR_failinit("Слишком много элементов WAD'а"); @@ -271,12 +266,12 @@ void F_initwads (void) { if (strncmp(s, "IWAD", 4) != 0 && strncmp(s, "PWAD", 4) != 0) { ERR_failinit("Нет подписи IWAD или PWAD (2)"); } - n = myread_int32(h); // num - o = myread_int32(h); // offset + n = myfread32(h); // num + o = myfread32(h); // offset fseek(h, o, SEEK_SET); for (j = 0; j < n; ++j) { - w.o = myread_int32(h); // offset - w.l = myread_int32(h); // len + w.o = myfread32(h); // offset + w.o = myfread32(h); // len myfread(w.n, 1, 8, h); // name for (k = 0; k < MAX_WAD; ++k) { if (strncasecmp(wad[k].n, w.n, 8) == 0) { @@ -461,14 +456,14 @@ void F_loadmap(char n[8]) { h = wadh[wad[r].f]; fseek(h, wad[r].o, SEEK_SET); myfread(hdr.id, 8, 1, h); - myfread16(&hdr.ver, h); + hdr.ver = myfread16(h); if (memcmp(hdr.id, "Doom2D\x1A", 8) != 0) { ERR_fatal("%.8s не является уровнем", n); } for(;;) { - myfread16(&blk.t, h); - myfread16(&blk.st, h); - myfread32(&blk.sz, h); + blk.t = myfread16(h); + blk.st = myfread16(h); + blk.sz = myfread32(h); if(blk.t == MB_END) { break; } diff --git a/src/fx.c b/src/fx.c index 9947854..2b81fd6 100644 --- a/src/fx.c +++ b/src/fx.c @@ -27,6 +27,7 @@ #include "view.h" #include "fx.h" #include "misc.h" +#include "my.h" enum{NONE,TFOG,IFOG,BUBL}; @@ -126,14 +127,14 @@ void FX_savegame (FILE *h) { void FX_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread32(&fx[i].x, h); - myfread32(&fx[i].y, h); - myfread32(&fx[i].xv, h); - myfread32(&fx[i].yv, h); - myfread8(&fx[i].t, h); - myfread8(&fx[i].s, h); + fx[i].x = myfread32(h); + fx[i].y = myfread32(h); + fx[i].xv = myfread32(h); + fx[i].yv = myfread32(h); + fx[i].t = myfread8(h); + fx[i].s = myfread8(h); } } diff --git a/src/game.c b/src/game.c index 1846b57..353ed53 100644 --- a/src/game.c +++ b/src/game.c @@ -42,6 +42,7 @@ #include "menu.h" #include "misc.h" #include "map.h" +#include "my.h" #include @@ -79,7 +80,8 @@ extern byte clrmap[256*12]; extern byte cheat; -byte _2pl=0,g_dm=0,g_st=GS_TITLE,g_exit=0,g_map=1,_warp=0,g_music[8]="MENU"; +byte _2pl=0,g_dm=0,g_st=GS_TITLE,g_exit=0,g_map=1,_warp=0; +char g_music[8]="MENU"; byte _net=0; int g_sttm=1092; dword g_time; @@ -132,22 +134,22 @@ void G_savegame(FILE* h) { } void G_loadgame(FILE* h) { - myfread8(&_2pl, h); - myfread8(&g_dm, h); - myfread8(&g_exit, h); - myfread8(&g_map, h); - myfread32(&g_time, h); - myfread32(&dm_pl1p, h); - myfread32(&dm_pl2p, h); - myfread32(&dm_pnum, h); + _2pl = myfread8(h); + g_dm = myfread8(h); + g_exit = myfread8(h); + g_map = myfread8(h); + g_time = myfread32(h); + dm_pl1p = myfread32(h); + dm_pl2p = myfread32(h); + dm_pnum = myfread32(h); int i = 0; while (i < dm_pnum) { - myfread32(&dm_pos[i].x, h); - myfread32(&dm_pos[i].y, h); - myfread8(&dm_pos[i].d, h); + dm_pos[i].x = myfread32(h); + dm_pos[i].y = myfread32(h); + dm_pos[i].d = myfread8(h); i += 1; } - myfread8(&cheat, h); + cheat = myfread8(h); myfread(g_music, 8, 1, h); F_loadmus(g_music); } diff --git a/src/items.c b/src/items.c index 005c375..c9b23b5 100644 --- a/src/items.c +++ b/src/items.c @@ -31,6 +31,7 @@ #include "things.h" #include "misc.h" #include "map.h" +#include "my.h" extern map_block_t blk; @@ -73,20 +74,20 @@ void IT_savegame (FILE *h) { void IT_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread32(&it[i].o.x, h); - myfread32(&it[i].o.y, h); - myfread32(&it[i].o.xv, h); - myfread32(&it[i].o.yv, h); - myfread32(&it[i].o.vx, h); - myfread32(&it[i].o.vy, h); - myfread32(&it[i].o.r, h); - myfread32(&it[i].o.h, h); - myfread32(&it[i].t, h); - myfread32(&it[i].s, h); + it[i].o.x = myfread32(h); + it[i].o.y = myfread32(h); + it[i].o.xv = myfread32(h); + it[i].o.yv = myfread32(h); + it[i].o.vx = myfread32(h); + it[i].o.vy = myfread32(h); + it[i].o.r = myfread32(h); + it[i].o.h = myfread32(h); + it[i].t = myfread32(h); + it[i].s = myfread32(h); } - myfread32(&itm_rtime, h); + itm_rtime = myfread32(h); } void IT_alloc(void) { @@ -141,10 +142,10 @@ int IT_load (FILE *h) { switch (blk.t) { case MB_THING: for (i = 0; blk.sz > 0; ++i, blk.sz -= 8) { - myfread16(&t.x, h); - myfread16(&t.y, h); - myfread16(&t.t, h); - myfread16(&t.f, h); + t.x = myfread16(h); + t.y = myfread16(h); + t.t = myfread16(h); + t.f = myfread16(h); it[i].o.x = t.x; it[i].o.y = t.y; it[i].t = t.t; diff --git a/src/menu.c b/src/menu.c index aca7cd4..faf5b3d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -47,7 +47,7 @@ enum{HIT100,ARMOR,JUMP,WPNS,IMMORTAL,SPEED,OPEN,EXIT}; extern int PL_JUMP,PL_RUN; extern byte _warp,cheat,p_fly; -extern byte g_music[8]; +extern char g_music[8]; extern byte savname[7][24],savok[7]; void load_game(int); @@ -62,7 +62,8 @@ byte pcolortab[PCOLORN]={ }; int p1color=5,p2color=4; -static byte ibuf[24],input=0; +static char ibuf[24]; +static byte input=0; static int icur; enum{MENU,MSG}; diff --git a/src/misc.h b/src/misc.h index 3a96a5e..dad870a 100644 --- a/src/misc.h +++ b/src/misc.h @@ -23,6 +23,7 @@ // Miscellaneous functions #include +#include "view.h" #define MAXDIST 2000000L @@ -85,5 +86,5 @@ int Z_getacid(int x,int y,int r,int h); void Z_clrst(); -uint16_t short2host (uint16_t x); -uint32_t int2host (uint32_t x); +int16_t short2host (int16_t x); +int32_t int2host (int32_t x); diff --git a/src/miscc.c b/src/miscc.c index 4f5a302..b705817 100644 --- a/src/miscc.c +++ b/src/miscc.c @@ -615,20 +615,20 @@ void Z_calc_time(dword t,word *h,word *m,word *s) #define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0) -uint16_t short2swap (uint16_t x) { +int16_t short2swap (int16_t x) { union { uint8_t a[2]; - uint16_t x; + int16_t x; } y; y.x = x; SWAP_VAR(y.a[0], y.a[1]); return y.x; } -uint32_t int2swap (uint32_t x) { +int32_t int2swap (int32_t x) { union { uint8_t a[4]; - uint32_t x; + int32_t x; } y; y.x = x; SWAP_VAR(y.a[0], y.a[3]); @@ -638,7 +638,7 @@ uint32_t int2swap (uint32_t x) { #undef SWAP_VAR -uint16_t short2host (uint16_t x) { +int16_t short2host (int16_t x) { #if __BIG_ENDIAN__ return short2swap(x); #else @@ -646,7 +646,7 @@ uint16_t short2host (uint16_t x) { #endif } -uint32_t int2host (uint32_t x) { +int32_t int2host (int32_t x) { #if __BIG_ENDIAN__ return int2swap(x); #else diff --git a/src/monster.c b/src/monster.c index b0d677f..749ef78 100644 --- a/src/monster.c +++ b/src/monster.c @@ -36,6 +36,7 @@ #include "misc.h" #include "fx.h" #include "smoke.h" +#include "my.h" #define MANCOLOR 0xD0 @@ -159,7 +160,7 @@ void MN_savegame (FILE *h) { myfwrite8(mn[i].ftime, h); myfwrite32(mn[i].fobj, h); myfwrite32(mn[i].s, h); - myfwrite32(mn[i].ap, h); // useless, changed after load + myfwrite32(0, h); // mn[i].ap useless, changed after load myfwrite32(mn[i].aim, h); myfwrite32(mn[i].life, h); myfwrite32(mn[i].pain, h); @@ -179,34 +180,34 @@ static int MN_hit(int n,int d,int o,int t); void MN_loadgame (FILE *h) { int i, n, c; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread32(&mn[i].o.x, h); - myfread32(&mn[i].o.y, h); - myfread32(&mn[i].o.xv, h); - myfread32(&mn[i].o.yv, h); - myfread32(&mn[i].o.vx, h); - myfread32(&mn[i].o.vy, h); - myfread32(&mn[i].o.r, h); - myfread32(&mn[i].o.h, h); - myfread8(&mn[i].t, h); - myfread8(&mn[i].d, h); - myfread8(&mn[i].st, h); - myfread8(&mn[i].ftime, h); - myfread32(&mn[i].fobj, h); - myfread32(&mn[i].s, h); - myfread32(&mn[i].ap, h); // useless, changed after loading - myfread32(&mn[i].aim, h); - myfread32(&mn[i].life, h); - myfread32(&mn[i].pain, h); - myfread32(&mn[i].ac, h); - myfread32(&mn[i].tx, h); - myfread32(&mn[i].ty, h); - myfread32(&mn[i].ammo, h); - myfread16(&mn[i].atm, h); + mn[i].o.x = myfread32(h); + mn[i].o.y = myfread32(h); + mn[i].o.xv = myfread32(h); + mn[i].o.yv = myfread32(h); + mn[i].o.vx = myfread32(h); + mn[i].o.vy = myfread32(h); + mn[i].o.r = myfread32(h); + mn[i].o.h = myfread32(h); + mn[i].t = myfread8(h); + mn[i].d = myfread8(h); + mn[i].st = myfread8(h); + mn[i].ftime = myfread8(h); + mn[i].fobj = myfread32(h); + mn[i].s = myfread32(h); + mn[i].ap = NULL; myfread32(h); // useless, changed after loading + mn[i].aim = myfread32(h); + mn[i].life = myfread32(h); + mn[i].pain = myfread32(h); + mn[i].ac = myfread32(h); + mn[i].tx = myfread32(h); + mn[i].ty = myfread32(h); + mn[i].ammo = myfread32(h); + mn[i].atm = myfread16(h); } - myfread32(&mnum, h); - myfread32(&gsndt, h); + mnum = myfread32(h); + gsndt = myfread32(h); for (n = 0; n < MAXMN; ++n) { if (mn[n].t) { c = mn[n].ac; diff --git a/src/music.c b/src/music.c index 4f6cc2b..4dc87c2 100644 --- a/src/music.c +++ b/src/music.c @@ -213,7 +213,7 @@ void F_freemus(void) { muslo = NULL; } -extern byte g_music[8]; +extern char g_music[8]; static int volsetcount = 0; diff --git a/src/my.c b/src/my.c index e4c2d45..bfae25f 100644 --- a/src/my.c +++ b/src/my.c @@ -23,6 +23,7 @@ #include #include "glob.h" #include "error.h" +#include "misc.h" #include #include #include @@ -90,34 +91,38 @@ void myfread (void *ptr, size_t size, size_t n, FILE *f) { } } -void myfread8 (uint8_t *x, FILE *f) { - myfread(x, 1, 1, f); +int8_t myfread8 (FILE *f) { + int8_t x; + myfread(&x, 1, 1, f); + return x; } -void myfread16 (uint16_t *x, FILE *f) { - myfread(x, 2, 1, f); - *x = short2host(*x); +int16_t myfread16 (FILE *f) { + int16_t x; + myfread(&x, 2, 1, f); + return short2host(x); } -void myfread32 (uint32_t *x, FILE *f) { - myfread(x, 4, 1, f); - *x = int2host(*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 (uint8_t x, FILE *f) { +void myfwrite8 (int8_t x, FILE *f) { myfwrite(&x, 1, 1, f); } -void myfwrite16 (uint16_t x, FILE *f) { +void myfwrite16 (int16_t x, FILE *f) { x = short2host(x); myfwrite(&x, 2, 1, f); } -void myfwrite32 (uint32_t x, FILE *f) { +void myfwrite32 (int32_t x, FILE *f) { x = int2host(x); myfwrite(&x, 4, 1, f); } diff --git a/src/my.h b/src/my.h index 37ba02b..f52be8b 100644 --- a/src/my.h +++ b/src/my.h @@ -31,14 +31,14 @@ 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); -void myfread8 (uint8_t *x, FILE *f); -void myfread16 (uint16_t *x, FILE *f); -void myfread32 (uint32_t *x, 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 (uint8_t x, FILE *f); -void myfwrite16 (uint16_t x, FILE *f); -void myfwrite32 (uint32_t x, FILE *f); +void myfwrite8 (int8_t x, FILE *f); +void myfwrite16 (int16_t x, FILE *f); +void myfwrite32 (int32_t x, FILE *f); void myrandomize (void); int fexists (char *filename); diff --git a/src/player.c b/src/player.c index 5a8a80e..7620493 100644 --- a/src/player.c +++ b/src/player.c @@ -35,6 +35,7 @@ #include "switch.h" #include "player.h" #include "misc.h" +#include "my.h" extern int hit_xv,hit_yv; @@ -131,46 +132,46 @@ void PL_savegame (FILE *h) { } void PL_load_player (player_t *p, FILE *h) { - myfread32(&p->o.x, h); - myfread32(&p->o.y, h); - myfread32(&p->o.xv, h); - myfread32(&p->o.yv, h); - myfread32(&p->o.vx, h); - myfread32(&p->o.vy, h); - myfread32(&p->o.r, h); - myfread32(&p->o.h, h); - myfread32(&p->looky, h); - myfread32(&p->st, h); - myfread32(&p->s, h); - myfread32(&p->life, h); - myfread32(&p->armor, h); - myfread32(&p->hit, h); - myfread32(&p->hito, h); - myfread32(&p->pain, h); - myfread32(&p->air, h); - myfread32(&p->invl, h); - myfread32(&p->suit, h); - myfread8(&p->d, h); - myfread32(&p->frag, h); - myfread32(&p->ammo, h); - myfread32(&p->shel, h); - myfread32(&p->rock, h); - myfread32(&p->cell, h); - myfread32(&p->fuel, h); - myfread32(&p->kills, h); - myfread32(&p->secrets, h); - myfread8(&p->fire, h); - myfread8(&p->cwpn, h); - myfread8(&p->csnd, h); - myfread8(&p->amul, h); - myfread16(&p->wpns, h); - myfread8(&p->wpn, h); - myfread8(&p->f, h); - myfread8(&p->drawst, h); - myfread8(&p->color, h); - myfread32(&p->id, h); - myfread8(&p->keys, h); - myfread8(&p->lives, h); + p->o.x = myfread32(h); + p->o.y = myfread32(h); + p->o.xv = myfread32(h); + p->o.yv = myfread32(h); + p->o.vx = myfread32(h); + p->o.vy = myfread32(h); + p->o.r = myfread32(h); + p->o.h = myfread32(h); + p->looky = myfread32(h); + p->st = myfread32(h); + p->s = myfread32(h); + p->life = myfread32(h); + p->armor = myfread32(h); + p->hit = myfread32(h); + p->hito = myfread32(h); + p->pain = myfread32(h); + p->air = myfread32(h); + p->invl = myfread32(h); + p->suit = myfread32(h); + p->d = myfread8(h); + p->frag = myfread32(h); + p->ammo = myfread32(h); + p->shel = myfread32(h); + p->rock = myfread32(h); + p->cell = myfread32(h); + p->fuel = myfread32(h); + p->kills = myfread32(h); + p->secrets = myfread32(h); + p->fire = myfread8(h); + p->cwpn = myfread8(h); + p->csnd = myfread8(h); + p->amul = myfread8(h); + p->wpns = myfread16(h); + p->wpn = myfread8(h); + p->f = myfread8(h); + p->drawst = myfread8(h); + p->color = myfread8(h); + p->id = myfread32(h); + p->keys = myfread8(h); + p->lives = myfread8(h); // k* not saved } @@ -179,9 +180,9 @@ void PL_loadgame (FILE *h) { if (_2pl) { PL_load_player(&pl2, h); } - myfread32(&PL_JUMP, h); - myfread32(&PL_RUN, h); - myfread8(&p_immortal, h); + PL_JUMP = myfread32(h); + PL_RUN = myfread32(h); + p_immortal = myfread8(h); } static int nonz(int a) {return (a)?a:1;} diff --git a/src/smoke.c b/src/smoke.c index 6b01261..2be63ad 100644 --- a/src/smoke.c +++ b/src/smoke.c @@ -27,6 +27,7 @@ #include "smoke.h" #include "fx.h" #include "misc.h" +#include "my.h" #define MAXSR 20 @@ -76,15 +77,15 @@ void SMK_savegame (FILE *h) { void SMK_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; ++i) { - myfread32(&sm[i].x, h); - myfread32(&sm[i].y, h); - myfread32(&sm[i].xv, h); - myfread32(&sm[i].xv, h); - myfread8(&sm[i].t, h); - myfread8(&sm[i].s, h); - myfread16(&sm[i].o, h); + sm[i].x = myfread32(h); + sm[i].y = myfread32(h); + sm[i].xv = myfread32(h); + sm[i].xv = myfread32(h); + sm[i].t = myfread8(h); + sm[i].s = myfread8(h); + sm[i].o = myfread16(h); } } diff --git a/src/switch.c b/src/switch.c index 275aed7..a046508 100644 --- a/src/switch.c +++ b/src/switch.c @@ -28,6 +28,7 @@ #include "player.h" #include "misc.h" #include "map.h" +#include "my.h" #define MAXSW 100 @@ -72,19 +73,19 @@ void SW_savegame (FILE *h) { void SW_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread8(&sw[i].x, h); - myfread8(&sw[i].y, h); - myfread8(&sw[i].t, h); - myfread8(&sw[i].tm, h); - myfread8(&sw[i].a, h); - myfread8(&sw[i].b, h); - myfread8(&sw[i].c, h); - myfread8(&sw[i].d, h); - myfread8(&sw[i].f, h); + sw[i].x = myfread8(h); + sw[i].y = myfread8(h); + sw[i].t = myfread8(h); + sw[i].tm = myfread8(h); + sw[i].a = myfread8(h); + sw[i].b = myfread8(h); + sw[i].c = myfread8(h); + sw[i].d = myfread8(h); + sw[i].f = myfread8(h); } - myfread32(&sw_secrets, h); + sw_secrets = myfread32(h); } int SW_load (FILE *h) { @@ -93,15 +94,15 @@ int SW_load (FILE *h) { case MB_SWITCH2: sw_secrets = 0; for (i = 0; i < MAXSW && blk.sz > 0; ++i, blk.sz -= 9) { - myfread8(&sw[i].x, h); - myfread8(&sw[i].y, h); - myfread8(&sw[i].t, h); - myfread8(&sw[i].tm, h); // unused - myfread8(&sw[i].a, h); - myfread8(&sw[i].b, h); - myfread8(&sw[i].c, h); - myfread8(&sw[i].d, h); // unused - myfread8(&sw[i].f, h); + sw[i].x = myfread8(h); + sw[i].y = myfread8(h); + sw[i].t = myfread8(h); + sw[i].tm = myfread8(h); // unused + sw[i].a = myfread8(h); + sw[i].b = myfread8(h); + sw[i].c = myfread8(h); + sw[i].d = myfread8(h); // unused + sw[i].f = myfread8(h); sw[i].tm = 0; sw[i].d = 0; sw[i].f |= 0x80; diff --git a/src/vga.c b/src/vga.c index 5db6b53..f2e5b44 100644 --- a/src/vga.c +++ b/src/vga.c @@ -26,6 +26,7 @@ #include "error.h" #include "view.h" #include "memory.h" +#include "misc.h" #include diff --git a/src/view.c b/src/view.c index 034b0aa..51e8179 100644 --- a/src/view.c +++ b/src/view.c @@ -39,6 +39,7 @@ #include "misc.h" #include "map.h" #include "sound.h" +#include "my.h" #define ANIT 5 @@ -75,13 +76,15 @@ byte fld[FLDH][FLDW]; extern int lt_time,lt_type,lt_side,lt_ypos; extern void *ltn[2][2]; -static void getname(int n,char *s) { - if(walh[n]==-1) {memset(s,0,8);return;} - if(walh[n]==-2) { - memcpy(s,"_WATER_",8);s[7]=(byte)walp[n]-1+'0'; - return; +static void getname (int n, char *s) { + if (walh[n] == -1) { + memset(s, 0, 8); + } else if (walh[n] == -2) { + memcpy(s, "_WATER_", 8); + s[7] = (char)walp[n] - 1 + '0'; + } else { + F_getresname(s, walh[n] & 0x7FFF); } - F_getresname(s,walh[n]&0x7FFF); } static short getani(char *n) { @@ -114,7 +117,7 @@ void W_savegame(FILE* h) { void W_loadgame(FILE* h) { char s[8]; int i; - myfread32(&sky_type, h); + sky_type = myfread32(h); for (i = 1; i < 256; ++i) { walani[i]=0; myfread(s, 8, 1, h); @@ -133,13 +136,13 @@ void W_loadgame(FILE* h) { } } for (i = 0; i < 256; i++) { - myfread32(&walf[i], h); + walf[i] = myfread32(h); if (i > 0 && walf[i] & 1) { walh[i] |= 0x8000; } } for (i = 0; i < 256; i++) { - myfread8(&walswp[i], h); + walswp[i] = myfread8(h); } myfread(fldb, FLDW*FLDH, 1, h); myfread(fld, FLDW*FLDH, 1, h); @@ -287,7 +290,7 @@ int W_load (FILE *h) { } for (i = 1; i < 256 && blk.sz > 0; ++i, blk.sz -= 9) { myfread(w.n, 8, 1, h); - myfread8(&w.t, h); + w.t = myfread8(h); if (strncasecmp(w.n, "_WATER_", 7) == 0) { walp[i] = (void*)(w.n[7] - '0' + 1); walh[i] = -2; @@ -355,7 +358,7 @@ int W_load (FILE *h) { } return 1; case MB_SKY: - myfread16(&sky_type, h); + sky_type = myfread16(h); strcpy(w.n, "RSKY1"); w.n[4] = '0' + sky_type; M_unlock(horiz); diff --git a/src/view.h b/src/view.h index 477f991..fb1eae1 100644 --- a/src/view.h +++ b/src/view.h @@ -22,6 +22,9 @@ // View functions +#ifndef VIEW_H_INCLUDED +#define VIEW_H_INCLUDED + #include @@ -90,3 +93,5 @@ extern int dm_pnum,dm_pl1p,dm_pl2p; extern int WD; // extern int HT; // + +#endif /* VIEW_H_INCLUDED */ \ No newline at end of file diff --git a/src/weapons.c b/src/weapons.c index 4a5a063..c05f456 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -28,6 +28,7 @@ #include "smoke.h" #include "weapons.h" #include "misc.h" +#include "my.h" extern int hit_xv,hit_yv; @@ -76,20 +77,20 @@ void WP_savegame (FILE *h) { void WP_loadgame (FILE *h) { int i, n; - myfread32(&n, h); + n = myfread32(h); for (i = 0; i < n; i++) { - myfread32(&wp[i].o.x, h); - myfread32(&wp[i].o.y, h); - myfread32(&wp[i].o.xv, h); - myfread32(&wp[i].o.yv, h); - myfread32(&wp[i].o.vx, h); - myfread32(&wp[i].o.vy, h); - myfread32(&wp[i].o.r, h); - myfread32(&wp[i].o.h, h); - myfread8(&wp[i].t, h); - myfread8(&wp[i].s, h); - myfread32(&wp[i].own, h); - myfread16(&wp[i].target, h); + wp[i].o.x = myfread32(h); + wp[i].o.y = myfread32(h); + wp[i].o.xv = myfread32(h); + wp[i].o.yv = myfread32(h); + wp[i].o.vx = myfread32(h); + wp[i].o.vy = myfread32(h); + wp[i].o.r = myfread32(h); + wp[i].o.h = myfread32(h); + wp[i].t = myfread8(h); + wp[i].s = myfread8(h); + wp[i].own = myfread32(h); + wp[i].target = myfread16(h); } }