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

Method PlatShadRend

src/SB/Game/zNPCTypeVillager.cpp:1886–1946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1884}
1885
1886void zNPCBalloonBoy::PlatShadRend()
1887{
1888 F32 ds2_cam;
1889 S32 fillit;
1890 S32 needit;
1891 xMat4x3 mat_fake;
1892
1893 if (this->rast_shadBalloon)
1894 {
1895 if (!plat_balloons && !shadCache)
1896 {
1897 return;
1898 }
1899
1900 if (!plat_balloons)
1901 {
1902 NPCC_ShadowCacheRelease(shadCache);
1903 shadCache = NULL;
1904 return;
1905 }
1906
1907 xVec3* pos = zNPCCommon::Pos();
1908 ds2_cam = NPCC_ds2_toCam(pos, NULL);
1909
1910 static S32 takeThePain = 0;
1911 needit = 0;
1912 takeThePain--;
1913 if (takeThePain < 0)
1914 {
1915 takeThePain = 8;
1916
1917 S32 is_close = (ds2_cam < SQ(30.0f)) ? 1 : 0;
1918 if (is_close && !shadCache)
1919 {
1920 shadCache = NPCC_ShadowCacheReserve();
1921 }
1922 else if (!is_close && shadCache)
1923 {
1924 NPCC_ShadowCacheRelease(shadCache);
1925 shadCache = NULL;
1926 }
1927 needit = 1;
1928 }
1929
1930 if (shadCache)
1931 {
1932 F32 ratio = CLAMP(ds2_cam / SQ(30.0f), 0.0f, 1.0f);
1933 F32 alpha = CLAMP(1.0f - ratio + 0.3f, 0.0f, 1.0f);
1934 fillit = alpha;
1935
1936 mat_fake.at = g_NY3;
1937 mat_fake.up = ((xMat4x3*)plat_balloons->model->Mat)->at;
1938 mat_fake.right = ((xMat4x3*)plat_balloons->model->Mat)->right;
1939 mat_fake.pos = *xEntGetCenter(plat_balloons);
1940
1941 RwMatrixUpdate((RwMatrix*)&mat_fake);
1942 NPCC_RenderProjTexture(rast_shadBalloon, alpha, &mat_fake, 0.97f, 10.0f, shadCache,
1943 needit, plat_balloons);

Callers

nothing calls this directly

Calls 5

NPCC_ShadowCacheReleaseFunction · 0.85
NPCC_ShadowCacheReserveFunction · 0.85
xEntGetCenterFunction · 0.85
NPCC_RenderProjTextureFunction · 0.85
NPCC_ds2_toCamFunction · 0.70

Tested by

no test coverage detected