comparison Render.cpp @ 1390:613c77e51e38

Messed with spell effects drawing a bit.
author Nomad
date Thu, 18 Jul 2013 04:08:20 +0200
parents 65379a50e4eb
children cc9a3a24d61d
comparison
equal deleted inserted replaced
1389:4dc34f7acb0b 1390:613c77e51e38
3713 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; 3713 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
3714 local_0.uDiffuse = 0xFF3C1E; 3714 local_0.uDiffuse = 0xFF3C1E;
3715 local_0.x = v3; 3715 local_0.x = v3;
3716 local_0.y = (double)*(signed int *)v0; 3716 local_0.y = (double)*(signed int *)v0;
3717 local_0.z = (double)*((signed int *)v0 + 1); 3717 local_0.z = (double)*((signed int *)v0 + 1);
3718 local_0.flt_10 = 0.0; 3718 local_0.r = 0.0;
3719 local_0.flt_14 = 0.0; 3719 local_0.g = 0.0;
3720 local_0.flt_18 = 0.0; 3720 local_0.b = 0.0;
3721 local_0.flt_28 = 1.0; 3721 local_0.flt_28 = 1.0;
3722 local_0.timeToLive = (rand() & 0x80) + 128; 3722 local_0.timeToLive = (rand() & 0x80) + 128;
3723 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); 3723 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
3724 pGame->pParticleEngine->AddParticle(&local_0); 3724 pGame->pParticleEngine->AddParticle(&local_0);
3725 } 3725 }
7077 if (pRenderD3D) 7077 if (pRenderD3D)
7078 { 7078 {
7079 pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0); 7079 pRenderD3D->ClearTarget(true, 0x00F08020, true, 1.0);
7080 pRenderer->uNumBillboardsToDraw = 0; 7080 pRenderer->uNumBillboardsToDraw = 0;
7081 pRenderD3D->pDevice->BeginScene(); 7081 pRenderD3D->pDevice->BeginScene();
7082 if (!pRenderD3D->DoesRaiseExceptions()) 7082
7083 {
7084 MessageBoxW(nullptr, L"Error executing scratch 3D operations", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\screen16_3d.cpp:360", 0);
7085 }
7086 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 7083 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
7087 uFogColor = GetLevelFogColor(); 7084 uFogColor = GetLevelFogColor();
7088 else 7085 else
7089 uFogColor = 0; 7086 uFogColor = 0;
7090 7087
7567 28)); 7564 28));
7568 } 7565 }
7569 } 7566 }
7570 } 7567 }
7571 7568
7569
7570 //----- (00479A53) --------------------------------------------------------
7571 void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID)
7572 {
7573 BLVFace *pFace; // esi@1
7574 unsigned int v3; // edi@1
7575 PolygonType v4; // al@1
7576 double v5; // st7@3
7577 signed __int64 v6; // qax@3
7578 PolygonType v7; // cl@3
7579 int v8; // esi@7
7580 int v9; // eax@7
7581 unsigned int v10; // eax@7
7582 double v11; // st6@7
7583 int v12; // edx@7
7584 int v13; // eax@7
7585 char *v14; // esi@8
7586 void *v15; // ecx@9
7587 int v16; // eax@9
7588 int v17; // edi@9
7589 double v18; // st7@9
7590 signed int v19; // ebx@9
7591 void *v20; // ecx@9
7592 int v21; // ebx@11
7593 int v22; // eax@14
7594 signed __int64 v23; // qtt@16
7595 double v24; // st7@16
7596 unsigned __int8 v25; // sf@16
7597 unsigned __int8 v26; // of@16
7598 Render *v27; // ecx@17
7599 double v28; // st7@20
7600 char *v29; // ebx@20
7601 char *v30; // edx@20
7602 unsigned __int8 v31; // c0@21
7603 unsigned __int8 v32; // c3@21
7604 double v33; // st6@23
7605 char *v34; // esi@30
7606 const void *v35; // ecx@31
7607 int v36; // eax@31
7608 const void *v37; // edi@31
7609 signed __int64 v38; // qax@31
7610 int v39; // ecx@31
7611 int v40; // ebx@33
7612 int v41; // eax@36
7613 signed __int64 v42; // qtt@39
7614 int v43; // eax@39
7615 char v44; // zf@39
7616 double v45; // st7@39
7617 double v46; // st7@39
7618 unsigned int v47; // edx@40
7619 double v48; // st7@41
7620 RenderVertexSoft *v49; // ebx@41
7621 void *v50; // edi@43
7622 double v51; // st7@46
7623 RenderVertexSoft *v52; // edx@46
7624 void *v53; // edi@48
7625 char *v54; // ebx@52
7626 unsigned int v55; // eax@53
7627 unsigned int v56; // eax@55
7628 int v57; // ST10_4@55
7629 Texture *v58; // eax@55
7630 signed int v59; // [sp-4h] [bp-178h]@17
7631 stru148 *v60; // [sp+0h] [bp-174h]@17
7632 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
7633 stru148 v62; // [sp+14h] [bp-160h]@6
7634 unsigned int v63; // [sp+120h] [bp-54h]@7
7635 double v64; // [sp+124h] [bp-50h]@7
7636 unsigned int v65; // [sp+128h] [bp-4Ch]@1
7637 unsigned int v66; // [sp+12Ch] [bp-48h]@7
7638 float v67; // [sp+130h] [bp-44h]@7
7639 __int64 v68; // [sp+134h] [bp-40h]@3
7640 __int64 v69; // [sp+13Ch] [bp-38h]@3
7641 int v70; // [sp+144h] [bp-30h]@3
7642 int X; // [sp+148h] [bp-2Ch]@9
7643 int v72; // [sp+14Ch] [bp-28h]@7
7644 float v73; // [sp+150h] [bp-24h]@16
7645 unsigned int v74; // [sp+154h] [bp-20h]@3
7646 RenderVertexSoft *v75; // [sp+158h] [bp-1Ch]@3
7647 float v76; // [sp+15Ch] [bp-18h]@9
7648 int v77; // [sp+160h] [bp-14h]@9
7649 int v78; // [sp+164h] [bp-10h]@7
7650 void *v79; // [sp+168h] [bp-Ch]@9
7651 float v80; // [sp+16Ch] [bp-8h]@3
7652 const void *v81; // [sp+170h] [bp-4h]@7
7653
7654 __debugbreak();
7655
7656 pFace = &pIndoor->pFaces[uFaceID];
7657 v65 = uFaceID;
7658 v3 = uNumVertices;
7659 v4 = pFace->uPolygonType;
7660 if ( v4 == POLYGON_InBetweenFloorAndWall || v4 == POLYGON_Floor )
7661 {
7662 if ( (signed int)uNumVertices > 0 )
7663 {
7664 v54 = (char *)&array_507D30[0].u;
7665 LODWORD(v80) = uNumVertices;
7666 do
7667 {
7668 v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x;
7669 *(float *)v54 = (double)v69 + *(float *)v54;
7670 *(float *)v54 = *(float *)v54 * 0.25;
7671 v55 = GetTickCount();
7672 v54 += 48;
7673 v44 = LODWORD(v80)-- == 1;
7674 v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5);
7675 *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25;
7676 }
7677 while ( !v44 );
7678 uFaceID = v65;
7679 }
7680 v56 = 8 * uFaceID;
7681 LOBYTE(v56) = PID(OBJECT_BModel,uFaceID);
7682 v57 = v56;
7683 v58 = pFace->GetTexture();
7684 pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0);
7685 return;
7686 }
7687 HIDWORD(v69) = pIndoorCamera->sRotationX;
7688 HIDWORD(v68) = pIndoorCamera->pos.z;
7689 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
7690 v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z)
7691 / (((double)pBLVRenderParams->field_40 + 16192.0)
7692 * 65536.0)
7693 + *(float *)&v74);
7694 v5 = (double)pIndoorCamera->sRotationX * 0.0030664064;
7695 *(float *)&v75 = v5;
7696 v80 = cos(v5) * 16192.0;
7697 v6 = (signed __int64)(*(float *)&v74
7698 - (double)pBLVRenderParams->field_40
7699 / ((v80 + 0.0000001)
7700 * 65535.0)
7701 * (sin(*(float *)&v75) * -16192.0 - (double)SHIDWORD(v68)));
7702 v7 = pFace->uPolygonType;
7703 if ( v7 == 4 || v7 == 3 )
7704 v70 = v6;
7705 stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0);
7706 v62._48607B(&stru_8019C8);
7707 v62.uTileBitmapID = pFace->uBitmapID;
7708 v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
7709 if ( !v62.pTexture )
7710 return;
7711 v8 = pBLVRenderParams->sPartyRotX;
7712 v62.dimming_level = 0;
7713 v62.uNumVertices = v3;
7714 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16);
7715 v62.v_18.y = 0;
7716 v62.v_18.x = -v9;
7717 v62.v_18.z = -stru_5C6E00->Cos(v8 + 16);
7718 v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX;
7719 memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3]));
7720 LODWORD(v80) = v10;
7721 v62.field_24 = 33554432;
7722 v64 = (double)(signed int)v10 * 0.5;
7723 v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5);
7724 LODWORD(v80) = v62.pTexture->uTextureWidth;
7725 v11 = 1.0 / (double)SLODWORD(v80);
7726 LODWORD(v80) = v62.pTexture->uTextureHeight;
7727 v12 = v62.pTexture->uWidthMinus1;
7728 v13 = v62.pTexture->uHeightMinus1;
7729 v67 = v11;
7730 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13;
7731 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12;
7732 v78 = 0;
7733 v81 = 0;
7734 *((float *)&v68 + 1) = 1.0 / (double)SLODWORD(v80);
7735 if ( (signed int)v62.uNumVertices <= 0 )
7736 {
7737 LABEL_17:
7738 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
7739 v27 = pRenderer;
7740 v60 = &v62;
7741 v59 = v62.uNumVertices;
7742 goto LABEL_18;
7743 }
7744 v14 = (char *)&array_507D30[0].vWorldViewProjY;
7745 while ( 2 )
7746 {
7747 v15 = (void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v14));
7748 LODWORD(v80) = v62.ptr_38->field_14;
7749 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16;
7750 v16 = v77 + v62.ptr_38->field_C;
7751 v77 = (int)v15;
7752 v74 = v16;
7753 LODWORD(v80) = v62.ptr_38->field_20;
7754 v77 = (unsigned __int64)(SLODWORD(v80) * (signed __int64)(signed int)v15) >> 16;
7755 v79 = v15;
7756 v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->field_18);
7757 LODWORD(v80) = v62.v_18.z;
7758 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16);
7759 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v14 - 1));
7760 v18 = *(float *)v14 - 1.0;
7761 v19 = -v62.field_24;
7762 v77 = -v62.field_24;
7763 X = (int)((char *)v79 + v62.v_18.x);
7764 LODWORD(v76) = (signed __int64)v18;
7765 v20 = (void *)(v72 * (v70 - LODWORD(v76)));
7766 while ( 1 )
7767 {
7768 v79 = v20;
7769 if ( !X )
7770 goto LABEL_14;
7771 v21 = abs(v19 >> 14);
7772 if ( v21 <= abs(X) )
7773 break;
7774 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
7775 break;
7776 v19 = v77;
7777 v20 = v79;
7778 LABEL_14:
7779 LODWORD(v80) = v62.v_18.z;
7780 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16);
7781 v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16;
7782 --LODWORD(v76);
7783 v20 = (char *)v20 + v72;
7784 X = v22 + v62.v_18.x;
7785 v78 = 1;
7786 }
7787 if ( !v78 )
7788 {
7789 LODWORD(v23) = v77 << 16;
7790 HIDWORD(v23) = v77 >> 16;
7791 v79 = (void *)(v23 / X);
7792 v77 = v17;
7793 LODWORD(v80) = v62.ptr_38->field_10;
7794 v77 = v17;
7795 LODWORD(v76) = v74 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16);
7796 LODWORD(v80) = v62.ptr_38->field_1C;
7797 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(SLODWORD(v80) * (signed __int64)v17) >> 16));
7798 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16;
7799 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16;
7800 v14 += 48;
7801 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4);
7802 v81 = (char *)v81 + 1;
7803 v24 = (double)SLODWORD(v80) * 0.000015259022;
7804 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
7805 v26 = __OFSUB__((int)v81, v62.uNumVertices);
7806 v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0;
7807 *((float *)v14 - 10) = v24 * v67;
7808 *((float *)v14 - 9) = (double)SLODWORD(v80) * 0.000015259022 * *((float *)&v68 + 1);
7809 *((float *)v14 - 11) = 65536.0 / (double)(signed int)v79;
7810 if ( !(v25 ^ v26) )
7811 goto LABEL_17;
7812 continue;
7813 }
7814 break;
7815 }
7816 LODWORD(v73) = 0;
7817 v80 = v76;
7818 if ( (signed int)v62.uNumVertices > 0 )
7819 {
7820 v28 = (double)SLODWORD(v76);
7821 LODWORD(v76) = (int)(char *)array_50AC10 + 28;
7822 v29 = (char *)&array_50AC10[0].vWorldViewProjX;
7823 v30 = (char *)&array_507D30[1].vWorldViewProjY;
7824 v79 = array_50AC10;
7825 v81 = array_507D30;
7826 v78 = v62.uNumVertices;
7827 do
7828 {
7829 v31 = v28 < *((float *)v30 - 12);
7830 v32 = v28 == *((float *)v30 - 12);
7831 ++LODWORD(v73);
7832 memcpy(v79, v81, 0x30u);
7833 v79 = (char *)v79 + 48;
7834 LODWORD(v76) += 48;
7835 v29 += 48;
7836 if ( v31 | v32 || v28 >= *(float *)v30 )
7837 {
7838 if ( v28 >= *((float *)v30 - 12) || v28 <= *(float *)v30 )
7839 goto LABEL_28;
7840 v33 = (*((float *)v30 - 1) - *((float *)v30 - 13)) * v28 / (*(float *)v30 - *((float *)v30 - 12))
7841 + *((float *)v30 - 1);
7842 }
7843 else
7844 {
7845 v33 = (*((float *)v30 - 13) - *((float *)v30 - 1)) * v28 / (*((float *)v30 - 12) - *(float *)v30)
7846 + *((float *)v30 - 13);
7847 }
7848 *(float *)v29 = v33;
7849 v79 = (char *)v79 + 48;
7850 v29 += 48;
7851 ++LODWORD(v73);
7852 *(unsigned int *)LODWORD(v76) = v28;
7853 LODWORD(v76) += 48;
7854 LABEL_28:
7855 v81 = (char *)v81 + 48;
7856 v30 += 48;
7857 --v78;
7858 }
7859 while ( v78 );
7860 }
7861 if ( SLODWORD(v73) <= 0 )
7862 goto LABEL_40;
7863 v34 = (char *)&array_50AC10[0].vWorldViewProjY;
7864 v65 = v77 >> 14;
7865 HIDWORD(v69) = LODWORD(v73);
7866 do
7867 {
7868 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34));
7869 v78 = v62.ptr_38->field_14;
7870 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
7871 v36 = (int)((char *)v81 + v62.ptr_38->field_C);
7872 v81 = v35;
7873 v74 = v36;
7874 v78 = v62.ptr_38->field_20;
7875 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
7876 v78 = (int)v35;
7877 v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->field_18);
7878 v81 = (const void *)v62.v_18.z;
7879 v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16;
7880 v37 = (const void *)(v72
7881 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1)));
7882 v38 = (signed __int64)(*(float *)v34 - 1.0);
7883 v81 = 0;
7884 LODWORD(v76) = v38;
7885 v39 = v72 * (v70 - v38);
7886 while ( 1 )
7887 {
7888 v78 = v39;
7889 if ( !X )
7890 goto LABEL_36;
7891 v40 = abs(X);
7892 if ( abs((signed __int64)v65) <= v40 )
7893 break;
7894 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
7895 break;
7896 v39 = v78;
7897 LABEL_36:
7898 v78 = v62.v_18.z;
7899 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16;
7900 --LODWORD(v76);
7901 v39 += v72;
7902 X = v41 + v62.v_18.x;
7903 v81 = (const void *)1;
7904 }
7905 if ( v81 )
7906 {
7907 v79 = (void *)v62.v_18.z;
7908 v78 = 2 * LODWORD(v76);
7909 v81 = (const void *)((unsigned __int64)(v62.v_18.z
7910 * (signed __int64)(signed int)(signed __int64)(((double)v70
7911 - ((double)(2 * LODWORD(v76))
7912 - *(float *)v34))
7913 * (double)v72)) >> 16);
7914 X = (int)((char *)v81 + v62.v_18.x);
7915 }
7916 LODWORD(v42) = v77 << 16;
7917 HIDWORD(v42) = v77 >> 16;
7918 v79 = (void *)(v42 / X);
7919 v81 = v37;
7920 v78 = v62.ptr_38->field_10;
7921 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
7922 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
7923 v74 = (unsigned int)v37;
7924 LODWORD(v76) = v43;
7925 v78 = v62.ptr_38->field_1C;
7926 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16));
7927 v74 = (unsigned __int64)(v43 * v42 / X) >> 16;
7928 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16);
7929 v34 += 48;
7930 v78 = v66 + ((signed int)v74 >> 4);
7931 v44 = HIDWORD(v69)-- == 1;
7932 v45 = (double)v78 * 0.000015259022;
7933 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4);
7934 *((float *)v34 - 10) = v45 * v67;
7935 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * *((float *)&v68 + 1);
7936 v46 = (double)(signed int)v79;
7937 *((float *)v34 - 16) = 0.000015258789 * v46;
7938 *((float *)v34 - 11) = 65536.0 / v46;
7939 }
7940 while ( !v44 );
7941 LABEL_40:
7942 v47 = 0;
7943 if ( SLODWORD(v73) > 0 )
7944 {
7945 v48 = (double)SLODWORD(v80);
7946 v75 = array_507D30;
7947 v49 = array_50AC10;
7948 HIDWORD(v69) = LODWORD(v73);
7949 do
7950 {
7951 if ( v48 >= v49->vWorldViewProjY )
7952 {
7953 v50 = v75;
7954 ++v47;
7955 ++v75;
7956 memcpy(v50, v49, 0x30u);
7957 }
7958 ++v49;
7959 --HIDWORD(v69);
7960 }
7961 while ( HIDWORD(v69) );
7962 }
7963 v62.uNumVertices = v47;
7964 pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]);
7965 *(float *)&v74 = 0.0;
7966 if ( SLODWORD(v73) > 0 )
7967 {
7968 v51 = (double)SLODWORD(v80);
7969 v75 = array_507D30;
7970 v52 = array_50AC10;
7971 v80 = v73;
7972 do
7973 {
7974 if ( v51 <= v52->vWorldViewProjY )
7975 {
7976 v53 = v75;
7977 ++v74;
7978 ++v75;
7979 memcpy(v53, v52, 0x30u);
7980 }
7981 ++v52;
7982 --LODWORD(v80);
7983 }
7984 while ( v80 != 0.0 );
7985 }
7986 v62.uNumVertices = v74;
7987 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
7988 v60 = &v62;
7989 v59 = v74;
7990 v27 = pRenderer;
7991 LABEL_18:
7992 v27->_4A2ED5(v59, v60, v61);
7993 }
7994
7995
7572 //----- (004A2FC0) -------------------------------------------------------- 7996 //----- (004A2FC0) --------------------------------------------------------
7573 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) 7997 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8)
7574 { 7998 {
7575 //Render *v8; // edi@1 7999 //Render *v8; // edi@1
7576 //unsigned int v9; // esi@3 8000 //unsigned int v9; // esi@3
7839 else 8263 else
7840 { 8264 {
7841 v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0); 8265 v12 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0);
7842 } 8266 }
7843 //v13 = (double)v25; 8267 //v13 = (double)v25;
7844 pBillboardRenderListD3D[v7].pQuards[0].specular = 0; 8268 pBillboardRenderListD3D[v7].pQuads[0].specular = 0;
7845 pBillboardRenderListD3D[v7].pQuards[0].diffuse = v12; 8269 pBillboardRenderListD3D[v7].pQuads[0].diffuse = v12;
7846 pBillboardRenderListD3D[v7].pQuards[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1; 8270 pBillboardRenderListD3D[v7].pQuads[0].pos.x = pSoftBillboard->uScreenSpaceX - v31 * a1;
7847 //v14 = (double)v24; 8271 //v14 = (double)v24;
7848 //v32 = v14; 8272 //v32 = v14;
7849 pBillboardRenderListD3D[v7].pQuards[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29; 8273 pBillboardRenderListD3D[v7].pQuads[0].pos.y = pSoftBillboard->uScreenSpaceY - v27 * v29;
7850 v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894); 8274 v15 = 1.0 - 1.0 / (pSoftBillboard->zbuffer_depth * 0.061758894);
7851 pBillboardRenderListD3D[v7].pQuards[0].pos.z = v15; 8275 pBillboardRenderListD3D[v7].pQuads[0].pos.z = v15;
7852 v16 = 1.0 / pSoftBillboard->zbuffer_depth; 8276 v16 = 1.0 / pSoftBillboard->zbuffer_depth;
7853 pBillboardRenderListD3D[v7].pQuards[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth; 8277 pBillboardRenderListD3D[v7].pQuads[0].rhw = 1.0 / pSoftBillboard->zbuffer_depth;
7854 pBillboardRenderListD3D[v7].pQuards[0].texcoord.x = 0.0; 8278 pBillboardRenderListD3D[v7].pQuads[0].texcoord.x = 0.0;
7855 pBillboardRenderListD3D[v7].pQuards[0].texcoord.y = 0.0; 8279 pBillboardRenderListD3D[v7].pQuads[0].texcoord.y = 0.0;
7856 v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX); 8280 v17 = (double)((pSprite->uBufferWidth >> 1) - pSprite->uAreaX);
7857 v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight); 8281 v18 = (double)(pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight);
7858 if ( pSoftBillboard->uFlags & 4 ) 8282 if ( pSoftBillboard->uFlags & 4 )
7859 v17 = v17 * -1.0; 8283 v17 = v17 * -1.0;
7860 pBillboardRenderListD3D[v7].pQuards[1].specular = 0; 8284 pBillboardRenderListD3D[v7].pQuads[1].specular = 0;
7861 pBillboardRenderListD3D[v7].pQuards[1].diffuse = v12; 8285 pBillboardRenderListD3D[v7].pQuads[1].diffuse = v12;
7862 pBillboardRenderListD3D[v7].pQuards[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1; 8286 pBillboardRenderListD3D[v7].pQuads[1].pos.x = pSoftBillboard->uScreenSpaceX - v17 * a1;
7863 pBillboardRenderListD3D[v7].pQuards[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29; 8287 pBillboardRenderListD3D[v7].pQuads[1].pos.y = pSoftBillboard->uScreenSpaceY - v18 * v29;
7864 pBillboardRenderListD3D[v7].pQuards[1].pos.z = v15; 8288 pBillboardRenderListD3D[v7].pQuads[1].pos.z = v15;
7865 pBillboardRenderListD3D[v7].pQuards[1].rhw = v16; 8289 pBillboardRenderListD3D[v7].pQuads[1].rhw = v16;
7866 pBillboardRenderListD3D[v7].pQuards[1].texcoord.x = 0.0; 8290 pBillboardRenderListD3D[v7].pQuads[1].texcoord.x = 0.0;
7867 pBillboardRenderListD3D[v7].pQuards[1].texcoord.y = 1.0; 8291 pBillboardRenderListD3D[v7].pQuads[1].texcoord.y = 1.0;
7868 v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight; 8292 v19 = pSprite->uBufferHeight - pSprite->uAreaY - pSprite->uAreaHeight;
7869 v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); 8293 v20 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
7870 if ( pSoftBillboard->uFlags & 4 ) 8294 if ( pSoftBillboard->uFlags & 4 )
7871 v20 = v20 * -1.0; 8295 v20 = v20 * -1.0;
7872 pBillboardRenderListD3D[v7].pQuards[2].specular = 0; 8296 pBillboardRenderListD3D[v7].pQuads[2].specular = 0;
7873 pBillboardRenderListD3D[v7].pQuards[2].diffuse = v12; 8297 pBillboardRenderListD3D[v7].pQuads[2].diffuse = v12;
7874 pBillboardRenderListD3D[v7].pQuards[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX; 8298 pBillboardRenderListD3D[v7].pQuads[2].pos.x = v20 * a1 + pSoftBillboard->uScreenSpaceX;
7875 pBillboardRenderListD3D[v7].pQuards[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29; 8299 pBillboardRenderListD3D[v7].pQuads[2].pos.y = pSoftBillboard->uScreenSpaceY - (double)v19 * v29;
7876 pBillboardRenderListD3D[v7].pQuards[2].pos.z = v15; 8300 pBillboardRenderListD3D[v7].pQuads[2].pos.z = v15;
7877 pBillboardRenderListD3D[v7].pQuards[2].rhw = v16; 8301 pBillboardRenderListD3D[v7].pQuads[2].rhw = v16;
7878 pBillboardRenderListD3D[v7].pQuards[2].texcoord.x = 1.0; 8302 pBillboardRenderListD3D[v7].pQuads[2].texcoord.x = 1.0;
7879 pBillboardRenderListD3D[v7].pQuards[2].texcoord.y = 1.0; 8303 pBillboardRenderListD3D[v7].pQuads[2].texcoord.y = 1.0;
7880 v21 = pSprite->uBufferHeight - pSprite->uAreaY; 8304 v21 = pSprite->uBufferHeight - pSprite->uAreaY;
7881 v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth); 8305 v22 = (double)(pSprite->uAreaX + pSprite->uAreaWidth + (pSprite->uBufferWidth >> 1) - pSprite->uBufferWidth);
7882 if ( pSoftBillboard->uFlags & 4 ) 8306 if ( pSoftBillboard->uFlags & 4 )
7883 v22 = v22 * -1.0; 8307 v22 = v22 * -1.0;
7884 pBillboardRenderListD3D[v7].pQuards[3].specular = 0; 8308 pBillboardRenderListD3D[v7].pQuads[3].specular = 0;
7885 pBillboardRenderListD3D[v7].pQuards[3].diffuse = v12; 8309 pBillboardRenderListD3D[v7].pQuads[3].diffuse = v12;
7886 pBillboardRenderListD3D[v7].pQuards[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX; 8310 pBillboardRenderListD3D[v7].pQuads[3].pos.x = v22 * a1 + pSoftBillboard->uScreenSpaceX;
7887 pBillboardRenderListD3D[v7].pQuards[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29; 8311 pBillboardRenderListD3D[v7].pQuads[3].pos.y = pSoftBillboard->uScreenSpaceY - (double)v21 * v29;
7888 pBillboardRenderListD3D[v7].pQuards[3].pos.z = v15; 8312 pBillboardRenderListD3D[v7].pQuads[3].pos.z = v15;
7889 pBillboardRenderListD3D[v7].pQuards[3].rhw = v16; 8313 pBillboardRenderListD3D[v7].pQuads[3].rhw = v16;
7890 pBillboardRenderListD3D[v7].pQuards[3].texcoord.x = 1.0; 8314 pBillboardRenderListD3D[v7].pQuads[3].texcoord.x = 1.0;
7891 pBillboardRenderListD3D[v7].pQuards[3].texcoord.y = 0.0; 8315 pBillboardRenderListD3D[v7].pQuads[3].texcoord.y = 0.0;
7892 //v23 = pSprite->pTexture; 8316 //v23 = pSprite->pTexture;
7893 pBillboardRenderListD3D[v7].uNumVertices = 4; 8317 pBillboardRenderListD3D[v7].uNumVertices = 4;
7894 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth; 8318 pBillboardRenderListD3D[v7].z_order = pSoftBillboard->zbuffer_depth;
7895 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture; 8319 pBillboardRenderListD3D[v7].pTexture = pSprite->pTexture;
7896 } 8320 }
7965 v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); 8389 v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12);
7966 v18 = stru_5C6E00->Cos(angle); 8390 v18 = stru_5C6E00->Cos(angle);
7967 v19 = stru_5C6E00->Sin(angle); 8391 v19 = stru_5C6E00->Sin(angle);
7968 v20 = stru_5C6E00->Sin(angle); 8392 v20 = stru_5C6E00->Sin(angle);
7969 v21 = stru_5C6E00->Cos(angle); 8393 v21 = stru_5C6E00->Cos(angle);
7970 pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 8394 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
7971 + (double)(v18 >> 16)) 8395 + (double)(v18 >> 16))
7972 * v16 8396 * v16
7973 - ((double)(unsigned __int16)v19 * 0.000015259022 8397 - ((double)(unsigned __int16)v19 * 0.000015259022
7974 + (double)(v19 >> 16)) 8398 + (double)(v19 >> 16))
7975 * v17) 8399 * v17)
7977 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 8401 v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17
7978 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 8402 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16
7979 - 12.0) 8403 - 12.0)
7980 * v11 8404 * v11
7981 + (double)a2->uScreenSpaceY; 8405 + (double)a2->uScreenSpaceY;
7982 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; 8406 pBillboardRenderListD3D[v8].pQuads[0].specular = 0;
7983 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; 8407 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse;
7984 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; 8408 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v22;
7985 pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); 8409 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894);
7986 pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; 8410 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth;
7987 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; 8411 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
7988 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; 8412 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
7989 v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; 8413 v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX;
7990 v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); 8414 v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12);
7991 v25 = stru_5C6E00->Cos(angle); 8415 v25 = stru_5C6E00->Cos(angle);
7992 v26 = stru_5C6E00->Sin(angle); 8416 v26 = stru_5C6E00->Sin(angle);
7993 v27 = stru_5C6E00->Sin(angle); 8417 v27 = stru_5C6E00->Sin(angle);
7994 v28 = stru_5C6E00->Cos(angle); 8418 v28 = stru_5C6E00->Cos(angle);
7995 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 8419 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022
7996 + (double)(v25 >> 16)) 8420 + (double)(v25 >> 16))
7997 * v31 8421 * v31
7998 - ((double)(unsigned __int16)v26 * 0.000015259022 8422 - ((double)(unsigned __int16)v26 * 0.000015259022
7999 + (double)(v26 >> 16)) 8423 + (double)(v26 >> 16))
8000 * v32) 8424 * v32)
8002 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32 8426 v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32
8003 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31 8427 + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31
8004 - 12.0) 8428 - 12.0)
8005 * v11 8429 * v11
8006 + (double)a2->uScreenSpaceY; 8430 + (double)a2->uScreenSpaceY;
8007 pBillboardRenderListD3D[v8].pQuards[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuards[0].pos.z; 8431 pBillboardRenderListD3D[v8].pQuads[1].pos.z = pRenderer->pBillboardRenderListD3D[v8].pQuads[0].pos.z;
8008 v30 = pBillboardRenderListD3D[v8].pQuards[0].rhw; 8432 v30 = pBillboardRenderListD3D[v8].pQuads[0].rhw;
8009 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v29; 8433 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v29;
8010 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; 8434 pBillboardRenderListD3D[v8].pQuads[1].specular = 0;
8011 pBillboardRenderListD3D[v8].pQuards[1].rhw = v30; 8435 pBillboardRenderListD3D[v8].pQuads[1].rhw = v30;
8012 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; 8436 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse;
8013 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; 8437 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
8014 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; 8438 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
8015 v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; 8439 v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX;
8016 v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); 8440 v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12);
8017 v33 = stru_5C6E00->Cos(angle); 8441 v33 = stru_5C6E00->Cos(angle);
8018 v34 = stru_5C6E00->Sin(angle); 8442 v34 = stru_5C6E00->Sin(angle);
8019 v35 = stru_5C6E00->Sin(angle); 8443 v35 = stru_5C6E00->Sin(angle);
8020 v36 = stru_5C6E00->Cos(angle); 8444 v36 = stru_5C6E00->Cos(angle);
8021 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 8445 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022
8022 + (double)(v33 >> 16)) 8446 + (double)(v33 >> 16))
8023 * v23 8447 * v23
8024 - ((double)(unsigned __int16)v34 * 0.000015259022 8448 - ((double)(unsigned __int16)v34 * 0.000015259022
8025 + (double)(v34 >> 16)) 8449 + (double)(v34 >> 16))
8026 * v24) 8450 * v24)
8027 * v11 + (double) a2->uScreenSpaceX; 8451 * v11 + (double) a2->uScreenSpaceX;
8028 v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; 8452 v37 = pBillboardRenderListD3D[v8].pQuads[0].pos.z;
8029 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 8453 v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24
8030 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 8454 + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23
8031 - 12.0) 8455 - 12.0)
8032 * v11 8456 * v11
8033 + (double)a2->uScreenSpaceY; 8457 + (double)a2->uScreenSpaceY;
8034 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; 8458 pBillboardRenderListD3D[v8].pQuads[2].specular = 0;
8035 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v37; 8459 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v37;
8036 pBillboardRenderListD3D[v8].pQuards[2].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; 8460 pBillboardRenderListD3D[v8].pQuads[2].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw;
8037 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; 8461 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse;
8038 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; 8462 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v38;
8039 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; 8463 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
8040 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; 8464 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
8041 v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; 8465 v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX;
8042 v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); 8466 v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12);
8043 v41 = stru_5C6E00->Cos(angle); 8467 v41 = stru_5C6E00->Cos(angle);
8044 v42 = stru_5C6E00->Sin(angle); 8468 v42 = stru_5C6E00->Sin(angle);
8045 v43 = stru_5C6E00->Sin(angle); 8469 v43 = stru_5C6E00->Sin(angle);
8046 v44 = stru_5C6E00->Cos(angle); 8470 v44 = stru_5C6E00->Cos(angle);
8047 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 8471 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022
8048 + (double)(v41 >> 16)) 8472 + (double)(v41 >> 16))
8049 * v39 8473 * v39
8050 - ((double)(unsigned __int16)v42 * 0.000015259022 8474 - ((double)(unsigned __int16)v42 * 0.000015259022
8051 + (double)(v42 >> 16)) 8475 + (double)(v42 >> 16))
8052 * v40) 8476 * v40)
8054 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 8478 v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40
8055 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 8479 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39
8056 - 12.0) 8480 - 12.0)
8057 * v11 8481 * v11
8058 + (double)a2->uScreenSpaceY; 8482 + (double)a2->uScreenSpaceY;
8059 v46 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; 8483 v46 = pBillboardRenderListD3D[v8].pQuads[0].pos.z;
8060 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; 8484 pBillboardRenderListD3D[v8].pQuads[3].specular = 0;
8061 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v46; 8485 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v46;
8062 pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; 8486 pBillboardRenderListD3D[v8].pQuads[3].rhw = pBillboardRenderListD3D[v8].pQuads[0].rhw;
8063 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; 8487 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse;
8064 pBillboardRenderListD3D[v8].pTexture = a3; 8488 pBillboardRenderListD3D[v8].pTexture = a3;
8065 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; 8489 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth;
8066 pBillboardRenderListD3D[v8].uNumVertices = 4; 8490 pBillboardRenderListD3D[v8].uNumVertices = 4;
8067 pBillboardRenderListD3D[v8].pQuards[3].pos.y = v45; 8491 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v45;
8068 pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; 8492 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
8069 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; 8493 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
8070 } 8494 }
8071 } 8495 }
8072 } 8496 }
8073 8497
8074 //----- (004A3AD9) -------------------------------------------------------- 8498 //----- (004A3AD9) --------------------------------------------------------
8139 v18 = stru_5C6E00->Cos(angle); 8563 v18 = stru_5C6E00->Cos(angle);
8140 v19 = angle - stru_5C6E00->uIntegerHalfPi; 8564 v19 = angle - stru_5C6E00->uIntegerHalfPi;
8141 v20 = stru_5C6E00->Sin(angle); 8565 v20 = stru_5C6E00->Sin(angle);
8142 v21 = stru_5C6E00->Sin(angle); 8566 v21 = stru_5C6E00->Sin(angle);
8143 v22 = stru_5C6E00->Cos(angle); 8567 v22 = stru_5C6E00->Cos(angle);
8144 pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 8568 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022
8145 + (double)(v18 >> 16)) 8569 + (double)(v18 >> 16))
8146 * v16 8570 * v16
8147 - ((double)(unsigned __int16)v20 * 0.000015259022 8571 - ((double)(unsigned __int16)v20 * 0.000015259022
8148 + (double)(v20 >> 16)) 8572 + (double)(v20 >> 16))
8149 * v17) 8573 * v17)
8151 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17 8575 v23 = (((double)(unsigned __int16)v22 * 0.000015259022 + (double)(v22 >> 16)) * v17
8152 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16 8576 + ((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v16
8153 - 12.0) 8577 - 12.0)
8154 * v11 8578 * v11
8155 + (double)a2->uScreenSpaceY; 8579 + (double)a2->uScreenSpaceY;
8156 pBillboardRenderListD3D[v8].pQuards[0].specular = 0; 8580 pBillboardRenderListD3D[v8].pQuads[0].specular = 0;
8157 pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; 8581 pBillboardRenderListD3D[v8].pQuads[0].diffuse = uDiffuse;
8158 pBillboardRenderListD3D[v8].pQuards[0].pos.y = v23; 8582 pBillboardRenderListD3D[v8].pQuads[0].pos.y = v23;
8159 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 8583 v24 = 1.0 - 1.0 / (v6 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
8160 pBillboardRenderListD3D[v8].pQuards[0].pos.z = v24; 8584 pBillboardRenderListD3D[v8].pQuads[0].pos.z = v24;
8161 v25 = 1.0 / v6; 8585 v25 = 1.0 / v6;
8162 pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; 8586 pBillboardRenderListD3D[v8].pQuads[0].rhw = v25;
8163 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; 8587 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
8164 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; 8588 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
8165 v26 = (double)(a2->uScreenSpaceX - 12) - v13; 8589 v26 = (double)(a2->uScreenSpaceX - 12) - v13;
8166 v27 = (double)a2->uScreenSpaceY - v15; 8590 v27 = (double)a2->uScreenSpaceY - v15;
8167 v28 = stru_5C6E00->Cos(angle); 8591 v28 = stru_5C6E00->Cos(angle);
8168 v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8592 v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8169 v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8593 v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8170 v31 = stru_5C6E00->Cos(angle); 8594 v31 = stru_5C6E00->Cos(angle);
8171 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 8595 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022
8172 + (double)(v28 >> 16)) 8596 + (double)(v28 >> 16))
8173 * v26 8597 * v26
8174 - ((double)(unsigned __int16)v29 * 0.000015259022 8598 - ((double)(unsigned __int16)v29 * 0.000015259022
8175 + (double)(v29 >> 16)) 8599 + (double)(v29 >> 16))
8176 * v27) 8600 * v27)
8178 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27 8602 v32 = (((double)(unsigned __int16)v31 * 0.000015259022 + (double)(v31 >> 16)) * v27
8179 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26 8603 + ((double)(unsigned __int16)v30 * 0.000015259022 + (double)(v30 >> 16)) * v26
8180 - 12.0) 8604 - 12.0)
8181 * v11 8605 * v11
8182 + (double)a2->uScreenSpaceY; 8606 + (double)a2->uScreenSpaceY;
8183 pBillboardRenderListD3D[v8].pQuards[1].pos.z = v24; 8607 pBillboardRenderListD3D[v8].pQuads[1].pos.z = v24;
8184 pBillboardRenderListD3D[v8].pQuards[1].pos.y = v32; 8608 pBillboardRenderListD3D[v8].pQuads[1].pos.y = v32;
8185 pBillboardRenderListD3D[v8].pQuards[1].specular = 0; 8609 pBillboardRenderListD3D[v8].pQuads[1].specular = 0;
8186 pBillboardRenderListD3D[v8].pQuards[1].rhw = v25; 8610 pBillboardRenderListD3D[v8].pQuads[1].rhw = v25;
8187 pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; 8611 pBillboardRenderListD3D[v8].pQuads[1].diffuse = uDiffuse;
8188 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; 8612 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
8189 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; 8613 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
8190 v33 = (double)(a2->uScreenSpaceX + 12) - v13; 8614 v33 = (double)(a2->uScreenSpaceX + 12) - v13;
8191 v34 = (double)a2->uScreenSpaceY - v15; 8615 v34 = (double)a2->uScreenSpaceY - v15;
8192 v35 = stru_5C6E00->Cos(angle); 8616 v35 = stru_5C6E00->Cos(angle);
8193 v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8617 v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8194 v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8618 v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8195 v38 = stru_5C6E00->Cos(angle); 8619 v38 = stru_5C6E00->Cos(angle);
8196 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 8620 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022
8197 + (double)(v35 >> 16)) 8621 + (double)(v35 >> 16))
8198 * v33 8622 * v33
8199 - ((double)(unsigned __int16)v36 * 0.000015259022 8623 - ((double)(unsigned __int16)v36 * 0.000015259022
8200 + (double)(v36 >> 16)) 8624 + (double)(v36 >> 16))
8201 * v34) 8625 * v34)
8203 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34 8627 v39 = (((double)(unsigned __int16)v38 * 0.000015259022 + (double)(v38 >> 16)) * v34
8204 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33 8628 + ((double)(unsigned __int16)v37 * 0.000015259022 + (double)(v37 >> 16)) * v33
8205 - 12.0) 8629 - 12.0)
8206 * v11 8630 * v11
8207 + (double)a2->uScreenSpaceY; 8631 + (double)a2->uScreenSpaceY;
8208 pBillboardRenderListD3D[v8].pQuards[2].specular = 0; 8632 pBillboardRenderListD3D[v8].pQuads[2].specular = 0;
8209 pBillboardRenderListD3D[v8].pQuards[2].pos.z = v24; 8633 pBillboardRenderListD3D[v8].pQuads[2].pos.z = v24;
8210 pBillboardRenderListD3D[v8].pQuards[2].rhw = v25; 8634 pBillboardRenderListD3D[v8].pQuads[2].rhw = v25;
8211 pBillboardRenderListD3D[v8].pQuards[2].diffuse = uDiffuse; 8635 pBillboardRenderListD3D[v8].pQuads[2].diffuse = uDiffuse;
8212 pBillboardRenderListD3D[v8].pQuards[2].pos.y = v39; 8636 pBillboardRenderListD3D[v8].pQuads[2].pos.y = v39;
8213 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; 8637 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
8214 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; 8638 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
8215 v40 = (double)(a2->uScreenSpaceX + 12) - v13; 8639 v40 = (double)(a2->uScreenSpaceX + 12) - v13;
8216 v41 = (double)(a2->uScreenSpaceY - 25) - v15; 8640 v41 = (double)(a2->uScreenSpaceY - 25) - v15;
8217 v42 = stru_5C6E00->Cos(angle); 8641 v42 = stru_5C6E00->Cos(angle);
8218 v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8642 v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8219 v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); 8643 v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi);
8220 v45 = stru_5C6E00->Cos(angle); 8644 v45 = stru_5C6E00->Cos(angle);
8221 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 8645 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022
8222 + (double)(v42 >> 16)) 8646 + (double)(v42 >> 16))
8223 * v40 8647 * v40
8224 - ((double)(unsigned __int16)v43 * 0.000015259022 8648 - ((double)(unsigned __int16)v43 * 0.000015259022
8225 + (double)(v43 >> 16)) 8649 + (double)(v43 >> 16))
8226 * v41) 8650 * v41)
8228 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41 8652 v46 = (((double)(unsigned __int16)v45 * 0.000015259022 + (double)(v45 >> 16)) * v41
8229 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 8653 + ((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40
8230 - 12.0) 8654 - 12.0)
8231 * v11 8655 * v11
8232 + (double)a2->uScreenSpaceY; 8656 + (double)a2->uScreenSpaceY;
8233 pBillboardRenderListD3D[v8].pQuards[3].specular = 0; 8657 pBillboardRenderListD3D[v8].pQuads[3].specular = 0;
8234 pBillboardRenderListD3D[v8].pQuards[3].pos.z = v24; 8658 pBillboardRenderListD3D[v8].pQuads[3].pos.z = v24;
8235 pBillboardRenderListD3D[v8].pQuards[3].rhw = v25; 8659 pBillboardRenderListD3D[v8].pQuads[3].rhw = v25;
8236 pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; 8660 pBillboardRenderListD3D[v8].pQuads[3].diffuse = uDiffuse;
8237 pBillboardRenderListD3D[v8].pTexture = a3; 8661 pBillboardRenderListD3D[v8].pTexture = a3;
8238 pBillboardRenderListD3D[v8].z_order = v6; 8662 pBillboardRenderListD3D[v8].z_order = v6;
8239 pBillboardRenderListD3D[v8].uNumVertices = 4; 8663 pBillboardRenderListD3D[v8].uNumVertices = 4;
8240 pBillboardRenderListD3D[v8].pQuards[3].pos.y = v46; 8664 pBillboardRenderListD3D[v8].pQuads[3].pos.y = v46;
8241 pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; 8665 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
8242 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; 8666 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
8243 } 8667 }
8244 } 8668 }
8245 8669
8246 //----- (004A4023) -------------------------------------------------------- 8670 //----- (004A4023) --------------------------------------------------------
8247 void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard) 8671 void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard)
8285 8709
8286 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); 8710 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX);
8287 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); 8711 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY);
8288 if (a2->uFlags & 4) 8712 if (a2->uFlags & 4)
8289 v14 *= -1.0; 8713 v14 *= -1.0;
8290 pBillboardRenderListD3D[v8].pQuards[0].diffuse = diffuse; 8714 pBillboardRenderListD3D[v8].pQuads[0].diffuse = diffuse;
8291 pBillboardRenderListD3D[v8].pQuards[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30; 8715 pBillboardRenderListD3D[v8].pQuads[0].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
8292 pBillboardRenderListD3D[v8].pQuards[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29; 8716 pBillboardRenderListD3D[v8].pQuads[0].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
8293 pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 8717 pBillboardRenderListD3D[v8].pQuads[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
8294 pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; 8718 pBillboardRenderListD3D[v8].pQuads[0].rhw = 1.0 / a2->zbuffer_depth;
8295 pBillboardRenderListD3D[v8].pQuards[0].specular = specular; 8719 pBillboardRenderListD3D[v8].pQuads[0].specular = specular;
8296 pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; 8720 pBillboardRenderListD3D[v8].pQuads[0].texcoord.x = 0.0;
8297 pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; 8721 pBillboardRenderListD3D[v8].pQuads[0].texcoord.y = 0.0;
8298 8722
8299 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX); 8723 v14 = (double)((int)pSprite->uBufferWidth / 2 - pSprite->uAreaX);
8300 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); 8724 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
8301 if ( a2->uFlags & 4 ) 8725 if ( a2->uFlags & 4 )
8302 v14 = v14 * -1.0; 8726 v14 = v14 * -1.0;
8303 pBillboardRenderListD3D[v8].pQuards[1].specular = specular; 8727 pBillboardRenderListD3D[v8].pQuads[1].specular = specular;
8304 pBillboardRenderListD3D[v8].pQuards[1].diffuse = diffuse; 8728 pBillboardRenderListD3D[v8].pQuads[1].diffuse = diffuse;
8305 pBillboardRenderListD3D[v8].pQuards[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30; 8729 pBillboardRenderListD3D[v8].pQuads[1].pos.x = (double)a2->uScreenSpaceX - v14 * v30;
8306 pBillboardRenderListD3D[v8].pQuards[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29; 8730 pBillboardRenderListD3D[v8].pQuads[1].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
8307 pBillboardRenderListD3D[v8].pQuards[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 8731 pBillboardRenderListD3D[v8].pQuads[1].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
8308 pBillboardRenderListD3D[v8].pQuards[1].rhw = 1.0 / a2->zbuffer_depth; 8732 pBillboardRenderListD3D[v8].pQuads[1].rhw = 1.0 / a2->zbuffer_depth;
8309 pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; 8733 pBillboardRenderListD3D[v8].pQuads[1].texcoord.x = 0.0;
8310 pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; 8734 pBillboardRenderListD3D[v8].pQuads[1].texcoord.y = 1.0;
8311 8735
8312 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); 8736 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
8313 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY); 8737 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaHeight - pSprite->uAreaY);
8314 if ( a2->uFlags & 4 ) 8738 if ( a2->uFlags & 4 )
8315 v14 *= -1.0; 8739 v14 *= -1.0;
8316 pBillboardRenderListD3D[v8].pQuards[2].diffuse = diffuse; 8740 pBillboardRenderListD3D[v8].pQuads[2].diffuse = diffuse;
8317 pBillboardRenderListD3D[v8].pQuards[2].specular = specular; 8741 pBillboardRenderListD3D[v8].pQuads[2].specular = specular;
8318 pBillboardRenderListD3D[v8].pQuards[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30; 8742 pBillboardRenderListD3D[v8].pQuads[2].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
8319 pBillboardRenderListD3D[v8].pQuards[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29; 8743 pBillboardRenderListD3D[v8].pQuads[2].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
8320 pBillboardRenderListD3D[v8].pQuards[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 8744 pBillboardRenderListD3D[v8].pQuads[2].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
8321 pBillboardRenderListD3D[v8].pQuards[2].rhw = 1.0 / a2->zbuffer_depth; 8745 pBillboardRenderListD3D[v8].pQuads[2].rhw = 1.0 / a2->zbuffer_depth;
8322 pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; 8746 pBillboardRenderListD3D[v8].pQuads[2].texcoord.x = 1.0;
8323 pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; 8747 pBillboardRenderListD3D[v8].pQuads[2].texcoord.y = 1.0;
8324 8748
8325 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth); 8749 v14 = (double)((int)pSprite->uAreaWidth + pSprite->uAreaX + pSprite->uBufferWidth / 2 - pSprite->uBufferWidth);
8326 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY); 8750 v15 = (double)((int)pSprite->uBufferHeight - pSprite->uAreaY);
8327 if ( a2->uFlags & 4 ) 8751 if ( a2->uFlags & 4 )
8328 v14 *= -1.0; 8752 v14 *= -1.0;
8329 pBillboardRenderListD3D[v8].pQuards[3].diffuse = diffuse; 8753 pBillboardRenderListD3D[v8].pQuads[3].diffuse = diffuse;
8330 pBillboardRenderListD3D[v8].pQuards[3].specular = specular; 8754 pBillboardRenderListD3D[v8].pQuads[3].specular = specular;
8331 pBillboardRenderListD3D[v8].pQuards[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30; 8755 pBillboardRenderListD3D[v8].pQuads[3].pos.x = (double)a2->uScreenSpaceX + v14 * v30;
8332 pBillboardRenderListD3D[v8].pQuards[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29; 8756 pBillboardRenderListD3D[v8].pQuads[3].pos.y = (double)a2->uScreenSpaceY - v15 * v29;
8333 pBillboardRenderListD3D[v8].pQuards[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); 8757 pBillboardRenderListD3D[v8].pQuads[3].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
8334 pBillboardRenderListD3D[v8].pQuards[3].rhw = 1.0 / a2->zbuffer_depth; 8758 pBillboardRenderListD3D[v8].pQuads[3].rhw = 1.0 / a2->zbuffer_depth;
8335 pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; 8759 pBillboardRenderListD3D[v8].pQuads[3].texcoord.x = 1.0;
8336 pBillboardRenderListD3D[v8].pQuards[3].texcoord.y = 0.0; 8760 pBillboardRenderListD3D[v8].pQuads[3].texcoord.y = 0.0;
8337 8761
8338 pBillboardRenderListD3D[v8].uNumVertices = 4; 8762 pBillboardRenderListD3D[v8].uNumVertices = 4;
8339 pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture; 8763 pBillboardRenderListD3D[v8].pTexture = pSprite->pTexture;
8340 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; 8764 pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth;
8341 pBillboardRenderListD3D[v8].field_90 = a2->field_44; 8765 pBillboardRenderListD3D[v8].field_90 = a2->field_44;
8507 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); 8931 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
8508 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); 8932 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW));
8509 } 8933 }
8510 8934
8511 //----- (004A4CC9) -------------------------------------------------------- 8935 //----- (004A4CC9) --------------------------------------------------------
8512 void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) 8936 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse)
8513 { 8937 {
8514 int v3; // eax@1
8515 int v4; // edx@3
8516 unsigned int v5; // eax@7 8938 unsigned int v5; // eax@7
8517 int v6; // edi@7
8518 char *v7; // edx@8 8939 char *v7; // edx@8
8519 char *v8; // ecx@8
8520 char v9; // zf@9
8521 double v10; // st6@9 8940 double v10; // st6@9
8522 double v11; // st6@10 8941 double v11; // st6@10
8523 int v12; // ebx@13 8942 int v12; // ebx@13
8524 int v13; // ecx@16 8943
8525 unsigned int v14; // [sp+Ch] [bp-4h]@1 8944 if (a1->uNumVertices < 3)
8526 8945 return;
8527 auto _this = this; 8946
8528 8947 float depth = 1000000.0;
8529 *(float *)&v14 = 1000000.0; 8948 for (uint i = 0; i < a1->uNumVertices; ++i)
8530 v3 = a1->field_10; 8949 {
8531 if ( v3 >= 3 ) 8950 if (a1->field_104[i].z < depth)
8532 { 8951 depth = a1->field_104[i * 4].z;
8533 if ( v3 > 0 ) 8952 }
8534 { 8953
8535 _this = (Render *)&a1->field_14[62]; 8954 v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth);
8536 v4 = a1->field_10; 8955 pBillboardRenderListD3D[v5].field_90 = 0;
8537 do 8956 pBillboardRenderListD3D[v5].uParentBillboardID = -1;
8538 { 8957 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2;
8539 if ( *(float *)&this->bUserDirect3D < (double)*(float *)&v14 ) 8958 pBillboardRenderListD3D[v5].pTexture = 0;
8540 v14 = this->bUserDirect3D; 8959 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
8541 _this = (Render *)((char *)_this + 16); 8960 pBillboardRenderListD3D[v5].z_order = depth;
8542 --v4; 8961
8543 } 8962 for (uint i = 0; i < a1->uNumVertices; ++i)
8544 while ( v4 ); 8963 {
8545 } 8964 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x;
8546 v5 = Billboard_ProbablyAddToListAndSortByZOrder(v14); 8965 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y;
8547 v6 = 0; 8966
8548 pBillboardRenderListD3D[v5].field_90 = 0; 8967 v10 = a1->field_104[i].z;
8549 pBillboardRenderListD3D[v5].uParentBillboardID = -1; 8968 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
8550 pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2; 8969 v11 = v10 * 0.061758894;
8551 if ( a1->field_10 > 0 ) 8970 else
8552 { 8971 v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist;
8553 v7 = (char *)&a1->field_14[62]; 8972 pBillboardRenderListD3D[v5].pQuads[i].pos.z = 1.0 - 1.0 / v11;
8554 v8 = (char *)&pBillboardRenderListD3D[v5].pQuards[0].pos.z; 8973 pBillboardRenderListD3D[v5].pQuads[i].rhw = 1.0 / a1->field_104[i].z;
8555 do 8974
8556 { 8975 if (diffuse & 0xFF000000)
8557 v9 = uCurrentlyLoadedLevelType == LEVEL_Indoor; 8976 v12 = a1->field_104[i].diffuse;
8558 *((int *)v8 - 2) = *((int *)v7 - 2); 8977 else
8559 *((int *)v8 - 1) = *((int *)v7 - 1); 8978 v12 = diffuse;
8560 v10 = *(float *)v7; 8979 pBillboardRenderListD3D[v5].pQuads[i].diffuse = v12;
8561 if ( v9 ) 8980 pBillboardRenderListD3D[v5].pQuads[i].specular = 0;
8562 v11 = v10 * 0.061758894; 8981
8563 else 8982 pBillboardRenderListD3D[v5].pQuads[i].texcoord.x = 0.0;
8564 v11 = v10 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; 8983 pBillboardRenderListD3D[v5].pQuads[i].texcoord.y = 0.0;
8565 *(float *)v8 = 1.0 - 1.0 / v11;
8566 *((float *)v8 + 1) = 1.0 / *(float *)v7;
8567 if ( a2 & 0xFF000000 )
8568 v12 = *((int *)v7 + 1);
8569 else
8570 v12 = a2;
8571 *((int *)v8 + 3) = 0;
8572 *((int *)v8 + 2) = v12;
8573 ++v6;
8574 v7 += 16;
8575 *((float *)v8 + 4) = 0.0;
8576 *((float *)v8 + 5) = 0.0;
8577 v8 += 32;
8578 }
8579 while ( v6 < a1->field_10 );
8580 }
8581 v13 = a1->field_10;
8582 pBillboardRenderListD3D[v5].pTexture = 0;
8583 pBillboardRenderListD3D[v5].uNumVertices = v13;
8584 LODWORD(pBillboardRenderListD3D[v5].z_order) = v14;
8585 } 8984 }
8586 } 8985 }
8587 8986
8588 //----- (004A4DE1) -------------------------------------------------------- 8987 //----- (004A4DE1) --------------------------------------------------------
8589 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) 8988 bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture)
10647 } 11046 }
10648 } 11047 }
10649 // 6BE364: using guessed type int dword_6BE364_game_settings_1; 11048 // 6BE364: using guessed type int dword_6BE364_game_settings_1;
10650 // A74C88: using guessed type int dword_A74C88; 11049 // A74C88: using guessed type int dword_A74C88;
10651 11050
10652 //----- (0044EC20) --------------------------------------------------------
10653 bool RenderD3D::DoesRaiseExceptions()
10654 {
10655 return true;
10656 }
10657
10658 11051
10659 //----- (004524D8) -------------------------------------------------------- 11052 //----- (004524D8) --------------------------------------------------------
10660 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) 11053 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps)
10661 { 11054 {
10662 int v11; // eax@13 11055 int v11; // eax@13
10879 /*if (pRenderer->uNumBillboardsToDraw) 11272 /*if (pRenderer->uNumBillboardsToDraw)
10880 { 11273 {
10881 auto p = &pRenderer->pBillboardRenderListD3D[0]; 11274 auto p = &pRenderer->pBillboardRenderListD3D[0];
10882 for (int i = 0; i < p->uNumVertices; ++i) 11275 for (int i = 0; i < p->uNumVertices; ++i)
10883 { 11276 {
10884 p->pQuards[i].pos.z -= p->pQuards[i].pos.z * 0.6; 11277 p->pQuads[i].pos.z -= p->pQuads[i].pos.z * 0.6;
10885 //p->pQuards[i].rhw = + 0.8 * (1.0f - p->pQuards[i].rhw); 11278 //p->pQuads[i].rhw = + 0.8 * (1.0f - p->pQuads[i].rhw);
10886 } 11279 }
10887 p->pQuards[0].pos.x = 10; 11280 p->pQuads[0].pos.x = 10;
10888 p->pQuards[0].pos.y = 10; 11281 p->pQuads[0].pos.y = 10;
10889 11282
10890 p->pQuards[1].pos.x = 10; 11283 p->pQuads[1].pos.x = 10;
10891 p->pQuards[1].pos.y = 200; 11284 p->pQuads[1].pos.y = 200;
10892 11285
10893 p->pQuards[2].pos.x = 100; 11286 p->pQuads[2].pos.x = 100;
10894 p->pQuards[2].pos.y = 200; 11287 p->pQuads[2].pos.y = 200;
10895 11288
10896 p->pQuards[3].pos.x = 100; 11289 p->pQuads[3].pos.x = 100;
10897 p->pQuards[3].pos.y = 10; 11290 p->pQuads[3].pos.y = 10;
10898 11291
10899 if (p->uOpacity != RenderBillboardD3D::NoBlend) 11292 if (p->uOpacity != RenderBillboardD3D::NoBlend)
10900 SetBillboardBlendOptions(p->uOpacity); 11293 SetBillboardBlendOptions(p->uOpacity);
10901 11294
10902 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); 11295 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture);
10903 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 11296 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
10904 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 11297 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
10905 p->pQuards, p->uNumVertices, 11298 p->pQuads, p->uNumVertices,
10906 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); 11299 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
10907 11300
10908 }*/ 11301 }*/
10909 11302
10910 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) 11303 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i)
10915 SetBillboardBlendOptions(p->uOpacity); 11308 SetBillboardBlendOptions(p->uOpacity);
10916 11309
10917 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); 11310 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture);
10918 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 11311 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
10919 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 11312 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
10920 p->pQuards, p->uNumVertices, 11313 p->pQuads, p->uNumVertices,
10921 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS)); 11314 D3DDP_DONOTLIGHT | D3DDP_DONOTUPDATEEXTENTS));
10922 } 11315 }
10923 11316
10924 if (pRenderer->bFogEnabled) 11317 if (pRenderer->bFogEnabled)
10925 { 11318 {
10985 //----- (0040DF3D) -------------------------------------------------------- 11378 //----- (0040DF3D) --------------------------------------------------------
10986 void __cdecl CallRenderPresent() 11379 void __cdecl CallRenderPresent()
10987 { 11380 {
10988 pRenderer->Present(); 11381 pRenderer->Present();
10989 } 11382 }
11383
11384
11385
11386 //----- (0044EC20) --------------------------------------------------------
11387 /*bool RenderD3D::DoesRaiseExceptions()
11388 {
11389 return true;
11390 }*/