Merge pull request 'Gitea actions' (#5) from gitea-actions into main
Build Dusk / run-tests (push) Successful in 5m39s
Build Dusk / build-linux (push) Successful in 5m20s
Build Dusk / build-psp (push) Successful in 1m22s
Build Dusk / build-knulli (push) Successful in 3m51s
Build Dusk / build-gamecube (push) Successful in 3m27s
Build Dusk / build-gamecube-iso (push) Successful in 3m25s
Build Dusk / build-wii (push) Successful in 3m2s
Build Dusk / build-wii-iso (push) Successful in 3m7s

Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2026-06-26 13:39:21 -05:00
17 changed files with 333 additions and 263 deletions
@@ -0,0 +1,49 @@
name: Setup devkitPro
description: Install devkitPro with GameCube/Wii packages on an Ubuntu runner
runs:
using: composite
steps:
- name: Install apt dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
python3 \
python3-pip \
python3-polib \
python3-pil \
python3-dotenv \
python3-pyqt5 \
python3-opengl \
xorriso
- name: Install devkitPro pacman
shell: bash
run: |
sudo ln -sf /proc/self/mounts /etc/mtab
wget https://apt.devkitpro.org/install-devkitpro-pacman \
-O /tmp/install-devkitpro-pacman
echo "=== installer script contents ==="
cat /tmp/install-devkitpro-pacman
echo "================================="
chmod +x /tmp/install-devkitpro-pacman
sudo /tmp/install-devkitpro-pacman
echo "DEVKITPRO=/opt/devkitpro" >> $GITHUB_ENV
echo "DEVKITPPC=/opt/devkitpro/devkitPPC" >> $GITHUB_ENV
echo "/opt/devkitpro/tools/bin" >> $GITHUB_PATH
echo "/opt/devkitpro/devkitPPC/bin" >> $GITHUB_PATH
- name: Install devkitPro GameCube/Wii packages
shell: bash
run: |
sudo dkp-pacman -S --needed --noconfirm \
gamecube-dev \
gamecube-sdl2 \
ppc-liblzma \
ppc-libzip \
libogc2 \
gamecube-tools \
ppc-libmad \
ppc-zlib-ng \
ppc-bzip2 \
ppc-zstd
+20
View File
@@ -0,0 +1,20 @@
name: Setup pspdev
description: Install the pspdev PSP toolchain on an Ubuntu runner
runs:
using: composite
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake python3 python3-pip python3-dotenv
- name: Install pspdev toolchain
shell: bash
run: |
wget -q \
https://github.com/pspdev/pspdev/releases/latest/download/pspdev-ubuntu-latest-x86_64.tar.gz \
-O /tmp/pspdev.tar.gz
sudo tar -xzf /tmp/pspdev.tar.gz -C /usr/local
echo "PSPDEV=/usr/local/pspdev" >> $GITHUB_ENV
echo "/usr/local/pspdev/bin" >> $GITHUB_PATH
+167 -64
View File
@@ -8,23 +8,63 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install dependencies
uses: docker/setup-docker-action@v5 run: |
- name: Run tests in Docker sudo apt-get update
run: ./scripts/test-linux-docker.sh sudo apt-get install -y \
build-essential \
cmake \
python3 \
python3-pip \
python3-polib \
python3-pil \
libsdl2-dev \
libgl1-mesa-dev \
libzip-dev \
python3-dotenv \
python3-pyqt5 \
python3-opengl \
xz-utils \
liblzma-dev \
libbz2-dev \
zlib1g-dev \
git \
libssl-dev
- name: Run tests
run: ./scripts/test-linux.sh
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install dependencies
uses: docker/setup-docker-action@v5 run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
python3 \
python3-pip \
python3-polib \
python3-pil \
libsdl2-dev \
libgl1-mesa-dev \
libzip-dev \
python3-dotenv \
python3-pyqt5 \
python3-opengl \
xz-utils \
liblzma-dev \
libbz2-dev \
zlib1g-dev \
git \
libssl-dev
- name: Build Linux - name: Build Linux
run: ./scripts/build-linux-docker.sh run: ./scripts/build-linux.sh
- name: Upload Linux binary - name: Upload Linux binary
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-linux name: dusk-linux
path: build-linux/Dusk path: build-linux/Dusk
@@ -34,53 +74,72 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Setup pspdev
uses: docker/setup-docker-action@v5 uses: ./.github/actions/setup-pspdev
- name: Build psp - name: Build PSP
run: ./scripts/build-psp-docker.sh run: ./scripts/build-psp.sh
- name: Move EBOOT.PBP to Dusk subfolder - name: Move EBOOT.PBP to Dusk subfolder
run: | run: |
mkdir -p ./git-artifcats/Dusk/PSP/GAME/Dusk mkdir -p ./git-artifcats/Dusk/PSP/GAME/Dusk
cp build-psp/EBOOT.PBP ./git-artifcats/Dusk/PSP/GAME/Dusk/EBOOT.PBP cp build-psp/EBOOT.PBP ./git-artifcats/Dusk/PSP/GAME/Dusk/EBOOT.PBP
- name: Upload psp binary - name: Upload PSP binary
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-psp name: dusk-psp
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
if-no-files-found: error if-no-files-found: error
# build-vita:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v6
# - name: Set up Docker
# uses: docker/setup-docker-action@v5
# - name: Build Vita
# run: ./scripts/build-vita-docker.sh
# - name: Upload Vita binary
# uses: actions/upload-artifact@v6
# with:
# name: dusk-vita
# path: build-vita/Dusk.vpk
# if-no-files-found: error
build-knulli: build-knulli:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: debian:trixie
steps: steps:
- name: Install Node.js
run: apt-get update && apt-get install -y nodejs
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install dependencies
uses: docker/setup-docker-action@v5 run: |
- name: Build knulli dpkg --add-architecture arm64
run: ./scripts/build-knulli-docker.sh apt-get update
apt-get install -y --no-install-recommends \
crossbuild-essential-arm64 \
ca-certificates \
pkg-config \
cmake \
make \
ninja-build \
git \
file \
python3 \
python3-pip \
python3-polib \
python3-pil \
python3-dotenv \
python3-pyqt5 \
python3-opengl \
liblua5.4-dev:arm64 \
xz-utils:arm64 \
libbz2-dev:arm64 \
zlib1g-dev:arm64 \
libzip-dev:arm64 \
libssl-dev:arm64 \
libsdl2-dev:arm64 \
liblzma-dev:arm64 \
libopengl0:arm64 \
libgl1:arm64 \
libegl1:arm64 \
libgles2:arm64 \
libgl1-mesa-dev:arm64
- name: Build Knulli
run: ./scripts/build-knulli.sh
- name: Move output to Dusk subfolder - name: Move output to Dusk subfolder
run: | run: |
mkdir -p ./git-artifcats/Dusk mkdir -p ./git-artifcats/Dusk
cp -r build-knulli/dusk ./git-artifcats/Dusk cp -r build-knulli/dusk ./git-artifcats/Dusk
- name: Upload knulli binary - name: Upload Knulli binary
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-knulli name: dusk-knulli
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
@@ -88,20 +147,31 @@ jobs:
build-gamecube: build-gamecube:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/extremscorner/libogc2:latest
steps: steps:
- name: Install Node.js
run: apt-get update && apt-get install -y nodejs
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install additional dependencies
uses: docker/setup-docker-action@v5 run: |
apt-get install -y \
python3-pip python3-polib python3-pil \
python3-dotenv python3-pyqt5 python3-opengl
dkp-pacman -Syu --noconfirm
dkp-pacman -S --needed --noconfirm \
gamecube-sdl2 ppc-liblzma ppc-libzip \
gamecube-tools ppc-libmad ppc-zlib-ng ppc-bzip2 ppc-zstd
- name: Build GameCube - name: Build GameCube
run: ./scripts/build-gamecube-docker.sh run: ./scripts/build-gamecube.sh
- name: Copy output files. - name: Copy output files
run: | run: |
mkdir -p ./git-artifcats/Dusk mkdir -p ./git-artifcats/Dusk
cp build-gamecube/Dusk.dol ./git-artifcats/Dusk/Dusk.dol cp build-gamecube/Dusk.dol ./git-artifcats/Dusk/Dusk.dol
cp build-gamecube/dusk.dsk ./git-artifcats/Dusk/dusk.dsk cp build-gamecube/dusk.dsk ./git-artifcats/Dusk/dusk.dsk
- name: Upload GameCube binary - name: Upload GameCube binary
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-gamecube name: dusk-gamecube
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
@@ -109,21 +179,32 @@ jobs:
build-gamecube-iso: build-gamecube-iso:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/extremscorner/libogc2:latest
steps: steps:
- name: Install Node.js
run: apt-get update && apt-get install -y nodejs
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install additional dependencies
uses: docker/setup-docker-action@v5 run: |
apt-get install -y \
python3-pip python3-polib python3-pil \
python3-dotenv python3-pyqt5 python3-opengl xorriso
dkp-pacman -Syu --noconfirm
dkp-pacman -S --needed --noconfirm \
gamecube-sdl2 ppc-liblzma ppc-libzip \
gamecube-tools ppc-libmad ppc-zlib-ng ppc-bzip2 ppc-zstd
- name: Build GameCube ISO - name: Build GameCube ISO
run: ./scripts/build-gamecube-iso-docker.sh run: ./scripts/build-gamecube-iso.sh
- name: Copy output files. - name: Copy output files
run: | run: |
mkdir -p ./git-artifcats/Dusk mkdir -p ./git-artifcats/Dusk
cp build-gamecube-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso cp build-gamecube-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso
cp build-gamecube-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso cp build-gamecube-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso
cp build-gamecube-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso cp build-gamecube-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso
- name: Upload GameCube ISO - name: Upload GameCube ISO
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-gamecube-iso name: dusk-gamecube-iso
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
@@ -131,21 +212,32 @@ jobs:
build-wii: build-wii:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/extremscorner/libogc2:latest
steps: steps:
- name: Install Node.js
run: apt-get update && apt-get install -y nodejs
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install additional dependencies
uses: docker/setup-docker-action@v5 run: |
apt-get install -y \
python3-pip python3-polib python3-pil \
python3-dotenv python3-pyqt5 python3-opengl
dkp-pacman -Syu --noconfirm
dkp-pacman -S --needed --noconfirm \
gamecube-sdl2 ppc-liblzma ppc-libzip \
gamecube-tools ppc-libmad ppc-zlib-ng ppc-bzip2 ppc-zstd
- name: Build Wii - name: Build Wii
run: ./scripts/build-wii-docker.sh run: ./scripts/build-wii.sh
- name: Copy output files. - name: Copy output files
run: | run: |
mkdir -p ./git-artifcats/Dusk/apps/Dusk mkdir -p ./git-artifcats/Dusk/apps/Dusk
cp build-wii/boot.dol ./git-artifcats/Dusk/apps/Dusk/boot.dol cp build-wii/boot.dol ./git-artifcats/Dusk/apps/Dusk/boot.dol
cp build-wii/dusk.dsk ./git-artifcats/Dusk/apps/Dusk/dusk.dsk cp build-wii/dusk.dsk ./git-artifcats/Dusk/apps/Dusk/dusk.dsk
cp build-wii/meta.xml ./git-artifcats/Dusk/apps/Dusk/meta.xml cp build-wii/meta.xml ./git-artifcats/Dusk/apps/Dusk/meta.xml
- name: Upload Wii binary - name: Upload Wii binary
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-wii name: dusk-wii
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
@@ -153,21 +245,32 @@ jobs:
build-wii-iso: build-wii-iso:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/extremscorner/libogc2:latest
steps: steps:
- name: Install Node.js
run: apt-get update && apt-get install -y nodejs
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Set up Docker - name: Install additional dependencies
uses: docker/setup-docker-action@v5 run: |
apt-get install -y \
python3-pip python3-polib python3-pil \
python3-dotenv python3-pyqt5 python3-opengl xorriso
dkp-pacman -Syu --noconfirm
dkp-pacman -S --needed --noconfirm \
gamecube-sdl2 ppc-liblzma ppc-libzip \
gamecube-tools ppc-libmad ppc-zlib-ng ppc-bzip2 ppc-zstd
- name: Build Wii ISO - name: Build Wii ISO
run: ./scripts/build-wii-iso-docker.sh run: ./scripts/build-wii-iso.sh
- name: Copy output files. - name: Copy output files
run: | run: |
mkdir -p ./git-artifcats/Dusk mkdir -p ./git-artifcats/Dusk
cp build-wii-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso cp build-wii-iso/Dusk-NTSC-J.iso ./git-artifcats/Dusk/Dusk-NTSC-J.iso
cp build-wii-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso cp build-wii-iso/Dusk-NTSC-U.iso ./git-artifcats/Dusk/Dusk-NTSC-U.iso
cp build-wii-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso cp build-wii-iso/Dusk-PAL.iso ./git-artifcats/Dusk/Dusk-PAL.iso
- name: Upload Wii ISO - name: Upload Wii ISO
uses: actions/upload-artifact@v6 uses: actions/upload-artifact@v3
with: with:
name: dusk-wii-iso name: dusk-wii-iso
path: ./git-artifcats/Dusk path: ./git-artifcats/Dusk
-1
View File
@@ -56,7 +56,6 @@ add_subdirectory(animation)
add_subdirectory(event) add_subdirectory(event)
add_subdirectory(assert) add_subdirectory(assert)
add_subdirectory(asset) add_subdirectory(asset)
add_subdirectory(cutscene)
add_subdirectory(console) add_subdirectory(console)
add_subdirectory(display) add_subdirectory(display)
add_subdirectory(log) add_subdirectory(log)
-9
View File
@@ -1,9 +0,0 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
target_sources(${DUSK_LIBRARY_TARGET_NAME}
PUBLIC
cutscene.c
)
-96
View File
@@ -1,96 +0,0 @@
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "cutscene.h"
#include "assert/assert.h"
#include "util/memory.h"
#include "console/console.h"
#include "time/time.h"
cutscene_t CUTSCENE;
errorret_t cutsceneInit(void) {
memoryZero(&CUTSCENE, sizeof(cutscene_t));
errorOk();
}
errorret_t cutsceneUpdate(void) {
#ifdef DUSK_TIME_DYNAMIC
if(TIME.dynamicUpdate) {
errorOk();
}
#endif
if(!CUTSCENE.active) errorOk();
cutsceneevent_t *event = &CUTSCENE.events[CUTSCENE.eventCurrent];
if(event->onUpdate) errorChain(event->onUpdate());
errorOk();
}
errorret_t cutscenePlay(
const cutsceneevent_t *events,
const uint8_t eventCount
) {
assertNotNull(events, "Events cannot be null");
assertTrue(eventCount > 0, "Event count must be greater than zero");
assertTrue(
eventCount <= CUTSCENE_EVENT_COUNT_MAX,
"Event count exceeds CUTSCENE_EVENT_COUNT_MAX"
);
if(CUTSCENE.active) {
errorChain(cutsceneStop());
}
memoryCopy(CUTSCENE.events, events, sizeof(cutsceneevent_t) * eventCount);
CUTSCENE.eventCount = eventCount;
CUTSCENE.eventCurrent = 0;
CUTSCENE.active = true;
cutsceneevent_t *firstEvent = &CUTSCENE.events[0];
if(firstEvent->onStart) errorChain(firstEvent->onStart());
errorOk();
}
errorret_t cutsceneAdvance(void) {
if(!CUTSCENE.active) errorOk();
cutsceneevent_t *currentEvent = &CUTSCENE.events[CUTSCENE.eventCurrent];
if(currentEvent->onEnd) errorChain(currentEvent->onEnd());
CUTSCENE.eventCurrent++;
if(CUTSCENE.eventCurrent >= CUTSCENE.eventCount) {
if(CUTSCENE.onStop) errorChain(CUTSCENE.onStop());
CUTSCENE.active = false;
errorOk();
}
cutsceneevent_t *nextEvent = &CUTSCENE.events[CUTSCENE.eventCurrent];
if(nextEvent->onStart) errorChain(nextEvent->onStart());
consolePrint("Cutscene advance");
errorOk();
}
errorret_t cutsceneStop(void) {
if(!CUTSCENE.active) errorOk();
cutsceneevent_t *currentEvent = &CUTSCENE.events[CUTSCENE.eventCurrent];
if(currentEvent->onEnd) errorChain(currentEvent->onEnd());
if(CUTSCENE.onStop) errorChain(CUTSCENE.onStop());
CUTSCENE.active = false;
errorOk();
}
errorret_t cutsceneDispose(void) {
errorChain(cutsceneStop());
errorOk();
}
bool_t cutsceneIsActive(void) {
return CUTSCENE.active;
}
-85
View File
@@ -1,85 +0,0 @@
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "error/error.h"
#define CUTSCENE_EVENT_COUNT_MAX 16
typedef struct {
errorret_t (*onStart)(void);
errorret_t (*onEnd)(void);
errorret_t (*onUpdate)(void);
} cutsceneevent_t;
typedef struct {
cutsceneevent_t events[CUTSCENE_EVENT_COUNT_MAX];
uint8_t eventCount;
uint8_t eventCurrent;
errorret_t (*onStop)(void);
bool_t active;
} cutscene_t;
extern cutscene_t CUTSCENE;
/**
* Initializes the cutscene manager.
*
* @return Any error state that happened.
*/
errorret_t cutsceneInit(void);
/**
* Ticks the active cutscene event, calling its onUpdate callback.
* Does nothing when no cutscene is playing.
*
* @return Any error state that happened.
*/
errorret_t cutsceneUpdate(void);
/**
* Copies the given event array and begins playing from the first
* event. If a cutscene is already playing it is stopped first.
*
* @param events Array of events to copy.
* @param eventCount Number of events. Must be > 0 and
* <= CUTSCENE_EVENT_COUNT_MAX.
* @return Any error state that happened.
*/
errorret_t cutscenePlay(
const cutsceneevent_t *events,
const uint8_t eventCount
);
/**
* Ends the current event and starts the next one.
* Marks the cutscene as inactive after the last event ends.
* Does nothing when no cutscene is playing.
*
* @return Any error state that happened.
*/
errorret_t cutsceneAdvance(void);
/**
* Ends the current event and stops the cutscene immediately.
* Does nothing when no cutscene is playing.
*
* @return Any error state that happened.
*/
errorret_t cutsceneStop(void);
/**
* Disposes of the cutscene manager, stopping any active cutscene.
*
* @return Any error state that happened.
*/
errorret_t cutsceneDispose(void);
/**
* Returns whether a cutscene is currently playing.
*
* @return true if a cutscene is active.
*/
bool_t cutsceneIsActive(void);
-4
View File
@@ -13,7 +13,6 @@
#include "rpg/rpg.h" #include "rpg/rpg.h"
#include "display/display.h" #include "display/display.h"
#include "scene/scene.h" #include "scene/scene.h"
#include "cutscene/cutscene.h"
#include "asset/asset.h" #include "asset/asset.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "assert/assert.h" #include "assert/assert.h"
@@ -42,7 +41,6 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
errorChain(localeManagerInit()); errorChain(localeManagerInit());
errorChain(displayInit()); errorChain(displayInit());
errorChain(uiInit()); errorChain(uiInit());
errorChain(cutsceneInit());
errorChain(rpgInit()); errorChain(rpgInit());
errorChain(networkInit()); errorChain(networkInit());
errorChain(sceneInit()); errorChain(sceneInit());
@@ -61,7 +59,6 @@ errorret_t engineUpdate(void) {
inputUpdate(); inputUpdate();
consoleUpdate(); consoleUpdate();
errorChain(rpgUpdate()); errorChain(rpgUpdate());
errorChain(cutsceneUpdate());
errorChain(sceneUpdate()); errorChain(sceneUpdate());
errorChain(assetUpdate()); errorChain(assetUpdate());
errorChain(uiUpdate()); errorChain(uiUpdate());
@@ -77,7 +74,6 @@ void engineExit(void) {
} }
errorret_t engineDispose(void) { errorret_t engineDispose(void) {
cutsceneDispose();
errorChain(sceneDispose()); errorChain(sceneDispose());
errorChain(networkDispose()); errorChain(networkDispose());
errorChain(rpgDispose()); errorChain(rpgDispose());
+6
View File
@@ -54,3 +54,9 @@ const cutsceneitem_t * cutsceneSystemGetCurrentItem() {
return &CUTSCENE_SYSTEM.scene->items[CUTSCENE_SYSTEM.currentItem]; return &CUTSCENE_SYSTEM.scene->items[CUTSCENE_SYSTEM.currentItem];
} }
void cutsceneSystemDispose() {
CUTSCENE_SYSTEM.scene = NULL;
CUTSCENE_SYSTEM.currentItem = 0xFF;
CUTSCENE_SYSTEM.mode = CUTSCENE_MODE_NONE;
}
+5
View File
@@ -48,3 +48,8 @@ void cutsceneSystemUpdate();
* @return Pointer to the current cutscene item. * @return Pointer to the current cutscene item.
*/ */
const cutsceneitem_t * cutsceneSystemGetCurrentItem(); const cutsceneitem_t * cutsceneSystemGetCurrentItem();
/**
* Disposes of the cutscene system, stopping any active cutscene.
*/
void cutsceneSystemDispose();
@@ -7,4 +7,5 @@
target_sources(${DUSK_LIBRARY_TARGET_NAME} target_sources(${DUSK_LIBRARY_TARGET_NAME}
PUBLIC PUBLIC
cutsceneitem.c cutsceneitem.c
cutsceneentitymove.c
) )
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "cutsceneentitymove.h"
#include "rpg/cutscene/cutscenesystem.h"
#include "rpg/entity/entity.h"
void cutsceneEntityMoveStart(const cutsceneitem_t *item) {
}
void cutsceneEntityMoveUpdate(const cutsceneitem_t *item) {
entity_t *entity = &ENTITIES[item->entityMove.entityIndex];
if(worldPosIsEqual(entity->position, item->entityMove.target)) {
cutsceneSystemNext();
return;
}
entitydir_t dir;
if(entity->position.x != item->entityMove.target.x) {
dir = entity->position.x < item->entityMove.target.x
? ENTITY_DIR_EAST : ENTITY_DIR_WEST;
} else {
dir = entity->position.y < item->entityMove.target.y
? ENTITY_DIR_SOUTH : ENTITY_DIR_NORTH;
}
if(entityCanTurn(entity)) entityTurn(entity, dir);
if(item->entityMove.run) {
if(entityCanRun(entity)) entityRun(entity, dir);
} else {
if(entityCanWalk(entity)) entityWalk(entity, dir);
}
}
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "cutsceneitem.h"
/**
* Handles the start of an entity move cutscene item.
*
* @param item The cutscene item.
*/
void cutsceneEntityMoveStart(const cutsceneitem_t *item);
/**
* Updates an entity move cutscene item, steering the entity one step
* per frame toward the target and advancing the cutscene on arrival.
*
* @param item The cutscene item.
*/
void cutsceneEntityMoveUpdate(const cutsceneitem_t *item);
@@ -6,6 +6,7 @@
*/ */
#include "rpg/cutscene/cutscenesystem.h" #include "rpg/cutscene/cutscenesystem.h"
#include "cutsceneentitymove.h"
#include "input/input.h" #include "input/input.h"
#include "time/time.h" #include "time/time.h"
@@ -31,6 +32,10 @@ void cutsceneItemStart(const cutsceneitem_t *item, cutsceneitemdata_t *data) {
if(item->cutscene != NULL) cutsceneSystemStartCutscene(item->cutscene); if(item->cutscene != NULL) cutsceneSystemStartCutscene(item->cutscene);
break; break;
case CUTSCENE_ITEM_TYPE_ENTITY_MOVE:
cutsceneEntityMoveStart(item);
break;
default: default:
break; break;
} }
@@ -48,6 +53,10 @@ void cutsceneItemUpdate(const cutsceneitem_t *item, cutsceneitemdata_t *data) {
if(data->wait <= 0) cutsceneSystemNext(); if(data->wait <= 0) cutsceneSystemNext();
break; break;
case CUTSCENE_ITEM_TYPE_ENTITY_MOVE:
cutsceneEntityMoveUpdate(item);
break;
default: default:
break; break;
} }
+8 -1
View File
@@ -9,6 +9,7 @@
#include "cutscenewait.h" #include "cutscenewait.h"
#include "cutscenecallback.h" #include "cutscenecallback.h"
#include "cutscenetext.h" #include "cutscenetext.h"
#include "rpg/overworld/worldpos.h"
typedef struct cutscene_s cutscene_t; typedef struct cutscene_s cutscene_t;
@@ -17,7 +18,8 @@ typedef enum {
CUTSCENE_ITEM_TYPE_TEXT, CUTSCENE_ITEM_TYPE_TEXT,
CUTSCENE_ITEM_TYPE_CALLBACK, CUTSCENE_ITEM_TYPE_CALLBACK,
CUTSCENE_ITEM_TYPE_WAIT, CUTSCENE_ITEM_TYPE_WAIT,
CUTSCENE_ITEM_TYPE_CUTSCENE CUTSCENE_ITEM_TYPE_CUTSCENE,
CUTSCENE_ITEM_TYPE_ENTITY_MOVE
} cutsceneitemtype_t; } cutsceneitemtype_t;
typedef struct cutsceneitem_s { typedef struct cutsceneitem_s {
@@ -29,6 +31,11 @@ typedef struct cutsceneitem_s {
cutscenecallback_t callback; cutscenecallback_t callback;
cutscenewait_t wait; cutscenewait_t wait;
const cutscene_t *cutscene; const cutscene_t *cutscene;
struct {
uint8_t entityIndex;
worldpos_t target;
bool_t run;
} entityMove;
}; };
} cutsceneitem_t; } cutsceneitem_t;
+1
View File
@@ -6,6 +6,7 @@
*/ */
#include "backpack.h" #include "backpack.h"
#include "assert/assert.h"
backpack_t BACKPACK; backpack_t BACKPACK;
+1
View File
@@ -72,6 +72,7 @@ errorret_t rpgUpdate(void) {
} }
errorret_t rpgDispose(void) { errorret_t rpgDispose(void) {
cutsceneSystemDispose();
errorChain(mapDispose()); errorChain(mapDispose());
errorOk(); errorOk();