8 public auto switchTouch (Actor me, Actor other) {
9 if (!me || !other) return false;
11 int x = other.x, y = other.y;
12 int sx = (x-other.radius)/CELW;
13 int sy = (y-other.height+1)/CELH;
14 x = (x+other.radius)/CELW;
20 return (myx >= sx && myx <= x && myy >= sy && myy <= y /*&& ((sw[i].f&0x8F)&t)*/);
24 public void switchOpenDoor (Actor me) {
25 int a = (me.switchabf>>16)&0xff;
26 int b = (me.switchabf>>8)&0xff;
28 //swsnd = Z_sound(sndbdo, 128);
29 auto j = mapGetTile(LAYER_FRONT, a, b);
34 processDoor(a, b, TILE_DOORC, TILE_DOORO, 0, 1);
35 mapSetTile(LAYER_FRONT, a, b, j);
39 // `x` and `y` in tiles
40 void processDoor (int x, int y, int cht, int chto, int chf, int f_ch) {
41 if (x < 0 || y < 0 || x >= FLDW || y >= FLDH) return;
42 if (mapGetTypeTile(x, y) != cht) return;
44 for (; x && mapGetTypeTile(x-1, y) == cht; --x) {}
45 for (; ex < FLDW && mapGetTypeTile(ex, y) == cht; ++ex) {}
46 for (int mx = x; mx < ex; ++mx) mapSetTypeTile(mx, y, chto); //memset(fldm+y*FLDW+x, chto, ex-x);
47 if (f_ch) for (int mx = x; mx < ex; ++mx) mapSetTile(LAYER_FRONT, mx, y, chf); //if (f_ch) memset(fldf+y*FLDW+x, chf, ex-x);
49 processDoor(x, y-1, cht, chto, chf, f_ch);
50 processDoor(x, y+1, cht, chto, chf, f_ch);