Advertisement
Earthcomputer

BiomeInitLayer.cpp

Nov 28th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.62 KB | None | 0 0
  1. __int64 __fastcall BiomeInitLayer::BiomeInitLayer(Layer *a1, unsigned int a2, __int64 a3, int a4)
  2. {
  3.   __int64 v4; // ST18_8
  4.   int v5; // ST14_4
  5.   __int64 result; // rax
  6.  
  7.   v4 = a3;
  8.   v5 = a4;
  9.   Layer::Layer(a1, a2);
  10.   *(_QWORD *)a1 = &'vtable for'BiomeInitLayer + 2;
  11.   std::vector<Biome *,std::allocator<Biome *>>::vector((char *)a1 + 112);
  12.   std::shared_ptr<Layer>::operator=((char *)a1 + 48, v4);
  13.   *((_QWORD *)a1 + 8) = VanillaBiomes::mDesert;
  14.   *((_QWORD *)a1 + 9) = VanillaBiomes::mDesert;
  15.   *((_QWORD *)a1 + 10) = VanillaBiomes::mDesert;
  16.   *((_QWORD *)a1 + 11) = VanillaBiomes::mSavanna;
  17.   *((_QWORD *)a1 + 12) = VanillaBiomes::mSavanna;
  18.   *((_QWORD *)a1 + 13) = VanillaBiomes::mPlains;
  19.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mForest);
  20.   if ( v5 == 1 )
  21.     std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mRoofedForest);
  22.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mExtremeHills);
  23.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mPlains);
  24.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mPlains);
  25.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mPlains);
  26.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mBirchForest);
  27.   std::vector<Biome *,std::allocator<Biome *>>::push_back((char *)a1 + 112, &VanillaBiomes::mSwampland);
  28.   *((_QWORD *)a1 + 17) = VanillaBiomes::mForest;
  29.   *((_QWORD *)a1 + 18) = VanillaBiomes::mExtremeHills;
  30.   *((_QWORD *)a1 + 19) = VanillaBiomes::mTaiga;
  31.   *((_QWORD *)a1 + 20) = VanillaBiomes::mPlains;
  32.   *((_QWORD *)a1 + 21) = VanillaBiomes::mIceFlats;
  33.   *((_QWORD *)a1 + 22) = VanillaBiomes::mIceFlats;
  34.   *((_QWORD *)a1 + 23) = VanillaBiomes::mIceFlats;
  35.   result = VanillaBiomes::mTaigaCold;
  36.   *((_QWORD *)a1 + 24) = VanillaBiomes::mTaigaCold;
  37.   return result;
  38. }
  39.  
  40. __int64 __fastcall BiomeInitLayer::fillArea(BiomeInitLayer *this, LayerData *a2, unsigned int a3, unsigned int a4, unsigned int a5, unsigned int a6)
  41. {
  42.   __int64 v6; // rax
  43.   int v7; // ecx
  44.   int v8; // eax
  45.   int v9; // eax
  46.   int v10; // eax
  47.   __int64 v11; // rax
  48.   int v12; // eax
  49.   int v13; // eax
  50.   int v15; // [rsp+2Ch] [rbp-74h]
  51.   unsigned int v16; // [rsp+30h] [rbp-70h]
  52.   int v17; // [rsp+34h] [rbp-6Ch]
  53.   int v18; // [rsp+38h] [rbp-68h]
  54.   int v19; // [rsp+40h] [rbp-60h]
  55.   __int64 v20; // [rsp+48h] [rbp-58h]
  56.   __int64 *v21; // [rsp+50h] [rbp-50h]
  57.   int v22; // [rsp+5Ch] [rbp-44h]
  58.   int v23; // [rsp+60h] [rbp-40h]
  59.   int v24; // [rsp+68h] [rbp-38h]
  60.   __int64 v25; // [rsp+70h] [rbp-30h]
  61.   __int64 *v26; // [rsp+78h] [rbp-28h]
  62.   unsigned int v27; // [rsp+80h] [rbp-20h]
  63.   unsigned int v28; // [rsp+84h] [rbp-1Ch]
  64.   unsigned int v29; // [rsp+88h] [rbp-18h]
  65.   unsigned int v30; // [rsp+8Ch] [rbp-14h]
  66.   LayerData *v31; // [rsp+90h] [rbp-10h]
  67.   BiomeInitLayer *v32; // [rsp+98h] [rbp-8h]
  68.  
  69.   v32 = this;
  70.   v31 = a2;
  71.   v30 = a3;
  72.   v29 = a4;
  73.   v28 = a5;
  74.   v27 = a6;
  75.   v6 = std::__shared_ptr<Layer,(__gnu_cxx::_Lock_policy)2>::operator->((char *)this + 48);
  76.   (*(void (__fastcall **)(__int64, LayerData *, _QWORD, _QWORD, _QWORD, _QWORD))(*(_QWORD *)v6 + 24LL))(
  77.     v6,
  78.     a2,
  79.     v30,
  80.     v29,
  81.     v28,
  82.     v27);
  83.   v25 = range<int,1>(v27);
  84.   v26 = &v25;
  85.   v24 = Range<int,1>::begin(&v25);
  86.   v23 = Range<int,1>::end(v26);
  87.   while ( Range<int,1>::iterator::operator!=(&v24, &v23) & 1 )
  88.   {
  89.     v22 = Range<int,1>::iterator::operator*(&v24);
  90.     v20 = range<int,1>(v28);
  91.     v21 = &v20;
  92.     v19 = Range<int,1>::begin(&v20);
  93.     v18 = Range<int,1>::end(v21);
  94.     while ( Range<int,1>::iterator::operator!=(&v19, &v18) & 1 )
  95.     {
  96.       v17 = Range<int,1>::iterator::operator*(&v19);
  97.       Layer::initRandom(this, (signed int)(v30 + v17), (signed int)(v29 + v22));
  98.       v15 = (*(_DWORD *)(*(_QWORD *)v31 + 4LL * (signed int)(v28 * v22 + v17)) & 0xF00) >> 8;
  99.       v16 = *(_DWORD *)(*(_QWORD *)v31 + 4LL * (signed int)(v28 * v22 + v17)) & 0xFFFFF0FF;
  100.       if ( Layer::_isOcean((Layer *)v16, *(_QWORD *)v31) & 1 )
  101.       {
  102.         *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = v16;
  103.       }
  104.       else if ( v16 == *(_DWORD *)(VanillaBiomes::mMushroomIsland + 136LL) )
  105.       {
  106.         *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = v16;
  107.       }
  108.       else
  109.       {
  110.         switch ( v16 )
  111.         {
  112.           case 1u:
  113.             if ( v15 <= 0 )
  114.             {
  115.               v8 = Layer::nextRandom(this, 6);
  116.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(*((_QWORD *)this + v8 + 8)
  117.                                                                                                   + 136LL);
  118.             }
  119.             else
  120.             {
  121.               if ( (unsigned int)Layer::nextRandom(this, 3) )
  122.                 v7 = *(_DWORD *)(VanillaBiomes::mMesaRock + 136LL);
  123.               else
  124.                 v7 = *(_DWORD *)(VanillaBiomes::mMesaClearRock + 136LL);
  125.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = v7;
  126.             }
  127.             break;
  128.           case 2u:
  129.             if ( v15 <= 0 )
  130.             {
  131.               v9 = std::vector<Biome *,std::allocator<Biome *>>::size((char *)this + 112);
  132.               v10 = Layer::nextRandom(this, v9);
  133.               v11 = std::vector<Biome *,std::allocator<Biome *>>::operator[]((char *)this + 112, v10);
  134.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(*(_QWORD *)v11
  135.                                                                                                   + 136LL);
  136.             }
  137.             else
  138.             {
  139.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(VanillaBiomes::mJungle
  140.                                                                                                   + 136LL);
  141.             }
  142.             break;
  143.           case 3u:
  144.             if ( v15 <= 0 )
  145.             {
  146.               v12 = Layer::nextRandom(this, 4);
  147.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(*((_QWORD *)this + v12 + 17)
  148.                                                                                                   + 136LL);
  149.             }
  150.             else
  151.             {
  152.               *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(VanillaBiomes::mRedwoodTaiga
  153.                                                                                                   + 136LL);
  154.             }
  155.             break;
  156.           case 4u:
  157.             v13 = Layer::nextRandom(this, 4);
  158.             *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(*((_QWORD *)this
  159.                                                                                                   + v13
  160.                                                                                                   + 21)
  161.                                                                                                 + 136LL);
  162.             break;
  163.           default:
  164.             *(_DWORD *)(*((_QWORD *)v31 + 1) + 4LL * (signed int)(v28 * v22 + v17)) = *(_DWORD *)(VanillaBiomes::mMushroomIsland
  165.                                                                                                 + 136LL);
  166.             break;
  167.         }
  168.       }
  169.       Range<int,1>::iterator::operator++(&v19);
  170.     }
  171.     Range<int,1>::iterator::operator++(&v24);
  172.   }
  173.   return LayerData::swap(v31);
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement