Ludum Dare 29
HackSoc's entry for the Ludum Dare Jam 29
|
#include <curses.h>
#include <stdlib.h>
#include "level.h"
#include "mob.h"
#include "utils.h"
#include "effect.h"
#include "list.h"
#include "player.h"
Macros | |
#define | DEF_MOB(sym, n, col, hlth) |
Functions | |
static void | place_cell (Level *level, unsigned int x, unsigned int y, Cell *to_place, bool careful) |
static void | mine_level (Level *level, unsigned int num_miners, unsigned int spread, unsigned int iterations, unsigned int startx, unsigned int starty, Cell *to_place, bool make_stairs) |
static void | add_mob (Level *level) |
void | build_level (Level *level) |
void | do_affliction (Mob *mob) |
void | run_turn (Level *level) |
static void | calculate_illumination (Level *level) |
void | display_level (Level *level) |
Variables | |
bool | quit |
static const struct Mob | default_mobs [] |
#define DEF_MOB | ( | sym, | |
n, | |||
col, | |||
hlth | |||
) |
|
static |
Add a mob to a level.
level | The level to add to. |
void build_level | ( | Level * | level | ) |
Initialises a level.
level | Level to initialise. |
|
static |
Calculate which cells are illuminated or not
level | The level to check |
void display_level | ( | Level * | level | ) |
Render the level to the screen. The symbol for a level is picked according to the following priorities: occupant > top item > base.
level | Grid to display. |
void do_affliction | ( | Mob * | mob | ) |
Run afflicated routines on a mob.
mob | Afflicted mob. |
|
static |
Mine out the level. All miners get placed in the same starting coordinates, and then are spread out, before being free to wander around as they see fit.
level | The level to mine |
num_miners | The number of miners to place. |
spread | The maximum distance to spread out the miners. |
iterations | The number of steps to mine. |
startx | The X coordinate to position the miners (before spreading). |
starty | The Y coordinate to position the miners (before spreading). |
to_place | The cell to place. |
make_stairs | If true, place the stairs at one of the miners randomly. |
|
static |
(Shallow) Clone a cell and place it in the given position. Mobs and items in the cell are NOT cloned, those pointers get shared.
level | The level to place the cell in. |
x | The X coordinate. |
y | The Y coordinate. |
to_place | The cell to clone. |
careful | Only place if the space is occuped by a wall or floor. |
void run_turn | ( | Level * | level | ) |
A "turn" consists of all of the mobs acting once, possibly followed by some constant effect on the mob. As the player is a turn, this is (indirectly) where blocking for input happens.
level | The level grid to run the turn on. |
|
static |
bool quit |
Whether to quit the game or not.