65 lines
1.4 KiB
C
65 lines
1.4 KiB
C
/**
|
|
* Copyright (c) 2024 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "rpg/entity/entity.h"
|
|
#include "rpg/world/tile.h"
|
|
|
|
#define CONVERSATION_NEXT ((uint16_t)-1)
|
|
#define CONVERSATION_CONTINUE ((uint16_t)-2)
|
|
#define CONVERSATION_NOT_INITIALIZED ((uint16_t)-3)
|
|
#define CONVERSATION_RESTART CONVERSATION_NOT_INITIALIZED
|
|
#define CONVERSATION_DONE ((uint16_t)-4)
|
|
#define CONVERSATION_INVALID ((uint16_t)-5)
|
|
|
|
typedef struct _conversation_t conversation_t;
|
|
|
|
typedef uint16_t (*conversationcallback_t) (
|
|
conversation_t *convo, const uint16_t
|
|
);
|
|
|
|
typedef union {
|
|
struct {
|
|
entity_t *entity;
|
|
} entityInteract;
|
|
|
|
struct {
|
|
tile_t tile;
|
|
} tileInteract;
|
|
} conversationdata_t;
|
|
|
|
typedef struct _conversation_t {
|
|
uint16_t index;
|
|
conversationcallback_t init;
|
|
conversationcallback_t update;
|
|
conversationdata_t data;
|
|
} conversation_t;
|
|
|
|
extern conversation_t CONVERSATION;
|
|
|
|
/**
|
|
* Initializes the conversation object.
|
|
*/
|
|
void conversationInit();
|
|
|
|
/**
|
|
* Sets the conversation object.
|
|
*
|
|
* @param init The initialization callback.
|
|
* @param update The update callback.
|
|
* @param data The user data.
|
|
*/
|
|
void conversationSet(
|
|
const conversationcallback_t init,
|
|
const conversationcallback_t update,
|
|
const conversationdata_t data
|
|
);
|
|
|
|
/**
|
|
* Update a given conversation.
|
|
*/
|
|
void conversationUpdate(); |