Implement some Act1State functions (#520)

* Implement some Act1State functions

* ci: push fix commits to pr

* ci fix

* Show diffs generated by clang-format

* Run clang-format

* Fix naming

* re-use _countof + add parentheses

* Fix naming

* Use MxS32

* Annotate Act1State::NamedPlane::~NamedPlane

* Apply suggestions

* Read and Write Mx3DPointFloat's

* Annotations, spacing

* Add Mx3DPointFloat copy ctor, match some functions

* Fix WriteVector3

* Adding more spacing for readability

* Use MxResult as a return type for Serialize

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Anonymous Maarten
2024-02-03 02:03:52 +01:00
committed by GitHub
parent 6653533b1f
commit 57d5949d84
10 changed files with 433 additions and 34 deletions

View File

@@ -2,6 +2,7 @@
#define __LEGOSTORAGE_H
#include "legotypes.h"
#include "mxgeometry/mxgeometry3d.h"
#include "mxstring.h"
#include <stdio.h>
@@ -72,6 +73,45 @@ public:
LegoResult SetPosition(LegoU32 p_position) override;
LegoResult Open(const char* p_name, LegoU32 p_mode);
// FUNCTION: LEGO1 0x100343d0
LegoStorage* WriteVector3(Mx3DPointFloat p_vec3)
{
float data = p_vec3[0];
Write(&data, sizeof(float));
data = p_vec3[1];
Write(&data, sizeof(float));
data = p_vec3[2];
Write(&data, sizeof(float));
return this;
}
// FUNCTION: LEGO1 0x10034430
LegoStorage* ReadVector3(Mx3DPointFloat& p_vec3)
{
Read(&p_vec3[0], sizeof(float));
Read(&p_vec3[1], sizeof(float));
Read(&p_vec3[2], sizeof(float));
return this;
}
// FUNCTION: LEGO1 0x10034470
LegoStorage* ReadString(MxString& p_str)
{
MxS16 len;
Read(&len, sizeof(MxS16));
char* text = new char[len + 1];
Read(text, len);
text[len] = '\0';
p_str = text;
delete[] text;
return this;
}
// FUNCTION: LEGO1 0x10006030
LegoStorage* FUN_10006030(MxString p_str)
{