mirror of
https://github.com/isledecomp/isle.git
synced 2025-12-10 08:03:13 +00:00
Refactor deserialization of objects (#170)
* Use template helpers for deserialization * Remove space * Fix naming
This commit is contained in:
committed by
GitHub
parent
62b97b8f1f
commit
a9fa734844
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "mxomni.h"
|
||||
#include "mxtimer.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
@@ -84,38 +85,24 @@ void MxDSAction::Deserialize(char **p_source, MxS16 p_unk24)
|
||||
{
|
||||
MxDSObject::Deserialize(p_source, p_unk24);
|
||||
|
||||
this->m_flags = *(MxU32*) *p_source;
|
||||
*p_source += sizeof(MxU32);
|
||||
this->m_startTime = *(MxLong*) *p_source;
|
||||
*p_source += sizeof(MxLong);
|
||||
this->m_duration = *(MxLong*) *p_source;
|
||||
*p_source += sizeof(MxLong);
|
||||
this->m_loopCount = *(MxS32*) *p_source;
|
||||
*p_source += sizeof(MxS32);
|
||||
this->m_location[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_location[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_location[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_direction[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[0] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[1] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
this->m_up[2] = *(double*) *p_source;
|
||||
*p_source += sizeof(double);
|
||||
GetScalar(p_source, this->m_flags);
|
||||
GetScalar(p_source, this->m_startTime);
|
||||
GetScalar(p_source, this->m_duration);
|
||||
GetScalar(p_source, this->m_loopCount);
|
||||
GetDouble(p_source, this->m_location[0]);
|
||||
GetDouble(p_source, this->m_location[1]);
|
||||
GetDouble(p_source, this->m_location[2]);
|
||||
GetDouble(p_source, this->m_direction[0]);
|
||||
GetDouble(p_source, this->m_direction[1]);
|
||||
GetDouble(p_source, this->m_direction[2]);
|
||||
GetDouble(p_source, this->m_up[0]);
|
||||
GetDouble(p_source, this->m_up[1]);
|
||||
GetDouble(p_source, this->m_up[2]);
|
||||
|
||||
MxU16 unkLength = *(MxU16*) *p_source;
|
||||
*p_source += sizeof(MxU16);
|
||||
if (unkLength) {
|
||||
AppendData(unkLength, *p_source);
|
||||
*p_source += unkLength;
|
||||
MxU16 extraLength = GetScalar((MxU16**) p_source);
|
||||
if (extraLength) {
|
||||
AppendData(extraLength, *p_source);
|
||||
*p_source += extraLength;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user