mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
lego1/isle: Add MxDSObject, implement SetObjectName, adjust MxDSAction (#20)
* add MxDSObject, implement SetObjectName, adjust MxDSAction * add a TODO * update project files * add WIP MxDSObject stuff * merge * update project file * add addresses and SetAtomId * switch addresses * remove comment since it's fixed now (?) * refactor * update project file * refactor into separate unit * refactor into separate unit * rename unit to avoid NMAKE issue * rename param * add last missing piece to Isle::Close * fix spelling * merge * use union hack
This commit is contained in:

committed by
GitHub

parent
66dd2cdeb9
commit
0ab8fc52d2
0
LEGO1/lego3dmanager.h
Executable file → Normal file
0
LEGO1/lego3dmanager.h
Executable file → Normal file
0
LEGO1/lego3dview.h
Executable file → Normal file
0
LEGO1/lego3dview.h
Executable file → Normal file
14
LEGO1/mxatomid.cpp
Normal file
14
LEGO1/mxatomid.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "mxatomid.h"
|
||||
|
||||
// OFFSET: LEGO1 0x100acfd0
|
||||
MxAtomId::~MxAtomId()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100ad1c0
|
||||
MxAtomId &MxAtomId::operator=(const MxAtomId &id)
|
||||
{
|
||||
// TODO
|
||||
return *this;
|
||||
}
|
@@ -12,8 +12,13 @@ public:
|
||||
__declspec(dllexport) MxAtomId &operator=(const MxAtomId &id);
|
||||
__declspec(dllexport) ~MxAtomId();
|
||||
|
||||
char *m_internal;
|
||||
MxAtomId()
|
||||
{
|
||||
this->m_internal = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
char *m_internal;
|
||||
};
|
||||
|
||||
#endif // MXATOMID_H
|
||||
|
@@ -1,25 +1,14 @@
|
||||
#ifndef MXDSACTION_H
|
||||
#define MXDSACTION_H
|
||||
|
||||
#include "mxatomid.h"
|
||||
#include "mxdsobject.h"
|
||||
|
||||
class MxDSAction
|
||||
class MxDSAction : public MxDSObject
|
||||
{
|
||||
public:
|
||||
__declspec(dllexport) MxDSAction();
|
||||
__declspec(dllexport) virtual ~MxDSAction();
|
||||
|
||||
int m_unk04;
|
||||
int m_unk08;
|
||||
int m_unk0c;
|
||||
int m_unk10;
|
||||
int m_unk14;
|
||||
int m_unk18;
|
||||
int m_unk1c;
|
||||
MxAtomId m_atomId;
|
||||
unsigned short m_unk24;
|
||||
unsigned short m_unk26;
|
||||
int m_unk28;
|
||||
int m_unk2c;
|
||||
int m_unk30;
|
||||
int m_unk34;
|
||||
@@ -46,12 +35,6 @@ public:
|
||||
int m_unk88;
|
||||
int m_unk8c;
|
||||
int m_unk90;
|
||||
|
||||
void setAtomId(MxAtomId &atomId)
|
||||
{
|
||||
this->m_atomId = atomId;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MXDSACTION_H
|
||||
|
45
LEGO1/mxdsobject.cpp
Normal file
45
LEGO1/mxdsobject.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "mxdsobject.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// OFFSET: LEGO1 0x100bf6a0
|
||||
MxDSObject::MxDSObject()
|
||||
{
|
||||
// The following code yields 100% matching assembly if m_unk24 is declared as (signed) short.
|
||||
// However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short.
|
||||
// Since we don't have a proper solution yet, we are using a union to work around this discrepancy.
|
||||
this->m_unk0c = 0;
|
||||
this->m_unk10 = 0;
|
||||
this->m_unk14 = 0;
|
||||
this->m_name = NULL;
|
||||
this->m_unk24signed = -1;
|
||||
this->m_unk1c = -1;
|
||||
this->m_unk28 = 0;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100bf8e0
|
||||
void MxDSObject::SetObjectName(const char *p_name)
|
||||
{
|
||||
if (p_name != this->m_name)
|
||||
{
|
||||
free(this->m_name);
|
||||
|
||||
if (p_name) {
|
||||
this->m_name = (char *)malloc(strlen(p_name) + 1);
|
||||
|
||||
if (this->m_name) {
|
||||
strcpy(this->m_name, p_name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->m_name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x10005530
|
||||
void MxDSObject::SetAtomId(MxAtomId p_atomId)
|
||||
{
|
||||
this->m_atomId = p_atomId;
|
||||
}
|
@@ -1,10 +1,41 @@
|
||||
#ifndef MXDSOBJECT_H
|
||||
#define MXDSOBJECT_H
|
||||
|
||||
class MxDSObject
|
||||
#include "mxcore.h"
|
||||
#include "mxatomid.h"
|
||||
|
||||
class MxDSObject : public MxCore
|
||||
{
|
||||
public:
|
||||
__declspec(dllexport) void SetObjectName(const char *);
|
||||
|
||||
MxDSObject();
|
||||
|
||||
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
|
||||
inline int GetUnknown1c() { return this->m_unk1c; }
|
||||
|
||||
inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; }
|
||||
inline void SetUnknown24(unsigned short p_unk24) { this->m_unk24 = p_unk24; }
|
||||
|
||||
void SetAtomId(MxAtomId p_atomId);
|
||||
|
||||
private:
|
||||
int m_unk08;
|
||||
short m_unk0c;
|
||||
char* m_unk10;
|
||||
int m_unk14;
|
||||
char *m_name;
|
||||
int m_unk1c;
|
||||
MxAtomId m_atomId;
|
||||
// So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short.
|
||||
// Most of the other game's code appears to treat it as unsigned short, however.
|
||||
// This union is a workaround until we have figured this out.
|
||||
union {
|
||||
unsigned short m_unk24;
|
||||
short m_unk24signed;
|
||||
};
|
||||
unsigned short m_unk26;
|
||||
int m_unk28;
|
||||
};
|
||||
|
||||
#endif // MXDSOBJECT_H
|
||||
|
Reference in New Issue
Block a user