2011-05-08 13:48:25 +02:00
|
|
|
/*
|
2019-08-03 19:43:48 +02:00
|
|
|
* This software is licensed under the terms of the MIT License.
|
2017-02-11 04:52:08 +01:00
|
|
|
* See COPYING for further information.
|
2011-05-08 13:48:25 +02:00
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2011-05-08 13:48:25 +02:00
|
|
|
*/
|
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#ifndef IGUARD_dialog_h
|
|
|
|
#define IGUARD_dialog_h
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
2011-05-08 13:48:25 +02:00
|
|
|
|
2018-02-06 07:19:25 +01:00
|
|
|
#include "resource/sprite.h"
|
2011-05-08 13:48:25 +02:00
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
struct DialogAction;
|
2011-05-08 13:48:25 +02:00
|
|
|
|
|
|
|
typedef enum {
|
2019-07-08 02:47:50 +02:00
|
|
|
DIALOG_RIGHT,
|
|
|
|
DIALOG_LEFT,
|
|
|
|
} DialogSide;
|
2011-05-08 13:48:25 +02:00
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
typedef enum {
|
|
|
|
DIALOG_MSG_RIGHT = DIALOG_RIGHT,
|
|
|
|
DIALOG_MSG_LEFT = DIALOG_LEFT,
|
2019-08-22 21:43:34 +02:00
|
|
|
DIALOG_SET_BGM,
|
|
|
|
DIALOG_SET_FACE_RIGHT,
|
|
|
|
DIALOG_SET_FACE_LEFT,
|
2019-07-08 02:47:50 +02:00
|
|
|
} DialogActionType;
|
|
|
|
|
|
|
|
typedef struct DialogAction {
|
|
|
|
DialogActionType type;
|
2019-08-22 21:43:34 +02:00
|
|
|
const char *data;
|
2017-11-12 18:16:15 +01:00
|
|
|
int timeout;
|
2019-07-08 02:47:50 +02:00
|
|
|
} DialogAction;
|
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
typedef struct Dialog {
|
2019-07-08 02:47:50 +02:00
|
|
|
DialogAction *actions;
|
2019-08-22 21:43:34 +02:00
|
|
|
|
|
|
|
Sprite *spr_base[2];
|
|
|
|
Sprite *spr_face[2];
|
|
|
|
|
|
|
|
Sprite spr_composite[2];
|
|
|
|
uint valid_composites;
|
2017-02-11 04:52:08 +01:00
|
|
|
|
2011-05-08 13:48:25 +02:00
|
|
|
int count;
|
|
|
|
int pos;
|
|
|
|
int page_time;
|
|
|
|
int birthtime;
|
2019-07-03 19:50:43 +02:00
|
|
|
|
|
|
|
float opacity;
|
2011-05-08 13:48:25 +02:00
|
|
|
} Dialog;
|
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
Dialog *dialog_create(void)
|
2019-08-04 00:29:41 +02:00
|
|
|
attr_returns_allocated;
|
2018-04-12 16:08:48 +02:00
|
|
|
|
2019-08-22 21:43:34 +02:00
|
|
|
void dialog_set_base(Dialog *d, DialogSide side, const char *sprite)
|
2019-07-08 02:47:50 +02:00
|
|
|
attr_nonnull(1);
|
|
|
|
|
2019-08-22 21:43:34 +02:00
|
|
|
void dialog_set_base_p(Dialog *d, DialogSide side, Sprite *sprite)
|
|
|
|
attr_nonnull(1);
|
2019-07-08 02:47:50 +02:00
|
|
|
|
2019-08-22 21:43:34 +02:00
|
|
|
void dialog_set_face(Dialog *d, DialogSide side, const char *sprite)
|
|
|
|
attr_nonnull(1);
|
|
|
|
|
|
|
|
void dialog_set_face_p(Dialog *d, DialogSide side, Sprite *sprite)
|
|
|
|
attr_nonnull(1);
|
2019-07-08 02:47:50 +02:00
|
|
|
|
2019-08-22 21:43:34 +02:00
|
|
|
void dialog_set_char(Dialog *d, DialogSide side, const char *char_name, const char *char_face, const char *char_variant)
|
|
|
|
attr_nonnull(1, 3, 4);
|
2018-04-12 16:08:48 +02:00
|
|
|
|
2019-08-22 21:43:34 +02:00
|
|
|
DialogAction *dialog_add_action(Dialog *d, const DialogAction *action)
|
|
|
|
attr_nonnull(1, 2);
|
2018-04-12 16:08:48 +02:00
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
void dialog_destroy(Dialog *d)
|
2018-04-12 16:08:48 +02:00
|
|
|
attr_nonnull(1);
|
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
void dialog_draw(Dialog *dialog);
|
2011-05-08 13:48:25 +02:00
|
|
|
|
2019-07-08 02:47:50 +02:00
|
|
|
bool dialog_page(Dialog **d) attr_nonnull(1);
|
|
|
|
void dialog_update(Dialog **d) attr_nonnull(1);
|
2018-07-15 17:48:22 +02:00
|
|
|
|
2019-07-03 19:50:43 +02:00
|
|
|
bool dialog_is_active(Dialog *d);
|
|
|
|
|
2019-09-12 17:33:08 +02:00
|
|
|
void dialog_preload(void);
|
|
|
|
|
2018-07-15 17:48:22 +02:00
|
|
|
// FIXME: might not be the best place for this
|
|
|
|
typedef struct PlayerDialogProcs {
|
|
|
|
void (*stage1_pre_boss)(Dialog *d);
|
|
|
|
void (*stage1_post_boss)(Dialog *d);
|
|
|
|
void (*stage2_pre_boss)(Dialog *d);
|
|
|
|
void (*stage2_post_boss)(Dialog *d);
|
|
|
|
void (*stage3_pre_boss)(Dialog *d);
|
|
|
|
void (*stage3_post_boss)(Dialog *d);
|
|
|
|
void (*stage4_pre_boss)(Dialog *d);
|
|
|
|
void (*stage4_post_boss)(Dialog *d);
|
|
|
|
void (*stage5_post_midboss)(Dialog *d);
|
|
|
|
void (*stage5_pre_boss)(Dialog *d);
|
|
|
|
void (*stage5_post_boss)(Dialog *d);
|
|
|
|
void (*stage6_pre_boss)(Dialog *d);
|
|
|
|
void (*stage6_pre_final)(Dialog *d);
|
|
|
|
} PlayerDialogProcs;
|
2019-01-23 21:10:43 +01:00
|
|
|
|
|
|
|
#endif // IGUARD_dialog_h
|