Skip to content

Commit 77de36c

Browse files
authored
Improvements (isledecomp#499)
1 parent fb9b974 commit 77de36c

22 files changed

Lines changed: 317 additions & 326 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ set(COMMON_SOURCES
134134
common/src/mabmaterialanimationitem0x8.cpp
135135
common/src/mabmaterialanimationitem0x18.cpp
136136
common/src/duskwindbananarelic0x24.cpp
137+
common/src/amethystbreeze0x104.cpp
137138
common/src/golmateriallibrary.cpp
138139
)
139140

@@ -351,7 +352,6 @@ add_executable(legoracers WIN32
351352
LEGORacers/src/race/slatebridge0x68.cpp
352353
LEGORacers/src/race/circuitracerunner.cpp
353354
LEGORacers/src/race/circuitstandings.cpp
354-
LEGORacers/src/util/amethystbreeze0x104.cpp
355355
LEGORacers/src/app/golapp.cpp
356356
LEGORacers/src/gol/golrenderdevice.cpp
357357
LEGORacers/src/model/golworlddatabase.cpp

GolDP/include/core/gol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class GolExport {
4545
// GolExport::`scalar deleting destructor'
4646

4747
protected:
48+
// FUNCTION: GOLDP 0x10007160
4849
virtual ~GolExport() {} // vtable+0x00
4950

5051
public:

GolDP/src/camera/golscenetransformnode.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,27 @@ void GolSceneTransformNode::VTable0x24(const GolMatrix34* p_m)
113113
// STUB: GOLDP 0x10014c20
114114
void GolSceneTransformNode::VTable0x20(const GolMatrix4& p_m)
115115
{
116+
LegoU32 i = 0;
117+
116118
if (m_unk0x14 == NULL) {
117-
for (LegoU32 i = 0; i < m_capacity; i++) {
118-
GolTransform* obj = &m_unk0x18[i];
119+
GolTransform* obj = m_unk0x18;
120+
GolTransform* end = &m_unk0x18[m_capacity];
121+
122+
for (; obj < end; obj++) {
119123
GolTransform* parent = static_cast<GolTransform*>(obj->m_unk0x04);
120-
if (parent != NULL) {
121-
GolMath::FUN_1002f450(obj->m_unk0x10, parent->m_unk0x90, &obj->m_unk0x90);
124+
if (parent == NULL) {
125+
GolMath::FUN_1002f450(obj->m_unk0x10, p_m, &obj->m_unk0x90);
122126
}
123127
else {
124-
GolMath::FUN_1002f450(obj->m_unk0x10, p_m, &obj->m_unk0x90);
128+
GolMath::FUN_1002f450(obj->m_unk0x10, parent->m_unk0x90, &obj->m_unk0x90);
125129
}
126130
}
127131
return;
128132
}
129133

130-
for (LegoU32 i = 0; i < m_capacity; i++) {
134+
for (; i < m_capacity; i++) {
131135
GolTransform* obj = &m_unk0x18[i];
132136
GolTransform* parent = static_cast<GolTransform*>(obj->m_unk0x04);
133-
const GolMatrix4& parentMatrix = parent != NULL ? parent->m_unk0x90 : p_m;
134137

135138
if (m_unk0x14->VTable0x00(i)) {
136139
GolQuat rotation;
@@ -141,10 +144,20 @@ void GolSceneTransformNode::VTable0x20(const GolMatrix4& p_m)
141144
position.m_y = obj->m_unk0x10.m_m[3][1];
142145
position.m_z = obj->m_unk0x10.m_m[3][2];
143146

144-
m_unk0x14->VTable0x04(i, rotation, position, parentMatrix, &obj->m_unk0x90);
147+
if (parent != NULL) {
148+
m_unk0x14->VTable0x04(i, rotation, position, parent->m_unk0x90, &obj->m_unk0x90);
149+
}
150+
else {
151+
m_unk0x14->VTable0x04(i, rotation, position, p_m, &obj->m_unk0x90);
152+
}
145153
}
146154
else {
147-
GolMath::FUN_1002f450(obj->m_unk0x10, parentMatrix, &obj->m_unk0x90);
155+
if (parent != NULL) {
156+
GolMath::FUN_1002f450(obj->m_unk0x10, parent->m_unk0x90, &obj->m_unk0x90);
157+
}
158+
else {
159+
GolMath::FUN_1002f450(obj->m_unk0x10, p_m, &obj->m_unk0x90);
160+
}
148161
}
149162
}
150163
}

GolDP/src/camera/goltransform.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ void GolTransform::VTable0x28(GolVec3* p_up, GolVec3* p_right)
179179
// FUNCTION: GOLDP 0x10002c10
180180
void GolTransform::VTable0x04(const GolVec3* p_src, GolVec3* p_dest)
181181
{
182-
p_dest->m_x = m_unk0x10.m_m[0][0] * p_src->m_x;
182+
LegoFloat product = m_unk0x10.m_m[0][0];
183+
product *= p_src->m_x;
184+
p_dest->m_x = product;
183185
p_dest->m_y = m_unk0x10.m_m[0][1] * p_src->m_x;
184186
p_dest->m_z = m_unk0x10.m_m[0][2] * p_src->m_x;
185187

@@ -199,7 +201,9 @@ void GolTransform::VTable0x04(const GolVec3* p_src, GolVec3* p_dest)
199201
// FUNCTION: GOLDP 0x10002c90
200202
void GolTransform::VTable0x0c(const GolVec3* p_src, GolVec3* p_dest)
201203
{
202-
p_dest->m_x = m_unk0x10.m_m[0][0] * p_src->m_x;
204+
LegoFloat product = m_unk0x10.m_m[0][0];
205+
product *= p_src->m_x;
206+
p_dest->m_x = product;
203207
p_dest->m_y = m_unk0x10.m_m[0][1] * p_src->m_x;
204208
p_dest->m_z = m_unk0x10.m_m[0][2] * p_src->m_x;
205209

@@ -265,7 +269,9 @@ void GolTransform::VTable0x08(const GolVec3* p_src, GolVec3* p_dest)
265269
// FUNCTION: GOLDP 0x10002dc0
266270
void GolTransform::VTable0x10(const GolVec3* p_src, GolVec3* p_dest)
267271
{
268-
p_dest->m_x = m_unk0x10.m_m[0][0] * p_src->m_x;
272+
LegoFloat product = m_unk0x10.m_m[0][0];
273+
product *= p_src->m_x;
274+
p_dest->m_x = product;
269275
p_dest->m_y = m_unk0x10.m_m[1][0] * p_src->m_x;
270276
p_dest->m_z = m_unk0x10.m_m[2][0] * p_src->m_x;
271277

GolDP/src/font/golfont.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void GolFont::CopyGlyphsToTextures(
315315
LegoU32 destPitch;
316316
texture->LockPixels(&destPixels, &destPitch, SilverDune0x30::c_lockRequestWrite);
317317

318-
for (LegoU32 i = 0; i < font->m_glyphCount; i++) {
318+
for (LegoU32 i = 0; i < static_cast<LegoU32>(font->m_glyphCount); i++) {
319319
if (font->m_glyphs[i].m_surfaceIndex != currentSurface) {
320320
texture->UnlockPixels();
321321
currentSurface = font->m_glyphs[i].m_surfaceIndex;

GolDP/src/image/whitebaffoon0x50.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ void WhiteBaffoon0x50::Reset()
4949
m_unk0x08 = 0;
5050
}
5151

52-
// STUB: GOLDP 0x1001f330
52+
// FUNCTION: GOLDP 0x1001f330
5353
void WhiteBaffoon0x50::VTable0x10()
5454
{
55+
GolSurfaceFormat imageFormat;
5556
WhiteBaffoon0x50::WhiteBaffoonImageName imageName;
5657
imageName.m_name[0] = m_name[0];
5758
imageName.m_name[1] = m_name[1];
@@ -64,13 +65,12 @@ void WhiteBaffoon0x50::VTable0x10()
6465

6566
imageFile->VTable0x08(imageName.m_chars);
6667

67-
GolSurfaceFormat imageFormat = imageFile->GetTextureFormat();
68+
imageFormat = imageFile->GetTextureFormat();
6869
m_renderer->SelectTextureFormat(imageFormat, &m_unk0x0c, m_flags & c_flagBit5);
6970
m_width = imageFile->GetWidth();
7071
m_height = imageFile->GetHeight();
7172
FUN_1001f430();
7273

73-
ColorRGBA* colorKey = NULL;
7474
if (m_flags & c_flagBit5) {
7575
if (m_renderer->GetFlags() & GolRenderDevice::c_flagBit9) {
7676
imageFile->SetUnk0x0a0(g_unk0x10057668);
@@ -79,10 +79,12 @@ void WhiteBaffoon0x50::VTable0x10()
7979
imageFile->SetUnk0x0a0(m_colorKey);
8080
}
8181

82-
colorKey = &m_colorKey;
82+
imageFile->VTable0x1c(this, m_flags & c_flagBit2, &m_colorKey);
83+
}
84+
else {
85+
imageFile->VTable0x1c(this, m_flags & c_flagBit2, NULL);
8386
}
8487

85-
imageFile->VTable0x1c(this, m_flags & c_flagBit2, colorKey);
8688
imageFile->Destroy();
8789
}
8890

GolDP/src/render/gold3drenderdevice.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4477,8 +4477,6 @@ void GolD3DRenderDevice::FUN_10010500(LegoU32 p_firstTriangle, LegoU32 p_triangl
44774477
// STUB: GOLDP 0x100106d0
44784478
void GolD3DRenderDevice::FUN_100106d0(undefined4 p_firstTriangle, undefined4 p_triangleCount, undefined4)
44794479
{
4480-
STUB(0x100106d0);
4481-
44824480
LegoU32 firstTriangle = p_firstTriangle;
44834481
LegoU32 triangleCount = p_triangleCount;
44844482
LegoU32 commandIndex = m_unk0xc86f4;
@@ -5181,7 +5179,7 @@ void GolD3DRenderDevice::FUN_10013110(LegoU32 p_outputFirst, LegoU32 p_firstVert
51815179
vertexMap[0] = static_cast<LegoU16>(m_unk0xc3848);
51825180
m_unk0xc3848 += p_vertexCount;
51835181

5184-
for (; source < sourceEnd; source++, vertex++, vertexMap++) {
5182+
for (; source < sourceEnd;) {
51855183
vertex->sx = m_unk0xc8518->m_m[0][0] * source->m_x;
51865184
vertex->sy = m_unk0xc8518->m_m[0][1] * source->m_x;
51875185
vertex->sz = m_unk0xc8518->m_m[0][2] * source->m_x;
@@ -5205,7 +5203,10 @@ void GolD3DRenderDevice::FUN_10013110(LegoU32 p_outputFirst, LegoU32 p_firstVert
52055203
vertex->color = 0;
52065204
vertex->sx *= vertex->rhw;
52075205
vertex->sy *= vertex->rhw;
5208-
vertex->sz *= vertex->rhw;
5206+
source++;
5207+
vertex++;
5208+
vertexMap++;
5209+
vertex[-1].sz = vertex[-1].rhw * vertex[-1].sz;
52095210
}
52105211

52115212
vertexMap[p_vertexCount] = savedMapEntry;

LEGORacers/include/menu/screens/racermodelslot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RacerModelSlot : public MenuSceneElement {
5050
undefined4 m_unk0x7c; // 0x7c
5151
undefined4 m_unk0x80; // 0x80
5252
undefined4 m_unk0x84; // 0x84
53-
GolVec3 m_unk0x88; // 0x88
53+
undefined4 m_unk0x88[3]; // 0x88
5454
LegoU32 m_unk0x94; // 0x94
5555
LegoU32 m_unk0x98; // 0x98
5656
LegoBool32 m_unk0x9c; // 0x9c

LEGORacers/src/gol/golrenderdevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ DuskwindBananaRelic0x24* GolRenderDevice::FindMaterialByName(const LegoChar* p_n
8484
return NULL;
8585
}
8686

87-
// STUB: LEGORACERS 0x004133a0
87+
// FUNCTION: LEGORACERS 0x004133a0
8888
LegoU32 GolBillboard::FUN_10029e90(
8989
MaterialTable0x0c* p_container,
9090
LegoS32 p_index,
@@ -96,7 +96,7 @@ LegoU32 GolBillboard::FUN_10029e90(
9696
m_positionContainer = p_container;
9797
m_positionIndex = static_cast<LegoU16>(p_index);
9898
LegoU32 result = VTable0x4c(
99-
static_cast<DuskwindBananaRelic0x24*>(p_container->GetPosition(p_index)),
99+
static_cast<DuskwindBananaRelic0x24*>(p_container->m_entries[p_index]),
100100
p_width,
101101
p_height,
102102
p_maxDistanceSquared

LEGORacers/src/menu/menumanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "menu/menumanager.h"
22

3+
#include "amethystbreeze0x104.h"
34
#include "audio/musicinstance.h"
45
#include "camera/golcamera.h"
56
#include "cmbmodelpart0x34.h"
@@ -25,7 +26,6 @@
2526
#include "render/goldrawstate.h"
2627
#include "save/memorycardsavegame.h"
2728
#include "surface/purpledune0x7c.h"
28-
#include "util/amethystbreeze0x104.h"
2929

3030
#include <float.h>
3131
#include <golerror.h>

0 commit comments

Comments
 (0)