Implement LegoTexturePresenter::Read and Store (#641)

* LegoTexturePresenter::Read

* Implement LegoTexturePresenter::Store

* Rename

* Fix naming
This commit is contained in:
Christian Semmler
2024-03-09 10:49:13 -05:00
committed by GitHub
parent fb800db862
commit 9e2f37e7ca
16 changed files with 281 additions and 85 deletions

View File

@@ -1,8 +1,8 @@
#ifndef ACT1STATE_H
#define ACT1STATE_H
#include "legonamedtexture.h"
#include "legostate.h"
#include "legoutil.h"
#include "roi/legoroi.h"
// VTABLE: LEGO1 0x100d7028
@@ -84,39 +84,39 @@ public:
protected:
MxS32* m_unk0x008; // 0x008
// FIXME: count for m_unk0x008
MxS16 m_unk0x00c; // 0x00c
undefined2 m_unk0x00e; // 0x00e
undefined2 m_unk0x010; // 0x010
undefined m_unk0x012; // 0x012
MxS32 m_unk0x014; // 0x014
MxU32 m_unk0x018; // 0x018
MxU16 m_unk0x01c; // 0x01c
undefined m_unk0x01e; // 0x01e
undefined m_unk0x01f; // 0x01f
undefined m_unk0x020; // 0x020
undefined m_unk0x021; // 0x021
undefined m_unk0x022; // 0x022
undefined m_unk0x023; // 0x023
NamedPlane m_unk0x024; // 0x024
NamedPlane m_unk0x070; // 0x070
NamedPlane m_unk0x0bc; // 0x0bc
NamedPlane m_unk0x108; // 0x108
NamedTexture* m_unk0x154; // 0x154
NamedTexture* m_unk0x158; // 0x158
NamedTexture* m_unk0x15c; // 0x15c
MxCore* m_unk0x160; // 0x160
NamedPlane m_unk0x164; // 0x164
NamedTexture* m_unk0x1b0; // 0x1b0
NamedTexture* m_unk0x1b4; // 0x1b4
MxCore* m_unk0x1b8; // 0x1b8
NamedPlane m_unk0x1bc; // 0x1bc
NamedTexture* m_unk0x208; // 0x208
MxCore* m_unk0x20c; // 0x20c
NamedPlane m_unk0x210; // 0x210
NamedTexture* m_unk0x25c; // 0x25c
NamedTexture* m_unk0x260; // 0x260
NamedTexture* m_unk0x264; // 0x264
MxCore* m_unk0x268; // 0x268
MxS16 m_unk0x00c; // 0x00c
undefined2 m_unk0x00e; // 0x00e
undefined2 m_unk0x010; // 0x010
undefined m_unk0x012; // 0x012
MxS32 m_unk0x014; // 0x014
MxU32 m_unk0x018; // 0x018
MxU16 m_unk0x01c; // 0x01c
undefined m_unk0x01e; // 0x01e
undefined m_unk0x01f; // 0x01f
undefined m_unk0x020; // 0x020
undefined m_unk0x021; // 0x021
undefined m_unk0x022; // 0x022
undefined m_unk0x023; // 0x023
NamedPlane m_unk0x024; // 0x024
NamedPlane m_unk0x070; // 0x070
NamedPlane m_unk0x0bc; // 0x0bc
NamedPlane m_unk0x108; // 0x108
LegoNamedTexture* m_unk0x154; // 0x154
LegoNamedTexture* m_unk0x158; // 0x158
LegoNamedTexture* m_unk0x15c; // 0x15c
MxCore* m_unk0x160; // 0x160
NamedPlane m_unk0x164; // 0x164
LegoNamedTexture* m_unk0x1b0; // 0x1b0
LegoNamedTexture* m_unk0x1b4; // 0x1b4
MxCore* m_unk0x1b8; // 0x1b8
NamedPlane m_unk0x1bc; // 0x1bc
LegoNamedTexture* m_unk0x208; // 0x208
MxCore* m_unk0x20c; // 0x20c
NamedPlane m_unk0x210; // 0x210
LegoNamedTexture* m_unk0x25c; // 0x25c
LegoNamedTexture* m_unk0x260; // 0x260
LegoNamedTexture* m_unk0x264; // 0x264
MxCore* m_unk0x268; // 0x268
};
// FUNCTION: LEGO1 0x10033a70

View File

@@ -0,0 +1,27 @@
#ifndef LEGONAMEDTEXTURE_H
#define LEGONAMEDTEXTURE_H
#include "misc/legotexture.h"
#include "mxstring.h"
// SIZE 0x14
class LegoNamedTexture {
public:
LegoNamedTexture(const char* p_name, LegoTexture* p_texture)
{
m_name = p_name;
m_texture = p_texture;
}
~LegoNamedTexture() { delete m_texture; }
// FUNCTION: LEGO1 0x1003f920
const MxString* GetName() const { return &m_name; }
LegoTexture* GetTexture() { return m_texture; }
private:
MxString m_name; // 0x00
LegoTexture* m_texture; // 0x04
};
#endif // LEGONAMEDTEXTURE_H

View File

@@ -0,0 +1,84 @@
#ifndef LEGONAMEDTEXTURELIST_H
#define LEGONAMEDTEXTURELIST_H
#include "legonamedtexture.h"
#include "mxlist.h"
// VTABLE: LEGO1 0x100d8110
// class MxCollection<LegoNamedTexture *>
// VTABLE: LEGO1 0x100d8128
// class MxList<LegoNamedTexture *>
// VTABLE: LEGO1 0x100d8140
// class MxPtrList<LegoNamedTexture>
// VTABLE: LEGO1 0x100d8158
// SIZE 0x18
class LegoNamedTextureList : public MxPtrList<LegoNamedTexture> {
public:
LegoNamedTextureList() : MxPtrList<LegoNamedTexture>(TRUE) {}
// SYNTHETIC: LEGO1 0x1004f040
// LegoNamedTextureList::`scalar deleting destructor'
};
// VTABLE: LEGO1 0x100d8170
// class MxListCursor<LegoNamedTexture *>
// VTABLE: LEGO1 0x100d8188
// class MxPtrListCursor<LegoNamedTexture>
// VTABLE: LEGO1 0x100d81a0
// SIZE 0x10
class LegoNamedTextureListCursor : public MxPtrListCursor<LegoNamedTexture> {
public:
LegoNamedTextureListCursor(LegoNamedTextureList* p_list) : MxPtrListCursor<LegoNamedTexture>(p_list) {}
};
// SYNTHETIC: LEGO1 0x1004f500
// LegoNamedTextureListCursor::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1004f570
// MxPtrListCursor<LegoNamedTexture>::~MxPtrListCursor<LegoNamedTexture>
// SYNTHETIC: LEGO1 0x1004f5c0
// MxListCursor<LegoNamedTexture *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1004f630
// MxPtrListCursor<LegoNamedTexture>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1004f6a0
// MxListCursor<LegoNamedTexture *>::~MxListCursor<LegoNamedTexture *>
// FUNCTION: LEGO1 0x1004f6f0
// LegoNamedTextureListCursor::~LegoNamedTextureListCursor
// TEMPLATE: LEGO1 0x1004eec0
// MxCollection<LegoNamedTexture *>::Compare
// TEMPLATE: LEGO1 0x1004eed0
// MxCollection<LegoNamedTexture *>::~MxCollection<LegoNamedTexture *>
// TEMPLATE: LEGO1 0x1004ef20
// MxCollection<LegoNamedTexture *>::Destroy
// TEMPLATE: LEGO1 0x1004ef30
// MxList<LegoNamedTexture *>::~MxList<LegoNamedTexture *>
// TEMPLATE: LEGO1 0x1004efc0
// MxPtrList<LegoNamedTexture>::Destroy
// TEMPLATE: LEGO1 0x1004f0b0
// MxPtrList<LegoNamedTexture>::~MxPtrList<LegoNamedTexture>
// SYNTHETIC: LEGO1 0x1004f100
// MxCollection<LegoNamedTexture *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1004f170
// MxList<LegoNamedTexture *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1004f220
// MxPtrList<LegoNamedTexture>::`scalar deleting destructor'
#endif // LEGONAMEDTEXTURELIST_H

View File

@@ -1,19 +1,26 @@
#ifndef LEGOTEXTUREINFO_H
#define LEGOTEXTUREINFO_H
#include "misc/legotypes.h"
#include "tgl/tgl.h"
#include <d3drmobj.h>
#include <ddraw.h>
class LegoTexture;
// SIZE 0x10
struct LegoTextureInfo {
class LegoTextureInfo {
public:
LegoTextureInfo();
~LegoTextureInfo();
static LegoTextureInfo* Create(const char* p_name, LegoTexture* p_texture);
static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo);
LegoResult FUN_10066010(LegoU8* p_bits);
// private:
char* m_name; // 0x00
LPDIRECTDRAWSURFACE m_surface; // 0x04
LPDIRECTDRAWPALETTE m_palette; // 0x08

View File

@@ -1,13 +1,14 @@
#ifndef LEGOTEXTUREPRESENTER_H
#define LEGOTEXTUREPRESENTER_H
#include "legonamedtexturelist.h"
#include "mxmediapresenter.h"
// VTABLE: LEGO1 0x100d4d90
// SIZE 0x54 (from inlined construction at 0x10009bb5)
class LegoTexturePresenter : public MxMediaPresenter {
public:
LegoTexturePresenter() : m_textureData(NULL) {}
LegoTexturePresenter() : m_textures(NULL) {}
~LegoTexturePresenter() override;
// FUNCTION: LEGO1 0x1000ce50
@@ -31,10 +32,10 @@ public:
// LegoTexturePresenter::`scalar deleting destructor'
MxResult Read(MxDSChunk& p_chunk);
void FUN_1004f290();
MxResult Store();
private:
MxDSChunk* m_textureData; // 0x54
LegoNamedTextureList* m_textures; // 0x50
};
#endif // LEGOTEXTUREPRESENTER_H

View File

@@ -13,23 +13,7 @@
class MxAtomId;
class LegoEntity;
class LegoAnimPresenter;
class LegoTexture;
// SIZE 0x14
class NamedTexture {
public:
~NamedTexture() { delete m_texture; }
// FUNCTION: LEGO1 0x1003f920
const MxString* GetName() const { return &m_name; }
LegoTexture* GetTexture() { return m_texture; }
private:
MxString m_name; // 0x00
LegoTexture* m_texture; // 0x04
};
class LegoNamedTexture;
void FUN_1003e050(LegoAnimPresenter* p_presenter);
Extra::ActionType MatchActionString(const char*);
@@ -42,9 +26,9 @@ void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_atomId1, MxS32 p_id1, MxAtomId& p_atomId2, MxS32 p_id2);
void SetLightPosition(MxU32);
NamedTexture* ReadNamedTexture(LegoFile* p_file);
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file);
void FUN_1003f540(LegoFile* p_file, const char* p_filename);
void WriteNamedTexture(LegoFile* p_file, NamedTexture* p_texture);
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture);
// SYNTHETIC: LEGO1 0x10034b40
// LegoTexture::`scalar deleting destructor'