shift pistol HUD sprite
[d2d-psx.git] / src / bmap.c
blob73607d8b1ec4912e744ab4324e73eb78ca5809b0
1 /*
2 * Copyright (C) Prikol Software 1996-1997
3 * Copyright (C) Aleksey Volynskov 1996-1997
4 * Copyright (C) <ARembo@gmail.com> 2011
6 * This file is part of the Doom2D PSX project.
8 * Doom2D PSX is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * Doom2D PSX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/> or
19 * write to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "glob.h"
24 #include "view.h"
25 #include "bmap.h"
27 byte fld_need_remap = 1;
29 byte bmap[FLDH / 4][FLDW / 4];
31 void BM_mark(obj_t * o, byte f) {
32 int x, y;
33 int xs, ys, xe, ye;
35 if ((xs = (o->x - o->r) >> 5) < 0)
36 xs = 0;
37 if ((xe = (o->x + o->r) >> 5) >= FLDW / 4)
38 xe = FLDW / 4 - 1;
39 if ((ys = (o->y - o->h) >> 5) < 0)
40 ys = 0;
41 if ((ye = o->y >> 5) >= FLDH / 4)
42 ye = FLDH / 4 - 1;
43 for (y = ys; y <= ye; ++y) {
44 for (x = xs; x <= xe; ++x)
45 bmap[y][x] |= f;
49 void BM_clear(byte f) {
50 int x, y;
52 for (x = 0; x < FLDW / 4; x++) {
53 for (y = 0; y < FLDH / 4; y++)
54 bmap[y][x] &= ~f;
58 void BM_remapfld(void) {
59 int x, y;
61 BM_clear(BM_WALL);
62 for (x = 0; x < FLDW; x++) {
63 for (y = 0; y < FLDH; y++) {
64 if ((fld[y][x] == 1) || (fld[y][x] == 2))
65 bmap[y / 4][x / 4] |= BM_WALL;
68 fld_need_remap = 0;