forked from razterizer/DungGine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RoomStyle.h
121 lines (111 loc) · 3.15 KB
/
RoomStyle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
// RoomStyle.h
// DungGine
//
// Created by Rasmus Anthin on 2024-06-21.
//
#pragma once
#include "SolarMotionPatterns.h"
#include "DungGineStyles.h"
namespace dung
{
using WallType = drawing::OutlineType; //{ Hash, Masonry, Masonry1, Masonry2, Masonry3, Temple };
using SolarDirection = drawing::SolarDirection;
using Style = styles::Style;
using HiliteSelectFGStyle = styles::HiliteSelectFGStyle;
enum class FloorType { None, Sand, Grass, Stone, Stone2, Water, Wood, NUM_ITEMS };
struct RoomStyle
{
WallType wall_type = WallType::Hash;
Style wall_style { Color::DarkGray, Color::LightGray };
FloorType floor_type = FloorType::None;
bool is_underground = true;
RC tex_pos;
Latitude latitude = Latitude::NorthernHemisphere;
Longitude longitude = Longitude::F;
void init_rand()
{
wall_type = rnd::rand_enum<WallType>();
WallBasicType wall_basic_type = WallBasicType::Other;
switch (wall_type)
{
case WallType::Masonry:
case WallType::Masonry2:
case WallType::Masonry3:
case WallType::Masonry4:
wall_basic_type = WallBasicType::Masonry;
break;
case WallType::Temple:
wall_basic_type = WallBasicType::Temple;
break;
case WallType::Line:
case WallType::Hash:
default:
wall_basic_type = WallBasicType::Other;
break;
}
wall_style = styles::get_random_style(wall_palette[wall_basic_type]);
do
{
floor_type = rnd::rand_enum<FloorType>();
} while (floor_type == FloorType::None);
is_underground = rnd::rand_bool();
}
char get_fill_char() const
{
switch (floor_type)
{
case FloorType::Sand:
return ':';
case FloorType::Grass:
return '|';
case FloorType::Stone:
return 'H';
case FloorType::Stone2:
return '8';
case FloorType::Water:
return '~';
case FloorType::Wood:
return 'W';
case FloorType::None:
default:
return ' ';
break;
}
}
char get_shadow_char() const
{
return get_fill_char();
}
Style get_fill_style() const
{
Style style;
switch (floor_type)
{
case FloorType::Sand:
style = styles::make_shaded_style(Color::Yellow, color::ShadeType::Bright);
break;
case FloorType::Grass:
style = styles::make_shaded_style(Color::Green, color::ShadeType::Bright);
break;
case FloorType::Stone:
case FloorType::Stone2:
style = styles::make_shaded_style(Color::LightGray, color::ShadeType::Bright);
break;
case FloorType::Water:
style = styles::make_shaded_style(Color::Blue, color::ShadeType::Bright);
break;
case FloorType::Wood:
style = { Color::DarkRed, Color::Yellow };
break;
case FloorType::None:
default:
style = { Color::DarkGray, Color::LightGray };
break;
}
if (is_underground)
style.swap();
return style;
}
};
}