comparison Outdoor.cpp @ 67:3b4f8bd48e3b

25.01.13 (I did sky)
author Ritor1
date Fri, 25 Jan 2013 16:48:21 +0600
parents 80484cf3a683
children 7ad8eaa172c5
comparison
equal deleted inserted replaced
66:653fdf29c654 67:3b4f8bd48e3b
61 pIndoorCamera->pos.x = pParty->vPosition.x 61 pIndoorCamera->pos.x = pParty->vPosition.x
62 - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) 62 - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY)
63 * (signed __int64)pParty->field_18) >> 16); 63 * (signed __int64)pParty->field_18) >> 16);
64 v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); 64 v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi);
65 pIndoorCamera->field_4C = v1; 65 pIndoorCamera->field_4C = v1;
66 pIndoorCamera->pos.y = pParty->vPosition.y - ((unsigned __int64)(v3 * (signed __int64)pParty->field_18) >> 16); 66 pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * (stru_5C6E00->SinCos(pIndoorCamera->sRotationY) / 2048.0);
67 pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; 67 pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;
68 if ( v2 || pRenderer->pRenderD3D ) 68 if ( v2 || pRenderer->pRenderD3D )
69 { 69 {
70 ResetStru148s(); 70 ResetStru148s();
71 pOutdoorCamera->RotationToInts(); 71 pOutdoorCamera->RotationToInts();
194 } 194 }
195 195
196 //----- (00488EB1) -------------------------------------------------------- 196 //----- (00488EB1) --------------------------------------------------------
197 int OutdoorLocation::GetSomeOtherTileInfo(int sX, int sY) 197 int OutdoorLocation::GetSomeOtherTileInfo(int sX, int sY)
198 { 198 {
199 OutdoorLocation *v3; // esi@1 199 //OutdoorLocation *v3; // esi@1
200 unsigned int v4; // edi@1 200 unsigned int v4; // edi@1
201 unsigned int v5; // eax@1 201 unsigned int v5; // eax@1
202 int result; // eax@5 202 int result; // eax@5
203 203
204 v3 = this; 204 /* v3 = this;
205 v4 = WorldPosToGridCellZ(sY); 205 v4 = WorldPosToGridCellZ(sY);
206 v5 = WorldPosToGridCellX(sX); 206 v5 = WorldPosToGridCellX(sX);
207 if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 ) 207 if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 )
208 result = 0; 208 result = 0;
209 else 209 else
210 result = ActuallyGetSomeOtherTileInfo(v5, v4); 210 result = ActuallyGetSomeOtherTileInfo(v5, v4);
211 return result; 211 return result;*/
212 v4 = WorldPosToGridCellZ(sY);
213 v5 = WorldPosToGridCellX(sX);
214 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 )
215 return 0;
216 return ActuallyGetSomeOtherTileInfo(v5, v4);
212 } 217 }
213 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); 218 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
214 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 219 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
215 220
216 //----- (00488EEF) -------------------------------------------------------- 221 //----- (00488EEF) --------------------------------------------------------
217 unsigned int OutdoorLocation::GetTileTexture(int sX, int sZ) 222 unsigned int OutdoorLocation::GetTileTexture(int sX, int sY)
218 { 223 {
219 OutdoorLocation *v3; // esi@1 224 //OutdoorLocation *v3; // esi@1
220 unsigned int v4; // edi@1 225 unsigned int v4; // edi@1
221 unsigned int v5; // eax@1 226 unsigned int v5; // eax@1
222 unsigned int result; // eax@5 227 // unsigned int result; // eax@5
223 228
224 v3 = this; 229 /*v3 = this;
225 v4 = WorldPosToGridCellZ(sZ); 230 v4 = WorldPosToGridCellZ(sZ);
226 v5 = WorldPosToGridCellX(sX); 231 v5 = WorldPosToGridCellX(sX);
227 if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 ) 232 if ( v5< 0 || (signed int)v5 > 127 || v4 < 0 || (signed int)v4 > 127 )//if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 )
228 result = -1; 233 result = -1;
229 else 234 else
230 result = DoGetTileTexture(v5, v4); 235 result = DoGetTileTexture(v5, v4);
231 return result; 236 return result;*/
237 v4 = WorldPosToGridCellZ(sY);
238 v5 = WorldPosToGridCellX(sX);
239 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 )
240 return -1;
241 return DoGetTileTexture(v5, v4);
232 } 242 }
233 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); 243 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
234 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); 244 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int);
235 245
236 //----- (00488F2E) -------------------------------------------------------- 246 //----- (00488F2E) --------------------------------------------------------
1684 } 1694 }
1685 1695
1686 memcpy(pLevelFilename, pSrc, 0x20); 1696 memcpy(pLevelFilename, pSrc, 0x20);
1687 memcpy(pLocationFileName, pSrc + 0x20, 0x20); 1697 memcpy(pLocationFileName, pSrc + 0x20, 0x20);
1688 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20); 1698 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20);
1689 memcpy(pSkyTextureName, pSrc + 0x60, 0x20); 1699 memcpy(pSkyTextureName, pSrc + 3 * 32, 32);
1690 memcpy(pGroundTileset, pSrc + 0x80, 0x20); 1700 memcpy(pGroundTileset, pSrc + 0x80, 0x20);
1691 memcpy(pTileTypes, pSrc + 0xA0, 0x10); 1701 memcpy(pTileTypes, pSrc + 0xA0, 0x10);
1692 pSrc += 0xB0; 1702 pSrc += 0xB0;
1693 1703
1694 //v43 = (char *)pSrc + 176; 1704 //v43 = (char *)pSrc + 176;
2387 } 2397 }
2388 return result; 2398 return result;
2389 } 2399 }
2390 2400
2391 //----- (0047ED08) -------------------------------------------------------- 2401 //----- (0047ED08) --------------------------------------------------------
2392 unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uZ) 2402 unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY)
2393 { 2403 {
2394 int v3; // esi@5 2404 int v3; // esi@5
2395 unsigned int result; // eax@9 2405 unsigned int result; // eax@9
2396 2406
2397 if ( (uX & 0x80000000u) != 0 || (signed int)uX > 127 || (uZ & 0x80000000u) != 0 || (signed int)uZ > 127 ) 2407
2398 { 2408 /* v3 = *(&this->pTerrain.pTilemap[128 * uZ] + uX);
2399 result = 0;
2400 }
2401 else
2402 {
2403 v3 = *(&this->pTerrain.pTilemap[128 * uZ] + uX);
2404 if ( v3 < 198 ) 2409 if ( v3 < 198 )
2405 { 2410 {
2406 if ( v3 >= 90 ) 2411 if ( v3 >= 90 )
2407 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90; 2412 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90;
2408 } 2413 }
2410 { 2415 {
2411 v3 = v3 + this->pTileTypes[3].uTileID - 198; 2416 v3 = v3 + this->pTileTypes[3].uTileID - 198;
2412 } 2417 }
2413 result = pTileTable->pTiles[v3].uBitmapID; 2418 result = pTileTable->pTiles[v3].uBitmapID;
2414 } 2419 }
2415 return result; 2420 return result;*/
2421 if (uX > 127 || uY > 127)
2422 return 0;
2423
2424 v3 = this->pTerrain.pTilemap[uY * 128 + uX];
2425 if (v3 < 198)
2426 {
2427 if (v3 >= 90)
2428 v3 = v3 + this->pTileTypes[(v3 - 90) / 18].uTileID - 36 * (v3 - 90) / 36 - 90;
2429 }
2430 else
2431 v3 = v3 + this->pTileTypes[3].uTileID - 198;
2432
2433 return pTileTable->pTiles[v3].uBitmapID;
2416 } 2434 }
2417 2435
2418 //----- (0047ED83) -------------------------------------------------------- 2436 //----- (0047ED83) --------------------------------------------------------
2419 int OutdoorLocation::_47ED83(signed int a2, signed int a3) 2437 int OutdoorLocation::_47ED83(signed int a2, signed int a3)
2420 { 2438 {
2429 2447
2430 //----- (0047EDB3) -------------------------------------------------------- 2448 //----- (0047EDB3) --------------------------------------------------------
2431 int OutdoorLocation::ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY) 2449 int OutdoorLocation::ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY)
2432 { 2450 {
2433 int v3; // esi@5 2451 int v3; // esi@5
2434 int result; // eax@7 2452 //int result; // eax@7
2435 2453
2436 if ( (uX & 0x80000000u) != 0 || (signed int)uX > 127 || (uY & 0x80000000u) != 0 || (signed int)uY > 127 ) 2454 /* if ( (uX & 0x80000000u) != 0 || (signed int)uX > 127 || (uY & 0x80000000u) != 0 || (signed int)uY > 127 )
2437 { 2455 {
2438 result = 0; 2456 result = 0;
2439 } 2457 }
2440 else 2458 else
2441 { 2459 {
2442 v3 = *(&this->pTerrain.pTilemap[128 * uY] + uX); 2460 v3 = *(&this->pTerrain.pTilemap[128 * uY] + uX);
2443 if ( v3 >= 90 ) 2461 if ( v3 >= 90 )
2444 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90; 2462 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90;
2445 result = pTileTable->pTiles[v3].uAttributes; 2463 result = pTileTable->pTiles[v3].uAttributes;
2446 } 2464 }
2447 return result; 2465 return result;*/
2466 if (uX > 127 || uY > 127)
2467 return 0;
2468 else
2469 {
2470 v3 = this->pTerrain.pTilemap[128 * uY + uX];
2471 if ( v3 >= 90 )
2472 v3 = v3 + this->pTileTypes[(v3 - 90) / 18].uTileID - 36 * (v3 - 90) / 36 - 90;
2473 return pTileTable->pTiles[v3].uAttributes;
2474 }
2448 } 2475 }
2449 2476
2450 //----- (0047EE16) -------------------------------------------------------- 2477 //----- (0047EE16) --------------------------------------------------------
2451 int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ) 2478 int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ)
2452 { 2479 {