openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: gfxinit.cpp 26217 2014-01-03 08:51:49Z rubidium $ */
/* $Id: gfxinit.cpp 26919 2014-09-25 16:04:02Z peter1138 $ */
/*
* This file is part of OpenTTD.
@@ -18,6 +18,7 @@
#include "transparency.h"
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
#include "window_func.h"
/* The type of set we're replacing */
#define SET_TYPE "graphics"
@@ -25,6 +26,8 @@
#include "table/sprites.h"
#include "safeguards.h"
/** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */
bool _palette_remap_grf[MAX_FILE_SLOTS];
@@ -236,16 +239,21 @@ static bool SwitchNewGRFBlitter()
/* Null driver => dedicated server => do nothing. */
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return false;
/* Get preferred depth. */
/* Get preferred depth.
* - depth_wanted_by_base: Depth required by the baseset, i.e. the majority of the sprites.
* - depth_wanted_by_grf: Depth required by some NewGRF.
* Both can force using a 32bpp blitter. depth_wanted_by_base is used to select
* between multiple 32bpp blitters, which perform differently with 8bpp sprites.
*/
uint depth_wanted_by_base = BaseGraphics::GetUsedSet()->blitter == BLT_32BPP ? 32 : 8;
uint depth_wanted_by_grf = 8;
uint depth_wanted_by_grf = _support8bpp == S8BPP_NONE ? 32 : 8;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND || HasBit(c->flags, GCF_INIT_ONLY)) continue;
if (c->palette & GRFP_BLT_32BPP) depth_wanted_by_grf = 32;
}
/* Search the best blitter. */
struct {
static const struct {
const char *name;
uint animation; ///< 0: no support, 1: do support, 2: both
uint min_base_depth, max_base_depth, min_grf_depth, max_grf_depth;
@@ -282,9 +290,9 @@ static bool SwitchNewGRFBlitter()
break;
}
if (!_video_driver->AfterBlitterChange()) {
if (!VideoDriver::GetInstance()->AfterBlitterChange()) {
/* Failed to switch blitter, let's hope we can return to the old one. */
if (BlitterFactory::SelectBlitter(cur_blitter) == NULL || !_video_driver->AfterBlitterChange()) usererror("Failed to reinitialize video driver. Specify a fixed blitter in the config");
if (BlitterFactory::SelectBlitter(cur_blitter) == NULL || !VideoDriver::GetInstance()->AfterBlitterChange()) usererror("Failed to reinitialize video driver. Specify a fixed blitter in the config");
}
return true;
@@ -297,6 +305,7 @@ void CheckBlitter()
ClearFontCache();
GfxClearSpriteCache();
ReInitAllWindows();
}
/** Initialise and load all the sprites. */