diff options
-rw-r--r-- | simon/debug.cpp | 20 | ||||
-rw-r--r-- | simon/simon.cpp | 42 | ||||
-rw-r--r-- | simon/sound.cpp | 5 | ||||
-rw-r--r-- | simon/vga.cpp | 1 |
4 files changed, 37 insertions, 31 deletions
diff --git a/simon/debug.cpp b/simon/debug.cpp index c594b6385b..d1eb7c1e62 100644 --- a/simon/debug.cpp +++ b/simon/debug.cpp @@ -372,18 +372,17 @@ void SimonEngine::dump_single_bitmap(int file, int image, byte *offs, int w, int } void pal_load(byte *pal, const byte *vga1, int a, int b) { - uint num = a==0 ? 0x20 : 0x10; + uint num = (a == 0) ? 0x20 : 0x10; byte *palptr; const byte *src; - palptr = (byte*)&pal[a<<4]; - - src = vga1 + 6 + b*96; + palptr = (byte *)&pal[a << 4]; + src = vga1 + 6 + b * 96; do { - palptr[0] = src[0]<<2; - palptr[1] = src[1]<<2; - palptr[2] = src[2]<<2; + palptr[0] = src[0] << 2; + palptr[1] = src[1] << 2; + palptr[2] = src[2] << 2; palptr[3] = 0; palptr += 4; @@ -398,7 +397,6 @@ void SimonEngine::dump_vga_bitmaps(byte *vga, byte *vga1, int res) { int i; uint32 offs; byte *p2; - byte pal[768]; { @@ -419,16 +417,16 @@ void SimonEngine::dump_vga_bitmaps(byte *vga, byte *vga1, int res) { i = 538; - for(i=1; ; i++) { + for(i = 1; ; i++) { p2 = vga + i * 8; - offs = TO_BE_32(*(uint32*)p2); + offs = TO_BE_32(*(uint32 *)p2); /* try to detect end of images. * assume the end when offset >= 200kb */ if (offs >= 200*1024) return; - width = TO_BE_16(*(uint16*)(p2+6)); + width = TO_BE_16(*(uint16 *)(p2 + 6)); height = p2[5]; flags = p2[4]; diff --git a/simon/simon.cpp b/simon/simon.cpp index b4bbc1222b..b85af55979 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -2931,7 +2931,7 @@ void SimonEngine::skip_speech() { start_vga_code(4, 1, 0x1e, 0, 0, 0); o_wait_for_vga(0x82); o_kill_sprite_simon2(2, 1); - } + } } void SimonEngine::timer_vga_sprites() { @@ -3729,10 +3729,10 @@ void decompress_icon_amiga (byte *dst, byte *src, byte base, uint pitch) { for (y = 0; y < 24; y++) { for (x = 0; x < 24; x++) { byte pixel = - (icon_pln[(( y)*3) + (x>>3)] & (1<<(7-(x&7))) ? 1 : 0) - | (icon_pln[((24+y)*3) + (x>>3)] & (1<<(7-(x&7))) ? 2 : 0) - | (icon_pln[((48+y)*3) + (x>>3)] & (1<<(7-(x&7))) ? 4 : 0) - | (icon_pln[((72+y)*3) + (x>>3)] & (1<<(7-(x&7))) ? 8 : 0); + (icon_pln[(( y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0) + | (icon_pln[((24 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0) + | (icon_pln[((48 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0) + | (icon_pln[((72 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0); if (pixel) dst[x] = pixel | base; } @@ -4261,12 +4261,26 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str // Thanks to Stuart Caie for providing the original // C conversion upon which this decruncher is based. -#define SD_GETBIT(var) do { \ -if(!bits--){s-=4;if(s<src)return false;bb=READ_BE_UINT32(s);bits=31;}(var)=bb&1;bb>>=1; \ +#define SD_GETBIT(var) do { \ + if (!bits--) { \ + s -= 4; \ + if (s < src) \ + return false; \ + bb = READ_BE_UINT32(s); \ + bits = 31; \ + } \ + (var) = bb & 1; \ + bb >>= 1; \ }while(0) #define SD_GETBITS(var, nbits) do { \ -bc=(nbits);(var)=0;while(bc--){(var)<<=1;SD_GETBIT(bit);(var)|=bit;} \ + bc = (nbits); \ + (var) = 0; \ + while(bc--) { \ + (var) <<= 1; \ + SD_GETBIT(bit); \ + (var) |= bit; \ + } \ }while(0) #define SD_TYPE_LITERAL (0) @@ -4292,7 +4306,7 @@ static bool decrunch_file_amiga (byte *src, byte *dst, uint32 size) { while (d > dst) { SD_GETBIT(x); if (x) { - SD_GETBITS(x,2); + SD_GETBITS(x, 2); switch (x) { case 0: type = SD_TYPE_MATCH; @@ -4309,7 +4323,7 @@ static bool decrunch_file_amiga (byte *src, byte *dst, uint32 size) { case 2: type = SD_TYPE_MATCH; x = 12; - SD_GETBITS(y,8); + SD_GETBITS(y, 8); break; default: @@ -4331,18 +4345,18 @@ static bool decrunch_file_amiga (byte *src, byte *dst, uint32 size) { } if (type == SD_TYPE_LITERAL) { - SD_GETBITS(x,x); + SD_GETBITS(x, x); y += x; if ((int)(y + 1) > (d - dst)) return false; // Overflow? do { - SD_GETBITS(x,8); + SD_GETBITS(x, 8); *--d = x; } while (y-- > 0); } else { if ((int)(y + 1) > (d - dst)) return false; // Overflow? - SD_GETBITS(x,x); + SD_GETBITS(x, x); if ((d + x) > (dst + destlen)) return false; // Offset overflow? do { @@ -4629,7 +4643,7 @@ void SimonEngine::fadeUpPalette() { int i; done = true; - src = _palette; + src = _palette; dst = _video_buf_1; for (i = 0; i < _palette_color_count; i++) { diff --git a/simon/sound.cpp b/simon/sound.cpp index 04391b61d3..8bc071a53a 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -58,7 +58,6 @@ public: int playSound(uint sound, PlayingSoundHandle *handle, byte flags); }; - BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian) { _mixer = mixer; _file = file; @@ -231,10 +230,6 @@ int MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) } #endif - -/******************************************************************************/ - - SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer) : _game(game), _gameDataPath(gameDataPath), _mixer(mixer) { _voice_index = 0; diff --git a/simon/vga.cpp b/simon/vga.cpp index f6bde58ef4..6adfac93a3 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -1238,7 +1238,6 @@ void SimonEngine::vc_27_reset_simon1() { vfs++; } - vte = _vga_timer_list; while (vte->delay) { if (vte->sprite_id != 0x80) { |