/** * Copyright (c) 2026 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "rpg/overworld/worldpos.h" #include "rpg/cutscene/item/cutsceneitembase.h" // Maximum number of waypoints a single ENTITY_WALK_TO/ // CUTSCENE_ENTITY_WALK_PATH may hold - generous relative to every current // asset/C-authored cutscene (none use more than a couple waypoints). #define CUTSCENE_ENTITY_WALK_TO_MAX 16 typedef struct { uint8_t entityIndex; worldpos_t positions[CUTSCENE_ENTITY_WALK_TO_MAX]; uint8_t count; bool_t walkAround; } cutsceneentitywalkto_t; typedef struct { uint8_t currentIndex; } cutsceneentitywalktodata_t; /** * Starts an entity walk-to item (resets the waypoint index). * * @param item The cutscene item. * @param data Runtime data storage. */ void cutsceneEntityWalkToStart( const cutsceneitem_t *item, cutsceneitemdata_t *data ); /** * Updates an entity walk-to item (steps the entity toward the next waypoint). * * @param item The cutscene item. * @param data Runtime data storage. * @returns true once all waypoints have been reached. */ bool_t cutsceneEntityWalkToUpdate( const cutsceneitem_t *item, cutsceneitemdata_t *data ); /** * Parses an ENTITY_WALK_TO cutscene item's JSON fields into item, writing * its "positions" array directly into item->entityWalkTo.positions (at * most CUTSCENE_ENTITY_WALK_TO_MAX entries). * * @param itemObj The item's JSON object. * @param item Destination item, already zeroed by the caller. * @return Error code indicating success or failure of the parse. */ errorret_t cutsceneEntityWalkToLoad( yyjson_val *itemObj, cutsceneitem_t *item );