[Scummvm-cvs-logs] CVS: residual driver_gl.cpp,1.43,1.44 driver_tinygl.cpp,1.13,1.14 lua.cpp,1.116,1.117 textobject.cpp,1.23,1.24 textobject.h,1.12,1.13
Pawel Kolodziejski
aquadran at users.sourceforge.net
Mon Apr 4 21:34:37 CEST 2005
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19758
Modified Files:
driver_gl.cpp driver_tinygl.cpp lua.cpp textobject.cpp
textobject.h
Log Message:
few changes for textObjects
Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- driver_gl.cpp 28 Mar 2005 01:54:21 -0000 1.43
+++ driver_gl.cpp 5 Apr 2005 04:33:56 -0000 1.44
@@ -579,6 +579,10 @@
byte *texData = new byte[4 * width * height];
byte *texDataPtr = texData;
uint8 *bitmapData = data;
+ uint8 r = fgColor.red();
+ uint8 g = fgColor.green();
+ uint8 b = fgColor.blue();
+
for (int i = 0; i < width * height; i++, texDataPtr += 4, bitmapData++) {
byte pixel = *bitmapData;
if (pixel == 0x00) {
@@ -592,9 +596,9 @@
texDataPtr[2] = 0;
texDataPtr[3] = 255;
} else if (pixel == 0xFF) {
- texDataPtr[0] = fgColor.red();
- texDataPtr[1] = fgColor.green();
- texDataPtr[2] = fgColor.blue();
+ texDataPtr[0] = r;
+ texDataPtr[1] = g;
+ texDataPtr[2] = b;
texDataPtr[3] = 255;
}
}
Index: driver_tinygl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- driver_tinygl.cpp 28 Mar 2005 01:54:21 -0000 1.13
+++ driver_tinygl.cpp 5 Apr 2005 04:33:56 -0000 1.14
@@ -428,6 +428,10 @@
uint16 *texDataPtr = texData;
handle->bitmapData = texData;
uint8 *bitmapData = data;
+ uint8 r = fgColor.red();
+ uint8 g = fgColor.green();
+ uint8 b = fgColor.blue();
+
for (int i = 0; i < width * height; i++, texDataPtr++, bitmapData++) {
byte pixel = *bitmapData;
if (pixel == 0x00) {
@@ -435,8 +439,8 @@
} else if (pixel == 0x80) {
*texDataPtr = 0;
} else if (pixel == 0xFF) {
- WRITE_LE_UINT16(texDataPtr, ((fgColor.red() & 0xF8) << 8) |
- ((fgColor.green() & 0xFC) << 3) | (fgColor.blue() >> 3));
+ WRITE_LE_UINT16(texDataPtr, ((r & 0xF8) << 8) |
+ ((g & 0xFC) << 3) | (b >> 3));
}
}
Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- lua.cpp 3 Apr 2005 11:33:28 -0000 1.116
+++ lua.cpp 5 Apr 2005 04:33:56 -0000 1.117
@@ -1198,6 +1198,8 @@
textObject->setJustify(1);
else if (strstr(key_text, "ljustify"))
textObject->setJustify(2);
+ else if (strstr(key_text, "disabled"))
+ warning("getTextObjectParams: key %s\n not implemented yet", key_text);
else
error("Unknown getTextObjectParams key %s\n", key_text);
}
@@ -1282,6 +1284,20 @@
lua_pushnumber(textObjectParam->getBitmapHeight());
}
+static void ExpireText() {
+ for (Engine::TextListType::const_iterator i = g_engine->textsBegin(); i != g_engine->textsEnd(); i++) {
+ TextObject *textO = *i;
+ g_engine->killTextObject(textO);
+ delete textO;
+ }
+}
+
+static void GetTextCharPosition() {
+ TextObject *textObjectParam = check_textobject(1);
+ int pos = lua_getnumber(lua_getparam(2));
+ lua_pushnumber(textObjectParam->getTextCharPosition(pos));
+}
+
static void BlastText() {
// there is some diffrence to MakeTextObject
// it draw directly to gfx buffer from here, not from main loop
@@ -1336,11 +1352,6 @@
g_smush->pause(lua_isnil(lua_getparam(1)) != 0);
}
-static void GetTextCharPosition() {
- warning("STUB GetTextCharPosition(\"%s\", %d)", lua_getstring(lua_getparam(1)), lua_getnumber(lua_getparam(2)));
- lua_pushnumber(0);
-}
-
static void GetDiskFreeSpace() {
// amount of free space in MB, used for creating saves
lua_pushnumber(50);
@@ -1597,7 +1608,6 @@
STUB_FUNC(SetEmergencyFont)
STUB_FUNC(GetTranslationMode)
STUB_FUNC(SetTranslationMode)
-STUB_FUNC(ExpireText)
STUB_FUNC(PrintLine)
STUB_FUNC(PurgePrimitiveQueue)
STUB_FUNC(KillPrimitive)
Index: textobject.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- textobject.cpp 3 Apr 2005 11:33:28 -0000 1.23
+++ textobject.cpp 5 Apr 2005 04:33:56 -0000 1.24
@@ -28,7 +28,7 @@
TextObjectDefaults textObjectDefaults;
TextObject::TextObject() :
- _created(false), _x(0), _y(0), _width(0), _height(0), _justify(0),
+ _created(false), _dim(false), _x(0), _y(0), _width(0), _height(0), _justify(0),
_font(NULL), _textBitmap(NULL), _bitmapWidth(0),
_bitmapHeight(0), _textObjectHandle(NULL) {
memset(_textID, 0, sizeof(_textID));
@@ -51,6 +51,16 @@
_justify = defaults->justify;
}
+int TextObject::getTextCharPosition(int pos) {
+ int width = 0;
+ std::string msg = parseMsgText(_textID, NULL);
+ for (int i = 0; (msg[i] != '\0') && (i < pos); ++i) {
+ width += _font->getCharLogicalWidth(msg[i]) + _font->getCharStartingCol(msg[i]);
+ }
+
+ return width;
+}
+
void TextObject::createBitmap() {
if (_created)
destroyBitmap();
@@ -107,5 +117,11 @@
}
void TextObject::draw() {
- g_driver->drawTextBitmap(_x, _y, _textObjectHandle);
+ int x = _x;
+
+ if (_justify == 1) {
+ x = 320 - (_bitmapWidth / 2);
+ }
+
+ g_driver->drawTextBitmap(x, _y, _textObjectHandle);
}
Index: textobject.h
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- textobject.h 3 Apr 2005 11:33:28 -0000 1.12
+++ textobject.h 5 Apr 2005 04:33:56 -0000 1.13
@@ -53,8 +53,10 @@
void setFGColor(Color *fgColor) { _fgColor = fgColor; }
void setFont(Font *font) { _font = font; }
void setJustify(int justify) { _justify = justify; }
+ void setDim() { _dim = true; }
int getBitmapWidth() { return _bitmapWidth; }
int getBitmapHeight() { return _bitmapHeight; }
+ int getTextCharPosition(int pos);
const char *name() const { return _textID; }
void draw();
@@ -67,6 +69,7 @@
protected:
bool _created;
+ bool _dim;
Color _fgColor;
int _x, _y;
uint _width, _height;
More information about the Scummvm-git-logs
mailing list