src/main_gui.cpp
changeset 5919 2b58160d667d
parent 5852 cb3f71b16e1a
child 5923 8fd520e817ed
equal deleted inserted replaced
5918:602e158900a2 5919:2b58160d667d
   116 	if (IsWindowWidgetLowered(w, widget)) {
   116 	if (IsWindowWidgetLowered(w, widget)) {
   117 		ResetObjectToPlace();
   117 		ResetObjectToPlace();
   118 		return false;
   118 		return false;
   119 	}
   119 	}
   120 
   120 
   121 	SetObjectToPlace(cursor, mode, w->window_class, w->window_number);
   121 	SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number);
   122 	LowerWindowWidget(w, widget);
   122 	LowerWindowWidget(w, widget);
   123 	_place_proc = placeproc;
   123 	_place_proc = placeproc;
   124 	return true;
   124 	return true;
   125 }
   125 }
   126 
   126 
   338 static void SelectSignTool(void)
   338 static void SelectSignTool(void)
   339 {
   339 {
   340 	if (_cursor.sprite == SPR_CURSOR_SIGN) {
   340 	if (_cursor.sprite == SPR_CURSOR_SIGN) {
   341 		ResetObjectToPlace();
   341 		ResetObjectToPlace();
   342 	} else {
   342 	} else {
   343 		SetObjectToPlace(SPR_CURSOR_SIGN, 1, 1, 0);
   343 		SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, 1, 1, 0);
   344 		_place_proc = PlaceProc_Sign;
   344 		_place_proc = PlaceProc_Sign;
   345 	}
   345 	}
   346 }
   346 }
   347 
   347 
   348 static void MenuClickForest(int index)
   348 static void MenuClickForest(int index)
  1254 			int n = _terraform_size * _terraform_size;
  1254 			int n = _terraform_size * _terraform_size;
  1255 			const int8 *coords = &_multi_terraform_coords[0][0];
  1255 			const int8 *coords = &_multi_terraform_coords[0][0];
  1256 
  1256 
  1257 			assert(n != 0);
  1257 			assert(n != 0);
  1258 			do {
  1258 			do {
  1259 				DrawSprite(SPR_WHITE_POINT, 77 + coords[0], 55 + coords[1]);
  1259 				DrawSprite(SPR_WHITE_POINT, PAL_NONE, 77 + coords[0], 55 + coords[1]);
  1260 				coords += 2;
  1260 				coords += 2;
  1261 			} while (--n);
  1261 			} while (--n);
  1262 		}
  1262 		}
  1263 
  1263 
  1264 		if (IsWindowWidgetLowered(w, 5) || IsWindowWidgetLowered(w, 6)) // change area-size if raise/lower corner is selected
  1264 		if (IsWindowWidgetLowered(w, 5) || IsWindowWidgetLowered(w, 6)) // change area-size if raise/lower corner is selected
  1769 {
  1769 {
  1770 	switch (e->event) {
  1770 	switch (e->event) {
  1771 	case WE_PAINT:
  1771 	case WE_PAINT:
  1772 		// Draw brown-red toolbar bg.
  1772 		// Draw brown-red toolbar bg.
  1773 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1773 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1774 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT);
  1774 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
  1775 
  1775 
  1776 		/* If spectator, disable all construction buttons
  1776 		/* If spectator, disable all construction buttons
  1777 		 * ie : Build road, rail, ships, airports and landscaping
  1777 		 * ie : Build road, rail, ships, airports and landscaping
  1778 		 * Since enabled state is the default, just disable when needed */
  1778 		 * Since enabled state is the default, just disable when needed */
  1779 		SetWindowWidgetsDisabledState(w, _current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END);
  1779 		SetWindowWidgetsDisabledState(w, _current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END);
  1982 		SetWindowWidgetDisabledState(w, 6, _patches_newgame.starting_year <= MIN_YEAR);
  1982 		SetWindowWidgetDisabledState(w, 6, _patches_newgame.starting_year <= MIN_YEAR);
  1983 		SetWindowWidgetDisabledState(w, 7, _patches_newgame.starting_year >= MAX_YEAR);
  1983 		SetWindowWidgetDisabledState(w, 7, _patches_newgame.starting_year >= MAX_YEAR);
  1984 
  1984 
  1985 		// Draw brown-red toolbar bg.
  1985 		// Draw brown-red toolbar bg.
  1986 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1986 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB2);
  1987 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | PALETTE_MODIFIER_GREYOUT);
  1987 		GfxFillRect(0, 0, w->width-1, w->height-1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT));
  1988 
  1988 
  1989 		DrawWindowWidgets(w);
  1989 		DrawWindowWidgets(w);
  1990 
  1990 
  1991 		SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
  1991 		SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
  1992 		DrawStringCentered(298, 6, STR_00AF, 0);
  1992 		DrawStringCentered(298, 6, STR_00AF, 0);
  2143 				SetDParam(1, p->name_2);
  2143 				SetDParam(1, p->name_2);
  2144 				DrawStringCentered(320, 1, STR_02BA, 0);
  2144 				DrawStringCentered(320, 1, STR_02BA, 0);
  2145 			}
  2145 			}
  2146 		}
  2146 		}
  2147 
  2147 
  2148 		if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT | PALETTE_TO_RED, 489, 2);
  2148 		if (WP(w, def_d).data_2 > 0) DrawSprite(SPR_BLOT, PALETTE_TO_RED, 489, 2);
  2149 	} break;
  2149 	} break;
  2150 
  2150 
  2151 	case WE_MESSAGE:
  2151 	case WE_MESSAGE:
  2152 		w->message.msg = e->we.message.msg;
  2152 		w->message.msg = e->we.message.msg;
  2153 		SetWindowDirty(w);
  2153 		SetWindowDirty(w);
  2206 	case WE_PAINT:
  2206 	case WE_PAINT:
  2207 		DrawWindowViewport(w);
  2207 		DrawWindowViewport(w);
  2208 		if (_game_mode == GM_MENU) {
  2208 		if (_game_mode == GM_MENU) {
  2209 			off_x = _screen.width / 2;
  2209 			off_x = _screen.width / 2;
  2210 
  2210 
  2211 			DrawSprite(SPR_OTTD_O, off_x - 120, 50);
  2211 			DrawSprite(SPR_OTTD_O, PAL_NONE, off_x - 120, 50);
  2212 			DrawSprite(SPR_OTTD_P, off_x -  86, 50);
  2212 			DrawSprite(SPR_OTTD_P, PAL_NONE, off_x -  86, 50);
  2213 			DrawSprite(SPR_OTTD_E, off_x -  53, 50);
  2213 			DrawSprite(SPR_OTTD_E, PAL_NONE, off_x -  53, 50);
  2214 			DrawSprite(SPR_OTTD_N, off_x -  22, 50);
  2214 			DrawSprite(SPR_OTTD_N, PAL_NONE, off_x -  22, 50);
  2215 
  2215 
  2216 			DrawSprite(SPR_OTTD_T, off_x +  34, 50);
  2216 			DrawSprite(SPR_OTTD_T, PAL_NONE, off_x +  34, 50);
  2217 			DrawSprite(SPR_OTTD_T, off_x +  65, 50);
  2217 			DrawSprite(SPR_OTTD_T, PAL_NONE, off_x +  65, 50);
  2218 			DrawSprite(SPR_OTTD_D, off_x +  96, 50);
  2218 			DrawSprite(SPR_OTTD_D, PAL_NONE, off_x +  96, 50);
  2219 
  2219 
  2220 			/*
  2220 			/*
  2221 			DrawSprite(SPR_OTTD_R, off_x + 119, 50);
  2221 			DrawSprite(SPR_OTTD_R, off_x + 119, 50);
  2222 			DrawSprite(SPR_OTTD_A, off_x + 148, 50);
  2222 			DrawSprite(SPR_OTTD_A, off_x + 148, 50);
  2223 			DrawSprite(SPR_OTTD_N, off_x + 181, 50);
  2223 			DrawSprite(SPR_OTTD_N, off_x + 181, 50);
  2432 	/* Clean old GUI values */
  2432 	/* Clean old GUI values */
  2433 	_last_built_railtype = RAILTYPE_RAIL;
  2433 	_last_built_railtype = RAILTYPE_RAIL;
  2434 }
  2434 }
  2435 
  2435 
  2436 
  2436 
       
  2437