comparison UI/Books/UIMapBook.cpp @ 1720:5f2583a4fa7d

m
author Ritor1
date Wed, 25 Sep 2013 08:59:01 +0600
parents 75fafd8ced59
children e1c451f4d5ba
comparison
equal deleted inserted replaced
1719:14d84e2a2a92 1720:5f2583a4fa7d
191 unsigned int map_id; // eax@35 191 unsigned int map_id; // eax@35
192 char party_coord[120]; // [sp+Ch] [bp-CCh]@37 192 char party_coord[120]; // [sp+Ch] [bp-CCh]@37
193 GUIWindow map_window; // [sp+84h] [bp-54h]@35 193 GUIWindow map_window; // [sp+84h] [bp-54h]@35
194 194
195 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); 195 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12);
196 if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1 196 if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1
197 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); 197 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off);
198 else 198 else
199 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); 199 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on);
200 200
201 if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2 201 if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2
202 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); 202 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off);
203 else 203 else
204 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); 204 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on);
205 205
206 if ( Book_PageBtn3_flag )//Button 3 206 if ( Book_PageBtn3_flag )//Button 3
351 screenCenter_X = (signed int)(tl_x + br_x) / 2; 351 screenCenter_X = (signed int)(tl_x + br_x) / 2;
352 screenCenterY = (signed int)(tl_y + br_y) / 2; 352 screenCenterY = (signed int)(tl_y + br_y) / 2;
353 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); 353 pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y);
354 pCenterX = viewparams->sViewCenterX; 354 pCenterX = viewparams->sViewCenterX;
355 pCenterY = viewparams->sViewCenterY; 355 pCenterY = viewparams->sViewCenterY;
356 if ( viewparams->field_2C != 384 ) 356 if ( viewparams->uMapBookMapZoom != 384 )
357 { 357 {
358 if ( viewparams->field_2C == 768 ) 358 if ( viewparams->uMapBookMapZoom == 768 )
359 { 359 {
360 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 360 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
361 viewparams->field_2C = 680; 361 viewparams->uMapBookMapZoom = 680;
362 } 362 }
363 } 363 }
364 else 364 else
365 { 365 {
366 viewparams->sViewCenterX = viewparams->indoor_center_x; 366 viewparams->sViewCenterX = viewparams->indoor_center_x;
367 pCenterX = viewparams->indoor_center_x; 367 pCenterX = viewparams->indoor_center_x;
368 pCenterY = viewparams->indoor_center_y; 368 pCenterY = viewparams->indoor_center_y;
369 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 369 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
370 viewparams->field_2C = viewparams->field_2C - 34; 370 viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34;
371 } 371 }
372 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) 372 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
373 { 373 {
374 screenWidth = br_x - tl_x + 1; 374 screenWidth = br_x - tl_x + 1;
375 screenHeight = br_y - tl_y + 1; 375 screenHeight = br_y - tl_y + 1;
376 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; 376 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
377 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; 377 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
378 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; 378 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
379 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->field_2C; 379 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom;
380 380
381 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); 381 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
382 382
383 teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30) << 16; 383 teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16;
384 // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); 384 // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
385 385
386 // v32 = map_texture_16; 386 // v32 = map_texture_16;
387 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 387 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
388 stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->field_2C / 384)+ 32768) / v30) << 16; 388 stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16;
389 // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 389 // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
390 black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30); 390 black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30);
391 391
392 // v76 = textr_width; 392 // v76 = textr_width;
393 scaled_posY = stepY_r >> 16; 393 scaled_posY = stepY_r >> 16;
394 //nearest neiborhood scaling 394 //nearest neiborhood scaling
395 if ( texture8_data) 395 if ( texture8_data)
444 v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX); 444 v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX);
445 screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; 445 screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY;
446 v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; 446 v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY;
447 v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; 447 v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX;
448 v97 = (const void *)v20; 448 v97 = (const void *)v20;
449 v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16; 449 v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
450 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->field_2C) >> 16; 450 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
451 v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16); 451 v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
452 screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->field_2C) >> 16; 452 screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
453 pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, 453 pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87,
454 screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - screenHeight, black); 454 screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - screenHeight, black);
455 } 455 }
456 } 456 }
457 } 457 }
458 } 458 }
459 v21 = 0; 459 v21 = 0;
460 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) 460 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
461 { 461 {
462 while ( 1 ) 462 while ( 1 )
463 { 463 {
464 v22 = pBlueFacesInBLVMinimapIDs[v21]; 464 v22 = pBlueFacesInBLVMinimapIDs[v21];
465 v87 = viewparams->field_2C; 465 v87 = viewparams->uMapBookMapZoom;
466 v23 = &pIndoor->pMapOutlines->pOutlines[v22]; 466 v23 = &pIndoor->pMapOutlines->pOutlines[v22];
467 v24 = &pIndoor->pVertices[v23->uVertex1ID]; 467 v24 = &pIndoor->pVertices[v23->uVertex1ID];
468 v25 = &pIndoor->pVertices[v23->uVertex2ID]; 468 v25 = &pIndoor->pVertices[v23->uVertex2ID];
469 v26 = v25->x; 469 v26 = v25->x;
470 v27 = (unsigned __int16 *)(v24->x - pCenterX); 470 v27 = (unsigned __int16 *)(v24->x - pCenterX);
471 v28 = v24->y - pCenterY; 471 v28 = v24->y - pCenterY;
472 v29 = v25->y - pCenterY; 472 v29 = v25->y - pCenterY;
473 v93 = v27; 473 v93 = v27;
474 screenHeight = v28; 474 screenHeight = v28;
475 v97 = (const void *)v29; 475 v97 = (const void *)v29;
476 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16; 476 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
477 v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->field_2C) >> 16; 477 v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
478 uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16; 478 uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
479 v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->field_2C) >> 16; 479 v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->uMapBookMapZoom) >> 16;
480 pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16), 480 pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16),
481 screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - v95, teal); 481 screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - v95, teal);
482 ++v21; 482 ++v21;
483 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) 483 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
484 break; 484 break;
485 } 485 }
486 viewparams->sViewCenterX = pCenterX; 486 viewparams->sViewCenterX = pCenterX;
487 } 487 }
488 } 488 }
489 v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 3; 489 v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 3;
490 v81 = pParty->vPosition.y - pCenterY; 490 v81 = pParty->vPosition.y - pCenterY;
491 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->field_2C) >> 16); 491 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
492 v48 = 1; 492 v48 = 1;
493 v49 = screenCenterY - (int)v97 - 3; 493 v49 = screenCenterY - (int)v97 - 3;
494 if ( v47 >= (signed int)tl_x ) 494 if ( v47 >= (signed int)tl_x )
495 { 495 {
496 if ( v47 > (signed int)br_x ) 496 if ( v47 > (signed int)br_x )
497 { 497 {
498 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 6) > (signed int)br_x ) 498 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 6) > (signed int)br_x )
499 v48 = 0; 499 v48 = 0;
500 v47 = br_x; 500 v47 = br_x;
501 } 501 }
502 } 502 }
503 else 503 else
504 { 504 {
505 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X) < (signed int)tl_x ) 505 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X) < (signed int)tl_x )
506 v48 = 0; 506 v48 = 0;
507 v47 = tl_x; 507 v47 = tl_x;
508 } 508 }
509 if ( v49 >= (signed int)tl_y ) 509 if ( v49 >= (signed int)tl_y )
510 { 510 {
550 { 550 {
551 if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP) 551 if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP)
552 { 552 {
553 screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; 553 screenHeight = pLevelDecorations[i].vPosition.y - pCenterY;
554 v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); 554 v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
555 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; 555 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X;
556 v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->field_2C) >> 16); 556 v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16);
557 v55 = screenCenterY - (int)v97; 557 v55 = screenCenterY - (int)v97;
558 if ( v54 >= pRenderer->raster_clip_x ) 558 if ( v54 >= pRenderer->raster_clip_x )
559 { 559 {
560 if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) 560 if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w )
561 { 561 {
562 if ( viewparams->field_2C > 512 ) 562 if ( viewparams->uMapBookMapZoom > 512 )
563 { 563 {
564 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX); 564 pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX);
565 pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, pCenterX); 565 pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, pCenterX);
566 ++v54; 566 ++v54;
567 v72 = v55 + 1; 567 v72 = v55 + 1;
569 v70 = v55 - 1; 569 v70 = v55 - 1;
570 } 570 }
571 else 571 else
572 { 572 {
573 v72 = screenCenterY - (int)v97; 573 v72 = screenCenterY - (int)v97;
574 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; 574 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X;
575 v70 = screenCenterY - (int)v97; 575 v70 = screenCenterY - (int)v97;
576 } 576 }
577 pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX); 577 pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX);
578 } 578 }
579 } 579 }
584 { 584 {
585 screenCenterY = br_x - tl_x + 1; 585 screenCenterY = br_x - tl_x + 1;
586 v95 = br_y - tl_y + 1; 586 v95 = br_y - tl_y + 1;
587 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; 587 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch];
588 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; 588 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
589 black = (1 << (v56 + 16)) / viewparams->field_2C; 589 black = (1 << (v56 + 16)) / viewparams->uMapBookMapZoom;
590 v57 = (double)(1 << (16 - v56)); 590 v57 = (double)(1 << (16 - v56));
591 v58 = 22528 / (viewparams->field_2C / 384); 591 v58 = 22528 / (viewparams->uMapBookMapZoom / 384);
592 v59 = (signed __int64)((double)(viewparams->sViewCenterX - v58 + 32768) / v57); 592 v59 = (signed __int64)((double)(viewparams->sViewCenterX - v58 + 32768) / v57);
593 v60 = (int)v59 << 16; 593 v60 = (int)v59 << 16;
594 v97 = (const void *)((int)v59 << 16); 594 v97 = (const void *)((int)v59 << 16);
595 v61 = (signed __int64)((double)(32768 - v58 - pCenterY) / v57); 595 v61 = (signed __int64)((double)(32768 - v58 - pCenterY) / v57);
596 pPalette_16 = (unsigned __int16 *)(v60 >> 16); 596 pPalette_16 = (unsigned __int16 *)(v60 >> 16);