Files
dusk/src/dusk/rpg/cutscene/item/entity/cutsceneentitywalkto.h
T
YourWishesandClaude Sonnet 5 68cebce04a Remove per-item cutscene authoring macros
Every CUTSCENE_XXX(...) shorthand (CUTSCENE_WAIT, CUTSCENE_TEXT,
CUTSCENE_ENTITY_WALK_TO, etc.) existed to build a cutsceneitem_t literal
in C; real cutscenes are now authored exclusively as .jsonc files, and
the only other users were test fixtures. Deletes all ~55 of these
macros (and the shared CUTSCENE_ITEM(...) helper they built on) along
with their doc comments, leaving each item's struct/enum/Start/Update/
Load declarations untouched.

test_battle.c, test_cutscenecontrol.c, test_cutscenemaparea.c,
test_cutscenesystem.c and test_entityinteract.c now build their
cutsceneitem_t fixtures as plain struct literals instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-14 11:20:58 -05:00

64 lines
1.7 KiB
C

/**
* 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
);