1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 07:07:09 +00:00

Fix _DW with permuter and GeometryMode macros (#323)

This commit is contained in:
Roman971 2020-08-15 20:04:27 +02:00 committed by GitHub
parent 337aaf2937
commit ac8796cbc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View file

@ -7,6 +7,8 @@
/* Types */ /* Types */
/* Private macro to wrap other macros in do {...} while (0) */
#define _DW(macro) do {macro} while (0)
#define F3DEX_GBI_2 #define F3DEX_GBI_2
@ -2743,11 +2745,11 @@ _DW({ \
* gSPLoadGeometryMode(pkt, word) sets GeometryMode directly. * gSPLoadGeometryMode(pkt, word) sets GeometryMode directly.
*/ */
#define gSPGeometryMode(pkt, c, s) \ #define gSPGeometryMode(pkt, c, s) \
{ \ _DW({ \
Gfx *_g = (Gfx *)(pkt); \ Gfx *_g = (Gfx *)(pkt); \
_g->words.w0 = _SHIFTL(G_GEOMETRYMODE,24,8)|_SHIFTL(~(u32)(c),0,24);\ _g->words.w0 = _SHIFTL(G_GEOMETRYMODE,24,8)|_SHIFTL(~(u32)(c),0,24);\
_g->words.w1 = (u32)(s); \ _g->words.w1 = (u32)(s); \
} })
#define gsSPGeometryMode(c, s) \ #define gsSPGeometryMode(c, s) \
{ \ { \
@ -2762,12 +2764,12 @@ _DW({ \
#else /* F3DEX_GBI_2 */ #else /* F3DEX_GBI_2 */
#define gSPSetGeometryMode(pkt, word) \ #define gSPSetGeometryMode(pkt, word) \
_DW({ \ { \
Gfx *_g = (Gfx *)(pkt); \ Gfx *_g = (Gfx *)(pkt); \
\ \
_g->words.w0 = _SHIFTL(G_SETGEOMETRYMODE, 24, 8); \ _g->words.w0 = _SHIFTL(G_SETGEOMETRYMODE, 24, 8); \
_g->words.w1 = (unsigned int)(word); \ _g->words.w1 = (unsigned int)(word); \
}) }
#define gsSPSetGeometryMode(word) \ #define gsSPSetGeometryMode(word) \
{ \ { \
@ -2775,12 +2777,12 @@ _DW({ \
} }
#define gSPClearGeometryMode(pkt, word) \ #define gSPClearGeometryMode(pkt, word) \
_DW({ \ { \
Gfx *_g = (Gfx *)(pkt); \ Gfx *_g = (Gfx *)(pkt); \
\ \
_g->words.w0 = _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8); \ _g->words.w0 = _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8); \
_g->words.w1 = (unsigned int)(word); \ _g->words.w1 = (unsigned int)(word); \
}) }
#define gsSPClearGeometryMode(word) \ #define gsSPClearGeometryMode(word) \
{ \ { \
@ -4495,7 +4497,4 @@ _DW({ \
#endif #endif
/* Private macro to wrap other macros in do {...} while (0) */
#define _DW(macro) do {macro} while (0)
#endif #endif

View file

@ -169,8 +169,7 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
gDPLoadTextureBlock(gfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, gDPLoadTextureBlock(gfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD);
if (1) {} // Both necessary to match if (1) {} // Necessary to match
if (1) {}
gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, 0, gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, 0,
0, 0, COMBINED, 0, 0, 0, COMBINED); 0, 0, COMBINED, 0, 0, 0, COMBINED);
@ -179,8 +178,6 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR);
gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH);
if (1) {} // Also necessary to match
EffectShieldParticle_GetColors(this, &primColor, &envColor); EffectShieldParticle_GetColors(this, &primColor, &envColor);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, primColor.r, primColor.g, primColor.b, primColor.a); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, primColor.r, primColor.g, primColor.b, primColor.a);