Files
mtgodot-poc/extension/src/port/EterGrnLib/Motion.cpp
T
shenleiandClaude Opus 5.5 668f48d6ec port 2V2-d.2: Granny runtime on libgr2, main character model animates
Implement the Granny SDK 2.11 API the client uses on top of libgr2
(platform/EterGrnLib/GrannyRuntime.cpp, shim granny.h declared from the
SDK header): file sections, type-definition vertex conversion, material
textures by Usage, mesh/bone bindings, deformer, control clock/loop/ease
and weighted SRT sampling. Port EterGrnLib (LODController, Material, Mesh,
Model, ModelInstance*, Motion, Thing, ThingInstance, Util) plus EterLib
GrpObjectInstance/GrpCollisionObject/CollisionData verbatim and drop their
platform skeletons and pending stand-ins; register the gr2 resource
factory; vertex/index buffers are CPU-side until the 2V2-e render adapter.

app.UpdateGame/RenderGame now run 40250's bodies, reaching the
CPythonApplication members through their singletons (the platform has no
app object); CPythonGraphic joins GameSingletons in member order, and
GetMousePosition reads the host cursor.

port.login_flow asserts the main instance's PART_MAIN model has meshes,
its diffuse image loaded and the WAIT motion moves the bones between
frames; offline and live pass, port_gate macos PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 19:43:27 +09:00

71 lines
1.2 KiB
C++

#include "StdAfx.h"
#include "Motion.h"
CGrannyMotion::CGrannyMotion()
{
Initialize();
}
CGrannyMotion::~CGrannyMotion()
{
Destroy();
}
bool CGrannyMotion::IsEmpty()
{
return m_pgrnAni ? false : true;
}
void CGrannyMotion::Destroy()
{
Initialize();
}
void CGrannyMotion::Initialize()
{
m_pgrnAni = NULL;
}
bool CGrannyMotion::BindGrannyAnimation(granny_animation * pgrnAni)
{
assert(IsEmpty());
m_pgrnAni = pgrnAni;
return true;
}
granny_animation* CGrannyMotion::GetGrannyAnimationPointer() const
{
return m_pgrnAni;
}
const char * CGrannyMotion::GetName() const
{
return m_pgrnAni->Name;
}
float CGrannyMotion::GetDuration() const
{
return m_pgrnAni->Duration;
}
void CGrannyMotion::GetTextTrack(const char * c_szTextTrackName, int * pCount, float * pArray) const
{
if (m_pgrnAni->TrackGroupCount != 1)
{
// assert(!"CGrannyMotion::GetTextTrack - TrackCount is not 1");
}
granny_track_group * pTrack = m_pgrnAni->TrackGroups[0];
for (int i = 0; i < pTrack->TextTrackCount; ++i)
{
granny_text_track & rTextTrack = pTrack->TextTracks[i];
for (int j = 0; j < rTextTrack.EntryCount; ++j)
if (!_stricmp(c_szTextTrackName, rTextTrack.Entries[j].Text))
pArray[(*pCount)++] = rTextTrack.Entries[j].TimeStamp;
}
}