X-Git-Url: https://deadsoftware.ru/gitweb?p=flatwaifu.git;a=blobdiff_plain;f=src%2Fswitch.c;h=719f0dd3635ef9988c621211f3c289096a6d8a0c;hp=980955dee5f54ad7ebb42b5be4c9b00f806fe2b0;hb=efb17348438f10c929e2e9807013969f71802661;hpb=e5c2eddc151a59db4e611a77901732d7c15fde90 diff --git a/src/switch.c b/src/switch.c index 980955d..719f0dd 100644 --- a/src/switch.c +++ b/src/switch.c @@ -28,60 +28,20 @@ #include "player.h" #include "misc.h" #include "map.h" - -#define MAXSW 100 - -extern map_block_t blk; - -#pragma pack(1) -typedef struct{ - byte x,y; - byte t,tm; - byte a,b,c,d; - byte f; -}sw_t; -#pragma pack() - -static sw_t sw[MAXSW]; - -static void *sndswn,*sndswx,*sndnoway,*sndbdo,*sndbdc,*sndnotele; -static int swsnd; +#include "files.h" +#include "game.h" +#include "my.h" +#include "monster.h" +#include "render.h" int sw_secrets; +sw_t sw[MAXSW]; -void SW_savegame(FILE* h) { - int n; - - for(n=MAXSW;--n;) if(sw[n].t) break; - ++n;myfwrite(&n,1,4,h);myfwrite(sw,1,n*sizeof(sw[0]),h); - myfwrite(&sw_secrets,1,4,h); -} - -void SW_loadgame(FILE* h) { - int n; - - myfread(&n,1,4,h);myfread(sw,1,n*sizeof(sw[0]),h); - myfread(&sw_secrets,1,4,h); -} - -int SW_load(FILE* h) { - int i; - - switch(blk.t) { - case MB_SWITCH2: - sw_secrets=0; - for(i=0;i0;++i,blk.sz-=sizeof(sw_t)) { - myfread(sw+i,1,sizeof(sw_t),h); - sw[i].c = short2host(sw[i].c); - sw[i].tm=0;sw[i].d=0; - sw[i].f|=0x80; - if(sw[i].t==SW_SECRET) ++sw_secrets; - } - return 1; - }return 0; -} +static void *sndswn, *sndswx, *sndnoway, *sndbdo, *sndbdc, *sndnotele; +static int swsnd; +static byte cht, chto, chf, f_ch; -void SW_alloc(void) { +void SW_alloc (void) { sndswn=Z_getsnd("SWTCHN"); sndswx=Z_getsnd("SWTCHX"); sndnoway=Z_getsnd("NOWAY"); @@ -90,15 +50,14 @@ void SW_alloc(void) { sndnotele=Z_getsnd("NOTELE"); } -void SW_init(void) { +void SW_init (void) { int i; - - for(i=0;iy)>=FLDH*CELH+o->h) return; @@ -132,7 +91,7 @@ void Z_water_trap(obj_t *o) { } } -void Z_untrap(byte t) { +void Z_untrap (byte t) { byte *p; word n; @@ -171,7 +130,7 @@ static int shutdoor(int i) { return 1; } -void SW_act(void) { +void SW_act (void) { int i; if(swsnd) --swsnd; @@ -199,7 +158,7 @@ static int doortime(int t) { return 0; } -void SW_cheat_open(void) { +void SW_cheat_open (void) { int i; for(i=0;i