Skip to content

Commit

Permalink
Make ui-player-properties, fixes #5305
Browse files Browse the repository at this point in the history
  • Loading branch information
NickMcConnell committed Mar 6, 2022
1 parent 6e1871e commit dc33bea
Show file tree
Hide file tree
Showing 12 changed files with 536 additions and 404 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ ADD_LIBRARY(OurCoreLib OBJECT
src/ui-object.c
src/ui-options.c
src/ui-output.c
src/ui-player-properties.c
src/ui-player.c
src/ui-prefs.c
src/ui-score.c
Expand Down
141 changes: 76 additions & 65 deletions src/Makefile.inc

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Makefile.src
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ ANGFILES = \
ui-object.o \
ui-options.o \
ui-output.o \
ui-player-properties.o \
ui-player.o \
ui-prefs.o \
ui-score.o \
Expand Down
38 changes: 38 additions & 0 deletions src/game-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "angband.h"
#include "cmd-core.h"
#include "game-input.h"
#include "player.h"

bool (*get_string_hook)(const char *prompt, char *buf, size_t len);
int (*get_quantity_hook)(const char *prompt, int max);
Expand All @@ -41,6 +42,10 @@ bool (*confirm_debug_hook)(void);
void (*get_panel_hook)(int *min_y, int *min_x, int *max_y, int *max_x);
bool (*panel_contains_hook)(unsigned int y, unsigned int x);
bool (*map_is_visible_hook)(void);
void (*view_abilities_hook)(struct player_ability *ability_list,
int num_abilities);
bool (*gain_specialty_hook)(int *pick);
void (*interact_with_specialties_hook)(void);

/**
* Prompt for a string from the user.
Expand Down Expand Up @@ -289,3 +294,36 @@ bool map_is_visible(void)
else
return true;
}

/**
* Browse player abilities
*/
void view_ability_menu(struct player_ability *ability_list,
int num_abilities)
{
/* Ask the UI for it */
if (view_abilities_hook)
view_abilities_hook(ability_list, num_abilities);
}

/**
* Interact with player abilities
*/
bool gain_specialty_menu(int *pick)
{
/* Ask the UI for it */
if (gain_specialty_hook)
return gain_specialty_hook(pick);
else
return false;
}

/**
* Interact with player abilities
*/
void interact_with_specialties(void)
{
/* Ask the UI for it */
if (interact_with_specialties_hook)
interact_with_specialties_hook();
}
9 changes: 9 additions & 0 deletions src/game-input.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define INCLUDED_GAME_INPUT_H

#include "cmd-core.h"
#include "player.h"

/**
* Bit flags for get_item() function
Expand Down Expand Up @@ -61,6 +62,10 @@ extern bool (*confirm_debug_hook)(void);
extern void (*get_panel_hook)(int *min_y, int *min_x, int *max_y, int *max_x);
extern bool (*panel_contains_hook)(unsigned int y, unsigned int x);
extern bool (*map_is_visible_hook)(void);
extern void (*view_abilities_hook)(struct player_ability *ability_list,
int num_abilities);
extern bool (*gain_specialty_hook)(int *pick);
extern void (*interact_with_specialties_hook)(void);

bool get_string(const char *prompt, char *buf, size_t len);
int get_quantity(const char *prompt, int max);
Expand All @@ -83,5 +88,9 @@ void get_panel(int *min_y, int *min_x, int *max_y, int *max_x);
bool confirm_debug(void);
bool panel_contains(unsigned int y, unsigned int x);
bool map_is_visible(void);
void view_ability_menu(struct player_ability *ability_list,
int num_abilities);
bool gain_specialty_menu(int *pick);
void interact_with_specialties(void);

#endif /* INCLUDED_GAME_INPUT_H */
Loading

0 comments on commit dc33bea

Please sign in to comment.