Collab_RPG/src/dialogs.h

92 lines
4.1 KiB
C

#ifndef DIALOG_H
#define DIALOG_H
#include <gint/display.h>
#include <string.h>
#include "game.h"
#include "map.h"
#define F_WIDTH (32*PXSIZE)
#define F_HEIGHT (32*PXSIZE)
/* showtext_opt()
*
* Show some text in a box with word wrap for dialogs.
*
* game: The game struct of the current game.
* face: A bopti_image_t of the face of the person who's saying this
* text. This bopti_image_t should have a width of F_WIDTH and
* a height of F_HEIGHT.
* text: The text to display.
* call_before_end: A function called when the end of the text was displayed and
* the user pressed EXE (or wait_continue was true). His
* parameter game is the game struct passed to showtext_opt,
* and i is the current position in text.
* start_anim: A boolean, that, if he's true, makes that a little animation
* is shown at the start of showtext_opt.
* end_anim: A boolean, that, if he's true, makes that a little animation
* is shown at the end of showtext_opt.
* for_each_screen: A function called before a page of the dialog gets drawn.
* His parameter game is the game struct passed to
* showtext_opt, and i is the current position in text.
* line_duration: How many ms showtext_opt will wait after a line has been
* drawn.
* update_screen: When he's true showtext_opt will update the screen after
* drawing a line etc.
* start_i: At which position I start displaying the text.
* wait_continue: If I should wait that EXE is pressed after drawing a page.
*/
int showtext_opt(Game *game, bopti_image_t *face, char *text,
int call_before_end(Game *game, unsigned int i),
bool start_anim,
bool end_anim,
void for_each_screen(Game *game, unsigned int i),
int line_duration, bool update_screen, unsigned int start_i,
bool wait_continue);
/* showtext_dialog()
*
* Calls showtext_opt with default parameters.
*
* game: The game struct of the current game.
* face: A bopti_image_t of the face of the person who's saying this
* text. This bopti_image_t should have a width of F_WIDTH and a
* height of F_HEIGHT.
* text: The text to display.
* dialog_start: A boolean, that, if he's true, makes that a little animation is
* shown at the start of showtext_opt.
* dialog_end: A boolean, that, if he's true, makes that a little animation is
* shown at the end of showtext_opt.
*/
void showtext_dialog(Game *game, bopti_image_t *face, char *text,
bool dialog_start, bool dialog_end);
/* showtext_dialog_ask()
*
* Like showtext_dialog, but lets the user choose between multiple possible
* choices after displaying the text.
*
* game: The game struct of the current game.
* face: A bopti_image_t of the face of the person who's saying this
* text. This bopti_image_t should have a width of F_WIDTH and a
* height of F_HEIGHT.
* text: The text to display.
* start: A boolean, that, if he's true, makes that a little animation
* is shown at the start of showtext_opt.
* end: A boolean, that, if he's true, makes that a little animation
* is shown at the end of showtext_opt.
* choices: A pointer to null-terminated strings that are one after the
* other in memory. They should be one null-terminated string
* for each possible choice.
* choice_amount: The amount of possible choices in the choices zero-terminated
* strings.
* default_choice: The choice choosen by default when the dialog just opened.
*/
int showtext_dialog_ask(Game *game, bopti_image_t *face, char *text, bool start,
bool end, char *choices, int choices_amount,
int default_choice);
#endif