[Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.41,1.42 smush.h,1.9,1.10
Pawe? Ko?odziejski
aquadran at users.sourceforge.net
Thu Jul 11 22:26:03 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv7712
Modified Files:
insane.cpp smush.h
Log Message:
corrected colors in SMUSH animations
Index: insane.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/insane.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- insane.cpp 11 Jul 2002 20:34:52 -0000 1.41
+++ insane.cpp 12 Jul 2002 05:25:32 -0000 1.42
@@ -145,18 +145,19 @@
return txt;
}
-void SmushPlayer::drawStringTRES(uint32 x, uint32 y, uint8 color, byte * txt)
+void SmushPlayer::drawStringTRES(uint32 x, uint32 y, byte * txt)
{
char buf[4];
uint32 c_line = 0, l = 0, i, tmp_x;
+ uint8 c_font = 0, c_color = 0;
if ((txt[l] == '^') && (txt[l + 1] == 'f')) {
buf[0] = txt[l + 2];
buf[1] = txt[l + 3];
buf[2] = 0;
l += 4;
- _c_font = atoi(buf);
- if (_c_font >= SP_MAX_FONTS)
+ c_font = atoi(buf);
+ if (c_font >= SP_MAX_FONTS)
error ("SP: number font out of range");
}
if ((txt[l] == '^') && (txt[l + 1] == 'c')) {
@@ -165,7 +166,7 @@
buf[2] = txt[l + 4];
buf[3] = 0;
l += 5;
- _c_color = atoi(buf);
+ c_color = atoi(buf);
}
for (;;) {
@@ -177,7 +178,7 @@
l += i + 2;
break;
}
- drawCharTRES (&tmp_x, y, c_line, color, txt[l + i]);
+ drawCharTRES (&tmp_x, y, c_line, c_font, c_color, txt[l + i]);
// this is hack
if (y + c_line * 0xe > 170) continue;
@@ -193,14 +194,13 @@
}
-void codec44_depack(byte *dst, byte *src, uint32 len, uint8 color)
+void codec44_depack(byte *dst, byte *src, uint32 len)
{
byte val;
uint16 size_line;
uint16 num;
do {
- if (len <= 0) break;
size_line = READ_LE_UINT16(src);
src += 2;
len -= 2;
@@ -216,11 +216,9 @@
num = READ_LE_UINT16(src) + 1;
src += 2;
- for (uint16 l = 0; l < num; l++) {
- uint8 tmp = *src++;
-// tmp -= 2;
- *dst++ = tmp;
- }
+ memcpy(dst, src, num);
+ dst += num;
+ src += num;
len -= num + 2;
size_line -= num + 2;
@@ -230,9 +228,9 @@
} while (len > 1);
}
-void SmushPlayer::drawCharTRES(uint32 * x, uint32 y, uint32 c_line, uint8 color, uint8 txt)
+void SmushPlayer::drawCharTRES(uint32 * x, uint32 y, uint32 c_line, uint8 c_font, uint8 color, uint8 txt)
{
- byte * font = _fonts[_c_font];
+ byte * font = _fonts[c_font];
uint32 offset = 0, t_offset = 0, l, width, height, length = 0;
if (font == NULL)
@@ -262,7 +260,7 @@
memset (dst, 0, 1000);
- codec44_depack (dst, src, length, color);
+ codec44_depack (dst, src, length);
width = *(uint16*)(font + t_offset + 6);
height = *(uint16*)(font + t_offset + 8);
@@ -272,7 +270,17 @@
for (uint32 tx = 0; tx < width; tx++) {
byte pixel = *(dst + ty * width + tx);
if (pixel != 0) {
- *(_renderBitmap + ((ty + y) * 320 + *x + tx)) = pixel;
+ if (color == 0) {
+ if (pixel == 0x01)
+ pixel = 0xf;
+ }
+ else {
+ if (pixel == 0x01)
+ pixel = color;
+ }
+ if (pixel == 0xff)
+ pixel = 0x0;
+ *(_renderBitmap + ((ty + y) * 320 + *x + tx)) = pixel;
}
}
}
@@ -1121,7 +1129,7 @@
void SmushPlayer::parseTRES()
{
byte * txt = getStringTRES (READ_LE_UINT16(_cur + 16));
- drawStringTRES (READ_LE_UINT16(_cur), READ_LE_UINT16(_cur + 2), *(_cur + 4), txt);
+ drawStringTRES (READ_LE_UINT16(_cur), READ_LE_UINT16(_cur + 2), txt);
if (txt != NULL)
free (txt);
}
@@ -1214,8 +1222,6 @@
_fonts[l] = NULL;
}
_buffer_tres = NULL;
- _c_font = 0;
- _c_color = 0;
loadTres();
loadFonts();
}
Index: smush.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/smush.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- smush.h 10 Jul 2002 20:50:44 -0000 1.9
+++ smush.h 12 Jul 2002 05:25:32 -0000 1.10
@@ -63,8 +63,6 @@
byte * _fonts[SP_MAX_FONTS];
byte * _buffer_tres;
- uint8 _c_font;
- uint8 _c_color;
PersistentCodecData37 pcd37;
@@ -75,8 +73,8 @@
byte * loadTres();
void loadFonts();
byte * getStringTRES(int32 number);
- void drawStringTRES(uint32 x, uint32 y, uint8 color, byte * txt);
- void drawCharTRES(uint32 * x, uint32 y, uint32 c_line, uint8 color, uint8 txt);
+ void drawStringTRES(uint32 x, uint32 y, byte * txt);
+ void drawCharTRES(uint32 * x, uint32 y, uint32 c_line, uint8 c_font, uint8 color, uint8 txt);
/* PSAD: Full Throttle audio */
uint32 _saudSize[8], _saudSubSize[8];
More information about the Scummvm-git-logs
mailing list