diff mm7_4.cpp @ 630:1b813023fcbd

Tilesets change according to current season
author Nomad
date Mon, 11 Mar 2013 03:37:48 +0200
parents 8a0ec99a5177
children 3d03a3a674bc
line wrap: on
line diff
--- a/mm7_4.cpp	Fri Mar 08 17:08:08 2013 +0200
+++ b/mm7_4.cpp	Mon Mar 11 03:37:48 2013 +0200
@@ -1683,14 +1683,12 @@
     result = &this->pTiles[uTileID];
   return result;*/
 
- if (uTileID < 0 || uTileID > this->uNumTiles - 1)
-   return this->pTiles;
- else
-   return &this->pTiles[uTileID];
+  assert(uTileID < uNumTiles);
+  return &pTiles[uTileID];
 }
 
 //----- (00487E58) --------------------------------------------------------
-void TileTable::InitializeTileset(int uTerrainType)
+void TileTable::InitializeTileset(Tileset tileset)
 {
   TileTable *v2; // edi@1
   int v3; // ebx@1
@@ -1702,7 +1700,7 @@
   for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 )
   {
     v4 = &v2->pTiles[v3];
-    if ( uTerrainType == v4->uTerrainType && v4->pTileName[0] )
+    if (v4->tileset == tileset && v4->pTileName[0] )
     {
       v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName);
       if ( v2->pTiles[v3].uBitmapID != -1 )
@@ -1978,7 +1976,7 @@
     v8 = atoi(v7);
     v9 = v84.pProperties[3];
     v2->pTiles[v2->uNumTiles].uBitmapID = v8;
-    v2->pTiles[v2->uNumTiles].uTerrainType = 0;
+    v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass;
     if ( _strcmpi(v9, "TTtype_NULL") )
     {
       if ( _strcmpi(v9, "TTtype_Start") )
@@ -2033,145 +2031,145 @@
                                                       {
                                                         if ( !_strcmpi(v9, "TTtype_RoadCityStone") )
                                                         {
-                                                          v34 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                          v34 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                           *(char *)v34 |= 0x1Cu;
                                                         }
                                                       }
                                                       else
                                                       {
-                                                        v33 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                        v33 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                         *(char *)v33 |= 0xDu;
                                                       }
                                                     }
                                                     else
                                                     {
-                                                      v32 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                      v32 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                       *(char *)v32 |= 0xCu;
                                                     }
                                                   }
                                                   else
                                                   {
-                                                    v31 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                    v31 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                     *(char *)v31 |= 0x1Bu;
                                                   }
                                                 }
                                                 else
                                                 {
-                                                  v30 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                  v30 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                   *(char *)v30 |= 0x1Au;
                                                 }
                                               }
                                               else
                                               {
-                                                v29 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                                v29 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                                 *(char *)v29 |= 0x19u;
                                               }
                                             }
                                             else
                                             {
-                                              v28 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                              v28 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                               *(char *)v28 |= 0x18u;
                                             }
                                           }
                                           else
                                           {
-                                            v27 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                            v27 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                             *(char *)v27 |= 0x11u;
                                           }
                                         }
                                         else
                                         {
-                                          v26 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                          v26 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                           *(char *)v26 |= 0x10u;
                                         }
                                       }
                                       else
                                       {
-                                        v25 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                        v25 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                         *(char *)v25 |= 0xFu;
                                       }
                                     }
                                     else
                                     {
-                                      v24 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                      v24 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                       *(char *)v24 |= 0xEu;
                                     }
                                   }
                                   else
                                   {
-                                    v23 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                    v23 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                     *(char *)v23 |= 0x17u;
                                   }
                                 }
                                 else
                                 {
-                                  v22 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                  v22 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                   *(char *)v22 |= 0x16u;
                                 }
                               }
                               else
                               {
-                                v21 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                                v21 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                                 *(char *)v21 |= 0xBu;
                               }
                             }
                             else
                             {
-                              v20 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                              v20 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                               *(char *)v20 |= 0xAu;
                             }
                           }
                           else
                           {
-                            v19 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                            v19 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                             *(char *)v19 |= 9u;
                           }
                         }
                         else
                         {
-                          v18 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                          v18 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                           *(char *)v18 |= 7u;
                         }
                       }
                       else
                       {
-                        v17 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                        v17 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                         *(char *)v17 |= 8u;
                       }
                     }
                     else
                     {
-                      v16 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                      v16 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                       *(char *)v16 |= 5u;
                     }
                   }
                   else
                   {
-                    v15 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                    v15 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                     *(char *)v15 |= 4u;
                   }
                 }
                 else
                 {
-                  v14 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                  v14 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                   *(char *)v14 |= 3u;
                 }
               }
               else
               {
-                v13 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+                v13 = (int)&v2->pTiles[v2->uNumTiles].tileset;
                 *(char *)v13 |= 2u;
               }
             }
             else
             {
-              v12 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+              v12 = (int)&v2->pTiles[v2->uNumTiles].tileset;
               *(char *)v12 |= 1u;
             }
           }
           else
           {
-            v11 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType;
+            v11 = (int)&v2->pTiles[v2->uNumTiles].tileset;
             *(char *)v11 |= 6u;
           }
         }
@@ -2184,7 +2182,7 @@
     }
     else
     {
-      LOBYTE(v2->pTiles[v2->uNumTiles].uTerrainType) = -1;
+      LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1;
     }
     v35 = v84.pProperties[4];
     v2->pTiles[v2->uNumTiles].uSection = 0;