Ludum Dare 29
HackSoc's entry for the Ludum Dare Jam 29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions | Variables
player.c File Reference
#include <stdbool.h>
#include <curses.h>
#include <string.h>
#include "mob.h"
#include "level.h"
#include "utils.h"
#include "player.h"
#include "effect.h"
Include dependency graph for player.c:

Functions

static void randomise_player (Mob *player)
 
static void design_player (Mob *player)
 
Mobcreate_player ()
 
bool attackmove (Mob *player, unsigned int x, unsigned int y)
 
bool attackmove_relative (Mob *player, int xdiff, int ydiff)
 
void player_turn (Mob *player)
 
void player_death (Mob *player)
 

Variables

const char * names []
 
const char * races []
 
const char * professions []
 
bool quit
 

Function Documentation

bool attackmove ( Mob player,
unsigned int  x,
unsigned int  y 
)

Move and attack at the same time - if a mob is in the target cell, damage it, but don't move.

Parameters
playerEntity representing the player.
xx-coordinate to move to.
yy-coordinate to move to.
Returns
If the player damaged a mob.

Here is the call graph for this function:

Here is the caller graph for this function:

bool attackmove_relative ( Mob player,
int  xdiff,
int  ydiff 
)

Like attackmove, but relative position.

Parameters
playerEntity representing the player.
xdiffDifference in the x-axis to move.
ydiffDifference in the y-axis to move.
Returns
If the player damaged a mob.

Here is the call graph for this function:

Here is the caller graph for this function:

Mob* create_player ( void  )

Create and return a new player. This prompts the user for stuff, and clears the screen when it is done.

Here is the call graph for this function:

Here is the caller graph for this function:

static void design_player ( Mob player)
static

Have the human player enter the character player's name, race, and profession (the opposite of randomise_player).

Parameters
playerThe player

Here is the call graph for this function:

Here is the caller graph for this function:

void player_death ( Mob player)

Say that the player is dead, and do stuff.

Parameters
playerPlayer that died.

Here is the call graph for this function:

Here is the caller graph for this function:

void player_turn ( Mob player)

Wait for user input, and then act accordingly.

Parameters
playerPlayer entity.

Here is the call graph for this function:

Here is the caller graph for this function:

static void randomise_player ( Mob player)
static

Randomise a player's name, race, and profession.

Parameters
playerThe player

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char* names[]
Initial value:
= {"Colin",
NULL}
const char* professions[]
Initial value:
= {"Miner",
"Attorney",
"Clog Maker",
"Huntsman",
"Chef",
"Tourist",
"Dog",
NULL}
bool quit

Whether to quit the game or not.

const char* races[]
Initial value:
= {"Human",
"Dutch",
"Elf",
"Dwarf",
"Halfling",
"Quarterling",
NULL}