Begin refactor.

This commit is contained in:
2021-09-18 23:13:05 -07:00
parent df53c646a2
commit 2b7446b818
143 changed files with 1706 additions and 2345 deletions

View File

@ -6,8 +6,58 @@
*/
#pragma once
#include <dawn/dawn.h>
#include "../../libs.h"
#include "../../util/array.h"
#include "../../engine/engine.h"
#define ANIMATION_QUEUE_ITEM_MAX 128
#define ANIMATION_QUEUE_START 0xFF
typedef struct _queueaction_t queueaction_t;
typedef struct _queue_t queue_t;
/**
* Callback for queue events.
* @param conversation Conversation this text is attached to.
* @param text Text item that is being used in the callback
* @param i Index of the item in the queue.
*/
typedef void queuecallback_t(queue_t *queue, queueaction_t *action, uint8_t i);
typedef struct _queueaction_t {
/** Index that the action is within the queue */
uint8_t index;
/** Pointer to any custom user data */
void *data;
/** Callback to fire the moment the action is active in the queue */
queuecallback_t *onStart;
/** Callback to fire when this action has ended */
queuecallback_t *onEnd;
/** Callback to fire every update of this queue while action is active. */
queuecallback_t *onUpdate;
} queueaction_t;
typedef struct _queue_t {
/** Array of items within the queue. */
queueaction_t items[ANIMATION_QUEUE_ITEM_MAX];
uint8_t count;
/** Current index within the array of actions that is currently processing */
uint8_t current;
/** Internal timeline tracking */
float timeline;
/** Time that the current aciton started */
float actionStarted;
/** Delay Queue Item Storage */
float delays[ANIMATION_QUEUE_ITEM_MAX];
} queue_t;
/**
* Initialize the queue set.