Skip to content

Commit 2229b75

Browse files
committed
Matches
1 parent c13a44e commit 2229b75

2 files changed

Lines changed: 44 additions & 11 deletions

File tree

GolDP/include/boundingshape0x2c.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@
66
#include "types.h"
77

88
// VTABLE: GOLDP 0x10056b74
9-
// SIZE: 0x1fc
9+
// SIZE 0x1fc
1010
class BdbTxtParser : public GolTxtParser {};
1111

1212
// VTABLE: GOLDP 0x10056b68
1313
// SIZE 0x2c
1414
class BoundingShape0x2c {
1515
public:
16-
// SIZE: 0x20
16+
// SIZE 0x20
1717
struct StructField0x08 {
1818
enum {
19+
c_invalidIndex = 0xffff,
1920
e_type0 = 0,
2021
e_type1 = 1,
2122
};
2223

2324
LegoU16 m_type;
24-
LegoS16 m_unk0x02;
25+
LegoU16 m_unk0x02;
2526
union {
2627
struct {
2728
LegoFloat m_unk0x00;
@@ -30,8 +31,8 @@ class BoundingShape0x2c {
3031
LegoFloat m_unk0x0c;
3132
undefined4 m_unk0x10;
3233
undefined4 m_unk0x14;
33-
LegoS16 m_unk0x18;
34-
LegoS16 m_unk0x1a;
34+
LegoU16 m_unk0x18;
35+
LegoU16 m_unk0x1a;
3536
} t0;
3637
struct {
3738
undefined4 m_unk0x00;
@@ -46,7 +47,7 @@ class BoundingShape0x2c {
4647
} t1;
4748
} m_unk0x04;
4849
};
49-
// SIZE: 0x18
50+
// SIZE 0x18
5051
struct StructField0x18 {
5152
LegoFloat m_unk0x00;
5253
LegoFloat m_unk0x04;

GolDP/src/boundingshape0x2c.cpp

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#include "golbinparser.h"
44
#include "golerror.h"
55

6+
DECOMP_SIZE_ASSERT(BdbTxtParser, 0x1fc)
7+
DECOMP_SIZE_ASSERT(BoundingShape0x2c::StructField0x08, 0x20)
8+
DECOMP_SIZE_ASSERT(BoundingShape0x2c::StructField0x18, 0x18)
9+
DECOMP_SIZE_ASSERT(BoundingShape0x2c, 0x2c)
10+
611
// FUNCTION: GOLDP 0x1001adc0
712
BoundingShape0x2c::BoundingShape0x2c()
813
{
@@ -32,6 +37,7 @@ void BoundingShape0x2c::Deserialize(const LegoChar* p_path, LegoBool32 p_binary)
3237
if (m_unk0x08 != NULL) {
3338
Destroy();
3439
}
40+
3541
GolFileParser* parser;
3642
if (p_binary) {
3743
parser = new GolBinParser;
@@ -47,6 +53,7 @@ void BoundingShape0x2c::Deserialize(const LegoChar* p_path, LegoBool32 p_binary)
4753
}
4854
}
4955
parser->OpenFileForRead(p_path);
56+
5057
GolFileParser::ParserTokenType token;
5158

5259
while ((token = parser->GetNextToken()) != 0) {
@@ -62,20 +69,24 @@ void BoundingShape0x2c::Deserialize(const LegoChar* p_path, LegoBool32 p_binary)
6269
if (m_unk0x1c == 0) {
6370
parser->HandleUnexpectedToken(GolFileParser::ParserTokenType::e_int);
6471
}
72+
6573
m_unk0x20 = new LegoS16[m_unk0x1c];
6674
if (m_unk0x20 == NULL) {
6775
GOL_FATALERROR(c_golErrorOutOfMemory);
6876
}
77+
6978
for (i = 0; i < m_unk0x1c; i++) {
7079
m_unk0x20[i] = parser->ReadInteger();
7180
}
81+
7282
parser->ReadRightCurly();
7383
break;
7484
default:
7585
parser->HandleUnexpectedToken(GolFileParser::ParserTokenType::e_syntaxerror);
7686
break;
7787
}
7888
}
89+
7990
parser->Dispose();
8091
delete parser;
8192
}
@@ -84,57 +95,67 @@ void BoundingShape0x2c::Deserialize(const LegoChar* p_path, LegoBool32 p_binary)
8495
void BoundingShape0x2c::FUN_1001b010(GolFileParser& p_parser)
8596
{
8697
LegoU32 i;
98+
8799
m_unk0x04 = p_parser.FUN_100327e0();
88100
if (m_unk0x04 == 0) {
89101
p_parser.HandleUnexpectedToken(GolFileParser::ParserTokenType::e_int);
90102
}
103+
91104
m_unk0x0c = m_unk0x08 = new StructField0x08[m_unk0x04];
92105
if (m_unk0x08 == NULL) {
93106
GOL_FATALERROR(c_golErrorOutOfMemory);
94107
}
108+
95109
for (i = 0; i < m_unk0x04; i++) {
96110
GolFileParser::ParserTokenType type = p_parser.GetNextToken();
97111
StructField0x08* obj = &m_unk0x08[i];
112+
98113
if (type == GolFileParser::e_unknown0x28) {
99114
obj->m_type = StructField0x08::e_type0;
100115
obj->m_unk0x04.t0.m_unk0x10 = 0;
101116
obj->m_unk0x04.t0.m_unk0x14 = 0;
117+
102118
if (p_parser.ReadInteger() < 0) {
103-
obj->m_unk0x02 = -1;
119+
obj->m_unk0x02 = StructField0x08::c_invalidIndex;
104120
m_unk0x0c = obj;
105121
}
106122
else {
107123
obj->m_unk0x02 = p_parser.GetUnk0x38();
108124
}
125+
109126
if (p_parser.ReadInteger() < 0) {
110-
obj->m_unk0x04.t0.m_unk0x18 = -1;
127+
obj->m_unk0x04.t0.m_unk0x18 = StructField0x08::c_invalidIndex;
111128
}
112129
else {
113130
obj->m_unk0x04.t0.m_unk0x18 = p_parser.GetUnk0x38();
114131
}
132+
115133
if (p_parser.ReadInteger() < 0) {
116-
obj->m_unk0x04.t0.m_unk0x1a = -1;
117-
if (obj->m_unk0x04.t0.m_unk0x18 == -1) {
134+
obj->m_unk0x04.t0.m_unk0x1a = StructField0x08::c_invalidIndex;
135+
if (obj->m_unk0x04.t0.m_unk0x18 == StructField0x08::c_invalidIndex) {
118136
p_parser.HandleUnexpectedToken(GolFileParser::e_unsuported);
119137
}
120138
}
121139
else {
122140
obj->m_unk0x04.t0.m_unk0x1a = p_parser.GetUnk0x38();
123141
}
142+
124143
obj->m_unk0x04.t0.m_unk0x00 = p_parser.ReadFloat();
125144
obj->m_unk0x04.t0.m_unk0x04 = p_parser.ReadFloat();
126145
obj->m_unk0x04.t0.m_unk0x08 = p_parser.ReadFloat();
127146
obj->m_unk0x04.t0.m_unk0x0c = p_parser.ReadFloat();
128147
}
129148
else if (type == GolFileParser::e_unknown0x29) {
130149
obj->m_type = StructField0x08::e_type1;
150+
131151
if (p_parser.ReadInteger() < 0) {
132-
obj->m_unk0x02 = -1;
152+
obj->m_unk0x02 = StructField0x08::c_invalidIndex;
133153
m_unk0x0c = obj;
134154
}
135155
else {
136156
obj->m_unk0x02 = p_parser.GetUnk0x38();
137157
}
158+
138159
obj->m_unk0x04.t1.m_unk0x00 = p_parser.ReadInteger();
139160
obj->m_unk0x04.t1.m_unk0x04 = p_parser.ReadInteger();
140161
obj->m_unk0x04.t1.m_unk0x18 = p_parser.ReadInteger();
@@ -145,21 +166,25 @@ void BoundingShape0x2c::FUN_1001b010(GolFileParser& p_parser)
145166
p_parser.HandleUnexpectedToken(GolFileParser::e_syntaxerror);
146167
}
147168
}
169+
148170
p_parser.ReadRightCurly();
149171
}
150172

151173
// FUNCTION: GOLDP 0x1001b1a0
152174
void BoundingShape0x2c::FUN_1001b1a0(GolFileParser& p_parser)
153175
{
154176
LegoS32 i;
177+
155178
m_unk0x14 = p_parser.FUN_100327e0();
156179
if (m_unk0x14 == 0) {
157180
p_parser.HandleUnexpectedToken(GolFileParser::ParserTokenType::e_int);
158181
}
182+
159183
m_unk0x18 = new StructField0x18[m_unk0x14];
160184
if (m_unk0x18 == NULL) {
161185
GOL_FATALERROR(c_golErrorOutOfMemory);
162186
}
187+
163188
for (i = 0; i < m_unk0x14; i++) {
164189
m_unk0x18[i].m_unk0x00 = p_parser.ReadFloat();
165190
m_unk0x18[i].m_unk0x04 = p_parser.ReadFloat();
@@ -168,6 +193,7 @@ void BoundingShape0x2c::FUN_1001b1a0(GolFileParser& p_parser)
168193
m_unk0x18[i].m_unk0x10 = p_parser.ReadFloat();
169194
m_unk0x18[i].m_unk0x14 = p_parser.ReadFloat();
170195
}
196+
171197
p_parser.ReadRightCurly();
172198
}
173199

@@ -176,20 +202,26 @@ void BoundingShape0x2c::Destroy()
176202
{
177203
m_unk0x04 = 0;
178204
m_unk0x10 = 0;
205+
179206
if (m_unk0x08 != NULL) {
180207
delete[] m_unk0x08;
181208
m_unk0x08 = NULL;
182209
}
210+
183211
m_unk0x14 = 0;
212+
184213
if (m_unk0x18 != NULL) {
185214
delete[] m_unk0x18;
186215
m_unk0x18 = NULL;
187216
}
217+
188218
m_unk0x1c = 0;
219+
189220
if (m_unk0x20 != NULL) {
190221
delete[] m_unk0x20;
191222
m_unk0x20 = NULL;
192223
}
224+
193225
m_unk0x24 = 0;
194226
m_unk0x28 = 0;
195227
}

0 commit comments

Comments
 (0)