Files
@ r4381:c965d1f3016a
Branch filter:
Location: cpp/openttd-patchpack/source/intro_gui.c - annotation
r4381:c965d1f3016a
6.8 KiB
text/x-c
(svn r6131) -Codechange : Complete all missing _ttdpatch_flags entries
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r1891:c5c5466afa35 r507:b1b0a0a3c313 r2163:ae001e2aa5b0 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r543:efdb197f91ad r2159:2c706fe6b0a7 r3888:aa900cebaacd r4300:642b2431578b r4300:642b2431578b r0:d63b455452f6 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1711:a6b193ef1712 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1711:a6b193ef1712 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1618:4065e588d933 r0:d63b455452f6 r0:d63b455452f6 r543:efdb197f91ad r1093:18f56ef2d029 r543:efdb197f91ad r1794:15e23047f8c1 r1794:15e23047f8c1 r1794:15e23047f8c1 r1794:15e23047f8c1 r1794:15e23047f8c1 r1794:15e23047f8c1 r1711:a6b193ef1712 r1711:a6b193ef1712 r1711:a6b193ef1712 r0:d63b455452f6 r4300:642b2431578b r1500:e5979abe9361 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1711:a6b193ef1712 r4300:642b2431578b r0:d63b455452f6 r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r1620:a9a9ace3189c r105:9609297bc621 r2749:e781205c9f97 r4077:259c4c4aacad r172:1c41a7220acb r4077:259c4c4aacad r1620:a9a9ace3189c r2749:e781205c9f97 r1620:a9a9ace3189c r0:d63b455452f6 r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r129:8ef2815ca423 r0:d63b455452f6 r4308:7752673085fa r4308:7752673085fa r4308:7752673085fa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4300:642b2431578b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2725:4ee74e2f100e r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r0:d63b455452f6 r0:d63b455452f6 r4171:bf306290d87e r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r534:46e9db8de483 r867:c270355a1b34 r587:5b588feaf051 r810:08bcb4bf8186 r810:08bcb4bf8186 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r0:d63b455452f6 r0:d63b455452f6 r2631:d39f0cdd1c56 r161:0a970d887482 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r2631:d39f0cdd1c56 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2725:4ee74e2f100e r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r1618:4065e588d933 r0:d63b455452f6 r0:d63b455452f6 r4171:bf306290d87e r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r661:49162bef3179 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
#include "functions.h"
#include "window.h"
#include "gui.h"
#include "gfx.h"
#include "player.h"
#include "network.h"
#include "variables.h"
#include "settings.h"
#include "heightmap.h"
#include "genworld.h"
static const Widget _select_game_widgets[] = {
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 176, STR_NULL, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_PLAY_HEIGHTMAP, STR_PLAY_HEIGHTMAP_HINT},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 58, 69, STR_0220_CREATE_SCENARIO, STR_02FE_CREATE_A_CUSTOMIZED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 58, 69, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME},
{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 86, 77, 131, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 166, 77, 131, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 246, 77, 131, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 326, 77, 131, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 139, 150, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 139, 150, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 157, 168, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 157, 168, STR_0304_QUIT, STR_0305_QUIT_OPENTTD},
{ WIDGETS_END },
};
extern void HandleOnEditText(WindowEvent *e);
extern void HandleOnEditTextCancel(void);
static inline void SetNewLandscapeType(byte landscape)
{
_opt_newgame.landscape = landscape;
InvalidateWindowClasses(WC_SELECT_GAME);
}
static void SelectGameWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
w->click_state = (w->click_state & ~(0xF << 8)) | (1 << (_opt_newgame.landscape + 8));
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w);
break;
case WE_CLICK:
switch (e->click.widget) {
case 2: ShowGenerateLandscape(); break;
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
case 4: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
case 5: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
case 6: ShowCreateScenario(); break;
case 7:
#ifdef ENABLE_NETWORK
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
} else {
ShowNetworkGameWindow();
}
#else
ShowErrorMessage(INVALID_STRING_ID ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
#endif
break;
case 8: case 9: case 10: case 11:
SetNewLandscapeType(e->click.widget - 8);
break;
case 12: ShowGameOptions(); break;
case 13: ShowGameDifficulty(); break;
case 14: ShowPatchesSelection(); break;
case 15: AskExitGame(); break;
}
break;
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
case WE_ON_EDIT_TEXT_CANCEL: HandleOnEditTextCancel(); break;
}
}
static const WindowDesc _select_game_desc = {
WDP_CENTER, WDP_CENTER, 336, 177,
WC_SELECT_GAME,0,
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
_select_game_widgets,
SelectGameWndProc
};
void ShowSelectGameWindow(void)
{
AllocateWindowDesc(&_select_game_desc);
}
static const Widget _ask_abandon_game_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_00C7_QUIT, STR_NULL},
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
{ WIDGETS_END },
};
static void AskAbandonGameWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
DrawWindowWidgets(w);
#if defined(_WIN32)
SetDParam(0, STR_0133_WINDOWS);
#elif defined(__APPLE__)
SetDParam(0, STR_0135_OSX);
#elif defined(__BEOS__)
SetDParam(0, STR_OSNAME_BEOS);
#elif defined(__MORPHOS__)
SetDParam(0, STR_OSNAME_MORPHOS);
#elif defined(__AMIGA__)
SetDParam(0, STR_OSNAME_AMIGAOS);
#elif defined(__OS2__)
SetDParam(0, STR_OSNAME_OS2);
#else
SetDParam(0, STR_0134_UNIX);
#endif
DrawStringMultiCenter(90, 38, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178);
return;
case WE_CLICK:
switch (e->click.widget) {
case 3: DeleteWindow(w); break;
case 4: _exit_game = true; break;
}
break;
case WE_KEYPRESS: /* Exit game on pressing 'Enter' */
switch (e->keypress.keycode) {
case WKC_RETURN:
case WKC_NUM_ENTER:
_exit_game = true;
break;
}
break;
}
}
static const WindowDesc _ask_abandon_game_desc = {
WDP_CENTER, WDP_CENTER, 180, 92,
WC_ASK_ABANDON_GAME,0,
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
_ask_abandon_game_widgets,
AskAbandonGameWndProc
};
void AskExitGame(void)
{
AllocateWindowDescFront(&_ask_abandon_game_desc, 0);
}
static const Widget _ask_quit_game_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_0161_QUIT_GAME, STR_NULL},
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
{ WIDGETS_END },
};
static void AskQuitGameWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT:
DrawWindowWidgets(w);
DrawStringMultiCenter(
90, 38,
_game_mode != GM_EDITOR ?
STR_0160_ARE_YOU_SURE_YOU_WANT_TO : STR_029B_ARE_YOU_SURE_YOU_WANT_TO,
178
);
break;
case WE_CLICK:
switch (e->click.widget) {
case 3: DeleteWindow(w); break;
case 4: _switch_mode = SM_MENU; break;
}
break;
case WE_KEYPRESS: /* Return to main menu on pressing 'Enter' */
if (e->keypress.keycode == WKC_RETURN) _switch_mode = SM_MENU;
break;
}
}
static const WindowDesc _ask_quit_game_desc = {
WDP_CENTER, WDP_CENTER, 180, 92,
WC_QUIT_GAME,0,
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
_ask_quit_game_widgets,
AskQuitGameWndProc
};
void AskExitToGameMenu(void)
{
AllocateWindowDescFront(&_ask_quit_game_desc, 0);
}
|