mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Added animation factory, fixed ub on wriggler, skyboxes and cake are loaded from otr, and fixed audio corruption
This commit is contained in:
+2
-67
@@ -135,6 +135,8 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"src/port/*.h"
|
||||
"src/port/*.c"
|
||||
"src/port/*.cpp"
|
||||
"src/port/importer/*.cpp"
|
||||
"src/port/importer/types/*.cpp"
|
||||
"text/*.c"
|
||||
"textures/*.h"
|
||||
"textures/*.c"
|
||||
@@ -146,33 +148,11 @@ list(FILTER ALL_FILES EXCLUDE REGEX "bin/eu/.*.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/game/main.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/pc/dlmalloc.c")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.tmp
|
||||
COMMAND ${CPP} -I${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/levels/level_headers.h.in > ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.tmp
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT include/level_headers.h
|
||||
COMMAND ${Python3_EXECUTABLE} tools/wrapinclude.py ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.tmp > ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.tmp
|
||||
)
|
||||
|
||||
list(APPEND ALL_FILES ${CMAKE_CURRENT_BINARY_DIR}/include/level_headers.h)
|
||||
|
||||
|
||||
#==============================================================================#
|
||||
# Generated Source Code Files #
|
||||
#==============================================================================#
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT assets/mario_anim_data.c
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/mario_anims_converter.py > ${CMAKE_CURRENT_BINARY_DIR}/assets/mario_anim_data.c
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
list(APPEND ALL_FILES ${CMAKE_CURRENT_BINARY_DIR}/assets/mario_anim_data.c)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT include/text_strings.h
|
||||
COMMAND $<TARGET_FILE:textconv> charmap.txt ${CMAKE_CURRENT_SOURCE_DIR}/include/text_strings.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/text_strings.h
|
||||
@@ -270,51 +250,6 @@ if(APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
#==============================================================================#
|
||||
# Texture Generation #
|
||||
#==============================================================================#
|
||||
|
||||
set (TEXTURE_ENCODING u8)
|
||||
set(INC_C_FILES "")
|
||||
|
||||
file(GLOB_RECURSE ORGFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "actors/*.png")
|
||||
file(GLOB_RECURSE ORGFILES2 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "levels/*.png")
|
||||
file(GLOB_RECURSE ORGFILES3 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "textures/*.png")
|
||||
list (APPEND ORGFILES ${ORGFILES2})
|
||||
list (APPEND ORGFILES ${ORGFILES3})
|
||||
list(FILTER ORGFILES EXCLUDE REGEX "textures/ipl3_raw/.*.png")
|
||||
list(FILTER ORGFILES EXCLUDE REGEX "textures/skyboxes/.*.png")
|
||||
foreach(orgfile ${ORGFILES})
|
||||
get_filename_component(OUTPUT_FILE_WLE ${orgfile} NAME_WLE)
|
||||
get_filename_component(OUTPUT_DIR ${orgfile} DIRECTORY)
|
||||
set(OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIR}/${OUTPUT_FILE_WLE}.inc.c)
|
||||
string(REPLACE "." ";" FORMAT ${OUTPUT_FILE_WLE})
|
||||
list(POP_BACK FORMAT FORMAT2)
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_DIR}
|
||||
VERBATIM COMMAND $<TARGET_FILE:n64graphics> -s ${TEXTURE_ENCODING} -i ${OUTPUT_FILE} -g ${CMAKE_CURRENT_SOURCE_DIR}/${orgfile} -f ${FORMAT2}
|
||||
DEPENDS n64graphics
|
||||
)
|
||||
list(APPEND INC_C_FILES ${OUTPUT_FILE})
|
||||
endforeach(orgfile)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text-tmp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/text/us
|
||||
COMMAND ${CPP} -I${CMAKE_CURRENT_SOURCE_DIR}/text/us ${CMAKE_CURRENT_SOURCE_DIR}/text/define_text.inc.c > ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text-tmp
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text.inc.c
|
||||
COMMAND $<TARGET_FILE:textconv> ${CMAKE_CURRENT_SOURCE_DIR}/charmap.txt ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text-tmp ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text.inc.c
|
||||
VERBATIM
|
||||
DEPENDS textconv
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text-tmp
|
||||
)
|
||||
|
||||
list(APPEND INC_C_FILES ${CMAKE_CURRENT_BINARY_DIR}/text/us/define_text.inc.c)
|
||||
|
||||
#==============================================================================#
|
||||
# Sound File Generation #
|
||||
#==============================================================================#
|
||||
|
||||
+438
-406
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
#include "levels/bbh/header.h"
|
||||
#include "levels/ccm/header.h"
|
||||
#include "levels/castle_inside/header.h"
|
||||
#include "levels/hmc/header.h"
|
||||
#include "levels/ssl/header.h"
|
||||
#include "levels/bob/header.h"
|
||||
#include "levels/sl/header.h"
|
||||
#include "levels/wdw/header.h"
|
||||
#include "levels/jrb/header.h"
|
||||
#include "levels/thi/header.h"
|
||||
#include "levels/ttc/header.h"
|
||||
#include "levels/rr/header.h"
|
||||
#include "levels/castle_grounds/header.h"
|
||||
#include "levels/bitdw/header.h"
|
||||
#include "levels/vcutm/header.h"
|
||||
#include "levels/bitfs/header.h"
|
||||
#include "levels/sa/header.h"
|
||||
#include "levels/bits/header.h"
|
||||
#include "levels/lll/header.h"
|
||||
#include "levels/ddd/header.h"
|
||||
#include "levels/wf/header.h"
|
||||
#include "levels/ending/header.h"
|
||||
#include "levels/castle_courtyard/header.h"
|
||||
#include "levels/pss/header.h"
|
||||
#include "levels/cotmc/header.h"
|
||||
#include "levels/totwc/header.h"
|
||||
#include "levels/bowser_1/header.h"
|
||||
#include "levels/wmotr/header.h"
|
||||
#include "levels/bowser_2/header.h"
|
||||
#include "levels/bowser_3/header.h"
|
||||
#include "levels/ttm/header.h"
|
||||
@@ -288,7 +288,6 @@ struct MarioState {
|
||||
/*0x94*/ struct PlayerCameraState *statusForCamera;
|
||||
/*0x98*/ struct MarioBodyState *marioBodyState;
|
||||
/*0x9C*/ struct Controller *controller;
|
||||
/*0xA0*/ struct DmaHandlerList *animList;
|
||||
/*0xA4*/ u32 collidedObjInteractTypes;
|
||||
/*0xA8*/ s16 numCoins;
|
||||
/*0xAA*/ s16 numStars;
|
||||
|
||||
@@ -233,8 +233,6 @@ const Gfx dl_cake_end_screen_eu_070297D8[] = {
|
||||
// VERSION_EU
|
||||
#else
|
||||
|
||||
#include "levels/ending/cake.inc.c"
|
||||
|
||||
// 0x07025800 - 0x07025840
|
||||
static const Vtx cake_end_vertex_07025800[] = {
|
||||
{{{ 0, 220, -1}, 0, { 0, 608}, {0xff, 0xff, 0xff, 0xff}}},
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
#define STUB_LEVEL(_0, _1, _2, _3, _4, _5, _6, _7, _8)
|
||||
#define DEFINE_LEVEL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) + 3
|
||||
static const LevelScript script_exec_level_table[2
|
||||
#include "level_defines.h"
|
||||
#include "levels/level_defines.h"
|
||||
];
|
||||
#undef DEFINE_LEVEL
|
||||
#undef STUB_LEVEL
|
||||
|
||||
+1
-1
Submodule libultraship updated: 555869b6c5...6abea588cd
@@ -150,9 +150,7 @@ void wiggler_init_segments(void) {
|
||||
cur_obj_unhide();
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
o->oHealth = 4; // This fixes Wiggler reading UB on his first frame of his acceleration, as his health is not set.
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -614,10 +614,6 @@ void setup_game_memory(void) {
|
||||
gPhysicalFramebuffers[0] = VIRTUAL_TO_PHYSICAL(gFramebuffer0);
|
||||
gPhysicalFramebuffers[1] = VIRTUAL_TO_PHYSICAL(gFramebuffer1);
|
||||
gPhysicalFramebuffers[2] = VIRTUAL_TO_PHYSICAL(gFramebuffer2);
|
||||
// Setup Mario Animations
|
||||
gMarioAnimsMemAlloc = main_pool_alloc(0x4000, MEMORY_POOL_LEFT);
|
||||
set_segment_base_addr(17, (void *) gMarioAnimsMemAlloc);
|
||||
setup_dma_table_list(&gMarioAnimsBuf, gMarioAnims, gMarioAnimsMemAlloc);
|
||||
// Setup Level Script Entry
|
||||
load_segment(0x10, _entrySegmentRomStart, _entrySegmentRomEnd, MEMORY_POOL_LEFT);
|
||||
// Setup Segment 2 (Fonts, Text, etc)
|
||||
|
||||
@@ -46,12 +46,6 @@ extern struct DemoInput *gCurrDemoInput;
|
||||
extern u16 gDemoInputListID;
|
||||
extern struct DemoInput gRecordedDemoInput;
|
||||
|
||||
// this area is the demo input + the header. when the demo is loaded in, there is a header the size
|
||||
// of a single word next to the input list. this word is the current ID count.
|
||||
extern struct DmaHandlerList gMarioAnimsBuf;
|
||||
|
||||
extern u8 gMarioAnims[];
|
||||
|
||||
extern u16 sRenderingFramebuffer;
|
||||
extern u32 gGlobalTimer;
|
||||
|
||||
|
||||
+10
-12
@@ -1,4 +1,5 @@
|
||||
#include <libultra/types.h>
|
||||
#include <libultraship.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "area.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
#include "save_file.h"
|
||||
#include "sound_init.h"
|
||||
#include "rumble_init.h"
|
||||
#include "animation_table.h"
|
||||
|
||||
u32 unused80339F10;
|
||||
u8 unused80339F1C[20];
|
||||
@@ -63,12 +65,11 @@ s32 is_anim_past_end(struct MarioState *m) {
|
||||
*/
|
||||
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
|
||||
struct Object *o = m->marioObj;
|
||||
struct Animation *targetAnim = m->animList->bufTarget;
|
||||
|
||||
if (load_patchable_table(m->animList, targetAnimID)) {
|
||||
targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
|
||||
targetAnim->index = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->index);
|
||||
}
|
||||
char gAnimationData[sizeof(gAnimationRoot) / sizeof(gAnimationRoot[0]) + 1];
|
||||
sprintf(gAnimationData, gAnimationRoot, targetAnimID);
|
||||
|
||||
struct Animation *targetAnim = ResourceGetDataByName(gAnimationData);
|
||||
|
||||
if (o->header.gfx.animInfo.animID != targetAnimID) {
|
||||
o->header.gfx.animInfo.animID = targetAnimID;
|
||||
@@ -96,12 +97,10 @@ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
|
||||
*/
|
||||
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) {
|
||||
struct Object *o = m->marioObj;
|
||||
struct Animation *targetAnim = m->animList->bufTarget;
|
||||
char gAnimationData[sizeof(gAnimationRoot) / sizeof(gAnimationRoot[0]) + 1];
|
||||
sprintf(gAnimationData, gAnimationRoot, targetAnimID);
|
||||
|
||||
if (load_patchable_table(m->animList, targetAnimID)) {
|
||||
targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
|
||||
targetAnim->index = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->index);
|
||||
}
|
||||
struct Animation *targetAnim = ResourceGetDataByName(gAnimationData);
|
||||
|
||||
if (o->header.gfx.animInfo.animID != targetAnimID) {
|
||||
o->header.gfx.animInfo.animID = targetAnimID;
|
||||
@@ -1876,7 +1875,6 @@ void init_mario_from_save_file(void) {
|
||||
gMarioState->statusForCamera = &gPlayerCameraState[0];
|
||||
gMarioState->marioBodyState = &gBodyStates[0];
|
||||
gMarioState->controller = &gControllers[0];
|
||||
gMarioState->animList = &gMarioAnimsBuf;
|
||||
|
||||
gMarioState->numCoins = 0;
|
||||
gMarioState->numStars =
|
||||
|
||||
@@ -511,17 +511,13 @@ static void geo_process_background(struct GraphNodeBackground *node) {
|
||||
if (list != NULL) {
|
||||
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
|
||||
} else if (gCurGraphNodeMasterList != NULL) {
|
||||
#ifndef F3DEX_GBI_2E
|
||||
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 7);
|
||||
#else
|
||||
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 8);
|
||||
#endif
|
||||
Gfx *gfx = gfxStart;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetCycleType(gfx++, G_CYC_FILL);
|
||||
gDPSetFillColor(gfx++, node->background);
|
||||
gDPFillRectangle(gfx++, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(0), BORDER_HEIGHT,
|
||||
gDPFillWideRectangle(gfx++, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(0), BORDER_HEIGHT,
|
||||
GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(0) - 1, SCREEN_HEIGHT - BORDER_HEIGHT - 1);
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Engine.h"
|
||||
#include "ImguiUI.h"
|
||||
#include "port/importer/AnimationFactory.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
@@ -13,6 +14,7 @@ GameEngine::GameEngine(){
|
||||
this->context = LUS::Context::CreateInstance("Ghostship", "sm64", "ghostship.cfg.json", { main, assets }, {}, 3);
|
||||
this->context->GetWindow()->SetTargetFps(30);
|
||||
this->context->GetWindow()->SetMaximumFrameLatency(1);
|
||||
this->context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::Anim, "Animation", std::make_shared<CubeOS::AnimationFactory>());
|
||||
}
|
||||
|
||||
void GameEngine::Create(){
|
||||
|
||||
+5
-6
@@ -4,8 +4,8 @@
|
||||
#include <vector>
|
||||
#include <Context.h>
|
||||
|
||||
#define SAMPLES_HIGH 762
|
||||
#define SAMPLES_LOW 720
|
||||
#define SAMPLES_HIGH 544
|
||||
#define SAMPLES_LOW 528
|
||||
#define AUDIO_FRAMES_PER_UPDATE 2
|
||||
#define NUM_AUDIO_CHANNELS 2
|
||||
|
||||
@@ -16,11 +16,10 @@ class GameEngine {
|
||||
std::shared_ptr<LUS::Context> context;
|
||||
|
||||
GameEngine();
|
||||
~GameEngine();
|
||||
static void Create(void);
|
||||
void StartFrame(void) const;
|
||||
static void Create();
|
||||
void StartFrame() const;
|
||||
static void RunCommands(Gfx* Commands);
|
||||
void ProcessFrame(void (*run_one_game_iter)(void)) const;
|
||||
void ProcessFrame(void (*run_one_game_iter)()) const;
|
||||
};
|
||||
#else
|
||||
uint32_t GameEngine_GetSampleRate();
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ void push_frame() {
|
||||
int samples_left = AudioPlayerBuffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||
|
||||
s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 2];
|
||||
s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3];
|
||||
for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
|
||||
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "AnimationFactory.h"
|
||||
#include "port/importer/types/Animation.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
std::shared_ptr<LUS::IResource> CubeOS::AnimationFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Animation>(initData);
|
||||
std::shared_ptr<LUS::ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<AnimationFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void CubeOS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<LUS::BinaryReader> reader, std::shared_ptr<LUS::IResource> resource) {
|
||||
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
||||
|
||||
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
||||
|
||||
animation->mData.flags = reader->ReadInt16();
|
||||
animation->mData.animYTransDivisor = reader->ReadInt16();
|
||||
animation->mData.startFrame = reader->ReadInt16();
|
||||
animation->mData.loopStart = reader->ReadInt16();
|
||||
animation->mData.loopEnd = reader->ReadInt16();
|
||||
animation->mData.unusedBoneCount = reader->ReadInt16();
|
||||
animation->mData.length = reader->ReadUInt64();
|
||||
|
||||
uint32_t indexCount = reader->ReadUInt32();
|
||||
animation->indices.reserve(indexCount);
|
||||
for (uint32_t i = 0; i < indexCount; i++) {
|
||||
animation->indices.push_back(reader->ReadUInt16());
|
||||
}
|
||||
|
||||
uint32_t valuesCount = reader->ReadUInt32();
|
||||
animation->values.reserve(valuesCount);
|
||||
for (uint32_t i = 0; i < valuesCount; i++) {
|
||||
animation->values.push_back(reader->ReadInt16());
|
||||
}
|
||||
|
||||
animation->mData.index = (uint16_t*)animation->indices.data();
|
||||
animation->mData.values = (int16_t*)animation->values.data();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "ResourceFactory.h"
|
||||
|
||||
namespace CubeOS{
|
||||
class AnimationFactory : public LUS::ResourceFactory {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class AnimationFactoryV0 : public LUS::ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<LUS::BinaryReader> reader, std::shared_ptr<LUS::IResource> resource) override;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "Animation.h"
|
||||
|
||||
namespace CubeOS {
|
||||
AnimationData* Animation::GetPointer() {
|
||||
return &mData;
|
||||
}
|
||||
|
||||
size_t Animation::GetPointerSize() {
|
||||
return sizeof(mData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <Resource.h>
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
namespace CubeOS {
|
||||
struct AnimationData {
|
||||
/*0x00*/ int16_t flags;
|
||||
/*0x02*/ int16_t animYTransDivisor;
|
||||
/*0x04*/ int16_t startFrame;
|
||||
/*0x06*/ int16_t loopStart;
|
||||
/*0x08*/ int16_t loopEnd;
|
||||
/*0x0A*/ int16_t unusedBoneCount;
|
||||
/*0x0C*/ const int16_t *values;
|
||||
/*0x10*/ const uint16_t *index;
|
||||
/*0x14*/ uint64_t length; // only used with Mario animations to determine how much to load. 0 otherwise.
|
||||
};
|
||||
|
||||
class Animation : public LUS::Resource<AnimationData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Animation() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
AnimationData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
AnimationData mData;
|
||||
|
||||
std::vector<uint16_t> indices;
|
||||
std::vector<int16_t> values;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user