Fixes some render layer issues
- Chance for more daggers in containers - Less health from meat - Prevent exit from spawning under containers
This commit is contained in:
parent
4ba301769a
commit
b4a6c4b46f
|
@ -398,17 +398,22 @@ local function build_coridoor_room(room)
|
||||||
build_center_corner_walls(room, exits)
|
build_center_corner_walls(room, exits)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function room_tile_available(room, rx, ry)
|
||||||
|
return not room.chests[rx][ry]
|
||||||
|
and not room.traps[rx][ry]
|
||||||
|
and not room.monsters[rx][ry]
|
||||||
|
and not room.decor[rx][ry]
|
||||||
|
and (room.tiles[rx][ry]
|
||||||
|
and not room.tiles[rx][ry][5]
|
||||||
|
and not room.tiles[rx][ry][8])
|
||||||
|
end
|
||||||
|
|
||||||
local function add_level_exit(room)
|
local function add_level_exit(room)
|
||||||
success = false
|
success = false
|
||||||
while not success do
|
while not success do
|
||||||
x = random(14)
|
x = random(14)
|
||||||
y = random(10)
|
y = random(10)
|
||||||
if not room.decor[x][y]
|
if room_tile_available(room, x, y) then
|
||||||
and not room.traps[x][y]
|
|
||||||
and (room.tiles[x][y]
|
|
||||||
and not room.tiles[x][y][5]
|
|
||||||
and not room.tiles[x][y][8])
|
|
||||||
then
|
|
||||||
success = true
|
success = true
|
||||||
room.tiles[x][y] = special.level_exit
|
room.tiles[x][y] = special.level_exit
|
||||||
end
|
end
|
||||||
|
@ -453,13 +458,7 @@ function module.add_full_lighting(room)
|
||||||
end
|
end
|
||||||
|
|
||||||
function module.is_tile_avilable(room, rx, ry)
|
function module.is_tile_avilable(room, rx, ry)
|
||||||
return not room.chests[rx][ry]
|
return room_tile_available(room, rx, ry);
|
||||||
and not room.traps[rx][ry]
|
|
||||||
and not room.monsters[rx][ry]
|
|
||||||
and not room.decor[rx][ry]
|
|
||||||
and (room.tiles[rx][ry]
|
|
||||||
and not room.tiles[rx][ry][5]
|
|
||||||
and not room.tiles[rx][ry][8])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function module.create_empty_room()
|
function module.create_empty_room()
|
||||||
|
|
|
@ -56,6 +56,8 @@ item_collected(Item *item, Player *player)
|
||||||
gui_log("You open a container");
|
gui_log("You open a container");
|
||||||
item->opened = true;
|
item->opened = true;
|
||||||
item->sprite->texture_index = 1;
|
item->sprite->texture_index = 1;
|
||||||
|
if (!item->items)
|
||||||
|
gui_log("You find nothing inside");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->effect != NULL)
|
if (item->effect != NULL)
|
||||||
|
|
|
@ -48,7 +48,7 @@ static void
|
||||||
eat_flesh(Item *item, Player *player)
|
eat_flesh(Item *item, Player *player)
|
||||||
{
|
{
|
||||||
int original_hp = player->stats.hp;
|
int original_hp = player->stats.hp;
|
||||||
player->stats.hp += (int) item->value * player->stats.lvl;
|
player->stats.hp += (int) item->value;
|
||||||
if (player->stats.hp > player->stats.maxhp)
|
if (player->stats.hp > player->stats.maxhp)
|
||||||
player->stats.hp = player->stats.maxhp;
|
player->stats.hp = player->stats.maxhp;
|
||||||
|
|
||||||
|
|
|
@ -538,13 +538,15 @@ run_game_render(void)
|
||||||
SDL_RenderSetViewport(gRenderer, &gameViewport);
|
SDL_RenderSetViewport(gRenderer, &gameViewport);
|
||||||
map_render(gMap, gCamera);
|
map_render(gMap, gCamera);
|
||||||
particle_engine_render_game(gCamera);
|
particle_engine_render_game(gCamera);
|
||||||
map_render_top_layer(gMap, gCamera);
|
map_render_mid_layer(gMap, gCamera);
|
||||||
|
|
||||||
if (!is_player_dead()) {
|
if (!is_player_dead()) {
|
||||||
player_render(gPlayer, gCamera);
|
player_render(gPlayer, gCamera);
|
||||||
player_render_toplayer(gPlayer, gCamera);
|
player_render_toplayer(gPlayer, gCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map_render_top_layer(gMap, gCamera);
|
||||||
|
|
||||||
if (gPlayer->class == MAGE || gPlayer->class == PALADIN)
|
if (gPlayer->class == MAGE || gPlayer->class == PALADIN)
|
||||||
roommatrix_render_mouse_square(gRoomMatrix, gCamera);
|
roommatrix_render_mouse_square(gRoomMatrix, gCamera);
|
||||||
|
|
||||||
|
|
27
src/map.c
27
src/map.c
|
@ -309,15 +309,8 @@ void map_render(Map *map, Camera *cam)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
map_render_top_layer(Map *map, Camera *cam)
|
map_render_mid_layer(Map *map, Camera *cam)
|
||||||
{
|
{
|
||||||
LinkedList *monsterItem = map->monsters;
|
|
||||||
while (monsterItem != NULL) {
|
|
||||||
Monster *monster = monsterItem->data;
|
|
||||||
monsterItem = monsterItem->next;
|
|
||||||
monster_render(monster, cam);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedList *items = map->items;
|
LinkedList *items = map->items;
|
||||||
while (items != NULL) {
|
while (items != NULL) {
|
||||||
item_render(items->data, cam);
|
item_render(items->data, cam);
|
||||||
|
@ -329,6 +322,24 @@ map_render_top_layer(Map *map, Camera *cam)
|
||||||
artifact_render(artifacts->data, cam);
|
artifact_render(artifacts->data, cam);
|
||||||
artifacts = artifacts->next;
|
artifacts = artifacts->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinkedList *monsterItem = map->monsters;
|
||||||
|
while (monsterItem != NULL) {
|
||||||
|
Monster *monster = monsterItem->data;
|
||||||
|
monsterItem = monsterItem->next;
|
||||||
|
monster_render(monster, cam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
map_render_top_layer(Map *map, Camera *cam)
|
||||||
|
{
|
||||||
|
LinkedList *monsterItem = map->monsters;
|
||||||
|
while (monsterItem != NULL) {
|
||||||
|
Monster *monster = monsterItem->data;
|
||||||
|
monsterItem = monsterItem->next;
|
||||||
|
monster_render_top_layer(monster, cam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_set_current_room(Map *map, Position *pos)
|
void map_set_current_room(Map *map, Position *pos)
|
||||||
|
|
|
@ -103,6 +103,9 @@ map_update(UpdateData*);
|
||||||
void
|
void
|
||||||
map_render(Map*, Camera*);
|
map_render(Map*, Camera*);
|
||||||
|
|
||||||
|
void
|
||||||
|
map_render_mid_layer(Map*, Camera*);
|
||||||
|
|
||||||
void
|
void
|
||||||
map_render_top_layer(Map*, Camera*);
|
map_render_top_layer(Map*, Camera*);
|
||||||
|
|
||||||
|
|
|
@ -336,8 +336,11 @@ l_add_chest(lua_State *L)
|
||||||
linkedlist_append(&chest->items, item_builder_build_item(TREASURE, level));
|
linkedlist_append(&chest->items, item_builder_build_item(TREASURE, level));
|
||||||
if (get_random(4) == 0)
|
if (get_random(4) == 0)
|
||||||
linkedlist_append(&chest->items, item_builder_build_item(HEALTH, level));
|
linkedlist_append(&chest->items, item_builder_build_item(HEALTH, level));
|
||||||
if (get_random(4) == 0)
|
if (get_random(4) == 0) {
|
||||||
linkedlist_append(&chest->items, item_builder_build_item(DAGGER, level));
|
Item *dagger = item_builder_build_item(DAGGER, level);
|
||||||
|
dagger->value = get_random(4) + 1;
|
||||||
|
linkedlist_append(&chest->items, dagger);
|
||||||
|
}
|
||||||
|
|
||||||
linkedlist_append(&map->items, chest);
|
linkedlist_append(&map->items, chest);
|
||||||
|
|
||||||
|
|
|
@ -571,6 +571,11 @@ monster_render(Monster *m, Camera *cam)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprite_render(m->sprite, cam);
|
sprite_render(m->sprite, cam);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
monster_render_top_layer(Monster *m, Camera *cam)
|
||||||
|
{
|
||||||
if (m->stateIndicator.displayCount != 0)
|
if (m->stateIndicator.displayCount != 0)
|
||||||
sprite_render(m->stateIndicator.sprite, cam);
|
sprite_render(m->stateIndicator.sprite, cam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,9 @@ monster_move(Monster*, RoomMatrix*);
|
||||||
void
|
void
|
||||||
monster_render(Monster*, Camera*);
|
monster_render(Monster*, Camera*);
|
||||||
|
|
||||||
|
void
|
||||||
|
monster_render_top_layer(Monster*, Camera*);
|
||||||
|
|
||||||
void
|
void
|
||||||
monster_hit(Monster*, unsigned int dmg);
|
monster_hit(Monster*, unsigned int dmg);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include "projectile.h"
|
#include "projectile.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "texturecache.h"
|
#include "texturecache.h"
|
||||||
|
|
Loading…
Reference in New Issue