| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#pragma once |
| 30 |
|
| 31 |
#include "blit.h" |
| 32 |
#include "c_array.h" |
| 33 |
#include "character_class.h" |
| 34 |
#include "pickup_class.h" |
| 35 |
#include "weapon.h" |
| 36 |
#include "yajl/api/yajl_gen.h" |
| 37 |
|
| 38 |
typedef struct |
| 39 |
{ |
| 40 |
int probabilityToMove; |
| 41 |
int probabilityToTrack; |
| 42 |
int probabilityToShoot; |
| 43 |
int actionDelay; |
| 44 |
} CharBot; |
| 45 |
|
| 46 |
typedef struct |
| 47 |
{ |
| 48 |
const CharacterClass *Class; |
| 49 |
char *PlayerTemplateName; |
| 50 |
char *HeadParts[HEAD_PART_COUNT]; |
| 51 |
float speed; |
| 52 |
const WeaponClass *Gun; |
| 53 |
const WeaponClass *Melee; |
| 54 |
int maxHealth; |
| 55 |
|
| 56 |
int excessHealth; |
| 57 |
unsigned int flags; |
| 58 |
CharColors Colors; |
| 59 |
const PickupClass *Drop; |
| 60 |
CharBot *bot; |
| 61 |
} Character; |
| 62 |
|
| 63 |
typedef struct |
| 64 |
{ |
| 65 |
CArray OtherChars; |
| 66 |
|
| 67 |
|
| 68 |
CArray prisonerIds; |
| 69 |
CArray baddieIds; |
| 70 |
CArray specialIds; |
| 71 |
} CharacterStore; |
| 72 |
|
| 73 |
void CharacterStoreInit(CharacterStore *store); |
| 74 |
void CharacterStoreTerminate(CharacterStore *store); |
| 75 |
void CharacterStoreCopy( |
| 76 |
CharacterStore *dst, const CharacterStore *src, CArray *playerTemplates); |
| 77 |
void CharacterStoreResetOthers(CharacterStore *store); |
| 78 |
void CharacterLoadJSON( |
| 79 |
CharacterStore *c, CArray *playerTemplates, json_t *root, int version); |
| 80 |
bool CharacterStoreSave(CharacterStore *s, const char *path); |
| 81 |
Character *CharacterStoreAddOther(CharacterStore *store); |
| 82 |
Character *CharacterStoreInsertOther(CharacterStore *store, const size_t idx); |
| 83 |
void CharacterStoreDeleteOther(CharacterStore *store, int idx); |
| 84 |
void CharacterStoreAddPrisoner(CharacterStore *store, int character); |
| 85 |
void CharacterStoreAddBaddie(CharacterStore *store, int character); |
| 86 |
void CharacterStoreAddSpecial(CharacterStore *store, int character); |
| 87 |
void CharacterStoreDeleteBaddie(CharacterStore *store, int idx); |
| 88 |
void CharacterStoreDeleteSpecial(CharacterStore *store, int idx); |
| 89 |
int CharacterStoreGetPrisonerId(const CharacterStore *store, const int i); |
| 90 |
int CharacterStoreGetSpecialId(const CharacterStore *store, const int i); |
| 91 |
int CharacterStoreGetRandomBaddieId(const CharacterStore *store); |
| 92 |
int CharacterStoreGetRandomSpecialId(const CharacterStore *store); |
| 93 |
|
| 94 |
void CharacterCopy( |
| 95 |
Character *dst, const Character *src, CArray *playerTemplates); |
| 96 |
bool CharacterSave(yajl_gen g, const Character *c); |
| 97 |
|
| 98 |
bool CharacterIsPrisoner(const CharacterStore *store, const Character *c); |
| 99 |
|
| 100 |
void CharacterSetHeadPart(Character *c, const HeadPart hp, const char *name); |
| 101 |
void CharacterShuffleAppearance(Character *c); |