Fixes compile error and some graphical issues
- Keys and artifacts should render on to of other items - Locked doors will impact surrounding wall layouts
This commit is contained in:
parent
2ae6ada297
commit
ebfe2715e0
|
@ -325,17 +325,19 @@ function createJumbleLayout(matrix)
|
|||
end
|
||||
|
||||
function draw_layout_to_room(room, matrix, roomx, roomy)
|
||||
local wallTypes = {"#", "\"", "/", "d", "g", "S", "G"}
|
||||
|
||||
for i=2,13 do
|
||||
for j=2,10 do
|
||||
if matrix[i][j] == "p" then
|
||||
setPitTile(room, matrix, i, j);
|
||||
elseif matrix[i][j] == "#" then
|
||||
setBlockTile(room, matrix, i, j, walls, {"#", "\"", "/", "d", "g"}, false)
|
||||
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
|
||||
elseif matrix[i][j] == "\"" then
|
||||
setBlockTile(room, matrix, i, j, walls, {"#", "\"", "/", "d", "g"}, false)
|
||||
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
|
||||
room.decor[i][j] = lights.candle1
|
||||
elseif matrix[i][j] == "/" then
|
||||
setBlockTile(room, matrix, i, j, walls, {"#", "\"", "/", "d", "g"}, false)
|
||||
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
|
||||
if random(2) == 1 then
|
||||
room.decor[i][j] = lights.candle1
|
||||
else
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* BreakHack - A dungeone crawler RPG
|
||||
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef enum DoorLockType {
|
||||
LOCK_NONE,
|
||||
LOCK_SILVER,
|
||||
LOCK_GOLD
|
||||
} DoorLockType;
|
|
@ -32,16 +32,11 @@
|
|||
#include "player.h"
|
||||
#include "map_room_modifiers.h"
|
||||
#include "object.h"
|
||||
#include "doorlocktype.h"
|
||||
|
||||
typedef struct UpdateData UpdateData;
|
||||
typedef struct Trap Trap;
|
||||
|
||||
typedef enum DoorLockType {
|
||||
LOCK_NONE,
|
||||
LOCK_SILVER,
|
||||
LOCK_GOLD
|
||||
} DoorLockType;
|
||||
|
||||
typedef struct MapTile_t {
|
||||
Sprite *sprite;
|
||||
bool collider;
|
||||
|
|
|
@ -690,25 +690,25 @@ monster_drop_loot(Monster *monster, Map *map, Player *player)
|
|||
linkedlist_append(&map->artifacts, a);
|
||||
Item *treasure = item_builder_build_item(TREASURE, map->level*2);
|
||||
treasure->sprite->pos = monsterTilePos;
|
||||
linkedlist_push(&map->items, treasure);
|
||||
linkedlist_append(&map->items, treasure);
|
||||
}
|
||||
|
||||
if (monster->items.keyType != LOCK_NONE) {
|
||||
Item *key = item_builder_build_key(monster->items.keyType);
|
||||
key->sprite->pos = monsterTilePos;
|
||||
linkedlist_push(&map->items, key);
|
||||
linkedlist_append(&map->items, key);
|
||||
}
|
||||
|
||||
if (strcmp(monster->label, "The Trader") == 0) {
|
||||
Item *treasure = item_builder_build_treasure(PLATINUM, 10 * monster->stats.lvl);
|
||||
treasure->sprite->pos = monsterTilePos;
|
||||
linkedlist_push(&map->items, treasure);
|
||||
linkedlist_append(&map->items, treasure);
|
||||
}
|
||||
|
||||
if (strcmp(monster->label, "A Fairy") == 0) {
|
||||
Item *treasure = item_builder_build_treasure(PLATINUM, 3 * monster->stats.lvl);
|
||||
treasure->sprite->pos = monsterTilePos;
|
||||
linkedlist_push(&map->items, treasure);
|
||||
linkedlist_append(&map->items, treasure);
|
||||
}
|
||||
|
||||
if (monster->stats.lvl > 2 && get_random(29) == 0) {
|
||||
|
@ -744,15 +744,15 @@ monster_drop_loot(Monster *monster, Map *map, Player *player)
|
|||
gui_log("%s dropped something", monster->label);
|
||||
|
||||
if (item_count == 1) {
|
||||
linkedlist_append(&map->items, items[0]);
|
||||
linkedlist_push(&map->items, items[0]);
|
||||
} else {
|
||||
Item *container = item_builder_build_sack();
|
||||
container->sprite->pos = monsterTilePos;
|
||||
unsigned int i;
|
||||
for (i = 0; i < item_count; ++i) {
|
||||
linkedlist_append(&container->items, items[i]);
|
||||
linkedlist_push(&container->items, items[i]);
|
||||
}
|
||||
linkedlist_append(&map->items, container);
|
||||
linkedlist_push(&map->items, container);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "actiontext.h"
|
||||
#include "player.h"
|
||||
#include "linkedlist.h"
|
||||
#include "doorlocktype.h"
|
||||
|
||||
struct UpdateData;
|
||||
enum DoorLockType;
|
||||
|
||||
typedef enum {
|
||||
PACIFIST,
|
||||
|
|
Loading…
Reference in New Issue