6 using namespace Graphics
;
8 extern const char *tileset_names
[]; // from stagedata.cpp
9 extern const char *stage_dir
; // from main
11 static NXSurface
*tileset
;
12 static int current_tileset
= -1;
27 void c------------------------------() {}
30 // load the given tileset into memory, replacing any other tileset.
31 bool Tileset::Load(int new_tileset
)
33 char fname
[MAXPATHLEN
];
35 if (new_tileset
!= current_tileset
)
43 sprintf(fname
, "%s/Prt%s.pbm", stage_dir
, tileset_names
[new_tileset
]);
45 // always use SDL_DisplayFormat on tilesets; they need to come out of 8-bit
46 // so that we can replace the destroyable star tiles without them palletizing.
47 tileset
= NXSurface::FromFile(fname
, true, true);
53 current_tileset
= new_tileset
;
59 // draw the given tile from the current tileset to the screen
60 void Tileset::draw_tile(int x
, int y
, int t
)
62 // 16 tiles per row on all tilesheet
63 int srcx
= (t
% 16) * TILE_W
;
64 int srcy
= (t
/ 16) * TILE_H
;
66 DrawSurface(tileset
, x
, y
, srcx
, srcy
, TILE_W
, TILE_H
);
69 void Tileset::Reload()
71 if (current_tileset
!= -1)
73 int tileset
= current_tileset
;
80 void c------------------------------() {}
83 NXSurface
*Tileset::GetSurface()