diff --git a/src/switch.c b/src/switch.c
index a04650889c04feace9571f39701ae9ac0a8a1a51..b04c3033119b5c81ba7480b07829fe21f69a125c 100644 (file)
--- a/src/switch.c
+++ b/src/switch.c
#include "player.h"
#include "misc.h"
#include "map.h"
+#include "files.h"
+#include "game.h"
#include "my.h"
+#include "monster.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;
+typedef struct {
+ byte x, y;
+ byte t, tm;
+ byte a, b, c, d;
byte f;
-}sw_t;
+} sw_t;
#pragma pack()
-static sw_t sw[MAXSW];
+int sw_secrets;
-static void *sndswn,*sndswx,*sndnoway,*sndbdo,*sndbdc,*sndnotele;
+static sw_t sw[MAXSW];
+static void *sndswn, *sndswx, *sndnoway, *sndbdo, *sndbdc, *sndnotele;
static int swsnd;
-
-int sw_secrets;
+static byte cht, chto, chf, f_ch;
void SW_savegame (FILE *h) {
int i, n;
int SW_load (FILE *h) {
int i;
switch(blk.t) {
- case MB_SWITCH2:
- sw_secrets = 0;
- for (i = 0; i < MAXSW && blk.sz > 0; ++i, blk.sz -= 9) {
- 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;
- if (sw[i].t == SW_SECRET) {
- ++sw_secrets;
+ case MB_SWITCH2:
+ sw_secrets = 0;
+ for (i = 0; i < MAXSW && blk.sz > 0; ++i, blk.sz -= 9) {
+ 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;
+ if (sw[i].t == SW_SECRET) {
+ ++sw_secrets;
+ }
}
- }
- return 1;
+ return 1;
}
return 0;
}
-void SW_alloc(void) {
+void SW_alloc (void) {
sndswn=Z_getsnd("SWTCHN");
sndswx=Z_getsnd("SWTCHX");
sndnoway=Z_getsnd("NOWAY");
sndnotele=Z_getsnd("NOTELE");
}
-void SW_init(void) {
+void SW_init (void) {
int i;
-
- for(i=0;i<MAXSW;++i) sw[i].t=0;
- swsnd=0;
+ for (i = 0; i < MAXSW; i++) {
+ sw[i].t = 0;
+ }
+ swsnd = 0;
}
-static byte cht,chto,chf,f_ch;
-
static void door(byte x,byte y) {
byte ex;
}
}
-void Z_water_trap(obj_t *o) {
+void Z_water_trap (obj_t *o) {
int i,j,sx,sy,x,y;
if((y=o->y)>=FLDH*CELH+o->h) return;
}
}
-void Z_untrap(byte t) {
+void Z_untrap (byte t) {
byte *p;
word n;
return 1;
}
-void SW_act(void) {
+void SW_act (void) {
int i;
if(swsnd) --swsnd;
return 0;
}
-void SW_cheat_open(void) {
+void SW_cheat_open (void) {
int i;
for(i=0;i<MAXSW;++i) if(sw[i].t && !sw[i].tm) switch(sw[i].t) {
}
}
-int SW_press(int x,int y,int r,int h,byte t,int o) {
+int SW_press (int x, int y, int r, int h, byte t, int o) {
int sx,sy,i,p;
sx=(x-r)/CELW;sy=(y-h+1)/CELH;