Collab_RPG/src/dialogs.h
2024-08-03 16:02:01 +02:00

102 lines
4.5 KiB
C

#ifndef DIALOG_H
#define DIALOG_H
#include "config.h"
#include "game.h"
#include "map.h"
#include <gint/display.h>
#include <string.h>
/**
*
* Show some text in a box with word wrap for dialogs.
*
* @param game The game struct of the current game.
* @param 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.
* @param text The text to display.
* @param call_before_end A function called when the end of the text was
* displayed and the user pressed SHIFT (or wait_continue
* was true). His parameter game is the game struct
* passed to showtext_opt, and i is the current position
* in text.
* @param start_anim A boolean, that, if he's true, makes that a little
* animation is shown at the start of showtext_opt.
* @param end_anim A boolean, that, if he's true, makes that a little
* animation is shown at the end of showtext_opt.
* @param 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.
* @param line_duration How many ms showtext_opt will wait after a line has
* been drawn.
* @param update_screen When he's true showtext_opt will update the screen
* after drawing a line etc.
* @param start_i At which position I start displaying the text.
* @param wait_continue If I should wait that EXE is pressed after drawing a
* page.
*
* @return TODO
*/
int dialogs_text_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);
/**
*
* Calls dialogs_text_opt with default parameters.
*
* @param game The game struct of the current game.
* @param 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.
* @param text The text to display.
* @param dialog_start A boolean, that, if he's true, makes that a little
* animation is shown at the start of showtext_opt.
* @param dialog_end A boolean, that, if he's true, makes that a little
* animation is shown at the end of showtext_opt.
*/
void dialogs_text(Game *game, bopti_image_t *face, char *text,
bool dialog_start, bool dialog_end);
/**
*
* Like dialogs_text, but lets the user choose between multiple possible
* choices after displaying the text.
*
* @param game The game struct of the current game.
* @param 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.
* @param text The text to display.
* @param start A boolean, that, if he's true, makes that a little
* animation is shown at the start of showtext_opt.
* @param end A boolean, that, if he's true, makes that a little
* animation is shown at the end of showtext_opt.
* @param 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.
* @param choice_amount The amount of possible choices in the choices
* zero-terminated strings.
* @param default_choice The choice choosen by default when the dialog just
* opened.
*/
int dialogs_ask(Game *game, bopti_image_t *face, char *text, bool start,
bool end, char *choices, int choices_amount,
int default_choice);
/**
* TODO: Doc.
*/
void dialogs_initiate_sequence(Game *game, bopti_image_t *face,
uint32_t dialogNumber);
#endif