mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement TextureData::Create (#586)
* Implement TextureData::Create * Fix names * Rename * Fix name * Fix annotation * Add missing annotation * Fix annotation * More annotation fixes * Compat template type ambiguity * Fix
This commit is contained in:

committed by
GitHub

parent
688dc0b6ee
commit
9d8820ee06
@@ -1,143 +0,0 @@
|
||||
#ifndef GIFMANAGER_H
|
||||
#define GIFMANAGER_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <d3drmobj.h>
|
||||
#include <ddraw.h>
|
||||
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
// SIZE 0x14
|
||||
struct GifData {
|
||||
public:
|
||||
char* m_name; // 0x00
|
||||
LPDIRECTDRAWSURFACE m_surface; // 0x04
|
||||
LPDIRECTDRAWPALETTE m_palette; // 0x08
|
||||
LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c
|
||||
MxU8* m_data; // 0x10
|
||||
|
||||
~GifData();
|
||||
};
|
||||
|
||||
struct GifMapComparator {
|
||||
bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; }
|
||||
};
|
||||
|
||||
// SIZE 0x10
|
||||
class GifMap : public map<const char*, GifData*, GifMapComparator> {
|
||||
// SYNTHETIC: LEGO1 0x1005a400
|
||||
// GifMap::~GifMap
|
||||
};
|
||||
|
||||
typedef list<GifData*> GifList;
|
||||
|
||||
// VTABLE: LEGO1 0x100d86d4
|
||||
// SIZE 0x18
|
||||
class GifManagerBase {
|
||||
public:
|
||||
// FUNCTION: LEGO1 0x1005b660
|
||||
virtual ~GifManagerBase()
|
||||
{
|
||||
GifMap::iterator it;
|
||||
for (it = m_map.begin(); it != m_map.end(); it++) {
|
||||
// DECOMP: Use of const_cast here matches ~ViewLODListManager from 96 source.
|
||||
const char* const& key = (*it).first;
|
||||
delete[] const_cast<char*>(key);
|
||||
|
||||
if (m_ownership) {
|
||||
delete (*it).second; // GifData*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline GifData* Get(const char* p_name)
|
||||
{
|
||||
GifMap::iterator it = m_map.find(p_name);
|
||||
if (it != m_map.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline void SetOwnership(MxBool p_ownership) { m_ownership = p_ownership; }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005a310
|
||||
// GifManagerBase::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
MxBool m_ownership; // 0x04
|
||||
GifMap m_map; // 0x08
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d86fc
|
||||
// SIZE 0x24
|
||||
class GifManager : public GifManagerBase {
|
||||
public:
|
||||
GifManager() { m_ownership = TRUE; }
|
||||
~GifManager() override;
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005a580
|
||||
// GifManager::`scalar deleting destructor'
|
||||
|
||||
void FUN_10099cc0(GifData* p_data);
|
||||
|
||||
protected:
|
||||
GifList m_list; // 0x18
|
||||
};
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c50
|
||||
// allocator<GifData *>::_Charalloc
|
||||
|
||||
// clang-format off
|
||||
// TEMPLATE: LEGO1 0x10001cc0
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Lbound
|
||||
|
||||
// TEMPLATE: LEGO1 0x1004f9b0
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Insert
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c70
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Color
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c80
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Left
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c90
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Parent
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059ca0
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Right
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059cb0
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::~_Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059d80
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::iterator::_Inc
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059dc0
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::erase
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a210
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Erase
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a250
|
||||
// list<GifData *,allocator<GifData *> >::~list<GifData *,allocator<GifData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a2c0
|
||||
// map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::~map<char const *,GifData *,GifMapComparator,allocator<GifData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a450
|
||||
// Map<char const *,GifData *,GifMapComparator>::~Map<char const *,GifData *,GifMapComparator>
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a5a0
|
||||
// List<GifData *>::~List<GifData *>
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0100
|
||||
// _Tree<char const *,pair<char const * const,GifData *>,map<char const *,GifData *,GifMapComparator,allocator<GifData *> >::_Kfn,GifMapComparator,allocator<GifData *> >::_Nil
|
||||
// clang-format on
|
||||
|
||||
#endif // GIFMANAGER_H
|
161
LEGO1/lego/legoomni/include/legocontainer.h
Normal file
161
LEGO1/lego/legoomni/include/legocontainer.h
Normal file
@@ -0,0 +1,161 @@
|
||||
#ifndef LEGOTEXTURECONTAINER_H
|
||||
#define LEGOTEXTURECONTAINER_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <d3drmobj.h>
|
||||
#include <ddraw.h>
|
||||
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
class LegoTexture;
|
||||
|
||||
// SIZE 0x10
|
||||
struct TextureData {
|
||||
public:
|
||||
TextureData();
|
||||
~TextureData();
|
||||
|
||||
static TextureData* Create(const char* p_name, LegoTexture* p_texture);
|
||||
|
||||
char* m_name; // 0x00
|
||||
LPDIRECTDRAWSURFACE m_surface; // 0x04
|
||||
LPDIRECTDRAWPALETTE m_palette; // 0x08
|
||||
LPDIRECT3DRMTEXTURE2 m_texture; // 0x0c
|
||||
};
|
||||
|
||||
struct LegoContainerInfoComparator {
|
||||
bool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; }
|
||||
};
|
||||
|
||||
// SIZE 0x10
|
||||
template <class T>
|
||||
class LegoContainerInfo : public map<const char*, T*, LegoContainerInfoComparator> {};
|
||||
|
||||
// SIZE 0x18
|
||||
template <class T>
|
||||
class LegoContainer {
|
||||
public:
|
||||
virtual ~LegoContainer()
|
||||
{
|
||||
#ifdef COMPAT_MODE
|
||||
typename LegoContainerInfo<T>::iterator it;
|
||||
#else
|
||||
LegoContainerInfo<T>::iterator it;
|
||||
#endif
|
||||
for (it = m_map.begin(); it != m_map.end(); it++) {
|
||||
// DECOMP: Use of const_cast here matches ~ViewLODListManager from 96 source.
|
||||
const char* const& key = (*it).first;
|
||||
delete[] const_cast<char*>(key);
|
||||
|
||||
if (m_ownership) {
|
||||
delete (*it).second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline T* Get(const char* p_name)
|
||||
{
|
||||
#ifdef COMPAT_MODE
|
||||
typename LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#else
|
||||
LegoContainerInfo<T>::iterator it = m_map.find(p_name);
|
||||
#endif
|
||||
if (it != m_map.end()) {
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline void SetOwnership(MxBool p_ownership) { m_ownership = p_ownership; }
|
||||
|
||||
protected:
|
||||
MxBool m_ownership; // 0x04
|
||||
LegoContainerInfo<T> m_map; // 0x08
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d86d4
|
||||
// class LegoContainer<TextureData>
|
||||
|
||||
typedef list<TextureData*> TextureList;
|
||||
|
||||
// VTABLE: LEGO1 0x100d86fc
|
||||
// SIZE 0x24
|
||||
class LegoTextureContainer : public LegoContainer<TextureData> {
|
||||
public:
|
||||
LegoTextureContainer() { m_ownership = TRUE; }
|
||||
~LegoTextureContainer() override;
|
||||
|
||||
void FUN_10099cc0(TextureData* p_data);
|
||||
|
||||
protected:
|
||||
TextureList m_list; // 0x18
|
||||
};
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c50
|
||||
// allocator<TextureData *>::_Charalloc
|
||||
|
||||
// clang-format off
|
||||
// TEMPLATE: LEGO1 0x10001cc0
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Lbound
|
||||
|
||||
// TEMPLATE: LEGO1 0x1004f9b0
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Insert
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c70
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Color
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c80
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Left
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059c90
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Parent
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059ca0
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Right
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059cb0
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::~_Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059d80
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::iterator::_Inc
|
||||
|
||||
// TEMPLATE: LEGO1 0x10059dc0
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::erase
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a210
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Erase
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a250
|
||||
// list<TextureData *,allocator<TextureData *> >::~list<TextureData *,allocator<TextureData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a2c0
|
||||
// map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::~map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a310
|
||||
// LegoContainer<TextureData>::`scalar deleting destructor'
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a400
|
||||
// LegoContainerInfo<TextureData>::~LegoContainerInfo<TextureData>
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a450
|
||||
// Map<char const *,TextureData *,LegoContainerInfoComparator>::~Map<char const *,TextureData *,LegoContainerInfoComparator>
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005a580
|
||||
// LegoTextureContainer::`scalar deleting destructor'
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005a5a0
|
||||
// List<TextureData *>::~List<TextureData *>
|
||||
|
||||
// TEMPLATE: LEGO1 0x1005b660
|
||||
// LegoContainer<TextureData>::~LegoContainer<TextureData>
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0100
|
||||
// _Tree<char const *,pair<char const * const,TextureData *>,map<char const *,TextureData *,LegoContainerInfoComparator,allocator<TextureData *> >::_Kfn,LegoContainerInfoComparator,allocator<TextureData *> >::_Nil
|
||||
// clang-format on
|
||||
|
||||
#endif // LEGOTEXTURECONTAINER_H
|
@@ -5,7 +5,7 @@
|
||||
#include "mxdsaction.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
class GifManager;
|
||||
class LegoTextureContainer;
|
||||
class Isle;
|
||||
class IslePathActor;
|
||||
class LegoAnimationManager;
|
||||
@@ -211,8 +211,8 @@ public:
|
||||
|
||||
LegoVideoManager* GetVideoManager() { return (LegoVideoManager*) m_videoManager; }
|
||||
LegoSoundManager* GetSoundManager() { return (LegoSoundManager*) m_soundManager; }
|
||||
LegoInputManager* GetInputManager() { return m_inputMgr; }
|
||||
GifManager* GetGifManager() { return m_gifManager; }
|
||||
LegoInputManager* GetInputManager() { return m_inputManager; }
|
||||
LegoTextureContainer* GetTextureContainer() { return m_textureContainer; }
|
||||
LegoWorld* GetCurrentWorld() { return m_currentWorld; }
|
||||
LegoNavController* GetNavController() { return m_navController; }
|
||||
IslePathActor* GetCurrentVehicle() { return m_currentVehicle; }
|
||||
@@ -238,8 +238,8 @@ public:
|
||||
private:
|
||||
ScriptContainer* m_scripts; // 0x68
|
||||
ViewLODListManager* m_viewLODListManager; // 0x6c
|
||||
LegoInputManager* m_inputMgr; // 0x70
|
||||
GifManager* m_gifManager; // 0x74
|
||||
LegoInputManager* m_inputManager; // 0x70
|
||||
LegoTextureContainer* m_textureContainer; // 0x74
|
||||
LegoWorldList* m_worldList; // 0x78
|
||||
LegoWorld* m_currentWorld; // 0x7c
|
||||
MxBool m_exit; // 0x80
|
||||
@@ -275,7 +275,7 @@ ViewManager* GetViewManager();
|
||||
LegoPlantManager* PlantManager();
|
||||
LegoWorld* CurrentWorld();
|
||||
LegoUnkSaveDataWriter* UnkSaveDataWriter();
|
||||
GifManager* GetGifManager();
|
||||
LegoTextureContainer* GetTextureContainer();
|
||||
void FUN_10015820(MxBool p_disable, MxU16 p_flags);
|
||||
void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c);
|
||||
LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid);
|
||||
|
@@ -39,6 +39,7 @@ public:
|
||||
void OverrideSkyColor(MxBool p_shouldOverride);
|
||||
void FUN_1007c520();
|
||||
|
||||
inline Tgl::Renderer* GetRenderer() { return this->m_renderer; }
|
||||
inline Lego3DManager* Get3DManager() { return this->m_3dManager; }
|
||||
inline MxDirect3D* GetDirect3D() { return this->m_direct3d; }
|
||||
inline void SetRender3D(MxBool p_render3d) { this->m_render3d = p_render3d; }
|
||||
|
Reference in New Issue
Block a user