diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/bundle.cpp | 18 | ||||
-rw-r--r-- | scumm/smush/blitter.cpp | 38 | ||||
-rw-r--r-- | scumm/smush/frenderer.cpp | 8 | ||||
-rw-r--r-- | scumm/smush/imuse_channel.cpp | 3 | ||||
-rw-r--r-- | scumm/smush/player.cpp | 7 | ||||
-rw-r--r-- | scumm/smush/saud_channel.cpp | 3 | ||||
-rw-r--r-- | scumm/smush/scumm_renderer.h | 4 |
7 files changed, 32 insertions, 49 deletions
diff --git a/scumm/bundle.cpp b/scumm/bundle.cpp index 14486838b5..9e5f9b4acd 100644 --- a/scumm/bundle.cpp +++ b/scumm/bundle.cpp @@ -50,7 +50,7 @@ bool Bundle::openVoiceFile(char *filename) _voiceFile = fopen(filename, "rb"); if (_voiceFile == NULL) { - printf("Bundle: Can't open voice bundle file: %s\n", filename); + warning("Bundle: Can't open voice bundle file: %s", filename); return false; } @@ -93,7 +93,7 @@ bool Bundle::openMusicFile(char *filename) _musicFile = fopen(filename, "rb"); if (_musicFile == NULL) { - printf("Bundle: Can't open music bundle file: %s\n", filename); + warning("Bundle: Can't open music bundle file: %s", filename); return false; } @@ -132,7 +132,7 @@ int32 Bundle::decompressVoiceSampleByIndex(int32 index, byte *comp_final) byte *comp_input, *comp_output; if (_voiceFile == NULL) { - printf("Bundle: voice file is not open !\n"); + warning("Bundle: voice file is not open!"); return 0; } @@ -182,7 +182,7 @@ int32 Bundle::decompressMusicSampleByIndex(int32 index, int32 number, byte *comp byte *comp_input; if (_musicFile == NULL) { - printf("Bundle: music file is not open !\n"); + warning("Bundle: music file is not open!"); return 0; } @@ -228,7 +228,7 @@ int32 Bundle::decompressVoiceSampleByName(char *name, byte *comp_final) int32 final_size = 0, i; if (_voiceFile == NULL) { - printf("Bundle: voice file is not open !\n"); + warning("Bundle: voice file is not open!"); return 0; } @@ -246,7 +246,7 @@ int32 Bundle::decompressMusicSampleByName(char *name, int32 number, byte *comp_f int32 final_size = 0, i; if (_voiceFile == NULL) { - printf("Bundle: voice file is not open !\n"); + warning("Bundle: voice file is not open!"); return 0; } @@ -262,7 +262,7 @@ int32 Bundle::decompressMusicSampleByName(char *name, int32 number, byte *comp_f int32 Bundle::getNumberOfMusicSamplesByIndex(int32 index) { if (_musicFile == NULL) { - printf("Bundle: music file is not open !\n"); + warning("Bundle: music file is not open!"); return 0; } @@ -276,7 +276,7 @@ int32 Bundle::getNumberOfMusicSamplesByName(char *name) int32 number = 0, i; if (_musicFile == NULL) { - printf("Bundle: music file is not open !\n"); + warning("Bundle: music file is not open!"); return 0; } @@ -651,7 +651,7 @@ int32 Bundle::decompressCodec(int32 codec, byte *comp_input, byte *comp_output, break; default: - printf("Bundle: Unknown codec %d!\n", (int)codec); + warning("Bundle: Unknown codec %d!", (int)codec); output_size = 0; break; } diff --git a/scumm/smush/blitter.cpp b/scumm/smush/blitter.cpp index a209ceb852..d760919869 100644 --- a/scumm/smush/blitter.cpp +++ b/scumm/smush/blitter.cpp @@ -19,17 +19,14 @@ * */ -#include <stdafx.h> +#include "stdafx.h" +#include "common/util.h" #include "blitter.h" #include "chunk.h" #include <assert.h> #include <string.h> // for memcpy -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif - Blitter::Blitter(char * ptr, const Point & dstsize, const Rect & src) : _ptr(ptr), _clip(dstsize), @@ -91,7 +88,7 @@ void Blitter::put(char data, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); len -= l; memset(_offset, data, l); advance(l); @@ -106,7 +103,7 @@ void Blitter::blit(char * ptr, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() - _cur.getX(), _src.right() - _cur.getX())); len -= l; memcpy(_offset, ptr, l); ptr += l; @@ -122,7 +119,7 @@ void Blitter::blit(Chunk & src, unsigned int len) { #endif break; } - int l = min((int)len, min(_clip.getX() -_cur.getX(), _src.right() - _cur.getX())); + int l = MIN((int)len, MIN(_clip.getX() -_cur.getX(), _src.right() - _cur.getX())); len -= l; src.read(_offset, l); advance(l); @@ -134,6 +131,7 @@ void Blitter::putBlock(unsigned int data) { assert((_clip.getX() & 3) == 0); unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; + data = TO_LE_32(data); *dst = data; dst += line_size; *dst = data; dst += line_size; @@ -154,10 +152,10 @@ void Blitter::putBlock(unsigned int d1, unsigned int d2, unsigned int d3, unsign unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; - *dst = d4; dst += line_size; - *dst = d3; dst += line_size; - *dst = d2; dst += line_size; - *dst = d1; + *dst = TO_LE_32(d4); dst += line_size; + *dst = TO_LE_32(d3); dst += line_size; + *dst = TO_LE_32(d2); dst += line_size; + *dst = TO_LE_32(d1); #ifdef DEBUG_CLIPPER } else { @@ -173,10 +171,10 @@ void Blitter::putBlock(unsigned char * data) { unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; unsigned int * src = (unsigned int *)data; - *dst = *src++; dst += line_size; - *dst = *src++; dst += line_size; - *dst = *src++; dst += line_size; - *dst = *src++; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); dst += line_size; + *dst = TO_LE_32(*src++); #ifdef DEBUG_CLIPPER } else { _clippedBlock ++; @@ -190,10 +188,10 @@ void Blitter::putBlock(Chunk & src) { assert((_clip.getX() & 3) == 0); unsigned int * dst = (unsigned int *)_offset; int line_size = _clip.getX() >> 2; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); dst += line_size; - *dst = src.getDword(); + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); dst += line_size; + *dst = TO_LE_32(src.getDword()); #ifdef DEBUG_CLIPPER } else { _clippedBlock ++; diff --git a/scumm/smush/frenderer.cpp b/scumm/smush/frenderer.cpp index 7f3f08cae8..741e853087 100644 --- a/scumm/smush/frenderer.cpp +++ b/scumm/smush/frenderer.cpp @@ -20,16 +20,14 @@ */ #include <stdafx.h> +#include "common/util.h" + #include "frenderer.h" #include "rect.h" #include <assert.h> #include <string.h> // for memcpy, strcat, strdup -#ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - FontRenderer::FontRenderer(bool use_original_colors) : _nbChars(0), _color(-1), _original(use_original_colors) { } @@ -75,7 +73,7 @@ int FontRenderer::stringHeight(const char * str) const { for(int i = 0; str[i] != 0; i++) { int h = charHeight(str[i]); - ret = max(ret, h); + ret = MAX(ret, h); } return ret; diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp index 049a9e1c4d..ea969c9428 100644 --- a/scumm/smush/imuse_channel.cpp +++ b/scumm/smush/imuse_channel.cpp @@ -26,9 +26,6 @@ #include <assert.h> #include <string.h> // for memcpy.h -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif ImuseChannel::ImuseChannel(int track, int freq) : _track(track), diff --git a/scumm/smush/player.cpp b/scumm/smush/player.cpp index 33da6467b6..5a216bdc48 100644 --- a/scumm/smush/player.cpp +++ b/scumm/smush/player.cpp @@ -20,6 +20,7 @@ */ #include <stdafx.h> +#include "common/util.h" #include "player.h" #include "renderer.h" @@ -34,10 +35,6 @@ #include <string.h> // for strchr, strrchr #include <ctype.h> // for isdigit -#ifndef max -#define max(x, y) ((x) > (y) ? (x) : (y)) -#endif - const int WAIT = 100; /*! @brief parser and map of string resources @@ -371,7 +368,7 @@ void SmushPlayer::handleTextResource(Chunk & b) { if(flags == 0 || flags == 4) { fr->drawStringAbsolute(str, _curBuffer, _frameSize, pos_x, pos_y); } else { - fr->drawStringCentered(str, _curBuffer, _frameSize, max(pos_y, top), left, width, pos_x); + fr->drawStringCentered(str, _curBuffer, _frameSize, MAX(pos_y, top), left, width, pos_x); } } diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp index 36f06f2832..c101c0d346 100644 --- a/scumm/smush/saud_channel.cpp +++ b/scumm/smush/saud_channel.cpp @@ -26,9 +26,6 @@ #include <assert.h> #include <string.h> // for memcpy.h -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif void SaudChannel::handleStrk(Chunk & b) { int size = b.getSize(); diff --git a/scumm/smush/scumm_renderer.h b/scumm/smush/scumm_renderer.h index 2ee22db546..48d8eaaca0 100644 --- a/scumm/smush/scumm_renderer.h +++ b/scumm/smush/scumm_renderer.h @@ -39,10 +39,6 @@ #include "rect.h" #include "blitter.h" -#ifndef min -#define min(x, y) ((x) > (y) ? (y) : (x)) -#endif - class scumm_mixer; class ScummRenderer : public BaseRenderer { |