@@ -29,8 +29,6 @@ static void button_back(int param1, int param2);
29
29
static void button_start_mission (int param1, int param2);
30
30
static void inc_dec_difficulty (int param1, int param2);
31
31
32
- static const vec2i GOAL_OFFSET[] = {{32 , 90 }, {288 , 90 }, {32 , 112 }, {288 , 112 }, {32 , 134 }, {288 , 134 }};
33
-
34
32
struct mission_briefing : ui::widget {
35
33
struct {
36
34
image_button back = {0 , 0 , 31 , 20 , IB_NORMAL, GROUP_MESSAGE_ICON, 8 , button_back, button_none, 0 , 0 , 1 };
@@ -74,6 +72,29 @@ static void draw_background() {
74
72
75
73
g_mission_briefing[" title" ].text ((pcstr)msg->title .text );
76
74
g_mission_briefing[" subtitle" ].text ((pcstr)msg->subtitle .text );
75
+ g_mission_briefing[" difficulty_lable" ].text (ui::str (153 , g_settings.difficulty + 1 ));
76
+
77
+ const pcstr widgets[] = {" goal_0" , " goal_1" , " goal_2" , " goal_3" , " goal_4" , " goal_5" };
78
+ auto goal_label = widgets;
79
+
80
+ auto setup_goal = [&] (int group, int tid, bool enabled, int value) {
81
+ g_mission_briefing[*goal_label].enabled = enabled;
82
+ if (enabled) {
83
+ g_mission_briefing[*goal_label++].text_var (" %s: %u" , ui::str (group, tid), value);
84
+ }
85
+ };
86
+
87
+ setup_goal (62 , 11 , winning_population () > 0 , winning_population ());
88
+ setup_goal (29 , 20 + winning_houselevel (), winning_housing () > 0 , winning_housing ());
89
+ setup_goal (62 , 12 , winning_culture () > 0 , winning_culture ());
90
+ setup_goal (62 , 13 , winning_prosperity () > 0 , winning_prosperity ());
91
+ setup_goal (62 , 14 , winning_monuments () > 0 , winning_monuments ());
92
+ setup_goal (62 , 15 , winning_kingdom () > 0 , winning_kingdom ());
93
+
94
+ int immediate_goal_text = tutorial_get_immediate_goal_text ();
95
+ if (immediate_goal_text) {
96
+ g_mission_briefing[" goal_immediate" ].text (ui::str (62 , immediate_goal_text));
97
+ }
77
98
78
99
rich_text_set_fonts (FONT_NORMAL_WHITE_ON_DARK, FONT_NORMAL_YELLOW);
79
100
rich_text_init (msg->content .text , 64 , 200 , 31 , 14 , 0 );
@@ -90,66 +111,6 @@ static void draw_foreground(void) {
90
111
91
112
g_mission_briefing.draw ();
92
113
93
- lang_text_draw (62 , 10 , 48 , 104 , FONT_NORMAL_WHITE_ON_DARK);
94
- int goal_index = 0 ;
95
-
96
- if (winning_population ()) {
97
- vec2i offset = GOAL_OFFSET[goal_index];
98
- goal_index++;
99
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
100
- int width = lang_text_draw (62 , 11 , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
101
- text_draw_number (winning_population (), ' @' , " " , 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
102
- }
103
-
104
- if (winning_housing ()) {
105
- vec2i offset = GOAL_OFFSET[goal_index];
106
- goal_index++;
107
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
108
- int width = text_draw_number (winning_housing (), ' @' , " " , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
109
- lang_text_draw (29 , 20 + winning_houselevel (), 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
110
- }
111
-
112
- if (winning_culture ()) {
113
- vec2i offset = GOAL_OFFSET[goal_index];
114
- goal_index++;
115
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
116
- int width = lang_text_draw (62 , 12 , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
117
- text_draw_number (winning_culture (), ' @' , " " , 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
118
- }
119
-
120
- if (winning_prosperity ()) {
121
- vec2i offset = GOAL_OFFSET[goal_index];
122
- goal_index++;
123
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
124
- int width = lang_text_draw (62 , 13 , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
125
- text_draw_number (winning_prosperity (), ' @' , " " , 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
126
- }
127
-
128
- if (winning_monuments ()) {
129
- vec2i offset = GOAL_OFFSET[goal_index];
130
- goal_index++;
131
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
132
- int width = lang_text_draw (62 , 14 , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
133
- text_draw_number (winning_monuments (), ' @' , " " , 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
134
- }
135
-
136
- if (winning_kingdom ()) {
137
- vec2i offset = GOAL_OFFSET[goal_index];
138
- goal_index++;
139
- label_draw (16 + offset.x , 32 + offset.y , 15 , 1 );
140
- int width = lang_text_draw (62 , 15 , 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
141
- text_draw_number (winning_kingdom (), ' @' , " " , 16 + offset.x + 8 + width, 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
142
- }
143
- int immediate_goal_text = tutorial_get_immediate_goal_text ();
144
- if (immediate_goal_text) {
145
- vec2i offset = GOAL_OFFSET[4 ];
146
- label_draw (16 + offset.x , 32 + offset.y , 31 , 1 );
147
- lang_text_draw (62 , immediate_goal_text, 16 + offset.x + 8 , 32 + offset.y + 3 , FONT_NORMAL_YELLOW);
148
- }
149
-
150
- inner_panel_draw (32 , 200 , 33 , 14 );
151
- lang_text_draw (153 , g_settings.difficulty + 1 , 65 + 45 , 433 , FONT_NORMAL_BLACK_ON_LIGHT);
152
-
153
114
graphics_set_clip_rectangle (35 , 187 , 522 , 234 );
154
115
rich_text_draw (msg->content .text , 48 , 202 , 512 , 14 , 0 );
155
116
graphics_reset_clip_rectangle ();
0 commit comments