comparison Render.cpp @ 973:ec7568e13b24

Minor code cleaning.
author Nomad
date Wed, 08 May 2013 21:37:12 +0200
parents c0d0656aa662
children 062788391c88 c5d8ea1e6ccb
comparison
equal deleted inserted replaced
972:c8a0f6d89c70 973:ec7568e13b24
206 LOBYTE(result) = 0; 206 LOBYTE(result) = 0;
207 return result; 207 return result;
208 } 208 }
209 209
210 //----- (00487389) -------------------------------------------------------- 210 //----- (00487389) --------------------------------------------------------
211 __int16 Render::ExecOutdoorDrawSW() 211 void Render::ExecOutdoorDrawSW()
212 { 212 {
213 unsigned __int16 *v0; // ebx@1 213 unsigned __int16 *v0; // ebx@1
214 unsigned int v1; // esi@1 214 unsigned int v1; // esi@1
215 stru148 *v2; // eax@1 215 stru148 *v2; // eax@1
216 Span *v3; // edi@6 216 Span *v3; // edi@6
225 unsigned int v12; // ebp@32 225 unsigned int v12; // ebp@32
226 Span *v13; // esi@33 226 Span *v13; // esi@33
227 int v14; // ecx@37 227 int v14; // ecx@37
228 int v15; // eax@40 228 int v15; // eax@40
229 Texture *v16; // ebp@51 229 Texture *v16; // ebp@51
230 unsigned int v17; // eax@51 230 //unsigned int v17; // eax@51
231 int v18; // eax@54 231 int v18; // eax@54
232 char v19; // al@56 232 char v19; // al@56
233 unsigned int v20; // eax@57 233 unsigned int v20; // eax@57
234 int v21; // ecx@57 234 int v21; // ecx@57
235 unsigned int v22; // eax@57 235 unsigned int v22; // eax@57
313 else 313 else
314 { 314 {
315 while ( 1 ) 315 while ( 1 )
316 { 316 {
317 v16 = v4->pTexture; 317 v16 = v4->pTexture;
318 v17 = pBitmaps_LOD->LoadTexture("wtrtyl"); 318 v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl");
319 v4->pTexture = (Texture *)(v17 != -1 ? (int)&pBitmaps_LOD->pTextures[v17] : 0);
320 if ( pOutdoorCamera->outdoor_no_wavy_water ) 319 if ( pOutdoorCamera->outdoor_no_wavy_water )
321 sr_sub_48408A_prolly_odm_water_no_waves(v3); 320 sr_sub_48408A_prolly_odm_water_no_waves(v3);
322 else 321 else
323 sr_sub_485407_prolly_odm_water_wavy(v3); 322 sr_sub_485407_prolly_odm_water_wavy(v3);
324 v18 = v4->terrain_grid_z - 64; 323 v18 = v4->terrain_grid_z - 64;
547 uNumElementsIn80AA28 = v7; 546 uNumElementsIn80AA28 = v7;
548 } 547 }
549 } 548 }
550 v9 = pOutdoorCamera->uNumSpans; 549 v9 = pOutdoorCamera->uNumSpans;
551 unnamed_6BE060[0] = pOutdoorCamera->uNumSpans; 550 unnamed_6BE060[0] = pOutdoorCamera->uNumSpans;
552 if ( pOutdoorCamera->numStru148s >= 1999 551 if (pOutdoorCamera->numStru148s >= 1999)
553 || (array_77EC08[1999]._48607B(&stru_8019C8), 552 return;
554 array_77EC08[1999].ptr_38->_48694B(), 553
555 v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uMainTile_BitmapID], 554 array_77EC08[1999]._48607B(&stru_8019C8);
556 (array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uMainTile_BitmapID != -1 ? (int)v2 : 0)) == 0) ) 555 array_77EC08[1999].ptr_38->_48694B();
557 return (signed __int16)v2; 556
557 if (pOutdoor->uMainTile_BitmapID == -1)
558 {
559 array_77EC08[1999].pTexture = nullptr;
560 return;
561 }
562 else
563 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uMainTile_BitmapID);
558 array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16); 564 array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16);
559 if ( array_77EC08[1999].dimming_level > 20 ) 565 if ( array_77EC08[1999].dimming_level > 20 )
560 array_77EC08[1999].dimming_level = 20; 566 array_77EC08[1999].dimming_level = 20;
561 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); 567 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
562 array_77EC08[1999].v_18.y = 0; 568 array_77EC08[1999].v_18.y = 0;
568 + (double)pViewport->uScreenCenterY); 574 + (double)pViewport->uScreenCenterY);
569 cos((double)pIndoorCamera->sRotationX * 0.0030664064); 575 cos((double)pIndoorCamera->sRotationX * 0.0030664064);
570 sin((double)pIndoorCamera->sRotationX * 0.0030664064); 576 sin((double)pIndoorCamera->sRotationX * 0.0030664064);
571 array_77EC08[1999]._48607B(&stru_8019C8); 577 array_77EC08[1999]._48607B(&stru_8019C8);
572 array_77EC08[1999].ptr_38->_48694B(); 578 array_77EC08[1999].ptr_38->_48694B();
573 v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID]; 579
574 array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0); 580 if (pOutdoor->uSky_TextureID == -1)
575 if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) ) 581 {
576 return (signed __int16)v2; 582 array_77EC08[1999].pTexture = nullptr;
583 return;
584 }
585 else
586 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uSky_TextureID);
577 array_77EC08[1999].dimming_level = 0; 587 array_77EC08[1999].dimming_level = 0;
578 v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); 588 v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
579 array_77EC08[1999].v_18.y = 0; 589 array_77EC08[1999].v_18.y = 0;
580 array_77EC08[1999].v_18.x = -v11; 590 array_77EC08[1999].v_18.x = -v11;
581 array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); 591 array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);
589 || bUnderwater ) 599 || bUnderwater )
590 { 600 {
591 v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1); 601 v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1);
592 a1b = (unsigned int)v2; 602 a1b = (unsigned int)v2;
593 if ( (signed int)v9 <= 0 ) 603 if ( (signed int)v9 <= 0 )
594 return (signed __int16)v2; 604 return;
595 v29 = v9; 605 v29 = v9;
596 while ( 1 ) 606 while ( 1 )
597 { 607 {
598 v30 = &pSpans[v29 - 1]; 608 v30 = &pSpans[v29 - 1];
599 v2 = (stru148 *)v30->field_E; 609 v2 = (stru148 *)v30->field_E;
628 } 638 }
629 LABEL_125: 639 LABEL_125:
630 --v29; 640 --v29;
631 --v9; 641 --v9;
632 if ( !v9 ) 642 if ( !v9 )
633 return (signed __int16)v2; 643 return;
634 } 644 }
635 } 645 }
636 if ( (signed int)v9 > 0 ) 646 if ( (signed int)v9 > 0 )
637 { 647 {
638 v12 = v9; 648 v12 = v9;
673 --v12; 683 --v12;
674 --v9; 684 --v9;
675 } 685 }
676 while ( v9 ); 686 while ( v9 );
677 } 687 }
678 return (signed __int16)v2;
679 } 688 }
680 689
681 //----- (00485044) -------------------------------------------------------- 690 //----- (00485044) --------------------------------------------------------
682 int Render::DrawSkySW(Span *a1, stru148 *a2, int a3) 691 int Render::DrawSkySW(Span *a1, stru148 *a2, int a3)
683 { 692 {