Mercurial > mm7
comparison Outdoor.cpp @ 2364:94e5a9740727
OutdoorLocation::UpdateDiscoveredArea cleaned up
author | Grumpy7 |
---|---|
date | Sun, 11 May 2014 22:49:19 +0200 |
parents | a574a80e7012 |
children | 65789351a537 |
comparison
equal
deleted
inserted
replaced
2363:7966fc2949a7 | 2364:94e5a9740727 |
---|---|
2049 *(int *)thisa = 0; | 2049 *(int *)thisa = 0; |
2050 LABEL_120: | 2050 LABEL_120: |
2051 //v108 = (int)".odm"; | 2051 //v108 = (int)".odm"; |
2052 //v83 = strlen(pContainer); | 2052 //v83 = strlen(pContainer); |
2053 //strcpy((char *)v141 + v83, (const char *)v108); | 2053 //strcpy((char *)v141 + v83, (const char *)v108); |
2054 memcpy(uUndiscoveredArea, pSrc, 0x3C8); | 2054 memcpy(uFullyRevealedCellOnMap, pSrc, 0x3C8); |
2055 //v84 = (const void *)(v74 + 968); | 2055 //v84 = (const void *)(v74 + 968); |
2056 memcpy(uDicovered_area, pSrc + 0x3C8, 0x3C8); | 2056 memcpy(uPartiallyRevealedCellOnMap, pSrc + 0x3C8, 0x3C8); |
2057 pSrc += 2 * 0x3C8; | 2057 pSrc += 2 * 0x3C8; |
2058 //v85 = (char *)v84 + 968; | 2058 //v85 = (char *)v84 + 968; |
2059 | 2059 |
2060 pGameLoadingUI_ProgressBar->Progress(); | 2060 pGameLoadingUI_ProgressBar->Progress(); |
2061 | 2061 |
2062 if ( *(int *)thisa ) | 2062 if ( *(int *)thisa ) |
2063 { | 2063 { |
2064 memcpy(uUndiscoveredArea, Dst, 0x3C8u); | 2064 memcpy(uFullyRevealedCellOnMap, Dst, 0x3C8u); |
2065 memcpy(uDicovered_area, Src, 0x3C8u); | 2065 memcpy(uPartiallyRevealedCellOnMap, Src, 0x3C8u); |
2066 } | 2066 } |
2067 | 2067 |
2068 for (uint i = 0; i < uNumBModels; ++i) | 2068 for (uint i = 0; i < uNumBModels; ++i) |
2069 { | 2069 { |
2070 BSPModel model = pBModels[i]; | 2070 BSPModel model = pBModels[i]; |
2376 } | 2376 } |
2377 | 2377 |
2378 //----- (0047EF60) -------------------------------------------------------- | 2378 //----- (0047EF60) -------------------------------------------------------- |
2379 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) | 2379 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) |
2380 { | 2380 { |
2381 int v4; // ecx@1 | 2381 for (int i = -10; i < 10; i++) |
2382 int v5; // edx@2 | 2382 { |
2383 int v6; // edi@2 | 2383 int currYpos = Y_grid_poa + i - 20; |
2384 int v9; // ebx@4 | 2384 for (int j = -10; j < 10; j++) |
2385 int v10; // eax@5 | 2385 { |
2386 // int v12; // esi@12 | 2386 int currXpos = X_grid_pos + j - 20; |
2387 char v13; // al@12 | 2387 int distanceSquared = i * i + j * j; |
2388 int v15; // [sp+4h] [bp-14h]@7 | 2388 if ( distanceSquared <= 100 && currYpos >= 0 && currYpos <= 87 && currXpos >= 0 && currXpos <= 87 ) |
2389 | 2389 { |
2390 v4 = Y_grid_poa - 10; | 2390 unsigned char v13 = 1 << (7 - currXpos % 8); |
2391 if ( v4 < Y_grid_poa + 10 ) | 2391 this->uPartiallyRevealedCellOnMap[currYpos][currXpos / 8] |= v13; |
2392 { | 2392 if ( distanceSquared <= 49 ) |
2393 v5 = v4 - Y_grid_poa; | 2393 this->uFullyRevealedCellOnMap[currYpos][currXpos / 8] |= v13; |
2394 v6 = (Y_grid_poa - 30); | 2394 } |
2395 for ( int i = 0; i < Y_grid_poa + 10 - v4; i++) | |
2396 { | |
2397 v9 = X_grid_pos - 10; | |
2398 v10 = v9 - X_grid_pos; | |
2399 for ( v9; v9 < X_grid_pos + 10; ++v9 ) | |
2400 { | |
2401 v15 = abs(v10) * abs(v10) + abs(v5) * abs(v5); | |
2402 if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 87 ) | |
2403 { | |
2404 v13 = 1 << (7 - (v9 - 20) % 8); | |
2405 this->uDicovered_area[v6][(v9 - 20)/8] |= v13; | |
2406 if ( v15 <= 49 ) | |
2407 this->uUndiscoveredArea[v6][(v9 - 20)/8] |= v13; | |
2408 } | |
2409 ++v10; | |
2410 } | |
2411 ++v6; | |
2412 ++v5; | |
2413 } | 2395 } |
2414 } | 2396 } |
2415 return 1; | 2397 return 1; |
2416 } | 2398 } |
2399 | |
2417 | 2400 |
2418 //----- (0047F04C) -------------------------------------------------------- | 2401 //----- (0047F04C) -------------------------------------------------------- |
2419 bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos) | 2402 bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos) |
2420 { | 2403 { |
2421 bool result; // eax@5 | 2404 bool result; // eax@5 |
2422 | 2405 |
2423 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) | 2406 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
2424 result = 0; | 2407 result = 0; |
2425 else | 2408 else |
2426 result = (uUndiscoveredArea[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; | 2409 result = (uFullyRevealedCellOnMap[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
2427 return result; | 2410 return result; |
2428 } | 2411 } |
2429 | 2412 |
2430 //----- (0047F097) -------------------------------------------------------- | 2413 //----- (0047F097) -------------------------------------------------------- |
2431 bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos) | 2414 bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos) |
2433 bool result; // eax@5 | 2416 bool result; // eax@5 |
2434 | 2417 |
2435 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) | 2418 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
2436 result = 0; | 2419 result = 0; |
2437 else | 2420 else |
2438 result = (uDicovered_area[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; | 2421 result = (uPartiallyRevealedCellOnMap[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
2439 return result; | 2422 return result; |
2440 } | 2423 } |
2441 | 2424 |
2442 //----- (0047F0E2) -------------------------------------------------------- | 2425 //----- (0047F0E2) -------------------------------------------------------- |
2443 bool OutdoorLocation::_47F0E2() | 2426 bool OutdoorLocation::_47F0E2() |