X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fmap.c;h=d09022738cc1b2dc8dfcb4e076acec08581e885e;hb=refs%2Fheads%2Frenders;hp=dc65f0c2491e0952de1a089e0ee7118f02d7eec6;hpb=9df860ab2839447c7143bbe705a573df152d7734;p=flatwaifu.git diff --git a/src/map.c b/src/map.c index dc65f0c..d70a4fb 100644 --- a/src/map.c +++ b/src/map.c @@ -30,10 +30,10 @@ #include #include #include "error.h" -#include "cp866.h" #include "common/streams.h" #include "common/files.h" +#include "common/cp866.h" enum { MB_COMMENT = -1, MB_END = 0, @@ -62,7 +62,7 @@ typedef struct old_thing_t { static map_block_t blk; -static int G_load (Reader *h) { +static int G_load (Stream *h) { switch (blk.t) { case MB_MUSIC: stream_read(g_music, 8, 1, h); @@ -75,7 +75,7 @@ static int G_load (Reader *h) { return 0; } -static int IT_load (Reader *h) { +static int IT_load (Stream *h) { int m, i, j; old_thing_t t; switch (blk.t) { @@ -171,7 +171,7 @@ static int IT_load (Reader *h) { return 0; } -static int SW_load (Reader *h) { +static int SW_load (Stream *h) { int i; switch(blk.t) { case MB_SWITCH2: @@ -217,7 +217,7 @@ static void unpack (void *buf, int len, void *obuf) { } } -static int read_array (void *p, Reader *h) { +static int read_array (void *p, Stream *h) { void *buf; switch (blk.st) { case 0: @@ -239,7 +239,7 @@ static int read_array (void *p, Reader *h) { return 1; } -static int W_load (Reader *h) { +static int W_load (Stream *h) { int i; char s[8]; switch (blk.t) { @@ -270,10 +270,11 @@ static int W_load (Reader *h) { return 0; } -int MAP_load (Reader *r) { - assert(r != NULL); +int MAP_load (Stream *r) { 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); @@ -283,7 +284,7 @@ int MAP_load (Reader *r) { blk.t = stream_read16(r); blk.st = stream_read16(r); blk.sz = stream_read32(r); - long off = r->getpos(r) + blk.sz; + off = stream_getpos(r) + blk.sz; switch (blk.t) { case MB_MUSIC: ok = G_load(r); @@ -310,7 +311,7 @@ int MAP_load (Reader *r) { logo("Unknown block %d(%d)\n", blk.t, blk.st); return 0; // error } - r->setpos(r, off); + stream_setpos(r, off); } } else { logo("Invalid map header\n");