Skip to content

Commit c8809a0

Browse files
authored
xScrFx progress (#692)
* xScrFx progress * Use RwIm3DVertex macros in zNPCBSandy::Init * Fix zActionLine error
1 parent 0bb9f0c commit c8809a0

File tree

8 files changed

+586
-139
lines changed

8 files changed

+586
-139
lines changed

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def MatchingFor(*versions):
455455
Object(Matching, "SB/Core/x/xQuickCull.cpp"),
456456
Object(Matching, "SB/Core/x/xsavegame.cpp"),
457457
Object(NonMatching, "SB/Core/x/xScene.cpp", extra_cflags=["-sym on"]),
458-
Object(NonMatching, "SB/Core/x/xScrFx.cpp"),
458+
Object(Equivalent, "SB/Core/x/xScrFx.cpp", extra_cflags=["-sym on"]),
459459
Object(NonMatching, "SB/Core/x/xserializer.cpp"),
460460
Object(NonMatching, "SB/Core/x/xSFX.cpp"),
461461
Object(NonMatching, "SB/Core/x/xShadow.cpp"),

include/rwsdk/rwcore.h

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,73 @@
33

44
#include <rwsdk/rwplcore.h>
55

6-
typedef struct _RxObjSpace3DVertex RxObjSpace3DVertex;
7-
8-
union RxColorUnion
9-
{
10-
RwRGBA preLitColor;
11-
RwRGBA color;
12-
};
13-
14-
// TODO: Determine whether c should go before or after objNormal
15-
// Context: These headers came from an official header source (unsure of release platform)
16-
// However, currently decomped functions seem to pack the struct
17-
// in this particular way so it's like this for now.
18-
// See: zActionLIne.cpp
19-
struct _RxObjSpace3DVertex
20-
{
21-
RwV3d objVertex;
22-
RwV3d objNormal;
23-
RxColorUnion c;
6+
typedef struct RxObjSpace3DVertex RxObjSpace3DVertex;
7+
struct RxObjSpace3DVertex
8+
{
9+
RwReal x;
10+
RwReal y;
11+
RwReal z;
12+
RwReal nx;
13+
RwReal ny;
14+
RwReal nz;
15+
RwUInt8 r;
16+
RwUInt8 g;
17+
RwUInt8 b;
18+
RwUInt8 a;
2419
RwReal u;
2520
RwReal v;
2621
};
2722

2823
typedef RxObjSpace3DVertex RxObjSpace3DLitVertex;
2924
typedef RxObjSpace3DLitVertex RwIm3DVertex;
3025

26+
#define RwIm3DVertexSetPos(_vert, _imx, _imy, _imz) \
27+
MACRO_START \
28+
{ \
29+
(_vert)->x = _imx; \
30+
(_vert)->y = _imy; \
31+
(_vert)->z = _imz; \
32+
} \
33+
MACRO_STOP
34+
35+
#define RwIm3DVertexSetNormal(_vert, _imx, _imy, _imz) \
36+
MACRO_START \
37+
{ \
38+
(_vert)->nx = _imx; \
39+
(_vert)->ny = _imy; \
40+
(_vert)->nz = _imz; \
41+
} \
42+
MACRO_STOP
43+
44+
#define RwIm3DVertexSetRGBA(_vert, _r, _g, _b, _a) \
45+
MACRO_START \
46+
{ \
47+
(_vert)->r = _r; \
48+
(_vert)->g = _g; \
49+
(_vert)->b = _b; \
50+
(_vert)->a = _a; \
51+
} \
52+
MACRO_STOP
53+
54+
#define RwIm3DVertexSetUV(_vert, _u, _v) \
55+
MACRO_START \
56+
{ \
57+
(_vert)->u = _u; \
58+
(_vert)->v = _v; \
59+
} \
60+
MACRO_STOP
61+
62+
enum RwIm3DTransformFlags
63+
{
64+
rwIM3D_VERTEXUV = 1,
65+
rwIM3D_ALLOPAQUE = 2,
66+
rwIM3D_NOCLIP = 4,
67+
rwIM3D_VERTEXXYZ = 8,
68+
rwIM3D_VERTEXRGBA = 16,
69+
rwIM3DTRANSFORMFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
70+
};
71+
typedef enum RwIm3DTransformFlags RwIm3DTransformFlags;
72+
3173
typedef struct rxHeapFreeBlock;
3274
typedef struct rxHeapSuperBlockDescriptor;
3375
typedef struct RxHeap;

src/SB/Core/gc/iParMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void iRenderFlush()
5757

5858
void iRenderTrianglesImmediate(S32 vertType, S32 vertTypeSize, void* data, S32 dataSize, U16* index, S32 indexSize)
5959
{
60-
if (RwIm3DTransform((_RxObjSpace3DVertex *)data, dataSize, NULL, 1) != NULL)
60+
if (RwIm3DTransform((RwIm3DVertex *)data, dataSize, NULL, 1) != NULL)
6161
{
6262
if (indexSize != 0)
6363
{

0 commit comments

Comments
 (0)