MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xShadowSimple_CacheInit

Function xShadowSimple_CacheInit

src/SB/Core/x/xShadowSimple.cpp:27–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void xShadowSimple_CacheInit(xShadowSimpleCache* cache, xEnt* ent, u8 alpha)
28{
29 S32 i;
30 S32 n;
31 U32 j;
32 class zSimpleShadowTableHeader* sst;
33 class RwRaster* raster;
34 U32 flags;
35 U32 size;
36 class RwTexture* tex;
37
38 S32 var_r20;
39 S32 var_r24;
40
41 //memset(NULL, 0x98);
42 cache->corner[0].z = 1e38f;
43 cache->corner[1].y = 1e38f;
44 cache->flags = 4;
45 cache->alpha = alpha;
46
47 if (ent->model != NULL)
48 {
49 if ((U32)(ent->model->shadowID + 0x21530000) != -0x4111U)
50 {
51 return;
52 }
53 flags = 0U;
54 var_r20 = 0;
55 for (i = 0; i < xSTAssetCountByType('SHDW'); i += 1)
56 {
57 sst = (zSimpleShadowTableHeader*)xSTFindAssetByType('SHDW', i, &size);
58 var_r24 = 0;
59 for (j = 0; j < (U32)sst->num; j += 1)
60 {
61 if ((U32)ent->model->modelID == 0)
62 {
63 if (xSTFindAsset(sst->num, NULL) != NULL)
64 {
65 flags = (U32)xSTFindAsset(sst->num, NULL);
66 var_r20 = sst->num;
67 }
68 else
69 {
70 flags = 0xDEADBEEFU;
71 }
72 }
73 }
74 }
75 if ((flags == 0U) || ((U32)(flags + 0x21530000) == -0x4111U))
76 {
77 flags = sShadRaster->width;
78 }
79 cache->corner[1].x = flags;
80 cache->flags |= (S16)var_r20;
81 ent->model->shadowID = flags;
82 }
83}
84

Callers 4

InitMethod · 0.70
xEntBoulder_InitFunction · 0.70
zEntPlayer_InitFunction · 0.50
zEntPickupInitFunction · 0.50

Calls 3

xSTAssetCountByTypeFunction · 0.70
xSTFindAssetByTypeFunction · 0.70
xSTFindAssetFunction · 0.70

Tested by

no test coverage detected