diff --git a/src/SB/Core/x/xShadowSimple.cpp b/src/SB/Core/x/xShadowSimple.cpp index 8cc281bcd..2a62bec72 100644 --- a/src/SB/Core/x/xShadowSimple.cpp +++ b/src/SB/Core/x/xShadowSimple.cpp @@ -24,6 +24,64 @@ void xQuickCullForLine(xQCData* q, const xLine3* ln) xQuickCullForLine(&xqc_def_ctrl, q, ln); } +void xShadowSimple_CacheInit(xShadowSimpleCache* cache, xEnt* ent, u8 alpha) +{ + S32 i; + S32 n; + U32 j; + class zSimpleShadowTableHeader* sst; + class RwRaster* raster; + U32 flags; + U32 size; + class RwTexture* tex; + + S32 var_r20; + S32 var_r24; + + //memset(NULL, 0x98); + cache->corner[0].z = 1e38f; + cache->corner[1].y = 1e38f; + cache->flags = 4; + cache->alpha = alpha; + + if (ent->model != NULL) + { + if ((U32)(ent->model->shadowID + 0x21530000) != -0x4111U) + { + return; + } + flags = 0U; + var_r20 = 0; + for (i = 0; i < xSTAssetCountByType('SHDW'); i += 1) + { + sst = (zSimpleShadowTableHeader*)xSTFindAssetByType('SHDW', i, &size); + var_r24 = 0; + for (j = 0; j < (U32)sst->num; j += 1) + { + if ((U32)ent->model->modelID == 0) + { + if (xSTFindAsset(sst->num, NULL) != NULL) + { + flags = (U32)xSTFindAsset(sst->num, NULL); + var_r20 = sst->num; + } + else + { + flags = 0xDEADBEEFU; + } + } + } + } + if ((flags == 0U) || ((U32)(flags + 0x21530000) == -0x4111U)) + { + flags = sShadRaster->width; + } + cache->corner[1].x = flags; + cache->flags |= (S16)var_r20; + ent->model->shadowID = flags; + } +} + void xShadowSimple_Init() { memset(sCollQueue, 0, sizeof(sCollQueue)); diff --git a/src/SB/Core/x/xShadowSimple.h b/src/SB/Core/x/xShadowSimple.h index d718f670d..ee7abef1d 100644 --- a/src/SB/Core/x/xShadowSimple.h +++ b/src/SB/Core/x/xShadowSimple.h @@ -45,6 +45,11 @@ struct xShadowSimpleCache xVec3 corner[4]; }; +struct zSimpleShadowTableHeader { + // total size: 0x4 + U32 num; +}; + void xShadowSimple_Render(); void xShadowSimple_Add(xShadowSimpleCache* cache, xEnt* ent, F32 radius, F32 ecc); void xShadowSimple_CacheInit(xShadowSimpleCache* cache, xEnt* ent, U8 alpha);