mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 00:44:21 +00:00
Move Read/Write functions to LegoStorage base class, match Act1State::Serialize (#1335)
* Move Read/Write function to LegoStorage base class * Proper const use for vector / BETA match * Match `Act1State::Serialize`
This commit is contained in:
committed by
GitHub
parent
77a3dc0795
commit
70b0f76fa1
@@ -1324,150 +1324,140 @@ Act1State::Act1State()
|
||||
|
||||
// FUNCTION: LEGO1 0x10033ac0
|
||||
// FUNCTION: BETA10 0x1003524f
|
||||
MxResult Act1State::Serialize(LegoFile* p_file)
|
||||
MxResult Act1State::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
m_motocyclePlane.Serialize(p_file);
|
||||
m_bikePlane.Serialize(p_file);
|
||||
m_skateboardPlane.Serialize(p_file);
|
||||
m_helicopterPlane.Serialize(p_file);
|
||||
m_jetskiPlane.Serialize(p_file);
|
||||
m_dunebuggyPlane.Serialize(p_file);
|
||||
m_racecarPlane.Serialize(p_file);
|
||||
m_motocyclePlane.Serialize(p_storage);
|
||||
m_bikePlane.Serialize(p_storage);
|
||||
m_skateboardPlane.Serialize(p_storage);
|
||||
m_helicopterPlane.Serialize(p_storage);
|
||||
m_jetskiPlane.Serialize(p_storage);
|
||||
m_dunebuggyPlane.Serialize(p_storage);
|
||||
m_racecarPlane.Serialize(p_storage);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
// TODO: Seems to match better when using strcmp directly instead of IsPresent
|
||||
if (p_storage->IsWriteMode()) {
|
||||
if (strcmp(m_helicopterPlane.m_name.GetData(), "")) {
|
||||
if (!m_helicopterWindshield) {
|
||||
WriteDefaultTexture(p_file, "chwind.gif");
|
||||
WriteDefaultTexture(p_storage, "chwind.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterWindshield);
|
||||
WriteNamedTexture(p_storage, m_helicopterWindshield);
|
||||
}
|
||||
|
||||
if (!m_helicopterJetLeft) {
|
||||
WriteDefaultTexture(p_file, "chjetl.gif");
|
||||
WriteDefaultTexture(p_storage, "chjetl.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterJetLeft);
|
||||
WriteNamedTexture(p_storage, m_helicopterJetLeft);
|
||||
}
|
||||
|
||||
if (!m_helicopterJetRight) {
|
||||
WriteDefaultTexture(p_file, "chjetr.gif");
|
||||
WriteDefaultTexture(p_storage, "chjetr.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterJetRight);
|
||||
WriteNamedTexture(p_storage, m_helicopterJetRight);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_jetskiPlane.m_name.GetData(), "")) {
|
||||
if (!m_jetskiFront) {
|
||||
WriteDefaultTexture(p_file, "jsfrnt.gif");
|
||||
WriteDefaultTexture(p_storage, "jsfrnt.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_jetskiFront);
|
||||
WriteNamedTexture(p_storage, m_jetskiFront);
|
||||
}
|
||||
|
||||
if (!m_jetskiWindshield) {
|
||||
WriteDefaultTexture(p_file, "jswnsh.gif");
|
||||
WriteDefaultTexture(p_storage, "jswnsh.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_jetskiWindshield);
|
||||
WriteNamedTexture(p_storage, m_jetskiWindshield);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_dunebuggyPlane.m_name.GetData(), "")) {
|
||||
if (!m_dunebuggyFront) {
|
||||
WriteDefaultTexture(p_file, "dbfrfn.gif");
|
||||
WriteDefaultTexture(p_storage, "dbfrfn.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_dunebuggyFront);
|
||||
WriteNamedTexture(p_storage, m_dunebuggyFront);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_racecarPlane.m_name.GetData(), "")) {
|
||||
if (!m_racecarFront) {
|
||||
WriteDefaultTexture(p_file, "rcfrnt.gif");
|
||||
WriteDefaultTexture(p_storage, "rcfrnt.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarFront);
|
||||
WriteNamedTexture(p_storage, m_racecarFront);
|
||||
}
|
||||
|
||||
if (!m_racecarBack) {
|
||||
WriteDefaultTexture(p_file, "rcback.gif");
|
||||
WriteDefaultTexture(p_storage, "rcback.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarBack);
|
||||
WriteNamedTexture(p_storage, m_racecarBack);
|
||||
}
|
||||
|
||||
if (!m_racecarTail) {
|
||||
WriteDefaultTexture(p_file, "rctail.gif");
|
||||
WriteDefaultTexture(p_storage, "rctail.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarTail);
|
||||
WriteNamedTexture(p_storage, m_racecarTail);
|
||||
}
|
||||
}
|
||||
|
||||
p_file->Write(m_cptClickDialogue.m_nextIndex);
|
||||
p_file->Write(m_unk0x022);
|
||||
p_storage->WriteS16(m_cptClickDialogue.m_nextIndex);
|
||||
p_storage->WriteU8(m_unk0x022);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
else if (p_storage->IsReadMode()) {
|
||||
if (strcmp(m_helicopterPlane.m_name.GetData(), "")) {
|
||||
m_helicopterWindshield = ReadNamedTexture(p_file);
|
||||
if (m_helicopterWindshield == NULL) {
|
||||
if ((m_helicopterWindshield = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_helicopterJetLeft = ReadNamedTexture(p_file);
|
||||
if (m_helicopterJetLeft == NULL) {
|
||||
if ((m_helicopterJetLeft = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_helicopterJetRight = ReadNamedTexture(p_file);
|
||||
if (m_helicopterJetRight == NULL) {
|
||||
if ((m_helicopterJetRight = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_jetskiPlane.m_name.GetData(), "")) {
|
||||
m_jetskiFront = ReadNamedTexture(p_file);
|
||||
if (m_jetskiFront == NULL) {
|
||||
if ((m_jetskiFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_jetskiWindshield = ReadNamedTexture(p_file);
|
||||
if (m_jetskiWindshield == NULL) {
|
||||
if ((m_jetskiWindshield = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_dunebuggyPlane.m_name.GetData(), "")) {
|
||||
m_dunebuggyFront = ReadNamedTexture(p_file);
|
||||
if (m_dunebuggyFront == NULL) {
|
||||
if ((m_dunebuggyFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_racecarPlane.m_name.GetData(), "")) {
|
||||
m_racecarFront = ReadNamedTexture(p_file);
|
||||
if (m_racecarFront == NULL) {
|
||||
if ((m_racecarFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_racecarBack = ReadNamedTexture(p_file);
|
||||
if (m_racecarBack == NULL) {
|
||||
if ((m_racecarBack = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_racecarTail = ReadNamedTexture(p_file);
|
||||
if (m_racecarTail == NULL) {
|
||||
if ((m_racecarTail = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
p_file->Read(m_cptClickDialogue.m_nextIndex);
|
||||
p_file->Read(m_unk0x022);
|
||||
p_storage->ReadS16(m_cptClickDialogue.m_nextIndex);
|
||||
p_storage->ReadU8(m_unk0x022);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user