23#ifndef _POSIX_C_SOURCE
24#define _POSIX_C_SOURCE 200809L
28#ifdef HELAPORDO_CURSES_BUILD
31#include <ncursesw/panel.h>
32#include <ncursesw/menu.h>
38#ifndef HELAPORDO_RAYLIB_BUILD
39#error "HELAPORDO_CURSES_BUILD and HELAPORDO_RAYLIB_BUILD are both undefined."
66#ifdef HELAPORDO_CURSES_BUILD
69#include "../anvil__helapordo.h"
72#include "../release_data/release_data.h"
81void printWin_EnvVars(
void);
114 roomClass current_roomtype,
int current_room_index,
131void usage(
const char *progname);
167void dropEquip(
Fighter * player,
int beast, Koliseo * kls, RingaBuf* rb_notifications);
169#ifdef HELAPORDO_CURSES_BUILD
170void test_game_color_pairs(WINDOW * win,
int colors_per_row);
175 Boss * boss, FILE * save_file,
176 WINDOW * notify_win, Koliseo_Temp * t_kls,
178void print_label(WINDOW * win,
int starty,
int startx,
int width,
char *
string,
180void printEquipStats(
Equip * e);
181void printQualityColor(
quality q);
182void unlockSpecial(
Fighter * f);
184void printActivePerks(
Fighter * f);
185int retry(
char* seed);
186void getParams(
int argc,
char **argv,
Fighter * player,
Path * path,
int optTot,
189#ifndef HELAPORDO_RAYLIB_BUILD
190#error "HELAPORDO_CURSES_BUILD and HELAPORDO_RAYLIB_BUILD are both undefined.\n"
192void test_game_color_pairs(Rectangle * win,
int colors_per_row);
197 Boss * boss, FILE * save_file,
198 Rectangle * notification_area, Koliseo_Temp * t_kls,
200void unlockSpecial(
Fighter * f);
225#define hlpd_d_keyval(key) ((((key) >= 0) && ((key) <= HLPD_KEYCLASS_MAX)) ? (hlpd_default_keybinds[(key)].val) : -1 )
228int hlpd_getopt(
size_t argc,
char** argv,
const char* whoami);
turnOption
The different kinds of turnOption.
Definition game_core.h:1949
Gamemode
The different kinds of Gamemode.
Definition game_core.h:452
saveType
The different kinds of saveType.
Definition game_core.h:1852
quality
The different grades of Equip.
Definition game_core.h:1393
foeTurnOption_OP
The different kinds of foeTurnOption_OP.
Definition game_core.h:2030
roomClass
The different kinds of Room.
Definition game_core.h:1661
skillType
Definition game_core.h:859
winconClass
The different kinds of Wincon.
Definition game_core.h:1324
char * lore_strings[6]
Declares lore array for the game.
Definition game_lore.c:20
void * s4c_gui_calloc(size_t count, size_t size)
Definition game_utils.c:30
void pickWincon(Wincon *w)
Takes a Wincon pointer and sets its class after asking the user for input.
Definition game_utils.c:1424
void * s4c_gui_malloc(size_t size)
Definition game_utils.c:21
void purple(void)
Prints an ASCII escape code that makes subsequent output a thick purple color.
Definition game_utils.c:777
int scanClass(void)
Asks for an integer on stdin and returns it if it's a valid fighterClass index.
Definition game_utils.c:1236
void hlpd_sigint_handler(int signum)
Function to handle Ctrl+C signal.
Definition game_utils.c:45
void dbg_Fighter(Fighter *fighter)
Debugs the passed (preallocated) Fighter with log_tag().
Definition game_utils.c:197
void yellow(void)
Prints an ASCII escape code that makes subsequent output a thick yellow color.
Definition game_utils.c:745
void dbg_GameOptions(GameOptions *options)
Definition game_utils.c:182
void printEStats(Enemy *e)
Takes a Enemy pointer and prints most of its values formatted.
Definition game_utils.c:1855
void white(void)
Prints an ASCII escape code that makes subsequent output a light white color.
Definition game_utils.c:721
void useConsumable(Fighter *f, Enemy *e, Boss *b, char *string, int isBoss)
Takes a Fighter, an Enemy and a Boss pointers, a string denoting the consumableClass and an int for u...
Definition game_utils.c:3713
void printGlobVars(void)
Prints global vars to stdout.
Definition game_utils.c:145
void lightYellow(void)
Prints an ASCII escape code that makes subsequent output a light yellow color.
Definition game_utils.c:753
void strongWhite(void)
Prints an ASCII escape code that makes subsequent output a thick white color.
Definition game_utils.c:713
void applyPermboosts(Fighter *f)
Takes a Fighter pointer and applies all of its permboost_STAT values by adding them to the current st...
Definition game_utils.c:1565
void usage(const char *progname)
Prints correct argument syntax for command line invocation.
Definition game_utils.c:1169
void printSpawnMessage(Enemy *e, int roomIndex, int enemyIndex)
Takes a Enemy pointer and two integers for current room index and current enemy index,...
Definition game_utils.c:1619
void blue(void)
Prints an ASCII escape code that makes subsequent output a thick blue color.
Definition game_utils.c:761
void sell_all_equips(Fighter *f)
Takes a Fighter pointer and deleted all the equips not in use, granting a payment to the Fighter bala...
Definition game_utils.c:3533
void update_Equipslots(Fighter *f)
Updates the passed Fighter's Equipslots item fields, by reading the equipsBag field and setting the e...
Definition game_utils.c:657
int checkremainder(Fighter *player, int xp)
Takes a Fighter pointer and the amount of xp to add.
Definition game_utils.c:3378
void quit(Fighter *p, Room *room, loadInfo *load_info, Koliseo_Temp *t_kls)
Takes a Fighter, a Room and a loadInfo pointers, and prints fighter stats and a quitting message,...
Definition game_utils.c:3664
void e_death(Enemy *e)
Takes a Enemy pointer and frees its allocated memory.
Definition game_utils.c:3170
void lightCyan(void)
Prints an ASCII escape code that makes subsequent output a light cyan color.
Definition game_utils.c:801
void printArtifactStats(Artifact *a)
Takes a Artifact pointer and prints most of its values formatted.
Definition game_utils.c:1889
void updateCounters(Turncounter *counters[], int isEnemy, Fighter *f, Enemy *e)
Takes a Turncounter array, an integer, a Fighter pointer and an Enemy pointer.
Definition game_utils.c:3250
int scanWincon(void)
Asks for an integer on stdin and returns it if it's a valid winconClass index.
Definition game_utils.c:1345
void pickClass(Fighter *player)
Takes a Fighter pointer and sets the class value after asking the user for input.
Definition game_utils.c:1258
int giveXp(Fighter *player, Enemy *e)
Takes a Fighter and a Enemy pointers and handles xp gain by fighter.
Definition game_utils.c:3423
void dbg_Path(Path *path)
Debugs the passed (preallocated) Path with log_tag().
Definition game_utils.c:315
void dropEquip(Fighter *player, int beast, Koliseo *kls, RingaBuf *rb_notifications)
Takes a Fighter pointer value and an integer indicating if the drop was from a beast enemy,...
Definition game_utils.c:1919
void printVersion(void)
Prints version string.
Definition game_utils.c:1032
int dropConsumable(Fighter *player)
Takes a Fighter pointer value and adds a random Consumable to consumablesBag.
Definition game_utils.c:1648
void red(void)
Prints an ASCII escape code that makes subsequent output a thick red color.
Definition game_utils.c:697
void dbg_countStats(countStats *stats)
Debugs the passed (preallocated) countStats with log_tag().
Definition game_utils.c:352
void freeRoom(Room *room)
Frees the memory allocated for the passed room pointer.
Definition game_utils.c:913
int giveXp_Boss(Fighter *player, Boss *b)
Takes a Fighter and a Boss pointers and handles xp gain by fighter.
Definition game_utils.c:3440
int hlpd_getopt(size_t argc, char **argv, const char *whoami)
Parse options from CLI arguments.
Definition game_utils.c:3897
void lightPurple(void)
Prints an ASCII escape code that makes subsequent output a light purple color.
Definition game_utils.c:785
void hlpd_dbg_features(void)
Prints configuration info.
Definition game_utils.c:1049
void dbg_print_explored_layout(Floor *floor)
Logs explored layout for passed Floor.
Definition game_utils.c:417
int dropArtifact(Fighter *player)
Takes a Fighter pointer value and adds a random Artifact to artifactsBag.
Definition game_utils.c:1680
void updateCounters_Boss(Turncounter *counters[], int isBoss, Fighter *f, Boss *b)
Takes a Turncounter array, an integer, a Fighter pointer and a Boss pointer.
Definition game_utils.c:3320
void pickName(Fighter *player)
Takes a Fighter pointer and sets the name value after asking the user for input.
Definition game_utils.c:1367
int display_colorpairs(void)
Runs some shell commands to see all color pairs, then returns exitcode Prints the encoded value of th...
Definition game_utils.c:3877
saveType saveTypeFrom_string(char *s)
Takes a string and returns the corresponding saveType.
Definition game_utils.c:677
void initWincon(Wincon *w, Path *p, winconClass class)
Takes a Wincon and a Path pointers and a winconClass and initialises the passed Wincon.
Definition game_utils.c:110
int getEnemyXpGain(Enemy *e)
Takes a Enemy pointer and returns its xp gain as sum of xp field value and level.
Definition game_utils.c:3454
void hlpd_use_forced_flags(const char *whoami)
Definition game_utils.c:3787
void resetPermboosts(Fighter *f)
Takes a Fighter pointer and resets all of its permboost_STAT values to 0, also correctly updating the...
Definition game_utils.c:1519
void dbg_print_roomclass_layout(Floor *floor)
Logs roomclass layout for passed Floor.
Definition game_utils.c:441
Path * randomise_path(char *seed, Koliseo *kls, const char *path_to_savefile)
Takes an integer seed and returns a Path pointer.
Definition game_utils.c:1780
void loadLore(char **lore_strings, int loreKind)
Loads the lore strings from the appropriate lore file.
Definition game_utils.c:844
void dbg_Wincon(Wincon *wc)
Debugs the passed (preallocated) Wincon with log_tag().
Definition game_utils.c:334
void lightRed(void)
Prints an ASCII escape code that makes subsequent output a light red color.
Definition game_utils.c:705
void dbg_GameScreen(GameScreen *scr)
Debugs the passed (preallocated) GameScreen with log_tag().
Definition game_utils.c:582
void printClasses(void)
Prints all the fighterClass values as integers and as strings.
Definition game_utils.c:1218
void resetArtifactsState(Fighter *f)
Takes a Fighter pointer and Resets the active value for each Artifact in the fighter's artifactsBag a...
Definition game_utils.c:1597
void copy_fighter(Fighter *source, Fighter *dest)
Takes two Fighter pointers, with all their fields already allocated, and copies all valaues from sour...
Definition game_utils.c:1448
void green(void)
Prints an ASCII escape code that makes subsequent output a thick green color.
Definition game_utils.c:729
void lightBlue(void)
Prints an ASCII escape code that makes subsequent output a light blue color.
Definition game_utils.c:769
int getConsumableQty(Fighter *f, int n)
Takes a Fighter pointer and an integer denoting the consumableClass and returns the respective qty va...
Definition game_utils.c:1704
int onLevelUp(Fighter *player)
Takes a Fighter pointer and updated its stats.
Definition game_utils.c:3490
void printWincons(void)
Prints all the winconClass values as integers and as strings.
Definition game_utils.c:1327
void b_death(Boss *b)
Takes a Boss pointer and frees its allocated memory.
Definition game_utils.c:3209
void printConsumablesStats(Consumable *c)
Takes a Consumable pointer and prints most of its values formatted.
Definition game_utils.c:1879
void emptyConsumables(Fighter *player)
Sets the qty value to 0 for all Consumable in f's consumablesBag with positive qty.
Definition game_utils.c:1718
void dbg_Gamestate(Gamestate *gmst)
Debugs the passed (preallocated) Gamestate with log_tag().
Definition game_utils.c:501
void cyan(void)
Prints an ASCII escape code that makes subsequent output a thick cyan color.
Definition game_utils.c:793
void lightGreen(void)
Prints an ASCII escape code that makes subsequent output a light green color.
Definition game_utils.c:737
void dbg_print_floor_layout(Floor *floor)
Logs floor layout for passed Floor.
Definition game_utils.c:393
void update_Gamestate(Gamestate *gmst, int current_fighters, roomClass current_roomtype, int current_room_index, int current_enemy_index, Floor *current_floor, Room *current_room, GameOptions *game_options)
Updates the passed (preallocated) Gamestate with the passed int values.
Definition game_utils.c:628
void printFormattedVersion(const char *progname)
Prints formatted version string.
Definition game_utils.c:1041
void setRoomType(Path *path, int *roadFork_value, roomClass *room_type, int roomsDone)
Takes a path pointer, a roadFork value pointer, a room type pointer, and an integer.
Definition game_utils.c:890
void emptyArtifacts(Fighter *player)
Takes a Fighter pointer and sets the qty value to 0 and the active flag to false for all Artifacts in...
Definition game_utils.c:1735
void printTitle(void)
Prints an hardcoded title screen.
Definition game_utils.c:1017
turnOption getTurnChoice(char *ch)
Returns the chosen option as a turnOption.
Definition game_utils.c:3597
void init_game_color_pairs(void)
void death(Fighter *player, loadInfo *load_info)
Takes a Fighter and loadInfo pointers and prints fighter stats and a game over message.
Definition game_utils.c:3035
void emptyEquips(Fighter *player)
Takes a Fighter pointer and, for all Equip in equipsBag field with positive qty, sets qty to 0 and fr...
Definition game_utils.c:1751
void scanName(Fighter *player)
Takes a Fighter pointer and sets its name value to the string provided on stdin.
Definition game_utils.c:1203
void printStats(Fighter *f)
Takes a Fighter pointer and prints most of its values formatted.
Definition game_utils.c:1831
void dbg_Saveslot(Saveslot *saveslot)
Debugs the passed (preallocated) Saveslot with log_tag().
Definition game_utils.c:298
int getBossXpGain(Boss *b)
Takes a Boss pointer and returns its xp gain as sum of xp field value and level.
Definition game_utils.c:3467
Represents the entity initialised from a artifactClass.
Definition game_core.h:551
Represents the entity initialised from a bossClass.
Definition game_core.h:1204
Holds a certain qty of a consumableClass.
Definition game_core.h:502
Represents the entity initialised from a enemyClass.
Definition game_core.h:1163
Represents the entity initialised from a equipClass.
Definition game_core.h:1416
Represents the entity initialised from a fighterClass.
Definition game_core.h:1093
Represents the entity initialised from a floorClass.
Definition game_core.h:1825
Holds options useful for user runtime preferences.
Definition game_core.h:201
Holds arguments for a game.
Definition game_core.h:1899
Holds the state of game progression.
Definition game_core.h:1357
Represents the entity initialised from a roomClass.
Definition game_core.h:1770
Holds arguments for a saveslot.
Definition game_core.h:410
Represents the entity initialised from a CounterType.
Definition game_core.h:1303
Defines the entity initialised from a winconClass.
Definition game_core.h:1338
Holds the lifetime stats of the player.
Definition game_core.h:781
Contains loaded values to pass to initRoom().
Definition game_core.h:1878
Holds arguments for a turnOption_OP.
Definition game_core.h:2104