2013/01/20
■ [変愚蛮怒/スポイラー]build_type11()の部屋生成プロセス(変愚蛮怒 Ver2.1.1)
- 生成階 <= 1d15かつダンジョンにDARKNESSフラグがないなら、部屋全体を最初から明るくする。
- 半径を1d9-1で指定して、縦横共に半径*2+1マスの生成可能な空きフロアを探す。なければ生成キャンセル。
- 確保したフロアを全て走査して、distance()関数で得られる中央からの距離<=rad-1なら、床地形で埋める。
- そうでなくdistance()関数で得られる中央からの距離<=rad+1なら、外壁地形で埋める。
■ [変愚蛮怒/スポイラー]build_type12()の部屋生成プロセス(変愚蛮怒 Ver2.1.1)
- 地形生成のランダム要素として以下の値を乱数で振る。
- h1 = 1d32 - 16
- h2 = 1d16
- h3 = 1d32
- h4 = 1d32 - 16
- 生成階 <= 1d5かつダンジョンにDARKNESSフラグがないなら、部屋全体を最初から明るくする。
- 半径を1d9で指定して、縦横共に半径*2+3マスの生成可能な空きフロアを探す。なければ生成キャンセル。
- build_type10()と同じく、距離に応じて、確保した全フロアで床と外壁を指定するのだが、この場合h1~h4の歪みにより"誤った"答えを与えるdist2()関数により、独特の曲面を形成させる。そのままソースコードを引用すると以下の通り。
/* * Hacked distance formula - gives the 'wrong' answer. * Used to build crypts */ static int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4) { int dx, dy; dx = abs(x2 - x1); dy = abs(y2 - y1); /* Basically this works by taking the normal pythagorean formula * and using an expansion to express this in a way without the * square root. This approximate formula is then perturbed to give * the distorted results. (I found this by making a mistake when I was * trying to fix the circular rooms.) */ /* h1-h4 are constants that describe the metric */ if (dx >= 2 * dy) return (dx + (dy * h1) / h2); if (dy >= 2 * dx) return (dy + (dx * h1) / h2); return (((dx + dy) * 128) / 181 + (dx * dx / (dy * h3) + dy * dy / (dx * h3)) * h4); /* 128/181 is approx. 1/sqrt(2) */ }
- dist2() <= 半径-1か、半径3以内の地形を床、そうでなければ外壁地形で埋める。
- 以上によりにいかにも聖堂らしい、対称系の独特の形状が形成される。
- 中央の縦横5マスが床地形でなければ、この時点で生成を終了する。
- 1/2の確率で中央に1マスの極小の部屋を生成。
- 中央に通常生成のアイテムを一つ置く。
- 中央を中心に2+1d2のモンスターを配置。
- 中央を中心に1+1d3のトラップを配置。