diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/base/base_parser.cpp | 21 | ||||
-rw-r--r-- | engines/wintermute/base/base_parser.h | 8 | ||||
-rw-r--r-- | engines/wintermute/base/font/base_font_truetype.cpp | 7 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 21 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_render_osystem.h | 2 | ||||
-rw-r--r-- | engines/wintermute/platform_osystem.h | 1 | ||||
-rw-r--r-- | engines/wintermute/utils/string_util.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/video/video_theora_player.cpp | 5 | ||||
-rw-r--r-- | engines/wintermute/wintermute.cpp | 31 |
9 files changed, 34 insertions, 72 deletions
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp index 5d5a2d534d..1b39b55768 100644 --- a/engines/wintermute/base/base_parser.cpp +++ b/engines/wintermute/base/base_parser.cpp @@ -64,7 +64,7 @@ char *BaseParser::getLastOffender() { //////////////////////////////////////////////////////////////////////
-int32 BaseParser::getObject(char **buf, TokenDesc *tokens, char **name, char **data) {
+int32 BaseParser::getObject(char **buf, const TokenDesc *tokens, char **name, char **data) {
skipCharacters(buf, _whiteSpace);
// skip comment lines.
@@ -119,7 +119,7 @@ int32 BaseParser::getObject(char **buf, TokenDesc *tokens, char **name, char **d //////////////////////////////////////////////////////////////////////
-int32 BaseParser::getCommand(char **buf, TokenDesc *tokens, char **params) {
+int32 BaseParser::getCommand(char **buf, const TokenDesc *tokens, char **params) {
if (!*buf) {
return PARSERR_TOKENNOTFOUND;
}
@@ -205,12 +205,10 @@ char *BaseParser::getAssignmentText(char **buf) { return result;
}
-
-//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
-char *BaseParser::getToken(char **buf) {
- static char token[100];
- char *b = *buf, * t = token;
+Common::String BaseParser::getToken(char **buf) {
+ char token[100]; // TODO: Remove static
+ char *b = *buf, *t = token;
while (true) {
while (*b && (*b == ' ' || *b == '\n' || *b == 13 || *b == 10 || *b == '\t')) {
b++;
@@ -265,7 +263,8 @@ char *BaseParser::getToken(char **buf) { //////////////////////////////////////////////////////////////////////
float BaseParser::getTokenFloat(char **buf) {
- char *t = getToken(buf);
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
if (!((*t >= '0' && *t <= '9') || *t == '-' || *t == '.')) {
// Error situation. We handle this by return 0.
return 0.;
@@ -277,7 +276,8 @@ float BaseParser::getTokenFloat(char **buf) { //////////////////////////////////////////////////////////////////////
int BaseParser::getTokenInt(char **buf) {
- char *t = getToken(buf);
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
if (!((*t >= '0' && *t <= '9') || *t == '-')) {
// Error situation. We handle this by return 0.
return 0;
@@ -289,7 +289,8 @@ int BaseParser::getTokenInt(char **buf) { //////////////////////////////////////////////////////////////////////
void BaseParser::skipToken(char **buf, char *tok, char * /*msg*/) {
- char *t = getToken(buf);
+ Common::String token = getToken(buf);
+ const char *t = token.c_str();
if (strcmp(t, tok)) {
return; // Error
}
diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h index 3b1979efa1..34266bd5bd 100644 --- a/engines/wintermute/base/base_parser.h +++ b/engines/wintermute/base/base_parser.h @@ -40,7 +40,7 @@ TOKEN_TOTAL_COUNT \
};
#define TOKEN_TABLE_START(name) \
- static BaseParser::TokenDesc name [] = \
+ static const BaseParser::TokenDesc name [] = \
{
#define TOKEN_TABLE(name) \
{ TOKEN_ ## name, #name },
@@ -65,7 +65,7 @@ public: public:
int scanStr(const char *in, const char *format, ...);
- int32 getCommand(char **buf, TokenDesc *tokens, char **params);
+ int32 getCommand(char **buf, const TokenDesc *tokens, char **params);
BaseParser();
virtual ~BaseParser();
private:
@@ -73,11 +73,11 @@ private: void skipToken(char **buf, char *tok, char *msg = NULL);
int getTokenInt(char **buf);
float getTokenFloat(char **buf);
- char *getToken(char **buf);
+ Common::String getToken(char **buf);
char *getAssignmentText(char **buf);
char *getSubText(char **buf, char open, char close);
void skipCharacters(char **buf, const char *toSkip);
- int32 getObject(char **buf, TokenDesc *tokens, char **name, char **data);
+ int32 getObject(char **buf, const TokenDesc *tokens, char **name, char **data);
int _parserLine;
char _lastOffender[255];
char *_whiteSpace;
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index a141c68db7..b80bbdc41d 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -568,12 +568,7 @@ bool BaseFontTT::initFont() { //////////////////////////////////////////////////////////////////////////
void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
//TextLineList lines;
- // TODO: This function gets called a lot, so warnings like these drown out the usefull information
- static bool hasWarned = false;
- if (!hasWarned) {
- hasWarned = true;
- warning("Todo: Test Mesuretext");
- }
+
if (maxWidth >= 0) {
Common::Array<Common::String> lines;
_font->wordWrapText(text, maxWidth, lines);
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index f407a871b0..fa0663dc65 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -105,7 +105,6 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { setAlphaMod(255);
setColorMod(255, 255, 255);
_dirtyRect = NULL;
- _disableDirtyRects = true;
}
//////////////////////////////////////////////////////////////////////////
@@ -232,12 +231,10 @@ void BaseRenderOSystem::fade(uint16 alpha) { void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) {
// This particular warning is rather messy, as this function is called a ton,
// thus we avoid printing it more than once.
- static bool hasWarned = false;
- if (!hasWarned) {
- if (!_disableDirtyRects) {
- warning("BaseRenderOSystem::FadeToColor - Breaks when using dirty rects");
- }
- hasWarned = true;
+
+ // TODO: Add fading with dirty rects.
+ if (!_disableDirtyRects) {
+ warning("BaseRenderOSystem::FadeToColor - Breaks when using dirty rects");
}
Common::Rect fillRect;
@@ -461,13 +458,11 @@ void BaseRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::R //////////////////////////////////////////////////////////////////////////
bool BaseRenderOSystem::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
- static bool hasWarned = false;
- if (!hasWarned) {
- if (!_disableDirtyRects) {
- warning("BaseRenderOSystem::DrawLine - doesn't work for dirty rects yet");
- }
- hasWarned = true;
+
+ if (!_disableDirtyRects) {
+ warning("BaseRenderOSystem::DrawLine - doesn't work for dirty rects yet");
}
+
byte r = RGBCOLGetR(color);
byte g = RGBCOLGetG(color);
byte b = RGBCOLGetB(color);
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index dfffc68c17..2b6b5943c2 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -115,7 +115,7 @@ private: int _borderRight;
int _borderBottom;
- bool _disableDirtyRects;
+ static const bool _disableDirtyRects = true;
float _ratioX;
float _ratioY;
uint32 _colorMod;
diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h index 53462724bd..ffc9933635 100644 --- a/engines/wintermute/platform_osystem.h +++ b/engines/wintermute/platform_osystem.h @@ -64,6 +64,7 @@ public: static char *strlwr(char *string);
private:
+ // Set by initialize on game-startup, the object referred to is also deleted by deinit in WinterMuteEngine
static BaseGame *_gameRef;
};
diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index b51d094784..ed1d2094d2 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -162,11 +162,6 @@ char simpleAnsiToWide(const AnsiString &str, uint32 &offset) { //////////////////////////////////////////////////////////////////////////
WideString StringUtil::ansiToWide(const AnsiString &str) {
// TODO: This function gets called a lot, so warnings like these drown out the usefull information
- static bool hasWarned = false;
- if (!hasWarned) {
- hasWarned = true;
- warning("StringUtil::AnsiToWide - WideString not supported yet");
- }
/*Common::String converted = "";
uint32 index = 0;
while (index != str.size()) {
@@ -188,11 +183,6 @@ WideString StringUtil::ansiToWide(const AnsiString &str) { AnsiString StringUtil::wideToAnsi(const WideString &wstr) {
// using default os locale!
// TODO: This function gets called a lot, so warnings like these drown out the usefull information
- static bool hasWarned = false;
- if (!hasWarned) {
- hasWarned = true;
- warning("StringUtil::WideToAnsi - WideString not supported yet");
- }
/* setlocale(LC_CTYPE, "");
size_t wideSize = wcstombs(NULL, wstr.c_str(), 0) + 1;
char *str = new char[WideSize];
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index ad99e24534..49ce333b63 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -36,6 +36,7 @@ #include "engines/wintermute/utils/utils.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/video/decoders/theora_decoder.h" +#include "engines/wintermute/wintermute.h" #include "common/system.h" namespace WinterMute { @@ -264,10 +265,10 @@ bool VideoTheoraPlayer::update() { if (_theoraDecoder) { if (_theoraDecoder->endOfVideo() && _looping) { - warning("Should loop movie"); + warning("Should loop movie %s", _filename.c_str()); _theoraDecoder->rewind(); } else if (_theoraDecoder->endOfVideo() && !_looping) { - warning("Finished movie"); + debugC(kWinterMuteDebugLog, "Finished movie %s", _filename.c_str()); _state = THEORA_STATE_FINISHED; _playbackStarted = false; if (_freezeGame) { diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 2782ecd2c3..68a9dd6e13 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -77,7 +77,6 @@ WinterMuteEngine::WinterMuteEngine(OSystem *syst, const ADGameDescription *desc) // Don't forget to register your random source _rnd = new Common::RandomSource("WinterMute"); - debug("WinterMuteEngine::WinterMuteEngine"); _game = NULL; g_wintermute = this; @@ -85,8 +84,6 @@ WinterMuteEngine::WinterMuteEngine(OSystem *syst, const ADGameDescription *desc) } WinterMuteEngine::~WinterMuteEngine() { - debug("WinterMuteEngine::~WinterMuteEngine"); - // Dispose your resources here deinit(); delete _rnd; @@ -114,39 +111,21 @@ Common::Error WinterMuteEngine::run() { if (g_system->getScreenFormat() != format) { error("Wintermute currently REQUIRES 32bpp"); } - // You could use backend transactions directly as an alternative, - // but it isn't recommended, until you want to handle the error values - // from OSystem::endGFXTransaction yourself. - // This is just an example template: - //_system->beginGFXTransaction(); - // // This setup the graphics mode according to users seetings - // initCommonGFX(false); - // - // // Specify dimensions of game graphics window. - // // In this example: 320x200 - // _system->initSize(320, 200); - //FIXME: You really want to handle - //OSystem::kTransactionSizeChangeFailed here - //_system->endGFXTransaction(); // Create debugger console. It requires GFX to be initialized _console = new Console(this); - // Additional setup. - debug("WinterMuteEngine::init"); - - // Your main even loop should be (invoked from) here. - debug("WinterMuteEngine::go: Hello, World!"); - - DebugMan.enableDebugChannel("enginelog"); - // This test will show up if -d1 and --debugflags=example are specified on the commandline +// DebugMan.enableDebugChannel("enginelog"); debugC(1, kWinterMuteDebugLog, "Engine Debug-LOG enabled"); debugC(2, kWinterMuteDebugSaveGame , "Savegame debugging-enabled"); int ret = 1; + // Additional setup. + debugC(kWinterMuteDebugLog, "WinterMuteEngine::init"); ret = init(); - + + debugC(kWinterMuteDebugLog, "WinterMuteEngine::messageLoop"); if (ret == 0) { ret = messageLoop(); } |