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

Function zUI_Render

src/SB/Game/zUI.cpp:784–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782}
783
784void zUI_Render(xEnt* ent)
785{
786 static xVec3 from = { 0.0f, 0.0f, -1.0f };
787 static xVec3 to = { 0.0f, 0.0f, 0.0f };
788
789 _zUI* ui = (_zUI*)ent;
790 if (xScrFxIsLetterbox())
791 {
792 if (ent->id == cKeyUIid1off || ent->id == cKeyUIid2off || ent->id == cKeyUIid3off ||
793 ent->id == cKeyUIid4off || ent->id == cKeyUIid1on || ent->id == cKeyUIid2on ||
794 ent->id == cKeyUIid3on || ent->id == cKeyUIid4on)
795 {
796 return;
797 }
798 }
799
800 if (ui->uiFlags & 4)
801 {
802 if (xEntIsVisible(ui))
803 {
804 if (ui->sasset->textureID)
805 {
806 RwTexture* texture = (RwTexture*)xSTFindAsset(ui->sasset->textureID, 0);
807
808 if (texture != NULL && texture->raster != NULL)
809 {
810 RwRenderStateSet(rwRENDERSTATETEXTURERASTER, texture->raster);
811 }
812
813 RwRaster* raster = texture->raster;
814 U8 r = 0xFF;
815 U8 g = 0xFF;
816 U8 b = 0xFF;
817 U8 a = 0xFF;
818 F32 w = 640.0f;
819 F32 h = 480.0f;
820
821 F32 u1 = ui->sasset->uva[0];
822 F32 v1 = ui->sasset->uva[1];
823 F32 u2 = ui->sasset->uvb[0];
824 F32 v2 = ui->sasset->uvb[1];
825 F32 u3 = ui->sasset->uvc[0];
826 F32 v3 = ui->sasset->uvc[1];
827 F32 u4 = ui->sasset->uvd[0];
828 F32 v4 = ui->sasset->uvd[1];
829 F32 x1 = w * ui->sasset->pos.x / w;
830 F32 y1 = h * ui->sasset->pos.y / h;
831 F32 x2 = w * (ui->sasset->pos.x + ui->sasset->dim[0]) / w;
832 F32 y2 = h * (ui->sasset->pos.y + ui->sasset->dim[1]) / h;
833
834 F32 z = RwIm2DGetNearScreenZ();
835 F32 cz = z;
836
837 if ((float)iabs(z) <= 0.00001f)
838 {
839 cz = z >= 0.0f ? 0.00001f : -0.00001f;
840 }
841

Callers 1

zUIRenderAllFunction · 0.70

Calls 8

xScrFxIsLetterboxFunction · 0.85
xEntIsVisibleFunction · 0.85
zRenderStateFunction · 0.85
xEntRestorePipelineFunction · 0.85
xSTFindAssetFunction · 0.50
xEntSetupPipelineFunction · 0.50
xModelRender2DFunction · 0.50
xEntRenderFunction · 0.50

Tested by

no test coverage detected