Si el tile es sprite se pinta en el layer de sprites
This commit is contained in:
9
main.cpp
9
main.cpp
@@ -74,6 +74,8 @@ int undo_max = 0;
|
||||
int tile_sel = 0;
|
||||
int tile_back = 0;
|
||||
|
||||
int sprites = 208;
|
||||
|
||||
const char* GetPath(const char* filename) {
|
||||
#ifdef __APPLE__
|
||||
static char fullpath[400];
|
||||
@@ -146,6 +148,7 @@ void LoadConfig() {
|
||||
else if (strcmp(key, "zoom") == 0) { zoom = StrToInt(val); }
|
||||
else if (strcmp(key, "tiles") == 0) { strcpy(tiles_filename, val); }
|
||||
else if (strcmp(key, "map") == 0) { strcpy(map_filename, val); }
|
||||
else if (strcmp(key, "sprites") == 0) { sprites = StrToInt(val); }
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
@@ -456,10 +459,12 @@ void DoTileMap() {
|
||||
for (int x = 0; x < width_in_tiles; x++) {
|
||||
unsigned char tile = map[(map_x + x) + (map_y + y) * map_width];
|
||||
Draw(sdlTilesTexture, x*tile_width, y*tile_height, (tile % pal_width_in_tiles)*tile_width, (tile / pal_width_in_tiles)*tile_height, tile_width, tile_height);
|
||||
if (!keyboard[SDL_SCANCODE_LSHIFT]) {
|
||||
unsigned char sprite = map[((map_x + x) + (map_y + y) * map_width) + (map_width*map_height)];
|
||||
if (sprite != 0) Draw(sdlTilesTexture, x*tile_width, y*tile_height, (sprite % pal_width_in_tiles)*tile_width, (sprite / pal_width_in_tiles)*tile_height, tile_width, tile_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!menu) {
|
||||
const int cur_x = mouse.x / tile_width;
|
||||
@@ -480,10 +485,10 @@ void DoTileMap() {
|
||||
if (keyJustPressed == SDL_SCANCODE_R) { Undo_Op(); ReplaceTile(); }
|
||||
|
||||
if (mouse.mouse_down[MOUSE_BUTTON_LEFT] || mouse.mouse_down[MOUSE_BUTTON_RIGHT]) { Undo_Op(); }
|
||||
if (mouse.buttons[MOUSE_BUTTON_RIGHT]) { map[(map_x + cur_x) + (map_y + cur_y)*map_width] = tile_back; }
|
||||
if (mouse.buttons[MOUSE_BUTTON_RIGHT]) { if (tile_back < sprites) map[(map_x + cur_x) + (map_y + cur_y)*map_width] = tile_back; }
|
||||
if (mouse.buttons[MOUSE_BUTTON_LEFT]) {
|
||||
const int pos = (map_x + cur_x) + (map_y + cur_y)*map_width;
|
||||
if (keyboard[CTRL]) {
|
||||
if (tile_sel >= sprites) {
|
||||
ignoreMouse = true;
|
||||
if (map[pos + (map_width*map_height)] == 0) {
|
||||
map[pos + (map_width*map_height)] = tile_sel;
|
||||
|
||||
Reference in New Issue
Block a user