15 #define SCREENPIXW 320
16 #define SCREENPIXH 224
19 #define VIEWPIXW SCREENPIXW
20 #define VIEWH ((SCREENH >> 1) - 2)
21 #define VIEWPIXH ((SCREENPIXH >> 1) - 16)
25 #define VDPHH (VDPH >> 1)
51 u8 planeidx
; // BG_A or BG_B
52 u16 plane
; // VDP_BG_A or VDP_BG_B
53 u16 sy
, sh
; // screen offset and height in pixels
54 u16 sty
, sth
; // screen offset and height in tiles
55 s16 x
, y
; // position in the world in pixels
56 u16 tx
, ty
; // position in the world in tiles
57 u16 flags
; // set to 1 to reupload the entire screen, eg after teleports
60 extern u8 g_cells
[MAPH
*MAPW
];
62 extern cam_t g_cam
[MAX_PLAYERS
];
64 extern const u16 tile_rowoff
[MAPW
];
66 void map_startup(void);
67 void map_load(map_t
*map
);
68 void map_update(void);
70 void map_clear_tile(u16 tx
, u16 ty
);
71 void map_set_tile(u16 tx
, u16 ty
, u16 tile
);
72 void map_clear_tile_rect(s16 tx
, s16 ty
, s16 w
, s16 h
);
73 void map_set_tile_rect(s16 tx
, s16 ty
, s16 w
, s16 h
, u16 tile
);
75 #define MAP_WALLPTR(m) (u8*)(m)
76 #define MAP_SWMAPPTR(m) (u8*)(m + MAPH*MAPW)
77 #define MAP_TILEPTR(m) (u16*)(m + 2*MAPH*MAPW)
78 #define MAP_SWITCHPTR(m) (switch_t*)(m + 4*MAPH*MAPW)
79 #define MAP_THINGPTR(m, n) (mapthing_t*)(m + 4*MAPH*MAPW + sizeof(switch_t)*n)
81 #define DEFINE_MAP(tset, nsw, nth, ptr) \
82 { tset, nsw, nth, MAP_WALLPTR(ptr), MAP_SWMAPPTR(ptr), MAP_TILEPTR(ptr), MAP_SWITCHPTR(ptr), MAP_THINGPTR(ptr, nsw) }