comparison Outdoor.cpp @ 764:90bcfb56c8f9

sound cleaning
author Gloval
date Sat, 23 Mar 2013 21:39:21 +0400
parents 7f1487b74571
children 777c42590ffc
comparison
equal deleted inserted replaced
761:f24fb0d64a5c 764:90bcfb56c8f9
525 || v15 ) 525 || v15 )
526 return 2; 526 return 2;
527 v5 = WorldPosToGridCellX(pParty->vPosition.x); 527 v5 = WorldPosToGridCellX(pParty->vPosition.x);
528 v6 = WorldPosToGridCellZ(pParty->vPosition.y); 528 v6 = WorldPosToGridCellZ(pParty->vPosition.y);
529 v7 = _47ED83(v5, v6 - 1); 529 v7 = _47ED83(v5, v6 - 1);
530 v8 = pTileTable->pTiles[_47ECC1(v7)].tileset; 530 v8 = pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset;
531 if ( v8 ) 531 if ( v8 )
532 { 532 {
533 v9 = v8 - 1; 533 v9 = v8 - 1;
534 if ( !v9 ) 534 if ( !v9 )
535 return 3; 535 return 3;
2340 } 2340 }
2341 return true; 2341 return true;
2342 } 2342 }
2343 2343
2344 //----- (0047ECC1) -------------------------------------------------------- 2344 //----- (0047ECC1) --------------------------------------------------------
2345 int OutdoorLocation::_47ECC1(signed int a2) 2345 int OutdoorLocation::GetTileIdByTileMapId(signed int a2)
2346 { 2346 {
2347 signed int result; // eax@2 2347 signed int result; // eax@2
2348 int v3; // eax@3 2348 int v3; // eax@3
2349 2349
2350 if ( a2 >= 90 ) 2350 if ( a2 >= 90 )
2463 result = 32 * *(&this->pTerrain.pHeightmap[uZ * 128 + uX]); 2463 result = 32 * *(&this->pTerrain.pHeightmap[uZ * 128 + uX]);
2464 return result; 2464 return result;
2465 } 2465 }
2466 2466
2467 //----- (0047EE49) -------------------------------------------------------- 2467 //----- (0047EE49) --------------------------------------------------------
2468 int OutdoorLocation::_47EE49(signed int a2, signed int a3, int a4) 2468 int OutdoorLocation::GetSoundIdByPosition( signed int X_pos, signed int Y_pos, int running )
2469 { 2469 {
2470 signed int v4; // eax@5 2470 signed int v4; // eax@5
2471 signed int v5; // eax@7 2471 signed int v5; // eax@7
2472 int v6; // eax@8 2472 int v6; // eax@8
2473 signed int v8; // eax@9 2473 signed int v8; // eax@9
2474 int v9; // eax@12 2474 int modif=0;
2475 int v10; // eax@13 2475
2476 int v11; // eax@14 2476 if ( X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127 )
2477 int v12; // eax@16
2478 int v13; // eax@17
2479 int v14; // eax@18
2480 int v15; // eax@19
2481 int v16; // eax@20
2482 int v17; // eax@21
2483 int v18; // eax@28
2484 int v19; // eax@29
2485 int v20; // eax@30
2486
2487 if ( a2 < 0 || a2 > 127 || a3 < 0 || a3 > 127 )
2488 v4 = 0; 2477 v4 = 0;
2489 else 2478 else
2490 v4 = *(&this->pTerrain.pTilemap[128 * a3] + a2); 2479 v4 = this->pTerrain.pTilemap[128 * Y_pos + X_pos];
2491 v5 = _47ECC1(v4); 2480 v5 = GetTileIdByTileMapId(v4);
2481 if (running)
2482 modif=-39;
2492 if ( !v5 ) 2483 if ( !v5 )
2493 { 2484 return 92+modif;
2494 v6 = -(a4 != 0); 2485
2495 LOBYTE(v6) = v6 & 0xD9; 2486 switch (pTileTable->pTiles[v5].tileset)
2496 return v6 + 92; 2487 {
2497 } 2488 case 0: return 93+ modif;
2498 v8 = pTileTable->pTiles[v5].tileset; 2489 case 1: return 97+ modif;
2499 if ( v8 <= 6 ) 2490 case 2: return 91+ modif;
2500 { 2491 case 3: return 90+ modif;
2501 if ( v8 == Tileset_6 ) 2492 case 4: return 101+ modif;
2502 { 2493 case 5: return 95+ modif;
2503 v17 = -(a4 != 0); 2494 case 6: return 88+ modif;
2504 LOBYTE(v17) = v17 & 0xD9; 2495 case 7: return 100+ modif;
2505 return v17 + 88; 2496 case 8: return 93+ modif;
2506 } 2497 default:
2507 if ( v8 ) 2498 v8=pTileTable->pTiles[v5].tileset;
2508 { 2499 if ( (v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27) )
2509 v9 = v8 - 1; 2500 return 96+ modif;
2510 if ( !v9 ) 2501 else
2511 { 2502 return 95+ modif;
2512 v15 = -(a4 != 0); 2503 }
2513 LOBYTE(v15) = v15 & 0xD9; 2504
2514 return v15 + 97;
2515 }
2516 v10 = v9 - 1;
2517 if ( !v10 )
2518 {
2519 v14 = -(a4 != 0);
2520 LOBYTE(v14) = v14 & 0xD9;
2521 return v14 + 91;
2522 }
2523 v11 = v10 - 1;
2524 if ( !v11 )
2525 {
2526 v13 = -(a4 != 0);
2527 LOBYTE(v13) = v13 & 0xD9;
2528 return v13 + 90;
2529 }
2530 if ( v11 == 2 )
2531 {
2532 v12 = -(a4 != 0);
2533 LOBYTE(v12) = v12 & 0xD9;
2534 return v12 + 101;
2535 }
2536 LABEL_29:
2537 v19 = -(a4 != 0);
2538 LOBYTE(v19) = v19 & 0xD9;
2539 return v19 + 95;
2540 }
2541 goto LABEL_20;
2542 }
2543 if ( v8 != 7 )
2544 {
2545 if ( v8 != 8 )
2546 {
2547 if ( v8 > 9 && (v8 <= 17 || v8 > 21 && v8 <= 27) )
2548 {
2549 v18 = -(a4 != 0);
2550 LOBYTE(v18) = v18 & 0xD9;
2551 return v18 + 96;
2552 }
2553 goto LABEL_29;
2554 }
2555 LABEL_20:
2556 v16 = -(a4 != 0);
2557 LOBYTE(v16) = v16 & 0xD9;
2558 return v16 + 93;
2559 }
2560 v20 = -(a4 != 0);
2561 LOBYTE(v20) = v20 & 0xD9;
2562 return v20 + 100;
2563 } 2505 }
2564 2506
2565 //----- (0047EF60) -------------------------------------------------------- 2507 //----- (0047EF60) --------------------------------------------------------
2566 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) 2508 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4)
2567 { 2509 {
2703 pSoundList->LoadSound(v4, 0); 2645 pSoundList->LoadSound(v4, 0);
2704 v5 = _6807E0_num_decorations_with_sounds_6807B8++; 2646 v5 = _6807E0_num_decorations_with_sounds_6807B8++;
2705 _6807B8_level_decorations_ids[v5] = i; 2647 _6807B8_level_decorations_ids[v5] = i;
2706 } 2648 }
2707 if ( v8 && decor->uCog == 20 ) 2649 if ( v8 && decor->uCog == 20 )
2708 LOBYTE(decor->field_2) |= 0x40u; 2650 decor->field_2 |= 0x0040u;
2709 if ( !decor->field_16_event_id ) 2651 if ( !decor->field_16_event_id )
2710 { 2652 {
2711 if ( decor->IsInteractive() ) 2653 if ( decor->IsInteractive() )
2712 { 2654 {
2713 if ( v1 < 124 ) 2655 if ( v1 < 124 )
2714 { 2656 {
2715 v6 = v1 + 75; 2657 v6 = v1 + 75;
2716 decor->_idx_in_stru123 = v6; 2658 decor->_idx_in_stru123 = v6;
2717 if ( !stru_5E4C90._decor_events[v1++] ) 2659 if ( !stru_5E4C90._decor_events[v1++] )
2718 LOBYTE(decor->field_2) |= 0x20u; 2660 decor->field_2 |= 0x0020u;
2719 } 2661 }
2720 } 2662 }
2721 } 2663 }
2722 } 2664 }
2723 2665