summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da79be9)
raw | patch | inline | side by side (parent: da79be9)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 11 Mar 2020 12:27:12 +0000 (15:27 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 11 Mar 2020 12:27:12 +0000 (15:27 +0300) |
19 files changed:
src/dots.c | patch | blob | history | |
src/files.c | patch | blob | history | |
src/fx.c | patch | blob | history | |
src/game.c | patch | blob | history | |
src/items.c | patch | blob | history | |
src/menu.c | patch | blob | history | |
src/misc.h | patch | blob | history | |
src/miscc.c | patch | blob | history | |
src/monster.c | patch | blob | history | |
src/music.c | patch | blob | history | |
src/my.c | patch | blob | history | |
src/my.h | patch | blob | history | |
src/player.c | patch | blob | history | |
src/smoke.c | patch | blob | history | |
src/switch.c | patch | blob | history | |
src/vga.c | patch | blob | history | |
src/view.c | patch | blob | history | |
src/view.h | patch | blob | history | |
src/weapons.c | patch | blob | history |
diff --git a/src/dots.c b/src/dots.c
index 4f52130d53b46eec45097304ad53a25c6b963373..e31817221575efd7f2288ebf00571153c8640924 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
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 ef33a03d24265c6228e6a8a39f6b1987cfc90e04..f6ef6b5303dd1e740d4875a436ee075581ecdf14 100644 (file)
--- a/src/files.c
+++ b/src/files.c
#include "switch.h"
#include "files.h"
#include "map.h"
+#include "my.h"
char *S_getinfo(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);
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);
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;
}
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'а");
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) {
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 9947854ac121d6b86c3a0b0c1f67692b96acec2a..2b81fd652610230a8331ca015dc1e86be90ccc92 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};
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 1846b5760ee06854dd05e1b8d2f84fbe7828bf20..353ed539552dd0e3dc9ba049bc2739f927962f8c 100644 (file)
--- a/src/game.c
+++ b/src/game.c
#include "menu.h"
#include "misc.h"
#include "map.h"
+#include "my.h"
#include <SDL_keysym.h>
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;
}
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 005c375a658c258e671919bac7b3c35923c113e8..c9b23b5f7370a6a466fde5cf873b9fe2fb7e0644 100644 (file)
--- a/src/items.c
+++ b/src/items.c
#include "things.h"
#include "misc.h"
#include "map.h"
+#include "my.h"
extern map_block_t blk;
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) {
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 aca7cd43d0c407057c0d632d4ebd93ad1e788c1b..faf5b3de0014708b74a59f0ada005fdc1483588b 100644 (file)
--- a/src/menu.c
+++ b/src/menu.c
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);
};
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 3a96a5e0003996a1142e9a92080b8495b7a89315..dad870a8f6bd4e782ef4f9e3677471fe88837fbd 100644 (file)
--- a/src/misc.h
+++ b/src/misc.h
// Miscellaneous functions
#include <stdint.h>
+#include "view.h"
#define MAXDIST 2000000L
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 4f5a302458bda126792daa857a8fb9fb14917e0e..b7058172d4dd025e4af6de4efbbb1ee0949c3a71 100644 (file)
--- a/src/miscc.c
+++ b/src/miscc.c
#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]);
#undef SWAP_VAR
-uint16_t short2host (uint16_t x) {
+int16_t short2host (int16_t x) {
#if __BIG_ENDIAN__
return short2swap(x);
#else
#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 b0d677f7f5fb0e76136378ba271e7fcb937e22e1..749ef785039ace9fa4aeb0b7a73faceccbc95834 100644 (file)
--- a/src/monster.c
+++ b/src/monster.c
#include "misc.h"
#include "fx.h"
#include "smoke.h"
+#include "my.h"
#define MANCOLOR 0xD0
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);
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 4f6cc2b83ea8dc4429cd74127bc498257389b4a8..4dc87c295fbfc66a3569e70939577c83772c4dac 100644 (file)
--- a/src/music.c
+++ b/src/music.c
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 e4c2d459dd0b728dc02ea691e91942e1cb631990..bfae25f516d150ccbf2edd38e3af7eaea89ac493 100644 (file)
--- a/src/my.c
+++ b/src/my.c
#include <SDL.h>
#include "glob.h"
#include "error.h"
+#include "misc.h"
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
}
}
-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 37ba02b380528a2d9ddc31da89d4d3e193a1384c..f52be8b093009b1de67e6161b7ee479900b221cd 100644 (file)
--- 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 5a8a80ebb361689b65c3dcd5a8d79e971177e49f..762049316c31de67fdbb5432de03d3d4a13547e7 100644 (file)
--- a/src/player.c
+++ b/src/player.c
#include "switch.h"
#include "player.h"
#include "misc.h"
+#include "my.h"
extern int hit_xv,hit_yv;
}
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
}
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 6b012610b2eb64487d85602e9dc595bf65a50e19..2be63ad59fe73929b9eaeaaf3d865203aa68c459 100644 (file)
--- a/src/smoke.c
+++ b/src/smoke.c
#include "smoke.h"
#include "fx.h"
#include "misc.h"
+#include "my.h"
#define MAXSR 20
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 275aed721c9c13437bd38955260f5c70093e3863..a04650889c04feace9571f39701ae9ac0a8a1a51 100644 (file)
--- a/src/switch.c
+++ b/src/switch.c
#include "player.h"
#include "misc.h"
#include "map.h"
+#include "my.h"
#define MAXSW 100
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) {
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 5db6b53cf0c7cf457785348c5c8bace494811406..f2e5b44079941a7db71016564543efc4f664f44c 100644 (file)
--- a/src/vga.c
+++ b/src/vga.c
#include "error.h"
#include "view.h"
#include "memory.h"
+#include "misc.h"
#include <assert.h>
diff --git a/src/view.c b/src/view.c
index 034b0aa80a6a7bf5956d901f5c3c9e84cce4bee2..51e8179a1279b0e940909327a1de068e1f99b403 100644 (file)
--- a/src/view.c
+++ b/src/view.c
#include "misc.h"
#include "map.h"
#include "sound.h"
+#include "my.h"
#define ANIT 5
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) {
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);
}
}
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);
}
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;
}
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 477f991ea831c2a56ef1ee0b008c75b434ea8165..fb1eae16199be9b9d4cb47bcec19d25e706200b0 100644 (file)
--- a/src/view.h
+++ b/src/view.h
// View functions
+#ifndef VIEW_H_INCLUDED
+#define VIEW_H_INCLUDED
+
#include <stdio.h>
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 4a5a063d426b2e92e6695717ff50d0933f7032e9..c05f45692bb59d3299126f179286b207f2e1ab2d 100644 (file)
--- a/src/weapons.c
+++ b/src/weapons.c
#include "smoke.h"
#include "weapons.h"
#include "misc.h"
+#include "my.h"
extern int hit_xv,hit_yv;
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);
}
}