comparison Render.cpp @ 693:e0a1fccc89b1

map render fixes
author Gloval
date Sun, 17 Mar 2013 01:50:34 +0400
parents c0bfb386b15f
children af08fc9e29c8 a5ee769b02c6
comparison
equal deleted inserted replaced
692:066e2b29b30f 693:e0a1fccc89b1
330 if ( v4 ) 330 if ( v4 )
331 { 331 {
332 v5 = v4->pTexture; 332 v5 = v4->pTexture;
333 if ( v5 ) 333 if ( v5 )
334 { 334 {
335 if ( v3->field_8 >= (signed int)pViewport->uViewportX || v3->field_C != pViewport->uViewportX ) 335 if ( v3->field_8 >= (signed int)pViewport->uViewportTL_X || v3->field_C != pViewport->uViewportTL_X )
336 { 336 {
337 LOBYTE(v4->field_32) |= 2u; 337 LOBYTE(v4->field_32) |= 2u;
338 v14 = *(int *)&v4->flags; 338 v14 = *(int *)&v4->flags;
339 if ( v14 & 0x10 && v4->field_59 != 5 ) 339 if ( v14 & 0x10 && v4->field_59 != 5 )
340 { 340 {
648 { 648 {
649 v30 = &pSpans[v29 - 1]; 649 v30 = &pSpans[v29 - 1];
650 v2 = (stru148 *)v30->field_E; 650 v2 = (stru148 *)v30->field_E;
651 if ( v2 != (stru148 *)unnamed_6BE060[1] ) 651 if ( v2 != (stru148 *)unnamed_6BE060[1] )
652 { 652 {
653 LOWORD(v2) = LOWORD(pViewport->uViewportX); 653 LOWORD(v2) = LOWORD(pViewport->uViewportTL_X);
654 if ( v30->field_8 >= (signed int)pViewport->uViewportX ) 654 if ( v30->field_8 >= (signed int)pViewport->uViewportTL_X )
655 goto LABEL_124; 655 goto LABEL_124;
656 if ( v30->field_C == pViewport->uViewportX ) 656 if ( v30->field_C == pViewport->uViewportTL_X )
657 { 657 {
658 v30->field_E = LOWORD(unnamed_6BE060[1]); 658 v30->field_E = LOWORD(unnamed_6BE060[1]);
659 } 659 }
660 else 660 else
661 { 661 {
662 v30->field_8 = LOWORD(pViewport->uViewportX); 662 v30->field_8 = LOWORD(pViewport->uViewportTL_X);
663 v30->field_C -= LOWORD(pViewport->uViewportX); 663 v30->field_C -= LOWORD(pViewport->uViewportTL_X);
664 if ( v30->field_C >= 0 ) 664 if ( v30->field_C >= 0 )
665 { 665 {
666 LABEL_124: 666 LABEL_124:
667 v31 = v30->field_C; 667 v31 = v30->field_C;
668 v30->pParent = &array_77EC08[1999]; 668 v30->pParent = &array_77EC08[1999];
691 { 691 {
692 v13 = &pSpans[v12 - 1]; 692 v13 = &pSpans[v12 - 1];
693 v2 = (stru148 *)v13->field_E; 693 v2 = (stru148 *)v13->field_E;
694 if ( v2 != (stru148 *)unnamed_6BE060[1] ) 694 if ( v2 != (stru148 *)unnamed_6BE060[1] )
695 { 695 {
696 LOWORD(v2) = LOWORD(pViewport->uViewportX); 696 LOWORD(v2) = LOWORD(pViewport->uViewportTL_X);
697 if ( v13->field_8 >= (signed int)pViewport->uViewportX ) 697 if ( v13->field_8 >= (signed int)pViewport->uViewportTL_X )
698 goto LABEL_109; 698 goto LABEL_109;
699 if ( v13->field_C != pViewport->uViewportX ) 699 if ( v13->field_C != pViewport->uViewportTL_X )
700 { 700 {
701 v13->field_8 = LOWORD(pViewport->uViewportX); 701 v13->field_8 = LOWORD(pViewport->uViewportTL_X);
702 v13->field_C -= LOWORD(pViewport->uViewportX); 702 v13->field_C -= LOWORD(pViewport->uViewportTL_X);
703 if ( v13->field_C >= 0 ) 703 if ( v13->field_C >= 0 )
704 { 704 {
705 LABEL_109: 705 LABEL_109:
706 if ( pOutdoorCamera->bNoSky ) 706 if ( pOutdoorCamera->bNoSky )
707 { 707 {
788 int v56; // [sp+54h] [bp+8h]@11 788 int v56; // [sp+54h] [bp+8h]@11
789 int *v57; // [sp+54h] [bp+8h]@11 789 int *v57; // [sp+54h] [bp+8h]@11
790 790
791 v3 = a2; 791 v3 = a2;
792 v4 = a1; 792 v4 = a1;
793 v5 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5 / tan(0.6457717418670654) + 0.5; 793 v5 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5 / tan(0.6457717418670654) + 0.5;
794 v35 = v5 + 6.7553994e15; 794 v35 = v5 + 6.7553994e15;
795 if ( LODWORD(v35) ) 795 if ( LODWORD(v35) )
796 { 796 {
797 v55 = 65536 / SLODWORD(v35); 797 v55 = 65536 / SLODWORD(v35);
798 v7 = 65536 / SLODWORD(v35) * (a3 - v4->field_A); 798 v7 = 65536 / SLODWORD(v35) * (a3 - v4->field_A);
822 v10 = v50; 822 v10 = v50;
823 if ( v13 <= v14 ) 823 if ( v13 <= v14 )
824 break; 824 break;
825 v12 = a1a; 825 v12 = a1a;
826 } 826 }
827 if ( v11 <= (signed int)pViewport->uViewportY ) 827 if ( v11 <= (signed int)pViewport->uViewportTL_Y )
828 break; 828 break;
829 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v12) >> 16) + v3->v_18.x; 829 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v12) >> 16) + v3->v_18.x;
830 --v54; 830 --v54;
831 a1a += v55; 831 a1a += v55;
832 v12 = a1a; 832 v12 = a1a;
3002 3002
3003 billboard.uParentBillboardID = -1; 3003 billboard.uParentBillboardID = -1;
3004 billboard.pTarget = pRenderer->pTargetSurface; 3004 billboard.pTarget = pRenderer->pTargetSurface;
3005 billboard.pTargetZ = pRenderer->pActiveZBuffer; 3005 billboard.pTargetZ = pRenderer->pActiveZBuffer;
3006 billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; 3006 billboard.uTargetPitch = pRenderer->uTargetSurfacePitch;
3007 billboard.uViewportX = pViewport->uViewportX; 3007 billboard.uViewportX = pViewport->uViewportTL_X;
3008 billboard.uViewportY = pViewport->uViewportY; 3008 billboard.uViewportY = pViewport->uViewportTL_Y;
3009 billboard.uViewportZ = pViewport->uViewportZ - 1; 3009 billboard.uViewportZ = pViewport->uViewportBR_X - 1;
3010 billboard.uViewportW = pViewport->uViewportW; 3010 billboard.uViewportW = pViewport->uViewportBR_Y;
3011 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; 3011 pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw;
3012 3012
3013 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) 3013 for (int i = 0; i < ::uNumBillboardsToDraw; ++i)
3014 { 3014 {
3015 auto pBillboard = pBillboardRenderList + i; 3015 auto pBillboard = pBillboardRenderList + i;
3721 { 3721 {
3722 v26 = v41; 3722 v26 = v41;
3723 v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; 3723 v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1;
3724 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; 3724 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16;
3725 } 3725 }
3726 if ( b + v25 >= (signed int)pViewport->uViewportX && v25 - b <= (signed int)pViewport->uViewportZ ) 3726 if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X )
3727 { 3727 {
3728 if (::uNumBillboardsToDraw >= 500) 3728 if (::uNumBillboardsToDraw >= 500)
3729 return; 3729 return;
3730 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; 3730 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++];
3731 ++uNumDecorationsDrawnThisFrame; 3731 ++uNumDecorationsDrawnThisFrame;
9242 v4 = 1.0; 9242 v4 = 1.0;
9243 } 9243 }
9244 a3 = v4 * 255.0; 9244 a3 = v4 * 255.0;
9245 v39 = a3 + 6.7553994e15; 9245 v39 = a3 + 6.7553994e15;
9246 LODWORD(v40) = LODWORD(v39); 9246 LODWORD(v40) = LODWORD(v39);
9247 v5 = (double)(signed int)pViewport->uViewportX; 9247 v5 = (double)(signed int)pViewport->uViewportTL_X;
9248 v36[0].pos.x = v5; 9248 v36[0].pos.x = v5;
9249 v6 = (double)(signed int)pViewport->uViewportY; 9249 v6 = (double)(signed int)pViewport->uViewportTL_Y;
9250 v7 = this_ | (LODWORD(v39) << 24); 9250 v7 = this_ | (LODWORD(v39) << 24);
9251 this_ = pViewport->uViewportW + 1; 9251 this_ = pViewport->uViewportBR_Y + 1;
9252 v36[0].specular = 0; 9252 v36[0].specular = 0;
9253 v36[0].pos.y = v6; 9253 v36[0].pos.y = v6;
9254 v36[0].diffuse = v7; 9254 v36[0].diffuse = v7;
9255 v36[1].diffuse = v7; 9255 v36[1].diffuse = v7;
9256 v36[0].pos.z = 0.0; 9256 v36[0].pos.z = 0.0;
9261 v36[0].texcoord.x = 0.0; 9261 v36[0].texcoord.x = 0.0;
9262 v36[2].specular = 0; 9262 v36[2].specular = 0;
9263 v36[3].specular = 0; 9263 v36[3].specular = 0;
9264 v36[0].texcoord.y = 0.0; 9264 v36[0].texcoord.y = 0.0;
9265 v36[1].pos.x = v5; 9265 v36[1].pos.x = v5;
9266 v8 = (double)(pViewport->uViewportW + 1); 9266 v8 = (double)(pViewport->uViewportBR_Y + 1);
9267 v36[1].pos.y = v8; 9267 v36[1].pos.y = v8;
9268 v36[1].pos.z = 0.0; 9268 v36[1].pos.z = 0.0;
9269 v36[1].rhw = 1.0; 9269 v36[1].rhw = 1.0;
9270 v36[1].texcoord.x = 0.0; 9270 v36[1].texcoord.x = 0.0;
9271 v36[1].texcoord.y = 0.0; 9271 v36[1].texcoord.y = 0.0;
9272 v9 = (double)(signed int)pViewport->uViewportZ; 9272 v9 = (double)(signed int)pViewport->uViewportBR_X;
9273 v36[2].pos.x = v9; 9273 v36[2].pos.x = v9;
9274 v36[2].pos.y = v8; 9274 v36[2].pos.y = v8;
9275 v36[2].pos.z = 0.0; 9275 v36[2].pos.z = 0.0;
9276 v36[2].rhw = 1.0; 9276 v36[2].rhw = 1.0;
9277 v36[2].texcoord.x = 0.0; 9277 v36[2].texcoord.x = 0.0;
9306 else 9306 else
9307 { 9307 {
9308 v40 = (1.0 - a3) * 65536.0; 9308 v40 = (1.0 - a3) * 65536.0;
9309 v39 = v40 + 6.7553994e15; 9309 v39 = v40 + 6.7553994e15;
9310 LODWORD(a3) = LODWORD(v39); 9310 LODWORD(a3) = LODWORD(v39);
9311 v38 = (signed int)(pViewport->uViewportZ - pViewport->uViewportX) >> 1; 9311 v38 = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) >> 1;
9312 HIDWORD(v39) = pViewport->uViewportW - pViewport->uViewportY + 1; 9312 HIDWORD(v39) = pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1;
9313 v13 = pViewport->uViewportX + ecx0->uTargetSurfacePitch - pViewport->uViewportZ; 9313 v13 = pViewport->uViewportTL_X + ecx0->uTargetSurfacePitch - pViewport->uViewportBR_X;
9314 v14 = &ecx0->pTargetSurface[pViewport->uViewportX + pViewport->uViewportY * ecx0->uTargetSurfacePitch]; 9314 v14 = &ecx0->pTargetSurface[pViewport->uViewportTL_X + pViewport->uViewportTL_Y * ecx0->uTargetSurfacePitch];
9315 v37 = 2 * v13; 9315 v37 = 2 * v13;
9316 LODWORD(v40) = (int)v14; 9316 LODWORD(v40) = (int)v14;
9317 9317
9318 int __i = 0; 9318 int __i = 0;
9319 v15 = dword_F1B430; 9319 v15 = dword_F1B430;