genworld_gui.c
changeset 4750 b125e18e9e29
parent 4729 7c727a2adaad
child 4909 955f318a24cd
equal deleted inserted replaced
4749:65a49cfc922d 4750:b125e18e9e29
    92 {     WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 130, 141, SPR_ARROW_UP,                 STR_SNOW_LINE_UP},
    92 {     WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 130, 141, SPR_ARROW_UP,                 STR_SNOW_LINE_UP},
    93 
    93 
    94 {      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 192, 203, STR_NULL,                     STR_NULL},
    94 {      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 192, 203, STR_NULL,                     STR_NULL},
    95 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 192, 203, STR_0225,                     STR_NULL}, // Tree placer
    95 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 192, 203, STR_0225,                     STR_NULL}, // Tree placer
    96 
    96 
    97 {      WWT_EMPTY, RESIZE_NONE, 12, 114, 231, 174, 185, STR_NULL,                     STR_NULL},
    97 {      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 174, 185, STR_NULL,                     STR_NULL},
    98 //{      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 174, 185, STR_NULL,                     STR_NULL},
    98 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 174, 185, STR_0225,                     STR_NULL}, // Landscape generator
    99 {      WWT_PANEL, RESIZE_NONE, 12, 114, 231, 174, 185, STR_NULL,                     STR_NULL},
    99 {      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 210, 221, STR_NULL,                     STR_NULL},
   100 //{    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 174, 185, STR_0225,                     STR_NULL}, // Landscape generator
   100 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 210, 221, STR_0225,                     STR_NULL}, // Terrain type
   101 //{      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 210, 221, STR_NULL,                     STR_NULL},
   101 {      WWT_PANEL, RESIZE_NONE, 12, 113, 219, 228, 239, STR_NULL,                     STR_NULL},
   102 {      WWT_PANEL, RESIZE_NONE, 12, 114, 231, 210, 221, STR_NULL,                     STR_NULL},
   102 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 228, 239, STR_0225,                     STR_NULL}, // Water quantity
   103 //{    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 210, 221, STR_0225,                     STR_NULL}, // Terrain type
       
   104 //{      WWT_PANEL, RESIZE_NONE, 12, 114, 219, 228, 239, STR_NULL,                     STR_NULL},
       
   105 {      WWT_PANEL, RESIZE_NONE, 12, 114, 231, 228, 239, STR_NULL,                     STR_NULL},
       
   106 //{    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 228, 239, STR_0225,                     STR_NULL}, // Water quantity
       
   107 {      WWT_PANEL, RESIZE_NONE, 12, 113, 219, 246, 257, STR_NULL,                     STR_NULL},
   103 {      WWT_PANEL, RESIZE_NONE, 12, 113, 219, 246, 257, STR_NULL,                     STR_NULL},
   108 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 246, 257, STR_0225,                     STR_NULL}, // Map smoothness
   104 {    WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 246, 257, STR_0225,                     STR_NULL}, // Map smoothness
   109 {   WIDGETS_END},
   105 {   WIDGETS_END},
   110 };
   106 };
   111 
   107 
   209 
   205 
   210 	switch (e->event) {
   206 	switch (e->event) {
   211 	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 3); break;
   207 	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 3); break;
   212 
   208 
   213 	case WE_PAINT:
   209 	case WE_PAINT:
   214 		/* TODO -- Above and below you see some lines commented out with '//' in
       
   215 		 *  front of it. This is because currently the widget system can't handle
       
   216 		 *  more than 32 widgets per window, and we need 34. Therefor we draw
       
   217 		 *  parts of the widgets manually below, reducing the number to 32.
       
   218 		 *  Of course someone is already hard working to replace the system with
       
   219 		 *  one that can scale past the 32 limit. When this is done you should
       
   220 		 *  re-enable the lines and remove the ones that came instead. Better,
       
   221 		 *  revert revision 5817 (from TGP branch), and you should be just fine.
       
   222 		 * If you have any questions about it, bug TrueLight.
       
   223 		 */
       
   224 
       
   225 		/* You can't select smoothness if not terragenesis */
   210 		/* You can't select smoothness if not terragenesis */
   226 //		if (_patches_newgame.land_generator == 0) w->disabled_state |= (1 << 32 | 1 << 33);
   211 		SetWindowWidgetDisabledState(w, 32, _patches_newgame.land_generator == 0);
   227 		SetWindowWidgetDisabledState(w, 30, _patches_newgame.land_generator == 0);
   212 		SetWindowWidgetDisabledState(w, 33, _patches_newgame.land_generator == 0);
   228 		SetWindowWidgetDisabledState(w, 31, _patches_newgame.land_generator == 0);
       
   229 		/* Disable snowline if not hilly */
   213 		/* Disable snowline if not hilly */
   230 		SetWindowWidgetDisabledState(w, 22, _opt_newgame.landscape != LT_HILLY);
   214 		SetWindowWidgetDisabledState(w, 22, _opt_newgame.landscape != LT_HILLY);
   231 		/* Disable town and industry in SE */
   215 		/* Disable town and industry in SE */
   232 		SetWindowWidgetDisabledState(w, 11, _game_mode == GM_EDITOR);
   216 		SetWindowWidgetDisabledState(w, 11, _game_mode == GM_EDITOR);
   233 		SetWindowWidgetDisabledState(w, 12, _game_mode == GM_EDITOR);
   217 		SetWindowWidgetDisabledState(w, 12, _game_mode == GM_EDITOR);
   274 		DrawString(182, 131 + y, STR_SNOW_LINE_HEIGHT, 0);
   258 		DrawString(182, 131 + y, STR_SNOW_LINE_HEIGHT, 0);
   275 		SetDParam(0, _patches_newgame.snow_line_height);
   259 		SetDParam(0, _patches_newgame.snow_line_height);
   276 		DrawStringCentered(303, 131 + y, STR_SNOW_LINE_HEIGHT_NUM, 0x10);
   260 		DrawStringCentered(303, 131 + y, STR_SNOW_LINE_HEIGHT_NUM, 0x10);
   277 
   261 
   278 		if (mode == GLWP_GENERATE) {
   262 		if (mode == GLWP_GENERATE) {
   279 			/* TODO -- Remove next 2 lines if 32 widget limit is removed */
       
   280 			DrawFrameRect(114, 174, 219, 185, 12, 0);
       
   281 			DrawString(222, 175, STR_0225, 0x10);
       
   282 			DrawString( 12, 175, STR_LAND_GENERATOR, 0);
   263 			DrawString( 12, 175, STR_LAND_GENERATOR, 0);
   283 			DrawString(118, 175, landscape[_patches_newgame.land_generator], 0x10);
   264 			DrawString(118, 175, landscape[_patches_newgame.land_generator], 0x10);
   284 
   265 
   285 			DrawString( 12, 193, STR_TREE_PLACER, 0);
   266 			DrawString( 12, 193, STR_TREE_PLACER, 0);
   286 			DrawString(118, 193, tree_placer[_patches_newgame.tree_placer], 0x10);
   267 			DrawString(118, 193, tree_placer[_patches_newgame.tree_placer], 0x10);
   287 
   268 
   288 			/* TODO -- Remove next 2 lines if 32 widget limit is removed */
       
   289 			DrawFrameRect(114, 210, 219, 221, 12, 0);
       
   290 			DrawString(222, 211, STR_0225, 0x10);
       
   291 			DrawString( 12, 211, STR_TERRAIN_TYPE, 0);
   269 			DrawString( 12, 211, STR_TERRAIN_TYPE, 0);
   292 			DrawString(118, 211, elevations[_opt_newgame.diff.terrain_type], 0x10);
   270 			DrawString(118, 211, elevations[_opt_newgame.diff.terrain_type], 0x10);
   293 
   271 
   294 			/* TODO -- Remove next 2 lines if 32 widget limit is removed */
       
   295 			DrawFrameRect(114, 228, 219, 239, 12, 0);
       
   296 			DrawString(222, 229, STR_0225, 0x10);
       
   297 			DrawString( 12, 229, STR_QUANTITY_OF_SEA_LAKES, 0);
   272 			DrawString( 12, 229, STR_QUANTITY_OF_SEA_LAKES, 0);
   298 			DrawString(118, 229, sea_lakes[_opt_newgame.diff.quantity_sea_lakes], 0x10);
   273 			DrawString(118, 229, sea_lakes[_opt_newgame.diff.quantity_sea_lakes], 0x10);
   299 
   274 
   300 			DrawString( 12, 247, STR_SMOOTHNESS, 0);
   275 			DrawString( 12, 247, STR_SMOOTHNESS, 0);
   301 			DrawString(118, 247, smoothness[_patches_newgame.tgen_smoothness], 0x10);
   276 			DrawString(118, 247, smoothness[_patches_newgame.tgen_smoothness], 0x10);
   314 
   289 
   315 			DrawString( 12,  91, STR_HEIGHTMAP_NAME, 0x10);
   290 			DrawString( 12,  91, STR_HEIGHTMAP_NAME, 0x10);
   316 			SetDParam(0, _heightmap_str);
   291 			SetDParam(0, _heightmap_str);
   317 			DrawStringTruncated(114,  91, STR_ORANGE, 0x10, 326 - 114 - GetStringBoundingBox(buffer).width - 5);
   292 			DrawStringTruncated(114,  91, STR_ORANGE, 0x10, 326 - 114 - GetStringBoundingBox(buffer).width - 5);
   318 
   293 
   319 			/* TODO -- Remove next 2 lines if 32 widget limit is removed */
       
   320 			DrawFrameRect(114, 196, 219, 207, 12, 0);
       
   321 			DrawString(222, 197, STR_0225, 0x10);
       
   322 			DrawString( 12, 197, STR_TREE_PLACER, 0);
   294 			DrawString( 12, 197, STR_TREE_PLACER, 0);
   323 			DrawString(118, 197, tree_placer[_patches_newgame.tree_placer], 0x10);
   295 			DrawString(118, 197, tree_placer[_patches_newgame.tree_placer], 0x10);
   324 
   296 
   325 			DrawString( 12, 215, STR_HEIGHTMAP_ROTATION, 0);
   297 			DrawString( 12, 215, STR_HEIGHTMAP_ROTATION, 0);
   326 			DrawString(118, 215, rotation[_patches_newgame.heightmap_rotation], 0x10);
   298 			DrawString(118, 215, rotation[_patches_newgame.heightmap_rotation], 0x10);
   392 			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, WC_GENERATE_LANDSCAPE, mode, CS_NUMERAL);
   364 			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, WC_GENERATE_LANDSCAPE, mode, CS_NUMERAL);
   393 			break;
   365 			break;
   394 		case 24: case 25: // Tree placer
   366 		case 24: case 25: // Tree placer
   395 			ShowDropDownMenu(w, tree_placer, _patches_newgame.tree_placer, 25, 0, 0);
   367 			ShowDropDownMenu(w, tree_placer, _patches_newgame.tree_placer, 25, 0, 0);
   396 			break;
   368 			break;
   397 //		case 26: case 27: // Landscape generator OR Heightmap rotation
   369 		case 26: case 27: // Landscape generator OR Heightmap rotation
   398 		case 27:
       
   399 			if (mode == GLWP_HEIGHTMAP) {
   370 			if (mode == GLWP_HEIGHTMAP) {
   400 				ShowDropDownMenu(w, rotation, _patches_newgame.heightmap_rotation, 27, 0, 0);
   371 				ShowDropDownMenu(w, rotation, _patches_newgame.heightmap_rotation, 27, 0, 0);
   401 			} else {
   372 			} else {
   402 				ShowDropDownMenu(w, landscape, _patches_newgame.land_generator, 27, 0, 0);
   373 				ShowDropDownMenu(w, landscape, _patches_newgame.land_generator, 27, 0, 0);
   403 			}
   374 			}
   404 			break;
   375 			break;
   405 //		case 28: case 29: // Terrain type
   376 		case 28: case 29: // Terrain type
   406 		case 28:
   377 			ShowDropDownMenu(w, elevations, _opt_newgame.diff.terrain_type, 29, 0, 0);
   407 //			ShowDropDownMenu(w, elevations, _opt_newgame.diff.terrain_type, 29, 0, 0);
   378 			break;
   408 			ShowDropDownMenu(w, elevations, _opt_newgame.diff.terrain_type, 28, 0, 0);
   379 		case 30: case 31: // Water quantity
   409 			break;
   380 			ShowDropDownMenu(w, sea_lakes, _opt_newgame.diff.quantity_sea_lakes, 31, 0, 0);
   410 //		case 30: case 31: // Water quantity
   381 			break;
   411 		case 29:
   382 		case 32: case 33: // Map smoothness
   412 //			ShowDropDownMenu(w, sea_lakes, _opt_newgame.diff.quantity_sea_lakes, 31, 0, 0);
   383 			ShowDropDownMenu(w, smoothness, _patches_newgame.tgen_smoothness, 33, 0, 0);
   413 			ShowDropDownMenu(w, sea_lakes, _opt_newgame.diff.quantity_sea_lakes, 29, 0, 0);
       
   414 			break;
       
   415 //		case 32: case 33: // Map smoothness
       
   416 		case 30: case 31:
       
   417 //			ShowDropDownMenu(w, smoothness, _patches_newgame.tgen_smoothness, 33, 0, 0);
       
   418 			ShowDropDownMenu(w, smoothness, _patches_newgame.tgen_smoothness, 31, 0, 0);
       
   419 			break;
   384 			break;
   420 		}
   385 		}
   421 		break;
   386 		break;
   422 
   387 
   423 	case WE_MESSAGE:
   388 	case WE_MESSAGE:
   461 					_patches_newgame.heightmap_rotation = e->we.dropdown.index;
   426 					_patches_newgame.heightmap_rotation = e->we.dropdown.index;
   462 				} else {
   427 				} else {
   463 					_patches_newgame.land_generator = e->we.dropdown.index;
   428 					_patches_newgame.land_generator = e->we.dropdown.index;
   464 				}
   429 				}
   465 				break;
   430 				break;
   466 //			case 29:
   431 			case 29:
   467 			case 28:
       
   468 				_opt_newgame.diff.terrain_type = e->we.dropdown.index;
   432 				_opt_newgame.diff.terrain_type = e->we.dropdown.index;
   469 				if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
   433 				if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
   470 				DoCommandP(0, 12, _opt_newgame.diff.terrain_type, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
   434 				DoCommandP(0, 12, _opt_newgame.diff.terrain_type, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
   471 				break;
   435 				break;
   472 //			case 31:
   436 			case 31:
   473 			case 29:
       
   474 				_opt_newgame.diff.quantity_sea_lakes = e->we.dropdown.index;
   437 				_opt_newgame.diff.quantity_sea_lakes = e->we.dropdown.index;
   475 				if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
   438 				if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
   476 				DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
   439 				DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
   477 				break;
   440 				break;
   478 //			case 33:
   441 			case 33:
   479 			case 31:
       
   480 				_patches_newgame.tgen_smoothness = e->we.dropdown.index;
   442 				_patches_newgame.tgen_smoothness = e->we.dropdown.index;
   481 				break;
   443 				break;
   482 		}
   444 		}
   483 		SetWindowDirty(w);
   445 		SetWindowDirty(w);
   484 		break;
   446 		break;