player.h File Reference

#include "cell.h"
#include "skill.h"
#include "item.h"
#include "main.h"
#include "genmacro.h"
Include dependency graph for player.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  player
 Structure for storing character info. More...

Defines

#define MAX_ATTRIB   100
#define MAX_ITEMS   150
#define PLAYER   2
#define DIVINE_ASSASSIN   'a'
#define KNIGHT   'b'
#define ARCHER   'c'
#define HUMAN   'a'
#define FLOAT_RAND   (float)(rand())/(float)(RAND_MAX)
 Returns random float from 0 to 1.
#define WITH_PLAYER_INFO_POINTER(ip,...)   struct player *foopl_mac = ip; __VA_ARGS__
 Generates random int from <from> to <to>
#define ADD_ITEM_TO_INV_MACRO(...)   {struct item it; __VA_ARGS__ add_item_toinv (foopl_mac, it);}
#define ADD_SKILL_TO_BOX_MACRO(...)
#define SET_STAT(stat, num)   foopl_mac->stat = num;

Functions

void createplayer (struct cell *level, int size, int race, int profession)
 Creates player and puts it into world.
int getplayer (struct cell *level, int size)
 Finds a player in the world.
struct playergetplayer_pointer (struct cell *level, int size)
 Wrapper around getplayer ().
int moveplayer (struct cell *level, int columns, int rows, int dir)
 Moves player on one square in specified direction.
int opendoor (struct leveldata ld, int columns, int rows, int dir)
 Opens a door.
int closedoor (struct cell *level, int columns, int rows, int dir)
 Closes a door.
struct itemget_item_by_key (struct player pl, char key)
 Gets item by its key (you can see it in inventory window).
void addexp (struct player *pl, int dif)
 Adds expirience points to player.
int checklevel (struct player *pl)
 Checks if player is able to get new level.
struct exit_code dodmg_topl (struct player *pl, int dmg)
 Does damage to player.
void add_item_toinv (struct player *pl, struct item itm)
 Adds item to inventory.
void remove_item_frominv (struct player *pl, struct item itm)
 Removes item from inventory.

Define Documentation

#define ADD_ITEM_TO_INV_MACRO ( ...   )     {struct item it; __VA_ARGS__ add_item_toinv (foopl_mac, it);}
#define ADD_SKILL_TO_BOX_MACRO ( ...   ) 
Value:
{struct skillbox *skbx = foopl_mac->sb; \
        struct skill sk; S_STATUS (NORMAL) S_LEVEL (1) __VA_ARGS__      \
                             *(skbx->box+skbx->num) = sk; skbx->num++;}
#define ARCHER   'c'
#define DIVINE_ASSASSIN   'a'
#define FLOAT_RAND   (float)(rand())/(float)(RAND_MAX)

Returns random float from 0 to 1.

#define HUMAN   'a'
#define KNIGHT   'b'
#define MAX_ATTRIB   100
#define MAX_ITEMS   150
#define PLAYER   2
#define SET_STAT ( stat,
num   )     foopl_mac->stat = num;
#define WITH_PLAYER_INFO_POINTER ( ip,
...   )     struct player *foopl_mac = ip; __VA_ARGS__

Generates random int from <from> to <to>


Function Documentation

void add_item_toinv ( struct player pl,
struct item  itm 
)

Adds item to inventory.

Parameters:
pl - Player
itm - item

Here is the call graph for this function:

void addexp ( struct player pl,
int  dif 
)

Adds expirience points to player.

Parameters:
dif - difficulty of killed monster

Warning: use this function instead of accessing player::xp directly

int checklevel ( struct player pl  ) 

Checks if player is able to get new level.

int closedoor ( struct cell level,
int  columns,
int  rows,
int  dir 
)

Closes a door.

See opendoor ()

Here is the call graph for this function:

void createplayer ( struct cell level,
int  size,
int  race,
int  profession 
)

Creates player and puts it into world.

Parameters:
level - Level
size - Size of level
race - Race of new player

- profession of new player

Here is the call graph for this function:

struct exit_code dodmg_topl ( struct player pl,
int  dmg 
) [read]

Does damage to player.

Hits player when monster has turn

Parameters:
pl - Player
dmg - Damage without respect to player's AC
struct item* get_item_by_key ( struct player  pl,
char  key 
) [read]

Gets item by its key (you can see it in inventory window).

Parameters:
player - Owner of inventory
key - symbolic key
Returns:
pointer to item in inventory on success or NULL
int getplayer ( struct cell level,
int  size 
)

Finds a player in the world.

Parameters:
level - Level where player can be found
size - Size of level
Returns:
Number of cell where player is stored
struct player* getplayer_pointer ( struct cell level,
int  size 
) [read]

Wrapper around getplayer ().

Returns:
Pointer to player

Here is the call graph for this function:

int moveplayer ( struct cell level,
int  columns,
int  rows,
int  dir 
)

Moves player on one square in specified direction.

Parameters:
level - See above
columns - Columns in the field of the game
rows - Rows in the field of the game
dir - Direction (e.g. K, L, U or something else)
Returns:
1 on success

Here is the call graph for this function:

int opendoor ( struct leveldata  ld,
int  columns,
int  rows,
int  dir 
)

Opens a door.

Arguments like in function above

Returns:
OK on success, TRY_AGAIN if fails

Here is the call graph for this function:

void remove_item_frominv ( struct player pl,
struct item  itm 
)

Removes item from inventory.

See above

Here is the call graph for this function:

Generated on Mon Nov 15 10:27:07 2010 for Tales of Paraverse by  doxygen 1.6.3