mirror of
https://github.com/isledecomp/isle.git
synced 2024-12-17 19:42:35 -05:00
Implement/match Write
functions in LegoAnim
class (#1232)
* Implement/match `LegoAnim::Write` * Implement remaining Write functions * Bump total function count
This commit is contained in:
parent
2e7f2edbf1
commit
1b4142c6a9
3 changed files with 320 additions and 39 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -139,7 +139,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT
|
reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT
|
||||||
reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT
|
reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT
|
||||||
reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4345 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT
|
reccmp-reccmp -S LEGO1PROGRESS.SVG -T 4352 --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT
|
||||||
|
|
||||||
- name: Compare Accuracy With Current Master
|
- name: Compare Accuracy With Current Master
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
@ -30,8 +30,28 @@ LegoResult LegoUnknownKey::Read(LegoStorage* p_storage)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = p_storage->Read(&m_z, sizeof(m_z));
|
if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) {
|
||||||
return result == SUCCESS ? SUCCESS : result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009f060
|
||||||
|
// FUNCTION: BETA10 0x1018133f
|
||||||
|
LegoResult LegoUnknownKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
|
||||||
|
if ((result = LegoAnimKey::Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009f0a0
|
// FUNCTION: LEGO1 0x1009f0a0
|
||||||
|
@ -67,6 +87,49 @@ LegoAnimScene::~LegoAnimScene()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009f120
|
||||||
|
// FUNCTION: BETA10 0x101814be
|
||||||
|
LegoResult LegoAnimScene::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
LegoS32 i;
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_unk0x00 != 0) {
|
||||||
|
for (i = 0; i < m_unk0x00; i++) {
|
||||||
|
if ((result = m_unk0x04[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_unk0x08 != 0) {
|
||||||
|
for (i = 0; i < m_unk0x08; i++) {
|
||||||
|
if ((result = m_unk0x0c[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_unk0x10 != 0) {
|
||||||
|
for (i = 0; i < m_unk0x10; i++) {
|
||||||
|
if ((result = m_unk0x14[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009f200
|
// FUNCTION: LEGO1 0x1009f200
|
||||||
LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
|
LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
|
@ -76,8 +139,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
|
||||||
if ((result = p_storage->Read(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) {
|
if ((result = p_storage->Read(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (m_unk0x00 != 0) {
|
||||||
if (m_unk0x00) {
|
|
||||||
m_unk0x04 = new LegoTranslationKey[m_unk0x00];
|
m_unk0x04 = new LegoTranslationKey[m_unk0x00];
|
||||||
for (i = 0; i < m_unk0x00; i++) {
|
for (i = 0; i < m_unk0x00; i++) {
|
||||||
if ((result = m_unk0x04[i].Read(p_storage)) != SUCCESS) {
|
if ((result = m_unk0x04[i].Read(p_storage)) != SUCCESS) {
|
||||||
|
@ -89,8 +151,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
|
||||||
if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
|
if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (m_unk0x08 != 0) {
|
||||||
if (m_unk0x08) {
|
|
||||||
m_unk0x0c = new LegoTranslationKey[m_unk0x08];
|
m_unk0x0c = new LegoTranslationKey[m_unk0x08];
|
||||||
for (i = 0; i < m_unk0x08; i++) {
|
for (i = 0; i < m_unk0x08; i++) {
|
||||||
if ((result = m_unk0x0c[i].Read(p_storage)) != SUCCESS) {
|
if ((result = m_unk0x0c[i].Read(p_storage)) != SUCCESS) {
|
||||||
|
@ -102,8 +163,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
|
||||||
if ((result = p_storage->Read(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) {
|
if ((result = p_storage->Read(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (m_unk0x10 != 0) {
|
||||||
if (m_unk0x10) {
|
|
||||||
m_unk0x14 = new LegoUnknownKey[m_unk0x10];
|
m_unk0x14 = new LegoUnknownKey[m_unk0x10];
|
||||||
for (i = 0; i < m_unk0x10; i++) {
|
for (i = 0; i < m_unk0x10; i++) {
|
||||||
if ((result = m_unk0x14[i].Read(p_storage)) != SUCCESS) {
|
if ((result = m_unk0x14[i].Read(p_storage)) != SUCCESS) {
|
||||||
|
@ -232,14 +292,28 @@ LegoAnimKey::LegoAnimKey()
|
||||||
LegoResult LegoAnimKey::Read(LegoStorage* p_storage)
|
LegoResult LegoAnimKey::Read(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
LegoResult result;
|
LegoResult result;
|
||||||
LegoS32 und;
|
LegoS32 timeAndFlags;
|
||||||
|
|
||||||
if ((result = p_storage->Read(&und, sizeof(und))) != SUCCESS) {
|
if ((result = p_storage->Read(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flags = (LegoU32) timeAndFlags >> 24;
|
||||||
|
m_time = timeAndFlags & 0xffffff;
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009f950
|
||||||
|
// FUNCTION: BETA10 0x1017e018
|
||||||
|
LegoResult LegoAnimKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
LegoS32 timeAndFlags = (LegoS32) m_time | (m_flags << 24);
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_flags = (LegoU32) und >> 24;
|
|
||||||
m_time = und & 0xffffff;
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +353,31 @@ LegoResult LegoTranslationKey::Read(LegoStorage* p_storage)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009fa40
|
||||||
|
// FUNCTION: BETA10 0x1017e1fd
|
||||||
|
LegoResult LegoTranslationKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
|
||||||
|
if ((result = LegoAnimKey::Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009faa0
|
// FUNCTION: LEGO1 0x1009faa0
|
||||||
// FUNCTION: BETA10 0x1017e2b3
|
// FUNCTION: BETA10 0x1017e2b3
|
||||||
LegoRotationKey::LegoRotationKey()
|
LegoRotationKey::LegoRotationKey()
|
||||||
|
@ -321,6 +420,35 @@ LegoResult LegoRotationKey::Read(LegoStorage* p_storage)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009fb30
|
||||||
|
// FUNCTION: BETA10 0x1017e3fc
|
||||||
|
LegoResult LegoRotationKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
|
||||||
|
if ((result = LegoAnimKey::Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_angle, sizeof(m_angle))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009fba0
|
// FUNCTION: LEGO1 0x1009fba0
|
||||||
LegoScaleKey::LegoScaleKey()
|
LegoScaleKey::LegoScaleKey()
|
||||||
{
|
{
|
||||||
|
@ -357,6 +485,31 @@ LegoResult LegoScaleKey::Read(LegoStorage* p_storage)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009fc90
|
||||||
|
// FUNCTION: BETA10 0x1017e664
|
||||||
|
LegoResult LegoScaleKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
|
||||||
|
if ((result = LegoAnimKey::Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009fcf0
|
// FUNCTION: LEGO1 0x1009fcf0
|
||||||
// FUNCTION: BETA10 0x1017e71a
|
// FUNCTION: BETA10 0x1017e71a
|
||||||
LegoAnimNodeData::LegoAnimNodeData()
|
LegoAnimNodeData::LegoAnimNodeData()
|
||||||
|
@ -400,6 +553,7 @@ LegoAnimNodeData::~LegoAnimNodeData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009fe60
|
// FUNCTION: LEGO1 0x1009fe60
|
||||||
|
// FUNCTION: BETA10 0x1017e949
|
||||||
LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
|
LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
LegoResult result;
|
LegoResult result;
|
||||||
|
@ -490,10 +644,70 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100a01e0
|
// FUNCTION: LEGO1 0x100a01e0
|
||||||
|
// FUNCTION: BETA10 0x1017ef0f
|
||||||
LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
|
LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
// TODO
|
LegoResult result;
|
||||||
|
LegoU32 length = 0;
|
||||||
|
LegoU32 i;
|
||||||
|
|
||||||
|
if (m_name != NULL) {
|
||||||
|
length = strlen(m_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&length, sizeof(length))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_name != NULL && (result = p_storage->Write(m_name, length)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_numTranslationKeys, sizeof(m_numTranslationKeys))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_numTranslationKeys != 0) {
|
||||||
|
for (i = 0; i < m_numTranslationKeys; i++) {
|
||||||
|
if ((result = m_translationKeys[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_numRotationKeys, sizeof(m_numRotationKeys))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_numRotationKeys != 0) {
|
||||||
|
for (i = 0; i < m_numRotationKeys; i++) {
|
||||||
|
if ((result = m_rotationKeys[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_numScaleKeys, sizeof(m_numScaleKeys))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_numScaleKeys != 0) {
|
||||||
|
for (i = 0; i < m_numScaleKeys; i++) {
|
||||||
|
if ((result = m_scaleKeys[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_numMorphKeys, sizeof(m_numMorphKeys))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (m_numMorphKeys != 0) {
|
||||||
|
for (i = 0; i < m_numMorphKeys; i++) {
|
||||||
|
if ((result = m_morphKeys[i].Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +1012,7 @@ inline LegoAnimKey& LegoAnimNodeData::GetKey(LegoU32 p_i, LegoAnimKey* p_keys, L
|
||||||
LegoAnim::LegoAnim()
|
LegoAnim::LegoAnim()
|
||||||
{
|
{
|
||||||
m_duration = 0;
|
m_duration = 0;
|
||||||
m_actors = NULL;
|
m_modelList = NULL;
|
||||||
m_numActors = 0;
|
m_numActors = 0;
|
||||||
m_camAnim = NULL;
|
m_camAnim = NULL;
|
||||||
}
|
}
|
||||||
|
@ -806,12 +1020,12 @@ LegoAnim::LegoAnim()
|
||||||
// FUNCTION: LEGO1 0x100a0bc0
|
// FUNCTION: LEGO1 0x100a0bc0
|
||||||
LegoAnim::~LegoAnim()
|
LegoAnim::~LegoAnim()
|
||||||
{
|
{
|
||||||
if (m_actors != NULL) {
|
if (m_modelList != NULL) {
|
||||||
for (LegoU32 i = 0; i < m_numActors; i++) {
|
for (LegoU32 i = 0; i < m_numActors; i++) {
|
||||||
delete[] m_actors[i].m_name;
|
delete[] m_modelList[i].m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] m_actors;
|
delete[] m_modelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_camAnim != NULL) {
|
if (m_camAnim != NULL) {
|
||||||
|
@ -829,7 +1043,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_actors = new LegoAnimActorEntry[length];
|
m_modelList = new LegoAnimActorEntry[length];
|
||||||
m_numActors = 0;
|
m_numActors = 0;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
|
@ -839,15 +1053,15 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length) {
|
if (length) {
|
||||||
m_actors[i].m_name = new LegoChar[length + 1];
|
m_modelList[i].m_name = new LegoChar[length + 1];
|
||||||
|
|
||||||
if (p_storage->Read(m_actors[i].m_name, length) != SUCCESS) {
|
if (p_storage->Read(m_modelList[i].m_name, length) != SUCCESS) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_actors[i].m_name[length] = '\0';
|
m_modelList[i].m_name[length] = '\0';
|
||||||
|
|
||||||
if (p_storage->Read(&m_actors[i].m_unk0x04, sizeof(m_actors[i].m_unk0x04)) != SUCCESS) {
|
if (p_storage->Read(&m_modelList[i].m_unk0x04, sizeof(m_modelList[i].m_unk0x04)) != SUCCESS) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -872,41 +1086,81 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
|
||||||
result = LegoTree::Read(p_storage);
|
result = LegoTree::Read(p_storage);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (result != SUCCESS && m_actors != NULL) {
|
if (result != SUCCESS && m_modelList != NULL) {
|
||||||
for (i = 0; i < m_numActors; i++) {
|
for (i = 0; i < m_numActors; i++) {
|
||||||
delete[] m_actors[i].m_name;
|
delete[] m_modelList[i].m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_numActors = 0;
|
m_numActors = 0;
|
||||||
delete[] m_actors;
|
delete[] m_modelList;
|
||||||
m_actors = NULL;
|
m_modelList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100a0e30
|
// FUNCTION: LEGO1 0x100a0e30
|
||||||
|
// FUNCTION: BETA10 0x1017fe3a
|
||||||
LegoResult LegoAnim::Write(LegoStorage* p_storage)
|
LegoResult LegoAnim::Write(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
// TODO
|
LegoResult result = FAILURE;
|
||||||
return SUCCESS;
|
LegoU32 i;
|
||||||
|
|
||||||
|
if (p_storage->Write(&m_numActors, sizeof(m_numActors)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < m_numActors; i++) {
|
||||||
|
LegoU32 length = strlen(m_modelList[i].m_name);
|
||||||
|
|
||||||
|
if (p_storage->Write(&length, sizeof(length)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length != 0) {
|
||||||
|
if (p_storage->Write(m_modelList[i].m_name, length) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_storage->Write(&m_modelList[i].m_unk0x04, sizeof(m_modelList[i].m_unk0x04)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_storage->Write(&m_duration, sizeof(m_duration)) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_camAnim != NULL) {
|
||||||
|
if (m_camAnim->Write(p_storage) != SUCCESS) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = LegoTree::Write(p_storage);
|
||||||
|
|
||||||
|
done:
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a0f20
|
// FUNCTION: LEGO1 0x100a0f20
|
||||||
|
// FUNCTION: BETA10 0x101801fd
|
||||||
const LegoChar* LegoAnim::GetActorName(LegoU32 p_index)
|
const LegoChar* LegoAnim::GetActorName(LegoU32 p_index)
|
||||||
{
|
{
|
||||||
if (p_index < m_numActors) {
|
if (p_index < m_numActors) {
|
||||||
return m_actors[p_index].m_name;
|
return m_modelList[p_index].m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a0f40
|
// FUNCTION: LEGO1 0x100a0f40
|
||||||
|
// FUNCTION: BETA10 0x1018023c
|
||||||
undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index)
|
undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index)
|
||||||
{
|
{
|
||||||
if (p_index < m_numActors) {
|
if (p_index < m_numActors) {
|
||||||
return m_actors[p_index].m_unk0x04;
|
return m_modelList[p_index].m_unk0x04;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -928,6 +1182,26 @@ LegoResult LegoMorphKey::Read(LegoStorage* p_storage)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08));
|
if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
|
||||||
return result == SUCCESS ? SUCCESS : result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x100a0fb0
|
||||||
|
// FUNCTION: BETA10 0x10180308
|
||||||
|
LegoResult LegoMorphKey::Write(LegoStorage* p_storage)
|
||||||
|
{
|
||||||
|
LegoResult result;
|
||||||
|
|
||||||
|
if ((result = LegoAnimKey::Write(p_storage)) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ class LegoAnimKey {
|
||||||
|
|
||||||
LegoAnimKey();
|
LegoAnimKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
LegoFloat GetTime() { return m_time; }
|
LegoFloat GetTime() { return m_time; }
|
||||||
|
|
||||||
// The different types (LegoFloat vs. MxS32) are correct according to BETA10
|
// The different types (LegoFloat vs. MxS32) are correct according to BETA10
|
||||||
|
@ -49,6 +50,7 @@ class LegoTranslationKey : public LegoAnimKey {
|
||||||
public:
|
public:
|
||||||
LegoTranslationKey();
|
LegoTranslationKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
LegoFloat GetX() { return m_x; }
|
LegoFloat GetX() { return m_x; }
|
||||||
void SetX(LegoFloat p_x) { m_x = p_x; }
|
void SetX(LegoFloat p_x) { m_x = p_x; }
|
||||||
LegoFloat GetY() { return m_y; }
|
LegoFloat GetY() { return m_y; }
|
||||||
|
@ -67,6 +69,7 @@ class LegoRotationKey : public LegoAnimKey {
|
||||||
public:
|
public:
|
||||||
LegoRotationKey();
|
LegoRotationKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x10073a00
|
// FUNCTION: BETA10 0x10073a00
|
||||||
LegoFloat GetAngle() { return m_angle; }
|
LegoFloat GetAngle() { return m_angle; }
|
||||||
|
@ -104,6 +107,7 @@ class LegoScaleKey : public LegoAnimKey {
|
||||||
public:
|
public:
|
||||||
LegoScaleKey();
|
LegoScaleKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
LegoFloat GetX() { return m_x; }
|
LegoFloat GetX() { return m_x; }
|
||||||
void SetX(LegoFloat p_x) { m_x = p_x; }
|
void SetX(LegoFloat p_x) { m_x = p_x; }
|
||||||
LegoFloat GetY() { return m_y; }
|
LegoFloat GetY() { return m_y; }
|
||||||
|
@ -122,6 +126,7 @@ class LegoMorphKey : public LegoAnimKey {
|
||||||
public:
|
public:
|
||||||
LegoMorphKey();
|
LegoMorphKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
LegoBool GetUnknown0x08() { return m_unk0x08; }
|
LegoBool GetUnknown0x08() { return m_unk0x08; }
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x100738d0
|
// FUNCTION: BETA10 0x100738d0
|
||||||
|
@ -136,6 +141,7 @@ class LegoUnknownKey : public LegoAnimKey {
|
||||||
public:
|
public:
|
||||||
LegoUnknownKey();
|
LegoUnknownKey();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
|
|
||||||
LegoFloat GetZ() { return m_z; }
|
LegoFloat GetZ() { return m_z; }
|
||||||
|
|
||||||
|
@ -291,6 +297,7 @@ class LegoAnimScene {
|
||||||
LegoAnimScene();
|
LegoAnimScene();
|
||||||
~LegoAnimScene();
|
~LegoAnimScene();
|
||||||
LegoResult Read(LegoStorage* p_storage);
|
LegoResult Read(LegoStorage* p_storage);
|
||||||
|
LegoResult Write(LegoStorage* p_storage);
|
||||||
LegoResult FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix);
|
LegoResult FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix);
|
||||||
|
|
||||||
LegoU32 GetUnknown0x18() { return m_unk0x18; }
|
LegoU32 GetUnknown0x18() { return m_unk0x18; }
|
||||||
|
@ -337,10 +344,10 @@ class LegoAnim : public LegoTree {
|
||||||
// LegoAnim::`scalar deleting destructor'
|
// LegoAnim::`scalar deleting destructor'
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LegoTime m_duration; // 0x08
|
LegoTime m_duration; // 0x08
|
||||||
LegoAnimActorEntry* m_actors; // 0x0c
|
LegoAnimActorEntry* m_modelList; // 0x0c
|
||||||
LegoU32 m_numActors; // 0x10
|
LegoU32 m_numActors; // 0x10
|
||||||
LegoAnimScene* m_camAnim; // 0x14
|
LegoAnimScene* m_camAnim; // 0x14
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a1040
|
// FUNCTION: LEGO1 0x100a1040
|
||||||
LegoTreeNodeData* CreateData() override { return new LegoAnimNodeData(); } // vtable+0x0c
|
LegoTreeNodeData* CreateData() override { return new LegoAnimNodeData(); } // vtable+0x0c
|
||||||
|
|
Loading…
Reference in a new issue