Rev 116 | Rev 130 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 116 | Rev 124 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | scene->object_count = 3; |
45 | scene->object_count = 3; |
46 | 46 | ||
47 | // reset the camera position for a cool slide-in effect, but only if autorotate is enabled |
47 | // reset the camera position for a cool slide-in effect, but only if autorotate is enabled |
48 | if (options.want_autorotateon1vs1) |
48 | if (options.want_autorotateon1vs1) |
49 | { |
49 | { |
50 | current_pitch = |
50 | current_pitch = CLOSEUP_VIEW_PITCH; // autorotate is enabled, prepare for slide-in effect |
51 | current_yaw = (Board_ColorToMove (board) == COLOR_WHITE ? 90.0f : -90.0f); |
51 | current_yaw = (Board_ColorToMove (board) == COLOR_WHITE ? 90.0f : -90.0f); |
52 | current_distance = |
52 | current_distance = CLOSEUP_VIEW_DISTANCE; |
- | 53 | if (current_distance >= MIN_VIEW_DISTANCE) |
|
- | 54 | current_distance = MIN_VIEW_DISTANCE - 1.0f; // consistency check for stupid programmers |
|
53 | } |
55 | } |
54 | else |
56 | else |
55 | { |
57 | { |
56 | current_pitch = 55.0f; // no autorotate, reset to standard view position directly |
58 | current_pitch = 55.0f; // no autorotate, reset to standard view position directly |
57 | current_yaw = (Board_ColorToMove (board) == COLOR_BLACK ? 90.0f : -90.0f); |
59 | current_yaw = (Board_ColorToMove (board) == COLOR_BLACK ? 90.0f : -90.0f); |
58 | current_distance = 70.0f; |
60 | current_distance = 70.0f; |
- | 61 | if (current_distance < MIN_VIEW_DISTANCE) |
|
- | 62 | current_distance = MIN_VIEW_DISTANCE; // consistency check for stupid programmers |
|
59 | } |
63 | } |
60 | 64 | ||
61 | // HACK to prevent the player to click and block the view angles while the slide-in is not finished |
65 | // HACK to prevent the player to click and block the view angles while the slide-in is not finished |
62 | command_ignoretime = current_time + 2.0f; // allow 2 seconds |
66 | command_ignoretime = current_time + 2.0f; // allow 2 seconds |
63 | 67 | ||
Line 71... | Line 75... | ||
71 | 75 | ||
72 | // completely reset the whole GUI structure so as to NULL out all pointers |
76 | // completely reset the whole GUI structure so as to NULL out all pointers |
73 | memset (&scene->gui, 0, sizeof (scene->gui)); |
77 | memset (&scene->gui, 0, sizeof (scene->gui)); |
74 | 78 | ||
75 | // set the buttons locations |
79 | // set the buttons locations |
76 | Scene_SetButton (&scene->gui.larrow, 0.3f, 0.5f, 3.0f, 4.0f, |
80 | Scene_SetButton (&scene->gui.larrow, 0.3f, 0.5f, 3.0f, 4.0f, larrow_spriteindex, NULL); |
77 | Scene_SetButton (&scene->gui.rarrow, 3.3f, 0.5f, 3.0f, 4.0f, |
81 | Scene_SetButton (&scene->gui.rarrow, 3.3f, 0.5f, 3.0f, 4.0f, rarrow_spriteindex, NULL); |
- | 82 | Scene_SetButton (&scene->gui.newgamebutton, 20.0f, 65.0f, 20.0f, 26.0f, newgamebutton_spriteindex, L"\n\n\n\n\n\n\n%s", LOCALIZE (L"NewGame")); |
|
- | 83 | Scene_SetButton (&scene->gui.opengamebutton, 60.0f, 65.0f, 20.0f, 26.0f, opengamebutton_spriteindex, L"\n\n\n\n\n\n\n%s", LOCALIZE (L"OpenGame")); |
|
78 | Scene_SetButton (&scene->gui.chatbutton, 1.0f, 10.0f, 10.0f, 13.0f, |
84 | Scene_SetButton (&scene->gui.chatbutton, 1.0f, 10.0f, 10.0f, 13.0f, chatbutton_spriteindex, NULL); |
79 | Scene_SetButton (&scene->gui.gamesbutton, 1.0f, 35.0f, 10.0f, 13.0f, |
85 | Scene_SetButton (&scene->gui.gamesbutton, 1.0f, 35.0f, 10.0f, 13.0f, gamesbutton_spriteindex, NULL); |
80 | Scene_SetButton (&scene->gui.peoplebutton, 1.0f, 60.0f, 10.0f, 13.0f, |
86 | Scene_SetButton (&scene->gui.peoplebutton, 1.0f, 60.0f, 10.0f, 13.0f, peoplebutton_spriteindex, NULL); |
81 | 87 | ||
82 | // remember to update the scene |
88 | // remember to update the scene |
83 | scene->update = true; |
89 | scene->update = true; |
84 | 90 | ||
85 | return; // finished |
91 | return; // finished |
Line 1167... | Line 1173... | ||
1167 | 1173 | ||
1168 | return; // finished, announcement text is set |
1174 | return; // finished, announcement text is set |
1169 | } |
1175 | } |
1170 | 1176 | ||
1171 | 1177 | ||
1172 | void Scene_SetButton (guibutton_t *button, float left, float top, float width, float height, int |
1178 | void Scene_SetButton (guibutton_t *button, float left, float top, float width, float height, int sprite_index, wchar_t *fmt, ...) |
1173 | { |
1179 | { |
1174 | // helper function to set up a GUI button |
1180 | // helper function to set up a GUI button |
- | 1181 | ||
- | 1182 | va_list argptr; |
|
1175 | 1183 | ||
1176 | button->left = left; |
1184 | button->left = left; |
1177 | button->top = top; |
1185 | button->top = top; |
1178 | button->width = width; |
1186 | button->width = width; |
1179 | button->height = height; |
1187 | button->height = height; |
1180 | button->sprite_index = sprite_index; |
1188 | button->sprite_index = sprite_index; |
- | 1189 | ||
- | 1190 | // concatenate all the arguments in one string |
|
- | 1191 | if (fmt != NULL) |
|
- | 1192 | { |
|
- | 1193 | va_start (argptr, fmt); |
|
- | 1194 | _vsnwprintf_s (button->text, WCHAR_SIZEOF (button->text), _TRUNCATE, fmt, argptr); |
|
- | 1195 | va_end (argptr); |
|
- | 1196 | } |
|
- | 1197 | else |
|
- | 1198 | button->text[0] = 0; // (unless no text is specified for this button) |
|
1181 | 1199 | ||
1182 | return; // finished, button is set |
1200 | return; // finished, button is set |
1183 | } |
1201 | } |
1184 | 1202 | ||
1185 | 1203 |