Mercurial > mm7
comparison Outdoor.cpp @ 630:1b813023fcbd
Tilesets change according to current season
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:37:48 +0200 |
parents | cb0ad52d6a26 |
children | 71ecba604995 |
comparison
equal
deleted
inserted
replaced
619:574cc56e05e9 | 630:1b813023fcbd |
---|---|
41 Edge defaultEdge; // weak | 41 Edge defaultEdge; // weak |
42 Edge stru_80C9A4; | 42 Edge stru_80C9A4; |
43 Edge stru_80C9D8; | 43 Edge stru_80C9D8; |
44 | 44 |
45 | 45 |
46 | |
47 | |
48 | |
46 //----- (0047A59E) -------------------------------------------------------- | 49 //----- (0047A59E) -------------------------------------------------------- |
47 void OutdoorLocation::ExecDraw(unsigned int bRedraw) | 50 void OutdoorLocation::ExecDraw(unsigned int bRedraw) |
48 { | 51 { |
49 //unsigned int v2; // ebx@1 | 52 //unsigned int v2; // ebx@1 |
50 int v3; // ST18_4@3 | 53 int v3; // ST18_4@3 |
281 day_attrib = v5->day_attrib; | 284 day_attrib = v5->day_attrib; |
282 day_fogrange_1 = v5->day_fogrange_1; | 285 day_fogrange_1 = v5->day_fogrange_1; |
283 day_fogrange_2 = v5->day_fogrange_2; | 286 day_fogrange_2 = v5->day_fogrange_2; |
284 if ( Is_out15odm_underwater() ) | 287 if ( Is_out15odm_underwater() ) |
285 SetUnderwaterFog(); | 288 SetUnderwaterFog(); |
286 _6BE134_odm_main_tile_group = v5->pTileTypes[0].uTileGroup; | 289 _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset; |
287 result = 1; | 290 result = 1; |
288 } | 291 } |
289 else | 292 else |
290 { | 293 { |
291 result = 0; | 294 result = 0; |
518 || v15 ) | 521 || v15 ) |
519 return 2; | 522 return 2; |
520 v5 = WorldPosToGridCellX(pParty->vPosition.x); | 523 v5 = WorldPosToGridCellX(pParty->vPosition.x); |
521 v6 = WorldPosToGridCellZ(pParty->vPosition.y); | 524 v6 = WorldPosToGridCellZ(pParty->vPosition.y); |
522 v7 = _47ED83(v5, v6 - 1); | 525 v7 = _47ED83(v5, v6 - 1); |
523 v8 = pTileTable->pTiles[_47ECC1(v7)].uTerrainType; | 526 v8 = pTileTable->pTiles[_47ECC1(v7)].tileset; |
524 if ( v8 ) | 527 if ( v8 ) |
525 { | 528 { |
526 v9 = v8 - 1; | 529 v9 = v8 - 1; |
527 if ( !v9 ) | 530 if ( !v9 ) |
528 return 3; | 531 return 3; |
1084 v1 = this; | 1087 v1 = this; |
1085 strcpy(this->pLevelFilename, "blank"); | 1088 strcpy(this->pLevelFilename, "blank"); |
1086 strcpy(v1->pLocationFileName, "i6.odm"); | 1089 strcpy(v1->pLocationFileName, "i6.odm"); |
1087 strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); | 1090 strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); |
1088 v1->uNumBModels = 0; | 1091 v1->uNumBModels = 0; |
1089 v1->pTileTypes[0].uTileGroup = 0; | 1092 v1->pTileTypes[0].tileset = Tileset_Grass; |
1090 v1->pTileTypes[1].uTileGroup = 5; | 1093 v1->pTileTypes[1].tileset = Tileset_Water; |
1091 v1->pTileTypes[2].uTileGroup = 6; | 1094 v1->pTileTypes[2].tileset = Tileset_6; |
1092 v1->pTileTypes[3].uTileGroup = 10; | 1095 v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; |
1093 v1->LoadTileGroupIds(); | 1096 v1->LoadTileGroupIds(); |
1094 v1->_47F3EA(); | 1097 v1->LoadRoadTileset(); |
1095 pAllocator->FreeChunk(v1->pBModels); | 1098 pAllocator->FreeChunk(v1->pBModels); |
1096 pAllocator->FreeChunk(v1->pSpawnPoints); | 1099 pAllocator->FreeChunk(v1->pSpawnPoints); |
1097 v1->pBModels = 0; | 1100 v1->pBModels = 0; |
1098 v1->pSpawnPoints = 0; | 1101 v1->pSpawnPoints = 0; |
1099 v1->pTerrain.Initialize(); | 1102 v1->pTerrain.Initialize(); |
1384 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108); | 1387 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108); |
1385 fread(&DstBuf, 0x180u, 1u, (FILE *)v7); | 1388 fread(&DstBuf, 0x180u, 1u, (FILE *)v7); |
1386 fseek((FILE *)v7, Offset, 0); | 1389 fseek((FILE *)v7, Offset, 0); |
1387 fread(this, 0xB0u, 1u, (FILE *)v7); | 1390 fread(this, 0xB0u, 1u, (FILE *)v7); |
1388 LoadTileGroupIds(); | 1391 LoadTileGroupIds(); |
1389 _47F3EA(); | 1392 LoadRoadTileset(); |
1390 strcpy(pGroundTileset, "grastyl"); | 1393 strcpy(pGroundTileset, "grastyl"); |
1391 fseek((FILE *)v7, v114, 0); | 1394 fseek((FILE *)v7, v114, 0); |
1392 fread(&uNumBModels, 4u, 1u, (FILE *)v7); | 1395 fread(&uNumBModels, 4u, 1u, (FILE *)v7); |
1393 fseek((FILE *)v7, v115, 0); | 1396 fseek((FILE *)v7, v115, 0); |
1394 fread(&uNumSpriteObjects, 4u, 1u, (FILE *)v7); | 1397 fread(&uNumSpriteObjects, 4u, 1u, (FILE *)v7); |
1703 memcpy(pTileTypes, pSrc + 0xA0, 0x10); | 1706 memcpy(pTileTypes, pSrc + 0xA0, 0x10); |
1704 pSrc += 0xB0; | 1707 pSrc += 0xB0; |
1705 | 1708 |
1706 //v43 = (char *)pSrc + 176; | 1709 //v43 = (char *)pSrc + 176; |
1707 LoadTileGroupIds(); | 1710 LoadTileGroupIds(); |
1708 _47F3EA(); | 1711 LoadRoadTileset(); |
1709 strcpy(pGroundTileset, "grastyl"); | 1712 strcpy(pGroundTileset, "grastyl"); |
1710 pGameLoadingUI_ProgressBar->Progress(); | 1713 pGameLoadingUI_ProgressBar->Progress(); |
1711 pTerrain.Initialize(); | 1714 pTerrain.Initialize(); |
1712 //v108 = 16384; | 1715 //v108 = 16384; |
1713 //v107 = (int)v43; | 1716 //v107 = (int)v43; |
2256 pGameLoadingUI_ProgressBar->Progress(); | 2259 pGameLoadingUI_ProgressBar->Progress(); |
2257 memcpy(&uLastVisitDay, pSrc, 0x38u); | 2260 memcpy(&uLastVisitDay, pSrc, 0x38u); |
2258 | 2261 |
2259 free(pSrcMem); | 2262 free(pSrcMem); |
2260 | 2263 |
2261 pTileTable->InitializeTileset(4); | 2264 pTileTable->InitializeTileset(Tileset_Dirt); |
2265 pTileTable->InitializeTileset(Tileset_Snow); | |
2262 //thisa = (int)pTileTypes; | 2266 //thisa = (int)pTileTypes; |
2263 //v108 = pTileTypes[0].uTileGroup; | 2267 //v108 = pTileTypes[0].uTileGroup; |
2264 pTileTable->InitializeTileset(pTileTypes[0].uTileGroup); | 2268 pTileTable->InitializeTileset(pTileTypes[0].tileset); |
2265 //v108 = pTileTypes[1].uTileGroup; | 2269 //v108 = pTileTypes[1].uTileGroup; |
2266 pTileTable->InitializeTileset(pTileTypes[1].uTileGroup); | 2270 pTileTable->InitializeTileset(pTileTypes[1].tileset); |
2267 //v108 = pTileTypes[2].uTileGroup; | 2271 //v108 = pTileTypes[2].uTileGroup; |
2268 pTileTable->InitializeTileset(pTileTypes[2].uTileGroup); | 2272 pTileTable->InitializeTileset(pTileTypes[2].tileset); |
2269 //v108 = pTileTypes[3].uTileGroup; | 2273 //v108 = pTileTypes[3].uTileGroup; |
2270 pTileTable->InitializeTileset(pTileTypes[3].uTileGroup); | 2274 pTileTable->InitializeTileset(pTileTypes[3].tileset); |
2271 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); | 2275 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); |
2272 //v97 = pTileTypes[0].uTileID; | 2276 //v97 = pTileTypes[0].uTileID; |
2273 //v108 = 0; | 2277 //v108 = 0; |
2274 auto v98 = pTileTable->GetTileById(pTileTypes[0].uTileID); | 2278 auto v98 = pTileTable->GetTileById(pTileTypes[0].uTileID); |
2275 //v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT); | 2279 //v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT); |
2400 unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY) | 2404 unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY) |
2401 { | 2405 { |
2402 int v3; // esi@5 | 2406 int v3; // esi@5 |
2403 unsigned int result; // eax@9 | 2407 unsigned int result; // eax@9 |
2404 | 2408 |
2405 if ( uX < 0 || uX > 127 || uY < 0 || uY > 127) | 2409 assert(uX < 128 && uY < 128); |
2406 return 0; | |
2407 | 2410 |
2408 v3 = this->pTerrain.pTilemap[uY * 128 + uX]; | 2411 v3 = this->pTerrain.pTilemap[uY * 128 + uX]; |
2409 if (v3 < 198) | 2412 if (v3 < 198) // < Tileset_3 |
2410 { | 2413 { |
2411 if (v3 >= 90) | 2414 if (v3 >= 90) |
2412 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; | 2415 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; |
2413 } | 2416 } |
2414 else | 2417 else |
2415 v3 = v3 + this->pTileTypes[3].uTileID - 198; | 2418 v3 = v3 + this->pTileTypes[3].uTileID - 198; |
2419 | |
2420 static int f = 0; | |
2421 if (f) | |
2422 pParty->uCurrentMonth = 2; | |
2423 | |
2424 switch (pParty->uCurrentMonth) | |
2425 { | |
2426 case 11: case 0: case 1: // winter | |
2427 if (v3 >= 90) // Tileset_Grass begins at TileID = 90 | |
2428 { | |
2429 if (v3 <= 95) // some grastyl entries | |
2430 v3 = 348; | |
2431 else if (v3 <= 113) // rest of grastyl & all grdrt* | |
2432 v3 = 348 + (v3 - 96); | |
2433 } | |
2434 /*switch (v3) | |
2435 { | |
2436 case 102: v3 = 354; break; // grdrtNE -> SNdrtne | |
2437 case 104: v3 = 356; break; // grdrtNW -> SNdrtnw | |
2438 case 108: v3 = 360; break; // grdrtN -> SNdrtn | |
2439 }*/ | |
2440 break; | |
2441 | |
2442 case 2: case 3: case 4: // spring | |
2443 case 8: case 9: case 10: // autumn | |
2444 if (v3 >= 90 && v3 <= 113) // just convert all Tileset_Grass to dirt | |
2445 v3 = 1; | |
2446 break; | |
2447 | |
2448 case 5: case 6: case 7: // summer | |
2449 //all tiles are green grass by default | |
2450 break; | |
2451 | |
2452 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); | |
2453 } | |
2416 | 2454 |
2417 return pTileTable->pTiles[v3].uBitmapID; | 2455 return pTileTable->pTiles[v3].uBitmapID; |
2418 } | 2456 } |
2419 | 2457 |
2420 //----- (0047ED83) -------------------------------------------------------- | 2458 //----- (0047ED83) -------------------------------------------------------- |
2486 { | 2524 { |
2487 v6 = -(a4 != 0); | 2525 v6 = -(a4 != 0); |
2488 LOBYTE(v6) = v6 & 0xD9; | 2526 LOBYTE(v6) = v6 & 0xD9; |
2489 return v6 + 92; | 2527 return v6 + 92; |
2490 } | 2528 } |
2491 v8 = pTileTable->pTiles[v5].uTerrainType; | 2529 v8 = pTileTable->pTiles[v5].tileset; |
2492 if ( v8 <= 6 ) | 2530 if ( v8 <= 6 ) |
2493 { | 2531 { |
2494 if ( v8 == 6 ) | 2532 if ( v8 == Tileset_6 ) |
2495 { | 2533 { |
2496 v17 = -(a4 != 0); | 2534 v17 = -(a4 != 0); |
2497 LOBYTE(v17) = v17 & 0xD9; | 2535 LOBYTE(v17) = v17 & 0xD9; |
2498 return v17 + 88; | 2536 return v17 + 88; |
2499 } | 2537 } |
2839 thisa.PrepareSprites(v2); | 2877 thisa.PrepareSprites(v2); |
2840 return 1; | 2878 return 1; |
2841 } | 2879 } |
2842 | 2880 |
2843 //----- (0047F3EA) -------------------------------------------------------- | 2881 //----- (0047F3EA) -------------------------------------------------------- |
2844 bool OutdoorLocation::_47F3EA() | 2882 bool OutdoorLocation::LoadRoadTileset() |
2845 { | 2883 { |
2846 OutdoorLocationTileType *v1; // esi@1 | 2884 OutdoorLocationTileType *v1; // esi@1 |
2847 | 2885 |
2848 v1 = &this->pTileTypes[3]; | 2886 v1 = &this->pTileTypes[3]; |
2849 this->pTileTypes[3].uTileID = pTileTable->method_487ED6(this->pTileTypes[3].uTileGroup, 1); | 2887 pTileTypes[3].uTileID = pTileTable->method_487ED6(pTileTypes[3].tileset, 1); |
2850 pTileTable->InitializeTileset(v1->uTileGroup); | 2888 pTileTable->InitializeTileset(v1->tileset); |
2851 return 1; | 2889 return 1; |
2852 } | 2890 } |
2853 | 2891 |
2854 //----- (0047F420) -------------------------------------------------------- | 2892 //----- (0047F420) -------------------------------------------------------- |
2855 bool OutdoorLocation::LoadTileGroupIds() | 2893 bool OutdoorLocation::LoadTileGroupIds() |
2856 { | 2894 { |
2857 for (uint i = 0; i < 3; ++i) | 2895 for (uint i = 0; i < 3; ++i) |
2858 pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].uTileGroup, 1); | 2896 pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].tileset, 1); |
2859 | 2897 |
2860 return true; | 2898 return true; |
2861 } | 2899 } |
2862 | 2900 |
2863 //----- (0047B42C) -------------------------------------------------------- | 2901 //----- (0047B42C) -------------------------------------------------------- |