helapordo 1.4.12
Loading...
Searching...
No Matches
game_curses.c File Reference
#include "game_curses.h"
Include dependency graph for game_curses.c:

Functions

void plot_line_in_ncurses (int x1, int y1, int x2, int y2)
 
void print_encoded_char (WINDOW *w, int y, int x, char c)
 Takes a WINDOW pointer, two integers for coordinates and a char.
 
void displayLore (char **lore_strings, int lore_counter)
 Displays a certain lore string.
 
void printBattleStats (WINDOW *wins[3], Fighter *f, Enemy *e)
 Takes a Fighter and a Enemy pointers and prints most of their values formatted.
 
void init_wins (WINDOW **wins, Enemy *e, Fighter *f)
 Takes an array pointer of WINDOW pointers, a Fighter and a Enemy pointers and initialises the passed windows.
 
void win_show (WINDOW *win, Enemy *e, Fighter *f, int isEnemy, int border)
 Takes a WINDOW , a Fighter and a Enemy pointers and prints the appropriate content to it based on isEnemy integer passed.
 
void print_in_panel (WINDOW *win, int starty, int startx, int width, Enemy *e, Fighter *f, int isEnemy)
 Takes a WINDOW , a Fighter and a Enemy pointers and prints the appropriate content to it based on isEnemy integer passed.
 
void printBossBattleStats (WINDOW *wins[3], Fighter *f, Boss *b)
 Takes a Fighter and a Boss pointers and prints most of their values formatted.
 
void init_boss_wins (WINDOW **wins, Boss *b, Fighter *f)
 Takes an array pointer of WINDOW pointers, a Fighter and a Boss pointers and initialises the passed windows.
 
void boss_win_show (WINDOW *win, Boss *b, Fighter *f, int isBoss, int border)
 Takes a WINDOW , a Fighter and a Boss pointers and prints the appropriate content to it based on isBoss integer passed.
 
void boss_print_in_panel (WINDOW *win, int starty, int startx, int width, Boss *b, Fighter *f, int isBoss)
 Takes a WINDOW , a Fighter and a Boss pointers and prints the appropriate content to it based on isBoss integer passed.
 
void setEnemySprite (Enemy *e)
 Takes a Enemy pointer and prepares its sprite field by copying it line by line from enemies_sprites, defined in sprites.h header.
 
void setBossSprite (Boss *b)
 Takes a Boss pointer and prepares its sprite field by copying it line by line from bosses_sprites, defined in sprites.h header.
 
void setFighterSprite (Fighter *f)
 Takes a Fighter pointer and prepares its sprite field by copying it line by line.
 
void setEquipslotSprite (Equipslot *s)
 Takes a Equipslot pointer and prepares its sprite field by copying it line by line from equipzones_sprites, defined in sprites.h header.
 
void setChestSprite (Chest *c)
 Takes a Chest pointer and prepares its sprite field by copying it line by line.
 
void updateSelectedConsumableW (WINDOW *w, MENU *my_menu, Fighter *f)
 Takes a WINDOW, a MENU and a Fighter pointers and updates the window contents with the selected Consumable from the fighter's bag, in the passed MENU pointer.
 
void updateSelectedArtifactW (WINDOW *w, MENU *my_menu, Fighter *f)
 Takes a WINDOW, a MENU and a Fighter pointers and updates the window contents with the selected Artifact from the Fighter's artifactsBag, in the passed MENU pointer.
 
void updateSelectedEquipW (WINDOW *w, MENU *my_menu, Equip *selected, Fighter *f)
 Takes a WINDOW and MENU pointers and updates the window contents with the passed Equip.
 
void updateEquipslotsWin (WINDOW *w, Fighter *f)
 Takes a WINDOW and Fighter pointers and updates the window contents with the current Equipzone information.
 
void updateSelectedSpecialW (WINDOW *w, MENU *my_menu, Fighter *f)
 Takes a WINDOW and MENU pointers and updates the window contents with the selected Special in the passed MENU pointer.
 
void updateShopDisplayW_Equip (WINDOW *w, Equip *e)
 Takes a WINDOW and Equip pointers and updates the window contents with the Equip stats.
 
void updateShopDisplayW_Consumable (WINDOW *w, Consumable *c)
 Takes a WINDOW and Consumable pointers and updates the window contents with the Consumable stats.
 
void printLoadout (Fighter *f)
 Takes a Fighter pointer and prints its current loadout from the equipslots field.
 
void display_printFoeParty (FoeParty *fp)
 Takes a FoeParty pointer and prints its current layout into up to 3 new WINDOWS, deleted before returning.
 
void debug_printFoeParty (FoeParty *fp)
 Takes a FoeParty pointer and prints its current values.
 
void displayEquipbagMenu (Fighter *f)
 Takes a Fighter pointer and displays its equipsbag information.
 
void handleConsumables (Fighter *f, Enemy *e, Boss *b, int isBoss)
 Takes a Fighter, an Enemy and a Boss pointers and prints content of consumablesBag before asking user input to use a Consumable.
 
void handleArtifacts (Fighter *f)
 Takes a Fighter pointer and prints content of artifactsBag.
 
void handleEquips (Fighter *f, Path *p)
 Takes a Fighter and a Path pointers and asks user input to manage the Equips in fighter's equipsBag.
 
void fight_Special (specialMove move, WINDOW *w, Fighter *f, Enemy *e, Boss *b, Path *p, int roomIndex, int enemyIndex, int isBoss)
 Takes a specialMove, a Fighter, a Enemy, a Boss and a Path pointers (and integers for current room and enemy indexes) and uses the requested special move.
 
void handleSpecials (Fighter *f, Enemy *e, Boss *b, Path *p, int roomIndex, int enemyIndex, int isBoss)
 Takes a Fighter, a Enemy, a Boss and a Path pointers (and integers for current room and enemy indexes) and asks user input to use an unlocked special attack.
 
void handleStats (Fighter *f)
 Takes a Fighter pointer and prints its stats field with all the values, formatted.
 
void handleTutorial (void)
 Shows tutorial info.
 
int handleRogueMenu (Gamestate *gmst, Path *p, Fighter *player, Room *room, loadInfo *load_info, Koliseo *kls, Koliseo_Temp *t_kls)
 Takes a Fighter, a Path, and a Room pointers and handles menu for Rogue mode.
 
int handleGameOptions (GameOptions *game_options)
 Takes a GameOptions pointer and prompts the user with a form to change options.
 
void draw_buildinfo (WINDOW *win)
 
int hlpd_prep_saveslot_path (char save_path[300], Fighter *player, Path *path, loadInfo *load_info, GameOptions *game_options)
 Prompts the user to pick a saveslot and stores the corresponding path into the passed buffer.
 
void hlpd_draw_notifications (RingaBuf *rb_notifications, WINDOW *notifications_win)
 Takes a RingaBuf to take the Notification from, and a WINDOW to draw them to.
 

Variables

callback_void_t callback_func_ptrs [SPECIALSMAX]
 
callback_void_t callback_artifact_ptrs [ARTIFACTSMAX]
 
callback_void_t callback_counter_ptrs [COUNTERSMAX]
 

Function Documentation

◆ boss_print_in_panel()

void boss_print_in_panel ( WINDOW * win,
int starty,
int startx,
int width,
Boss * b,
Fighter * f,
int isBoss )

Takes a WINDOW , a Fighter and a Boss pointers and prints the appropriate content to it based on isBoss integer passed.

Additional parameters set coordinates for the output.

See also
Fighter
Boss
Parameters
winThe WINDOW pointer to print to.
fThe Fighter pointer with stats to print.
bThe Boss pointer with stats to print.
isBossThe integer indicating if the current window is for the boss stats, the fighter stats or the legend panel.
startyThe integer indicating starting y coordinate.
startxThe integer indicating starting x coordinate.
widthThe integer indicating panel width.
See also
init_boss_wins()
boss_print_in_panel()

◆ boss_win_show()

void boss_win_show ( WINDOW * win,
Boss * b,
Fighter * f,
int isBoss,
int border )

Takes a WINDOW , a Fighter and a Boss pointers and prints the appropriate content to it based on isBoss integer passed.

See also
Fighter
Boss
Parameters
winThe WINDOW pointer to print to.
fThe Fighter pointer with stats to print.
bThe Boss pointer with stats to print.
isBossThe integer indicating if the current window is for the boss stats, the fighter stats or the legend panel.
borderThe integer indicating if the current window should have a horizontal line bordering the label text.
See also
init_boss_wins()
boss_print_in_panel()

◆ debug_printFoeParty()

void debug_printFoeParty ( FoeParty * fp)

Takes a FoeParty pointer and prints its current values.

See also
FoeParty
stringFromFoePartyClass()
Parameters
fpThe FoeParty pointer with to print.

◆ display_printFoeParty()

void display_printFoeParty ( FoeParty * fp)

Takes a FoeParty pointer and prints its current layout into up to 3 new WINDOWS, deleted before returning.

See also
FoeParty
stringFromFoePartyClass()
Parameters
fpThe FoeParty pointer whose layout will be displayed.

◆ displayEquipbagMenu()

void displayEquipbagMenu ( Fighter * f)

Takes a Fighter pointer and displays its equipsbag information.

See also
Fighter
Equip
EQUIPSMAX
handleEquips
Parameters
fThe fighter pointer whose equipsbag will be displayed.

◆ displayLore()

void displayLore ( char ** lore_strings,
int lore_counter )

Displays a certain lore string.

Parameters
lore_stringsThe array of strings to display from.
lore_counterThe index of current string.
See also
gameloop()

◆ draw_buildinfo()

void draw_buildinfo ( WINDOW * win)

◆ fight_Special()

void fight_Special ( specialMove move,
WINDOW * w,
Fighter * f,
Enemy * e,
Boss * b,
Path * p,
int roomIndex,
int enemyIndex,
int isBoss )

Takes a specialMove, a Fighter, a Enemy, a Boss and a Path pointers (and integers for current room and enemy indexes) and uses the requested special move.

Prints the result to the passed WINDOW. The isBoss integer determines if the receiver is the Enemy or the Boss.

See also
Fighter
SpecialSlot
SPECIALSMAX
Parameters
moveThe specialMove to execute.
wThe WINDOW pointer to print results to.
fThe Fighter pointer with a equipsBag.
eThe Enemy pointer for current enemy.
bThe Boss pointer.
pThe Path pointer of the current game.
roomIndexThe index of current room.
enemyIndexThe index of current enemy.
isBossIs equal to 1 when receiver is a Boss.

◆ handleArtifacts()

void handleArtifacts ( Fighter * f)

Takes a Fighter pointer and prints content of artifactsBag.

See also
Fighter
Artifact
ARTIFACTSMAX
printArtifactStats()
Parameters
fThe Fighter pointer at hand.

◆ handleConsumables()

void handleConsumables ( Fighter * f,
Enemy * e,
Boss * b,
int isBoss )

Takes a Fighter, an Enemy and a Boss pointers and prints content of consumablesBag before asking user input to use a Consumable.

isBoss is passed to useConsumable().

See also
Fighter
Enemy
Consumable
CONSUMABLESMAX
printConsumableStats()
useConsumable()
Parameters
fThe Fighter pointer using the Consumable.
eThe Enemy pointer for current enemy.
bThe Boss pointer for current boss.
isBossThe integer defining if effect applies enemy or boss (==1).

◆ handleEquips()

void handleEquips ( Fighter * f,
Path * p )

Takes a Fighter and a Path pointers and asks user input to manage the Equips in fighter's equipsBag.

User can view the bag, equip a new item, view its loadout or exit. Equipping an item causes all the relevant field in Fighter to be updated.

See also
Fighter
Equipslot
Equipzone
EQUIPZONES
Parameters
fThe Fighter pointer with a equipsBag.
pThe Path pointer of the current game.

◆ handleGameOptions()

int handleGameOptions ( GameOptions * game_options)

Takes a GameOptions pointer and prompts the user with a form to change options.

Parameters
game_optionsPointer to GameOptions. return 0 on success, non-zero on errors.

◆ handleRogueMenu()

int handleRogueMenu ( Gamestate * gmst,
Path * p,
Fighter * player,
Room * room,
loadInfo * load_info,
Koliseo * kls,
Koliseo_Temp * t_kls )

Takes a Fighter, a Path, and a Room pointers and handles menu for Rogue mode.

It also takes a loadInfo pointer to a struct used for loading a game. User is asked for turn choice and according to the input, the corresponding action will be called.

See also
Fighter
Path
Parameters
gmstPointer to Gamestate.
pThe Path pointer.
playerThe Fighter pointer at hand.
roomThe Room pointer for current room.
load_infoA pointer to loadInfo struct containing stuff for loading a game.
klsThe Koliseo used for allocations.
t_klsThe Koliseo_Temp used for temporary allocations.

◆ handleSpecials()

void handleSpecials ( Fighter * f,
Enemy * e,
Boss * b,
Path * p,
int roomIndex,
int enemyIndex,
int isBoss )

Takes a Fighter, a Enemy, a Boss and a Path pointers (and integers for current room and enemy indexes) and asks user input to use an unlocked special attack.

The isBoss integer determines if the receiver is the Enemy or the Boss. If the selected slot is enabled and fighter has enough energy, GET_CALLBACK() is called to have the special attack execute.

See also
Fighter
SpecialSlot
SPECIALSMAX
GET_CALLBACK()
Parameters
fThe Fighter pointer with a equipsBag.
eThe Enemy pointer for current enemy.
bThe Boss pointer.
pThe Path pointer of the current game.
roomIndexThe index of current room.
enemyIndexThe index of current enemy.
isBossIs equal to 1 when receiver is a Boss.

◆ handleStats()

void handleStats ( Fighter * f)

Takes a Fighter pointer and prints its stats field with all the values, formatted.

See also
Fighter
countStats
Parameters
fThe Fighter pointer with stats to print.

< Main window, used for fighter stats.

< Second window, used for lifetime stats.

◆ handleTutorial()

void handleTutorial ( void )

Shows tutorial info.

See also
gameloop()

◆ hlpd_draw_notifications()

void hlpd_draw_notifications ( RingaBuf * rb_notifications,
WINDOW * notifications_win )

Takes a RingaBuf to take the Notification from, and a WINDOW to draw them to.

Parameters
rb_notificationsThe RingaBuf holding the Notification
notifications_winThe WINDOW used to draw the notifications
See also
Notification
enqueue_notification()

◆ hlpd_prep_saveslot_path()

int hlpd_prep_saveslot_path ( char save_path[300],
Fighter * player,
Path * path,
loadInfo * load_info,
GameOptions * game_options )

Prompts the user to pick a saveslot and stores the corresponding path into the passed buffer.

See also
gameloop()
Parameters
save_pathThe buffer to print picked saveslot path to
playerPointer to the Fighter for player
pathPointer to current game Path
load_infoPointer to current game load_info
game_optionsPointer to current game_options
Returns
The picked saveslot index.

◆ init_boss_wins()

void init_boss_wins ( WINDOW ** wins,
Boss * b,
Fighter * f )

Takes an array pointer of WINDOW pointers, a Fighter and a Boss pointers and initialises the passed windows.

See also
Fighter
Boss
Parameters
winsThe WINDOW array pointer to initialise.
fThe Fighter pointer with stats to print.
bThe Boss pointer with stats to print.
See also
handleRoom_Boss()
boss_win_show()

◆ init_wins()

void init_wins ( WINDOW ** wins,
Enemy * e,
Fighter * f )

Takes an array pointer of WINDOW pointers, a Fighter and a Enemy pointers and initialises the passed windows.

See also
Fighter
Enemy
Parameters
winsThe WINDOW array pointer to initialise.
fThe Fighter pointer with stats to print.
eThe Enemy pointer with stats to print.
See also
handleRoom_Enemies()
win_show()

◆ plot_line_in_ncurses()

void plot_line_in_ncurses ( int x1,
int y1,
int x2,
int y2 )

◆ print_encoded_char()

void print_encoded_char ( WINDOW * w,
int y,
int x,
char c )

Takes a WINDOW pointer, two integers for coordinates and a char.

Prints the encoded value of the passed char to the window at the coordinates.

Parameters
wA pointer to the window to print to.
yCoordinate to print at.
xCoordinate to print at.
cThe encoded char to print.

◆ print_in_panel()

void print_in_panel ( WINDOW * win,
int starty,
int startx,
int width,
Enemy * e,
Fighter * f,
int isEnemy )

Takes a WINDOW , a Fighter and a Enemy pointers and prints the appropriate content to it based on isEnemy integer passed.

Additional parameters set coordinates for the output.

See also
Fighter
Enemy
Parameters
winThe WINDOW pointer to print to.
fThe Fighter pointer with stats to print.
eThe Enemy pointer with stats to print.
isEnemyThe integer indicating if the current window is for the enemy stats, the fighter stats or the legend panel.
startyThe integer indicating starting y coordinate.
startxThe integer indicating starting x coordinate.
widthThe integer indicating panel width.
See also
init_wins()
print_in_panel()

◆ printBattleStats()

void printBattleStats ( WINDOW * wins[3],
Fighter * f,
Enemy * e )

Takes a Fighter and a Enemy pointers and prints most of their values formatted.

For the Fighter, the equipboost values are also displayed.

See also
Fighter
Enemy
stringFromClass()
stringFromEClass()
stringFromStatus()
getEnemyXpGain()
Parameters
winsThe WINDOW array to print fighter, enemy an stat legend to.
fThe Fighter pointer with stats to print.
eThe Enemy pointer with stats to print.

◆ printBossBattleStats()

void printBossBattleStats ( WINDOW * wins[3],
Fighter * f,
Boss * b )

Takes a Fighter and a Boss pointers and prints most of their values formatted.

For the Fighter, the equipboost values are also displayed.

See also
Fighter
Boss
stringFromClass()
stringFromBossClass()
stringFromStatus()
getBossXpGain()
Parameters
winsThe WINDOW array to print fighter, enemy an stat legend to.
fThe Fighter pointer with stats to print.
bThe Boss pointer with stats to print.

◆ printLoadout()

void printLoadout ( Fighter * f)

Takes a Fighter pointer and prints its current loadout from the equipslots field.

See also
Fighter
Equipslot
Equipzone
EQUIPZONES
stringFromEquipzones()
stringFromQuality()
printQualityColor()
Parameters
fThe Fighter pointer with a loadout to print.

◆ setBossSprite()

void setBossSprite ( Boss * b)

Takes a Boss pointer and prepares its sprite field by copying it line by line from bosses_sprites, defined in sprites.h header.

See also
Boss
initBossStats
bosses_sprites
Parameters
bThe Boss pointer whose sprite field will be initialised.

◆ setChestSprite()

void setChestSprite ( Chest * c)

Takes a Chest pointer and prepares its sprite field by copying it line by line.

See also
Chest
initChest
Parameters
cThe Chest pointer whose sprite field will be initialised.

◆ setEnemySprite()

void setEnemySprite ( Enemy * e)

Takes a Enemy pointer and prepares its sprite field by copying it line by line from enemies_sprites, defined in sprites.h header.

See also
Enemy
initEnemyStats
enemies_sprites
Parameters
eThe Enemy pointer whose sprite field will be initialised.

◆ setEquipslotSprite()

void setEquipslotSprite ( Equipslot * s)

Takes a Equipslot pointer and prepares its sprite field by copying it line by line from equipzones_sprites, defined in sprites.h header.

See also
Equipslot
initEquipSlots()
equipzones_sprites
Parameters
sThe Equipslot pointer whose sprite field will be initialised.

◆ setFighterSprite()

void setFighterSprite ( Fighter * f)

Takes a Fighter pointer and prepares its sprite field by copying it line by line.

See also
Fighter
initPlayerStats
Parameters
fThe Fighter pointer whose sprite field will be initialised.

◆ updateEquipslotsWin()

void updateEquipslotsWin ( WINDOW * w,
Fighter * f )

Takes a WINDOW and Fighter pointers and updates the window contents with the current Equipzone information.

See also
Equipslot
Equipzone
EQUIPZONES
handleEquips
Parameters
wThe window pointer to print to.
fThe fighter pointer to get the equipslots from.

◆ updateSelectedArtifactW()

void updateSelectedArtifactW ( WINDOW * w,
MENU * my_menu,
Fighter * f )

Takes a WINDOW, a MENU and a Fighter pointers and updates the window contents with the selected Artifact from the Fighter's artifactsBag, in the passed MENU pointer.

See also
Artifact
artifactClass
ARTIFACTSMAX
handleArtifacts
Parameters
wThe window pointer to print into.
my_menuThe menu pointer to get the selection from.
fThe fighter pointer holding the artifactsBag.

◆ updateSelectedConsumableW()

void updateSelectedConsumableW ( WINDOW * w,
MENU * my_menu,
Fighter * f )

Takes a WINDOW, a MENU and a Fighter pointers and updates the window contents with the selected Consumable from the fighter's bag, in the passed MENU pointer.

See also
Consumable
consumableClass
CONSUMABLESMAX
handleConsumables
Parameters
wThe window pointer to print into.
my_menuThe menu to get the selection from.
fThe fighter pointer to get the bag from.

◆ updateSelectedEquipW()

void updateSelectedEquipW ( WINDOW * w,
MENU * my_menu,
Equip * selected,
Fighter * f )

Takes a WINDOW and MENU pointers and updates the window contents with the passed Equip.

See also
Equip
equipClass
EQUIPSMAX
handleEquips
displayEquipbagMenu()
Parameters
wThe window pointer to point into.
my_menuThe menu pointer to get the selection from.
fThe fighter pointer to get the equipslots from.
selectedThe equip pointer to print.

◆ updateSelectedSpecialW()

void updateSelectedSpecialW ( WINDOW * w,
MENU * my_menu,
Fighter * f )

Takes a WINDOW and MENU pointers and updates the window contents with the selected Special in the passed MENU pointer.

See also
Special
Specialslot
SPECIALSMAX
handleSpecials
Parameters
wThe window pointer to print into.
my_menuThe menu pointer to get the selection from.
fThe Fighter pointer regarding the specials.

◆ updateShopDisplayW_Consumable()

void updateShopDisplayW_Consumable ( WINDOW * w,
Consumable * c )

Takes a WINDOW and Consumable pointers and updates the window contents with the Consumable stats.

See also
Consumable
Shop
handleRoom_Shop()
Parameters
wThe window pointer to print into.
cThe Consumable to be printed.

◆ updateShopDisplayW_Equip()

void updateShopDisplayW_Equip ( WINDOW * w,
Equip * e )

Takes a WINDOW and Equip pointers and updates the window contents with the Equip stats.

See also
Equip
Shop
handleRoom_Shop()
Parameters
wThe window pointer to print into.
eThe Equip to be printed.

◆ win_show()

void win_show ( WINDOW * win,
Enemy * e,
Fighter * f,
int isEnemy,
int border )

Takes a WINDOW , a Fighter and a Enemy pointers and prints the appropriate content to it based on isEnemy integer passed.

See also
Fighter
Enemy
Parameters
winThe WINDOW pointer to print to.
fThe Fighter pointer with stats to print.
eThe Enemy pointer with stats to print.
isEnemyThe integer indicating if the current window is for the enemy stats, the fighter stats or the legend panel.
borderThe integer indicating if the current window should have a horizontal line bordering the label text.
See also
init_wins()
print_in_panel()

Variable Documentation

◆ callback_artifact_ptrs

callback_void_t callback_artifact_ptrs[ARTIFACTSMAX]

◆ callback_counter_ptrs

callback_void_t callback_counter_ptrs[COUNTERSMAX]

◆ callback_func_ptrs

callback_void_t callback_func_ptrs[SPECIALSMAX]