# HG changeset patch # User Gloval # Date 1363985458 -14400 # Node ID 8b29c4121f6f4302eba38c727d729728fa9c9175 # Parent 6005142abce000535b84c2a401393c3560f41432 map mask diff -r 6005142abce0 -r 8b29c4121f6f Outdoor.cpp --- a/Outdoor.cpp Sat Mar 23 00:20:16 2013 +0400 +++ b/Outdoor.cpp Sat Mar 23 00:50:58 2013 +0400 @@ -121,7 +121,7 @@ { v4 = WorldPosToGridCellZ(pParty->vPosition.y); v5 = WorldPosToGridCellX(pParty->vPosition.x); - pOutdoor->_47EF60(v5, v4, 1); + pOutdoor->UpdateDiscoveredArea(v5, v4, 1); } pGame->uFlags2 &= 0xFFFFFFFEu; if (pRenderer->pRenderD3D && pRenderer->bUsingSpecular) @@ -2115,9 +2115,9 @@ //v108 = (int)".odm"; //v83 = strlen(pContainer); //strcpy((char *)v141 + v83, (const char *)v108); - memcpy(array_528, pSrc, 0x3C8); + memcpy(uUndiscoveredArea, pSrc, 0x3C8); //v84 = (const void *)(v74 + 968); - memcpy(array_8F0, pSrc + 0x3C8, 0x3C8); + memcpy(uDicovered_area, pSrc + 0x3C8, 0x3C8); pSrc += 2 * 0x3C8; //v85 = (char *)v84 + 968; @@ -2125,8 +2125,8 @@ if ( *(int *)thisa ) { - memcpy(array_528, Dst, 0x3C8u); - memcpy(array_8F0, Src, 0x3C8u); + memcpy(uUndiscoveredArea, Dst, 0x3C8u); + memcpy(uDicovered_area, Src, 0x3C8u); } //v25 = uNumBModels == 0; @@ -2594,7 +2594,7 @@ } //----- (0047EF60) -------------------------------------------------------- -int OutdoorLocation::_47EF60(int a2, int a3, int a4) +int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) { int v4; // ecx@1 int v5; // edx@2 @@ -2614,14 +2614,14 @@ int i; // [sp+24h] [bp+Ch]@5 v18 = this; - v4 = a3 - 10; - if ( a3 - 10 < a3 + 10 ) + v4 = Y_grid_poa - 10; + if ( Y_grid_poa - 10 < Y_grid_poa + 10 ) { - v5 = v4 - a3; - v6 = 88 * (a3 - 30); - v7 = a2; - v19 = v4 - a3; - v17 = a3 + 10 - v4; + v5 = v4 - Y_grid_poa; + v6 = (Y_grid_poa - 30); + v7 = X_grid_pos; + v19 = v4 - Y_grid_poa; + v17 = Y_grid_poa + 10 - v4; while ( 1 ) { v8 = abs(v5); @@ -2634,14 +2634,13 @@ { v11 = abs(v10); v15 = v11 * v11 + v16; - if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 7656 ) + if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 87 ) { - v12 = (v6 + v9 - 20) >> 3; - v13 = 1 << (8 - (v6 + v9 - 20) % 8 - 1); - v18->array_8F0[v12] |= v13; + v13 = 1 << (7 - (v9 - 20) % 8); + v18->uDicovered_area[v6][(v9 - 20)/8] |= v13; if ( v15 <= 49 ) - v18->array_528[v12] |= v13; - v7 = a2; + v18->uUndiscoveredArea[v6][(v9 - 20)/8] |= v13; + v7 = X_grid_pos; } ++v9; ++i; @@ -2649,7 +2648,7 @@ break; } } - v6 += 88; + ++v6 ; ++v19; --v17; if ( !v17 ) @@ -2661,26 +2660,26 @@ } //----- (0047F04C) -------------------------------------------------------- -bool OutdoorLocation::_47F04C(signed int a2, signed int a3) +bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos) { bool result; // eax@5 - if ( a2 < 0 || a2 >= 88 || a3 < 0 || a3 >= 88 ) + if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) result = 0; else - result = (this->array_528[(a2 + 88 * a3) / 8] & (unsigned __int8)(1 << (7 - (a2 + 88 * a3) % 8))) != 0; + result = (uUndiscoveredArea[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; return result; } //----- (0047F097) -------------------------------------------------------- -bool OutdoorLocation::_47F097(signed int a2, signed int a3) +bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos) { bool result; // eax@5 - if ( a2 < 0 || a2 >= 88 || a3 < 0 || a3 >= 88 ) + if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) result = 0; else - result = (this->array_8F0[(a2 + 88 * a3) / 8] & (unsigned __int8)(1 << (7 - (a2 + 88 * a3) % 8))) != 0; + result = (uDicovered_area[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; return result; } diff -r 6005142abce0 -r 8b29c4121f6f Outdoor.h --- a/Outdoor.h Sat Mar 23 00:20:16 2013 +0400 +++ b/Outdoor.h Sat Mar 23 00:50:58 2013 +0400 @@ -154,7 +154,7 @@ int ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY); int DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ); int _47EE49(signed int a2, signed int a3, int a4); - int _47EF60(int a2, int a3, int a4); + int UpdateDiscoveredArea(int a2, int a3, int a4); bool _47F04C(signed int a2, signed int a3); bool _47F097(signed int a2, signed int a3); bool _47F0E2(); @@ -206,8 +206,8 @@ int day_fogrange_1; int day_fogrange_2; char field_510[24]; - char array_528[968]; - char array_8F0[968]; + unsigned char uUndiscoveredArea[88][11];//968 + unsigned char uDicovered_area[88][11];//[968] int field_CB8; int max_terrain_dimming_level; int field_CC0; diff -r 6005142abce0 -r 8b29c4121f6f SaveLoad.cpp --- a/SaveLoad.cpp Sat Mar 23 00:20:16 2013 +0400 +++ b/SaveLoad.cpp Sat Mar 23 00:50:58 2013 +0400 @@ -507,9 +507,9 @@ pOutdoor->ddm.uNumDecorations = uNumLevelDecorations; memcpy(DstBuf, &pOutdoor->ddm, 0x28); v21 = (char *)v21 + 40; - memcpy(v21, pOutdoor->array_528, 0x3C8); + memcpy(v21, pOutdoor->uUndiscoveredArea, 0x3C8); v21 = (char *)v21 + 968; - memcpy(v21, pOutdoor->array_8F0, 0x3C8); + memcpy(v21, pOutdoor->uDicovered_area, 0x3C8); v22 = (char *)v21 + 968; if ( (signed int)pOutdoor->uNumBModels > 0 ) {