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:1969
Gamemode
The different kinds of Gamemode.
Definition game_core.h:451
saveType
The different kinds of saveType.
Definition game_core.h:1854
quality
The different grades of Equip.
Definition game_core.h:1394
foeTurnOption_OP
The different kinds of foeTurnOption_OP.
Definition game_core.h:2050
roomClass
The different kinds of Room.
Definition game_core.h:1662
skillType
Definition game_core.h:860
winconClass
The different kinds of Wincon.
Definition game_core.h:1325
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:1428
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:784
int scanClass(void)
Asks for an integer on stdin and returns it if it's a valid fighterClass index.
Definition game_utils.c:1243
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:752
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:1856
void white(void)
Prints an ASCII escape code that makes subsequent output a light white color.
Definition game_utils.c:728
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:3712
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:760
void strongWhite(void)
Prints an ASCII escape code that makes subsequent output a thick white color.
Definition game_utils.c:720
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:1566
void usage(const char *progname)
Prints correct argument syntax for command line invocation.
Definition game_utils.c:1176
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:1620
void blue(void)
Prints an ASCII escape code that makes subsequent output a thick blue color.
Definition game_utils.c:768
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:3535
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:664
int checkremainder(Fighter *player, int xp)
Takes a Fighter pointer and the amount of xp to add.
Definition game_utils.c:3380
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:3666
void e_death(Enemy *e)
Takes a Enemy pointer and frees its allocated memory.
Definition game_utils.c:3172
void lightCyan(void)
Prints an ASCII escape code that makes subsequent output a light cyan color.
Definition game_utils.c:808
void printArtifactStats(Artifact *a)
Takes a Artifact pointer and prints most of its values formatted.
Definition game_utils.c:1890
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:3252
int scanWincon(void)
Asks for an integer on stdin and returns it if it's a valid winconClass index.
Definition game_utils.c:1349
void pickClass(Fighter *player)
Takes a Fighter pointer and sets the class value after asking the user for input.
Definition game_utils.c:1265
int giveXp(Fighter *player, Enemy *e)
Takes a Fighter and a Enemy pointers and handles xp gain by fighter.
Definition game_utils.c:3425
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:1920
void printVersion(void)
Prints version string.
Definition game_utils.c:1039
int dropConsumable(Fighter *player)
Takes a Fighter pointer value and adds a random Consumable to consumablesBag.
Definition game_utils.c:1649
void red(void)
Prints an ASCII escape code that makes subsequent output a thick red color.
Definition game_utils.c:704
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:920
int giveXp_Boss(Fighter *player, Boss *b)
Takes a Fighter and a Boss pointers and handles xp gain by fighter.
Definition game_utils.c:3442
int hlpd_getopt(size_t argc, char **argv, const char *whoami)
Parse options from CLI arguments.
Definition game_utils.c:3896
void lightPurple(void)
Prints an ASCII escape code that makes subsequent output a light purple color.
Definition game_utils.c:792
void hlpd_dbg_features(void)
Prints configuration info.
Definition game_utils.c:1056
void dbg_print_explored_layout(Floor *floor)
Logs explored layout for passed Floor.
Definition game_utils.c:424
int dropArtifact(Fighter *player)
Takes a Fighter pointer value and adds a random Artifact to artifactsBag.
Definition game_utils.c:1681
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:3322
void pickName(Fighter *player)
Takes a Fighter pointer and sets the name value after asking the user for input.
Definition game_utils.c:1371
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:3876
saveType saveTypeFrom_string(char *s)
Takes a string and returns the corresponding saveType.
Definition game_utils.c:684
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:3456
void hlpd_use_forced_flags(const char *whoami)
Definition game_utils.c:3786
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:1520
void dbg_print_roomclass_layout(Floor *floor)
Logs roomclass layout for passed Floor.
Definition game_utils.c:448
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:1781
void loadLore(char **lore_strings, int loreKind)
Loads the lore strings from the appropriate lore file.
Definition game_utils.c:851
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:712
void dbg_GameScreen(GameScreen *scr)
Debugs the passed (preallocated) GameScreen with log_tag().
Definition game_utils.c:589
void printClasses(void)
Prints all the fighterClass values as integers and as strings.
Definition game_utils.c:1225
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:1598
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:1449
void green(void)
Prints an ASCII escape code that makes subsequent output a thick green color.
Definition game_utils.c:736
void lightBlue(void)
Prints an ASCII escape code that makes subsequent output a light blue color.
Definition game_utils.c:776
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:1705
int onLevelUp(Fighter *player)
Takes a Fighter pointer and updated its stats.
Definition game_utils.c:3492
void printWincons(void)
Prints all the winconClass values as integers and as strings.
Definition game_utils.c:1331
void b_death(Boss *b)
Takes a Boss pointer and frees its allocated memory.
Definition game_utils.c:3211
void printConsumablesStats(Consumable *c)
Takes a Consumable pointer and prints most of its values formatted.
Definition game_utils.c:1880
void dbg_Gamestate(Gamestate *gmst)
Debugs the passed (preallocated) Gamestate with log_tag().
Definition game_utils.c:508
void cyan(void)
Prints an ASCII escape code that makes subsequent output a thick cyan color.
Definition game_utils.c:800
void lightGreen(void)
Prints an ASCII escape code that makes subsequent output a light green color.
Definition game_utils.c:744
void dbg_print_floor_layout(Floor *floor)
Logs floor layout for passed Floor.
Definition game_utils.c:400
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:635
void printFormattedVersion(const char *progname)
Prints formatted version string.
Definition game_utils.c:1048
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:897
void printTitle(void)
Prints an hardcoded title screen.
Definition game_utils.c:1024
turnOption getTurnChoice(char *ch)
Returns the chosen option as a turnOption.
Definition game_utils.c:3599
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:3037
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:1752
void emptyConsumables(Fighter *f)
Sets the qty value to 0 for all Consumable in f's consumablesBag with positive qty.
Definition game_utils.c:1719
void scanName(Fighter *player)
Takes a Fighter pointer and sets its name value to the string provided on stdin.
Definition game_utils.c:1210
void emptyArtifacts(Fighter *f)
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:1736
void printStats(Fighter *f)
Takes a Fighter pointer and prints most of its values formatted.
Definition game_utils.c:1832
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:3469
void init_game_color_pairs(void)
Represents the entity initialised from a artifactClass.
Definition game_core.h:550
Represents the entity initialised from a bossClass.
Definition game_core.h:1205
Holds a certain qty of a consumableClass.
Definition game_core.h:501
Represents the entity initialised from a enemyClass.
Definition game_core.h:1164
Represents the entity initialised from a equipClass.
Definition game_core.h:1417
Represents the entity initialised from a fighterClass.
Definition game_core.h:1094
Represents the entity initialised from a floorClass.
Definition game_core.h:1826
Holds options useful for user runtime preferences.
Definition game_core.h:199
Holds arguments for a game.
Definition game_core.h:1901
Holds the state of game progression.
Definition game_core.h:1358
Represents the entity initialised from a roomClass.
Definition game_core.h:1771
Holds arguments for a saveslot.
Definition game_core.h:409
Represents the entity initialised from a CounterType.
Definition game_core.h:1304
Defines the entity initialised from a winconClass.
Definition game_core.h:1339
Holds the lifetime stats of the player.
Definition game_core.h:780
Contains loaded values to pass to initRoom().
Definition game_core.h:1880
Holds arguments for a turnOption_OP.
Definition game_core.h:2124