[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,NONE,2.1 charset.h,NONE,2.1 actor.cpp,1.43,1.44 actor.h,1.8,1.9 gfx.cpp,1.94,1.95 module.mk,1.7,1.8 saveload.cpp,1.37,1.38 script_v5.cpp,1.7,1.8 script_v6.cpp,1.22,1.23 script_v8.cpp,2.45,2.46 scumm.h,1.105,1.106 scummvm.cpp,2.8,2.9 string.cpp,1.61,1.62 verbs.cpp,1.13,1.14
Max Horn
fingolfin at users.sourceforge.net
Wed Dec 25 13:05:03 CET 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv11573
Modified Files:
actor.cpp actor.h gfx.cpp module.mk saveload.cpp script_v5.cpp
script_v6.cpp script_v8.cpp scumm.h scummvm.cpp string.cpp
verbs.cpp
Added Files:
charset.cpp charset.h
Log Message:
moved CharsetRendere into its own header/source file; changed Scumm::_charset into a pointer, to make it possible to use different implementations of it
--- NEW FILE: charset.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001/2002 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v 2.1 2002/12/25 21:04:47 fingolfin Exp $
*/
#include "stdafx.h"
#include "charset.h"
#include "scumm.h"
void CharsetRenderer::setCurID(byte id) {
_curId = id;
_fontPtr = getFontPtr(id);
}
byte *CharsetRenderer::getFontPtr(byte id)
{
byte *ptr = _vm->getResourceAddress(rtCharset, id);
assert(ptr);
if (_vm->_features & GF_SMALL_HEADER)
ptr += 17;
else
ptr += 29;
return ptr;
}
// do spacing for variable width old-style font
int CharsetRenderer::getSpacing(byte chr, byte *charset)
{
int spacing = 0;
if (_vm->_features & GF_OLD256) {
spacing = *(charset - 11 + chr);
} else {
int offs = READ_LE_UINT32(charset + chr * 4 + 4);
if (offs) {
spacing = charset[offs];
if (charset[offs + 2] >= 0x80) {
spacing += charset[offs + 2] - 0x100;
} else {
spacing += charset[offs + 2];
}
}
}
// FIXME - this fixes the inventory icons in Zak256/Indy3
// see bug #613109.
// chars 1,2: up arrow chars 3,4: down arrow
if ((_vm->_gameId == GID_ZAK256 || _vm->_gameId == GID_INDY3_256)
&& (chr >= 1 && chr <= 4))
spacing = 6;
return spacing;
}
int CharsetRenderer::getStringWidth(int arg, byte *text, int pos)
{
byte *ptr;
int width;
byte chr;
width = 1;
ptr = _fontPtr;
while ((chr = text[pos++]) != 0) {
if (chr == 0xD)
break;
if (chr == '@')
continue;
if (chr == 254 || chr == 255) {
chr = text[pos++];
if (chr == 3) // 'WAIT'
break;
if (chr == 8) { // 'Verb on next line'
if (arg == 1)
break;
while (text[pos] == ' ')
text[pos++] = '@';
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
continue;
}
if (chr == 9 || chr == 1 || chr == 2) // 'Newline'
break;
if (chr == 14) {
int set = text[pos] | (text[pos + 1] << 8);
pos += 2;
ptr = getFontPtr(set);
continue;
}
}
width += getSpacing(chr, ptr);
}
return width;
}
void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth)
{
int lastspace = -1;
int curw = 1;
byte *ptr;
byte chr;
ptr = _fontPtr;
while ((chr = str[pos++]) != 0) {
if (chr == '@')
continue;
if (chr == 254)
chr = 255;
if (chr == 255) {
chr = str[pos++];
if (chr == 3) // 'Wait'
break;
if (chr == 8) { // 'Verb on next line'
if (a == 1) {
curw = 1;
} else {
while (str[pos] == ' ')
str[pos++] = '@';
}
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
pos += 2;
continue;
}
if (chr == 1) { // 'Newline'
curw = 1;
continue;
}
if (chr == 2) // 'Don't terminate with \n'
break;
if (chr == 14) {
int set = str[pos] | (str[pos + 1] << 8);
pos += 2;
ptr = getFontPtr(set);
continue;
}
}
if (chr == ' ')
lastspace = pos - 1;
curw += getSpacing(chr, ptr);
if (lastspace == -1)
continue;
if (curw > maxwidth) {
str[lastspace] = 0xD;
curw = 1;
pos = lastspace + 1;
lastspace = -1;
}
}
}
void CharsetRenderer::printCharOld(int chr)
{ // Indy3 / Zak256
VirtScreen *vs;
byte *char_ptr, *dest_ptr;
unsigned int buffer = 0, mask = 0, x = 0, y = 0;
unsigned char color;
_vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d");
if ((vs = _vm->findVirtScreen(_top)) == NULL)
return;
if (chr == '@')
return;
if (_firstChar) {
_strLeft = _left;
_strTop = _top;
_strRight = _left;
_strBottom = _top;
_firstChar = false;
}
char_ptr = _fontPtr + 207 + (chr + 1) * 8;
dest_ptr = vs->screenPtr + vs->xstart + (_top - vs->topline) * _vm->_realWidth + _left;
_vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, _top - vs->topline + 8, 0);
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
if ((mask >>= 1) == 0) {
buffer = *char_ptr++;
mask = 0x80;
}
color = ((buffer & mask) != 0);
if (color)
*(dest_ptr + y * _vm->_realWidth + x) = _color;
}
}
// FIXME
_left += getSpacing(chr, _fontPtr);
if (_left > _strRight)
_strRight = _left;
if (_top + 8 > _strBottom)
_strBottom = _top + 8;
}
void CharsetRenderer::printChar(int chr)
{
int width, height;
int d;
VirtScreen *vs;
_vm->checkRange(_vm->_maxCharsets - 1, 1, _curId, "Printing with bad charset %d");
if ((vs = _vm->findVirtScreen(_top)) == NULL)
return;
if (chr == '@')
return;
_bpp = *_fontPtr;
_colorMap[1] = _color;
_charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
if (!_charOffs)
return;
assert(_charOffs < 0x10000);
_charPtr = _fontPtr + _charOffs;
width = _charPtr[0];
height = _charPtr[1];
if (_firstChar) {
_strLeft = 0;
_strTop = 0;
_strRight = 0;
_strBottom = 0;
}
if (_disableOffsX) {
_offsX = 0;
} else {
d = _charPtr[2];
if (d >= 0x80)
d -= 0x100;
_offsX = d;
}
d = _charPtr[3];
if (d >= 0x80)
d -= 0x100;
_offsY = d;
_top += _offsY;
_left += _offsX;
if (_left + width > _right + 1 || _left < 0) {
_left += width;
_top -= _offsY;
return;
}
_disableOffsX = false;
if (_firstChar) {
_strLeft = _left;
_strTop = _top;
_strRight = _left;
_strBottom = _top;
_firstChar = false;
}
if (_left < _strLeft)
_strLeft = _left;
if (_top < _strTop)
_strTop = _top;
int drawTop = _top - vs->topline;
if (drawTop < 0)
drawTop = 0;
int bottom = drawTop + height + _offsY;
_vm->updateDirtyRect(vs->number, _left, _left + width, drawTop, bottom, 0);
if (vs->number != 0)
_blitAlso = false;
if (vs->number == 0 && !_blitAlso)
_hasMask = true;
_charPtr += 4;
byte *mask = _vm->getResourceAddress(rtBuffer, 9)
+ drawTop * _vm->gdi._numStrips + _left / 8 + _vm->_screenStartStrip;
byte *dst = vs->screenPtr + vs->xstart + drawTop * _vm->_realWidth + _left;
if (_blitAlso) {
byte *back = dst;
dst = _vm->getResourceAddress(rtBuffer, vs->number + 5)
+ vs->xstart + drawTop * _vm->_realWidth + _left;
drawBits(vs, dst, mask, drawTop, width, height);
_vm->blit(back, dst, width, height);
} else {
drawBits(vs, dst, mask, drawTop, width, height);
}
_left += width;
if (_left > _strRight)
_strRight = _left;
if (_top + height > _strBottom)
_strBottom = _top + height;
_top -= _offsY;
}
void CharsetRenderer::drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height)
{
byte maskmask;
int y, x;
int maskpos;
int color;
byte numbits, bits;
bool useMask = (vs->number == 0 && !_ignoreCharsetMask);
bits = *_charPtr++;
numbits = 8;
y = 0;
for (y = 0; y < height && y + drawTop < vs->height; y++) {
maskmask = revBitMask[_left & 7];
maskpos = 0;
for (x = 0; x < width; x++) {
int myMask = (0xFF << (8 - _bpp)) & 0xFF;
int myColor = (bits & myMask) >> (8 - _bpp);
color = (bits >> (8 - _bpp)) & 0xFF;
assert(color == myColor);
if (color) {
if (useMask) {
mask[maskpos] |= maskmask;
}
*dst = _colorMap[color];
}
dst++;
bits <<= _bpp;
numbits -= _bpp;
if (numbits == 0) {
bits = *_charPtr++;
numbits = 8;
}
maskmask >>= 1;
if (maskmask == 0) {
maskmask = 0x80;
maskpos++;
}
}
dst += _vm->_realWidth - width;
mask += _vm->gdi._numStrips;
}
}
--- NEW FILE: charset.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001/2002 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/charset.h,v 2.1 2002/12/25 21:04:47 fingolfin Exp $
*/
#ifndef CHARSET_H
#define CHARSET_H
#include "common/scummsys.h"
class Scumm;
struct VirtScreen;
class CharsetRenderer {
public:
int _strLeft, _strRight, _strTop, _strBottom;
int _nextLeft, _nextTop;
int _top;
int _left, _startLeft;
byte _center;
int _right;
byte _color;
bool _hasMask;
bool _blitAlso;
int _bufPos;
bool _firstChar;
bool _disableOffsX;
bool _ignoreCharsetMask;
byte _colorMap[16];
byte _buffer[512]; // TODO - would be really nice to get rid of this
protected:
Scumm *_vm;
byte _curId;
byte *_fontPtr;
byte _bpp;
uint32 _charOffs;
byte *_charPtr;
int _offsX, _offsY;
void drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height);
public:
CharsetRenderer(Scumm *vm) : _vm(vm) {}
void printChar(int chr);
void printCharOld(int chr);
int getSpacing(byte chr, byte *charset);
int getStringWidth(int a, byte *str, int pos);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
void setCurID(byte id);
int getCurID() { return _curId; }
byte *getFontPtr() { return _fontPtr; }
byte *getFontPtr(byte id);
};
#endif
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- actor.cpp 25 Dec 2002 12:01:00 -0000 1.43
+++ actor.cpp 25 Dec 2002 21:04:47 -0000 1.44
@@ -24,6 +24,7 @@
#include "scumm.h"
#include "actor.h"
#include "akos.h"
+#include "charset.h"
#include "costume.h"
#include "resource.h"
#include "scumm/sound.h"
@@ -1095,9 +1096,9 @@
int oldact;
Actor *a;
- _msgPtrToAdd = _charset._buffer;
+ _msgPtrToAdd = _charset->_buffer;
_messagePtr = addMessageToStack(_messagePtr);
- assert((int)(_msgPtrToAdd - _charset._buffer) < (int)(sizeof(_charset._buffer)));
+ assert((int)(_msgPtrToAdd - _charset->_buffer) < (int)(sizeof(_charset->_buffer)));
if (_actorToPrintStrFor == 0xFF) {
if (!_keepText)
@@ -1128,7 +1129,7 @@
a = derefActorSafe(_vars[VAR_TALK_ACTOR], "actorTalk(2)");
_charsetColor = a->talkColor;
}
- _charset._bufPos = 0;
+ _charset->_bufPos = 0;
_talkDelay = 0;
_haveMsg = 0xFF;
_vars[VAR_HAVE_MSG] = 0xFF;
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- actor.h 23 Dec 2002 14:16:43 -0000 1.8
+++ actor.h 25 Dec 2002 21:04:47 -0000 1.9
@@ -24,10 +24,9 @@
#ifndef ACTOR_H
#define ACTOR_H
-#include <string.h>
-#include "scummsys.h"
+#include "common/scummsys.h"
-class Scumm;
+#include "scumm.h"
enum MoveFlags {
MF_NEW_LEG = 1,
@@ -158,6 +157,7 @@
bool isInCurrentRoom() {
return room == _vm->_currentRoom;
}
+
int getRoom() {
return room;
}
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- gfx.cpp 25 Dec 2002 20:07:08 -0000 1.94
+++ gfx.cpp 25 Dec 2002 21:04:47 -0000 1.95
@@ -22,7 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
-#include "gui/newgui.h"
+#include "charset.h"
#include "resource.h"
#include "util.h"
@@ -337,7 +337,7 @@
}
/* Handle shaking */
- if (_shakeEnabled && !_newgui->isActive()) {
+ if (_shakeEnabled) {
_shakeFrame = (_shakeFrame + 1) & (NUM_SHAKE_POSITIONS - 1);
_system->set_shake_pos(shake_positions[_shakeFrame]);
} else if (!_shakeEnabled &&_shakeFrame != 0) {
@@ -613,7 +613,7 @@
int diff;
if (!(_features & GF_AFTER_V7))
- if (camera._cur.x != camera._last.x && _charset._hasMask)
+ if (camera._cur.x != camera._last.x && _charset->_hasMask)
stopTalk();
val = 0;
@@ -675,14 +675,14 @@
{
if (gdi._mask_left != -1) {
restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
- _charset._hasMask = false;
+ _charset->_hasMask = false;
gdi._mask_left = -1;
- _charset._strLeft = -1;
- _charset._left = -1;
+ _charset->_strLeft = -1;
+ _charset->_left = -1;
}
- _charset._nextLeft = _string[0].xpos;
- _charset._nextTop = _string[0].ypos;
+ _charset->_nextLeft = _string[0].xpos;
+ _charset->_nextTop = _string[0].ypos;
}
void Scumm::restoreBG(int left, int top, int right, int bottom, byte backColor)
@@ -725,7 +725,7 @@
if (vs->alloctwobuffers && _currentRoom != 0 /*&& _vars[VAR_V5_DRAWFLAGS]&2 */ ) {
blit(backbuff, bgbak, width, height);
- if (vs->number == 0 && _charset._hasMask && height) {
+ if (vs->number == 0 && _charset->_hasMask && height) {
byte *mask;
int mask_width = (width >> 3);
@@ -751,7 +751,7 @@
int Scumm::hasCharsetMask(int x, int y, int x2, int y2)
{
- if (!_charset._hasMask || y > gdi._mask_bottom || x > gdi._mask_right ||
+ if (!_charset->_hasMask || y > gdi._mask_bottom || x > gdi._mask_right ||
y2 < gdi._mask_top || x2 < gdi._mask_left)
return 0;
return 1;
@@ -1737,7 +1737,7 @@
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
}
- if (camera._cur.x != camera._last.x && _charset._hasMask)
+ if (camera._cur.x != camera._last.x && _charset->_hasMask)
stopTalk();
}
}
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- module.mk 25 Dec 2002 14:46:39 -0000 1.7
+++ module.mk 25 Dec 2002 21:04:47 -0000 1.8
@@ -5,6 +5,7 @@
scumm/akos.o \
scumm/boxes.o \
scumm/bundle.o \
+ scumm/charset.o \
scumm/costume.o \
scumm/debugger.o \
scumm/dialogs.o \
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- saveload.cpp 25 Dec 2002 12:01:01 -0000 1.37
+++ saveload.cpp 25 Dec 2002 21:04:47 -0000 1.38
@@ -21,15 +21,16 @@
*/
#include "stdafx.h"
-#include "scumm.h"
-#include "sound/mididrv.h"
-#include "scumm/sound.h"
-#include "scumm/imuse.h"
#include "actor.h"
-#include "config-file.h"
+#include "charset.h"
+#include "imuse.h"
#include "resource.h"
#include "saveload.h"
+#include "scumm.h"
+#include "sound.h"
#include "verbs.h"
+#include "common/config-file.h"
+#include "sound/mididrv.h"
struct SaveGameHeader {
uint32 type;
@@ -358,7 +359,7 @@
MKARRAY(Scumm, vm.localvar[0][0], sleUint16, NUM_SCRIPT_SLOT * 17, VER_V9),
MKARRAY(Scumm, _resourceMapper[0], sleByte, 128, VER_V8),
- MKARRAY(Scumm, _charset._colorMap[0], sleByte, 16, VER_V8),
+ MKARRAY(Scumm, _charset->_colorMap[0], sleByte, 16, VER_V8),
// _charsetData grew from 10*16 to 15*16 bytes
MKARRAY_OLD(Scumm, _charsetData[0][0], sleByte, 10 * 16, VER_V8, VER_V9),
@@ -386,8 +387,8 @@
MKLINE(Scumm, _charsetColor, sleByte, VER_V8),
// charset._bufPos was changed from byte to int
- MKLINE_OLD(Scumm, _charset._bufPos, sleByte, VER_V8, VER_V9),
- MKLINE(Scumm, _charset._bufPos, sleInt16, VER_V10),
+ MKLINE_OLD(Scumm, _charset->_bufPos, sleByte, VER_V8, VER_V9),
+ MKLINE(Scumm, _charset->_bufPos, sleInt16, VER_V10),
MKLINE(Scumm, _haveMsg, sleByte, VER_V8),
MKLINE(Scumm, _useTalkAnims, sleByte, VER_V8),
@@ -429,7 +430,7 @@
MKARRAY(Scumm, _proc_special_palette[0], sleByte, 256, VER_V8),
- MKARRAY(Scumm, _charset._buffer[0], sleByte, 256, VER_V8),
+ MKARRAY(Scumm, _charset->_buffer[0], sleByte, 256, VER_V8),
MKLINE(Scumm, _egoPositioned, sleByte, VER_V8),
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- script_v5.cpp 25 Dec 2002 14:46:39 -0000 1.7
+++ script_v5.cpp 25 Dec 2002 21:04:47 -0000 1.8
@@ -23,6 +23,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "charset.h"
#include "intern.h"
#include "sound.h"
#include "verbs.h"
@@ -655,7 +656,7 @@
case 14: /* unk */
getWordVararg(table);
for (i = 0; i < 16; i++)
- _charset._colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)table[i];
+ _charset->_colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)table[i];
break;
}
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- script_v6.cpp 25 Dec 2002 16:55:43 -0000 1.22
+++ script_v6.cpp 25 Dec 2002 21:04:47 -0000 1.23
@@ -24,6 +24,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "charset.h"
#include "imuse.h"
#include "intern.h"
#include "sound.h"
@@ -863,7 +864,7 @@
case 0x9D: /* set charset colors */
getStackList(args, sizeof(args) / sizeof(args[0]));
for (i = 0; i < 16; i++)
- _charset._colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
+ _charset->_colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
break;
case 0xD6:
makeCursorColorTransparent(pop());
@@ -2581,10 +2582,10 @@
setStringVars(0);
addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
if (strncmp("/SYSTEM.007/ /", (char *)buf, 14) == 0) {
- translateText(buf + 13, _charset._buffer);
+ translateText(buf + 13, _charset->_buffer);
//description();
} else if (strncmp("/SYSTEM.007/ ", (char *)buf, 13) == 0) {
- strcpy((char *)_charset._buffer, (char *)buf + 13);
+ strcpy((char *)_charset->_buffer, (char *)buf + 13);
//description();
}
} else {
Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.45
retrieving revision 2.46
diff -u -d -r2.45 -r2.46
--- script_v8.cpp 25 Dec 2002 20:29:40 -0000 2.45
+++ script_v8.cpp 25 Dec 2002 21:04:47 -0000 2.46
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "charset.h"
#include "intern.h"
#include "sound.h"
#include "verbs.h"
@@ -794,7 +795,7 @@
case 0xE8: // SO_CHARSET_COLOR
getStackList(args, sizeof(args) / sizeof(args[0]));
for (i = 0; i < 16; i++)
- _charset._colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
+ _charset->_colorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
break;
case 0xE9: // SO_CURSOR_PUT
default:
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- scumm.h 25 Dec 2002 20:29:40 -0000 1.105
+++ scumm.h 25 Dec 2002 21:04:47 -0000 1.106
@@ -31,6 +31,7 @@
#include "common/timer.h"
#include "common/util.h"
+class CharsetRenderer;
class GameDetector;
class NewGui;
class Dialog;
@@ -175,56 +176,6 @@
#define _roomFileOffsets res.roomoffs[rtRoom]
-class CharsetRenderer {
-protected:
- byte _curId;
- byte *_fontPtr;
-
-public:
- Scumm *_vm;
- int _strLeft, _strRight, _strTop, _strBottom;
- int _nextLeft, _nextTop;
-
- int _top;
- int _left, _startLeft;
- byte _center;
- int _right;
- byte _color;
- bool _hasMask;
- bool _blitAlso;
-
- int _bufPos;
- bool _firstChar;
- bool _disableOffsX;
-
- bool _ignoreCharsetMask;
-
-protected:
- byte _bpp;
- uint32 _charOffs;
- byte *_charPtr;
- int _offsX, _offsY;
- int _virtScreenHeight;
-
- void drawBits(byte *dst, byte *mask, int drawTop, int width, int height, bool useMask);
-
-public:
- byte _colorMap[16];
- byte _buffer[512];
-
- void printChar(int chr);
- void printCharOld(int chr);
- int getSpacing(byte chr, byte *charset);
- int getStringWidth(int a, byte *str, int pos);
- void addLinebreaks(int a, byte *str, int pos, int maxwidth);
-
- void setCurID(byte id);
- int getCurID() { return _curId; }
-
- byte *getFontPtr() { return _fontPtr; }
- byte *getFontPtr(byte id);
-};
-
#define ARRAY_HDR_SIZE 6
struct ArrayHeader {
int16 dim1_size;
@@ -906,17 +857,17 @@
/* String class */
- CharsetRenderer _charset;
+ CharsetRenderer *_charset;
byte _charsetColor;
bool _noSubtitles; // Skip all subtitles?
byte _charsetData[15][16];
+
void initCharset(int charset);
void restoreCharsetBg();
int hasCharsetMask(int x, int y, int x2, int y2);
void CHARSET_1();
void description();
void drawDescString(byte *msg);
- byte *_msgPtrToAdd;
byte *addMessageToStack(byte *msg);
void addIntToStack(int var);
void addVerbToStack(int var);
@@ -925,7 +876,9 @@
void unkMessage1();
void unkMessage2();
void clearMsgQueue();
+
int _numInMsgStack;
+ byte *_msgPtrToAdd;
byte *_messagePtr;
int16 _talkDelay;
bool _keepText;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -d -r2.8 -r2.9
--- scummvm.cpp 25 Dec 2002 12:01:03 -0000 2.8
+++ scummvm.cpp 25 Dec 2002 21:04:47 -0000 2.9
@@ -24,6 +24,7 @@
#include "scumm.h"
#include "actor.h"
#include "bundle.h"
+#include "charset.h"
#include "debugger.h"
#include "dialogs.h"
#include "imuse.h"
@@ -289,7 +290,7 @@
_numObjectsInRoom = 0;
_actorToPrintStrFor = 0;
- _charset._bufPos = 0;
+ _charset->_bufPos = 0;
_haveMsg = 0;
_varwatch = -1;
@@ -487,7 +488,7 @@
if (_completeScreenRedraw) {
_completeScreenRedraw = false;
gdi.clearUpperMask();
- _charset._hasMask = false;
+ _charset->_hasMask = false;
redrawVerbs();
_fullRedraw = true;
}
@@ -1557,7 +1558,8 @@
void Scumm::launch()
{
- _charset._vm = this;
+ _charset = new CharsetRenderer(this);
+
gdi._vm = this;
_maxHeapThreshold = 450000;
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- string.cpp 25 Dec 2002 12:01:04 -0000 1.61
+++ string.cpp 25 Dec 2002 21:04:47 -0000 1.62
@@ -23,374 +23,11 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "charset.h"
#include "dialogs.h"
#include "verbs.h"
#include "scumm/sound.h"
-void CharsetRenderer::setCurID(byte id) {
- _curId = id;
- _fontPtr = getFontPtr(id);
-}
-
-byte *CharsetRenderer::getFontPtr(byte id)
-{
- byte *ptr = _vm->getResourceAddress(rtCharset, id);
- assert(ptr);
- if (_vm->_features & GF_SMALL_HEADER)
- ptr += 17;
- else
- ptr += 29;
- return ptr;
-}
-
-// do spacing for variable width old-style font
-int CharsetRenderer::getSpacing(byte chr, byte *charset)
-{
- int spacing = 0;
-
- if (_vm->_features & GF_OLD256) {
- spacing = *(charset - 11 + chr);
- } else {
- int offs = READ_LE_UINT32(charset + chr * 4 + 4);
- if (offs) {
- spacing = charset[offs];
- if (charset[offs + 2] >= 0x80) {
- spacing += charset[offs + 2] - 0x100;
- } else {
- spacing += charset[offs + 2];
- }
- }
- }
-
- // FIXME - this fixes the inventory icons in Zak256/Indy3
- // see bug #613109.
- // chars 1,2: up arrow chars 3,4: down arrow
- if ((_vm->_gameId == GID_ZAK256 || _vm->_gameId == GID_INDY3_256)
- && (chr >= 1 && chr <= 4))
- spacing = 6;
-
- return spacing;
-}
-
-int CharsetRenderer::getStringWidth(int arg, byte *text, int pos)
-{
- byte *ptr;
- int width;
- byte chr;
-
- width = 1;
- ptr = _fontPtr;
-
- while ((chr = text[pos++]) != 0) {
- if (chr == 0xD)
- break;
- if (chr == '@')
- continue;
- if (chr == 254 || chr == 255) {
- chr = text[pos++];
- if (chr == 3) // 'WAIT'
- break;
- if (chr == 8) { // 'Verb on next line'
- if (arg == 1)
- break;
- while (text[pos] == ' ')
- text[pos++] = '@';
- continue;
- }
- if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
- pos += 2;
- continue;
- }
- if (chr == 9 || chr == 1 || chr == 2) // 'Newline'
- break;
- if (chr == 14) {
- int set = text[pos] | (text[pos + 1] << 8);
- pos += 2;
- ptr = getFontPtr(set);
- continue;
- }
- }
- width += getSpacing(chr, ptr);
- }
-
- return width;
-}
-
-void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth)
-{
- int lastspace = -1;
- int curw = 1;
- byte *ptr;
- byte chr;
-
- ptr = _fontPtr;
-
- while ((chr = str[pos++]) != 0) {
- if (chr == '@')
- continue;
- if (chr == 254)
- chr = 255;
- if (chr == 255) {
- chr = str[pos++];
- if (chr == 3) // 'Wait'
- break;
- if (chr == 8) { // 'Verb on next line'
- if (a == 1) {
- curw = 1;
- } else {
- while (str[pos] == ' ')
- str[pos++] = '@';
- }
- continue;
- }
- if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
- pos += 2;
- continue;
- }
- if (chr == 1) { // 'Newline'
- curw = 1;
- continue;
- }
- if (chr == 2) // 'Don't terminate with \n'
- break;
- if (chr == 14) {
- int set = str[pos] | (str[pos + 1] << 8);
- pos += 2;
- ptr = getFontPtr(set);
- continue;
- }
- }
-
- if (chr == ' ')
- lastspace = pos - 1;
-
- curw += getSpacing(chr, ptr);
- if (lastspace == -1)
- continue;
- if (curw > maxwidth) {
- str[lastspace] = 0xD;
- curw = 1;
- pos = lastspace + 1;
- lastspace = -1;
- }
- }
-}
-
-
-void CharsetRenderer::printCharOld(int chr)
-{ // Indy3 / Zak256
- VirtScreen *vs;
- byte *char_ptr, *dest_ptr;
- unsigned int buffer = 0, mask = 0, x = 0, y = 0;
- unsigned char color;
-
- _vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d");
-
- if ((vs = _vm->findVirtScreen(_top)) == NULL)
- return;
-
- if (chr == '@')
- return;
-
- if (_firstChar) {
- _strLeft = _left;
- _strTop = _top;
- _strRight = _left;
- _strBottom = _top;
- _firstChar = false;
- }
- char_ptr = _fontPtr + 207 + (chr + 1) * 8;
- dest_ptr = vs->screenPtr + vs->xstart + (_top - vs->topline) * _vm->_realWidth + _left;
- _vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, _top - vs->topline + 8, 0);
-
- for (y = 0; y < 8; y++) {
- for (x = 0; x < 8; x++) {
- if ((mask >>= 1) == 0) {
- buffer = *char_ptr++;
- mask = 0x80;
- }
- color = ((buffer & mask) != 0);
- if (color)
- *(dest_ptr + y * _vm->_realWidth + x) = _color;
- }
- }
-
- // FIXME
- _left += getSpacing(chr, _fontPtr);
-
- if (_left > _strRight)
- _strRight = _left;
-
- if (_top + 8 > _strBottom)
- _strBottom = _top + 8;
-
-}
-
-
-void CharsetRenderer::printChar(int chr)
-{
- int width, height;
- int d;
- VirtScreen *vs;
-
- _vm->checkRange(_vm->_maxCharsets - 1, 1, _curId, "Printing with bad charset %d");
-
- if ((vs = _vm->findVirtScreen(_top)) == NULL)
- return;
-
- if (chr == '@')
- return;
-
- _bpp = *_fontPtr;
- _colorMap[1] = _color;
-
- _charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
-
- if (!_charOffs)
- return;
-
- assert(_charOffs < 0x10000);
-
- _charPtr = _fontPtr + _charOffs;
-
- width = _charPtr[0];
- height = _charPtr[1];
- if (_firstChar) {
- _strLeft = 0;
- _strTop = 0;
- _strRight = 0;
- _strBottom = 0;
- }
-
- if (_disableOffsX) {
- _offsX = 0;
- } else {
- d = _charPtr[2];
- if (d >= 0x80)
- d -= 0x100;
- _offsX = d;
- }
-
- d = _charPtr[3];
- if (d >= 0x80)
- d -= 0x100;
- _offsY = d;
-
- _top += _offsY;
- _left += _offsX;
-
- if (_left + width > _right + 1 || _left < 0) {
- _left += width;
- _top -= _offsY;
- return;
- }
-
- _disableOffsX = false;
-
- if (_firstChar) {
- _strLeft = _left;
- _strTop = _top;
- _strRight = _left;
- _strBottom = _top;
- _firstChar = false;
- }
-
- if (_left < _strLeft)
- _strLeft = _left;
-
- if (_top < _strTop)
- _strTop = _top;
-
- int drawTop = _top - vs->topline;
- if (drawTop < 0)
- drawTop = 0;
- int bottom = drawTop + height + _offsY;
-
- _vm->updateDirtyRect(vs->number, _left, _left + width, drawTop, bottom, 0);
-
- if (vs->number != 0)
- _blitAlso = false;
- if (vs->number == 0 && !_blitAlso)
- _hasMask = true;
-
- _virtScreenHeight = vs->height;
- _charPtr += 4;
-
- byte *mask = _vm->getResourceAddress(rtBuffer, 9)
- + drawTop * _vm->gdi._numStrips + _left / 8 + _vm->_screenStartStrip;
-
- byte *dst = vs->screenPtr + vs->xstart + drawTop * _vm->_realWidth + _left;
- bool useMask = (vs->number == 0 && !_ignoreCharsetMask);
-
- if (_blitAlso) {
- byte *back = dst;
- dst = _vm->getResourceAddress(rtBuffer, vs->number + 5)
- + vs->xstart + drawTop * _vm->_realWidth + _left;
-
- drawBits(dst, mask, drawTop, width, height, useMask);
-
- _vm->blit(back, dst, width, height);
- } else {
- drawBits(dst, mask, drawTop, width, height, useMask);
- }
-
- _left += width;
- if (_left > _strRight)
- _strRight = _left;
-
- if (_top + height > _strBottom)
- _strBottom = _top + height;
-
- _top -= _offsY;
-}
-
-void CharsetRenderer::drawBits(byte *dst, byte *mask, int drawTop, int width, int height, bool useMask)
-{
- byte maskmask;
- int y, x;
- int maskpos;
- int color;
- byte numbits, bits;
-
- bits = *_charPtr++;
- numbits = 8;
-
- y = 0;
-
- for (y = 0; y < height && y + drawTop < _virtScreenHeight; y++) {
- maskmask = revBitMask[_left & 7];
- maskpos = 0;
-
- for (x = 0; x < width; x++) {
- int myMask = (0xFF << (8 - _bpp)) & 0xFF;
- int myColor = (bits & myMask) >> (8 - _bpp);
- color = (bits >> (8 - _bpp)) & 0xFF;
- assert(color == myColor);
-
- if (color) {
- if (useMask) {
- mask[maskpos] |= maskmask;
- }
- *dst = _colorMap[color];
- }
- dst++;
- bits <<= _bpp;
- numbits -= _bpp;
- if (numbits == 0) {
- bits = *_charPtr++;
- numbits = 8;
- }
- maskmask >>= 1;
- if (maskmask == 0) {
- maskmask = 0x80;
- maskpos++;
- }
- }
- dst += _vm->_realWidth - width;
- mask += _vm->gdi._numStrips;
- }
-}
-
void Scumm::unkMessage1()
{
byte buffer[100];
@@ -494,28 +131,28 @@
}
}
- _charset._top = _string[0].ypos;
- _charset._startLeft = _charset._left = _string[0].xpos;
+ _charset->_top = _string[0].ypos;
+ _charset->_startLeft = _charset->_left = _string[0].xpos;
if (a && a->charset)
- _charset.setCurID(a->charset);
+ _charset->setCurID(a->charset);
else
- _charset.setCurID(_string[0].charset);
+ _charset->setCurID(_string[0].charset);
- _charset._center = _string[0].center;
- _charset._right = _string[0].right;
- _charset._color = _charsetColor;
+ _charset->_center = _string[0].center;
+ _charset->_right = _string[0].right;
+ _charset->_color = _charsetColor;
if (!(_features & GF_OLD256)) // FIXME
for (i = 0; i < 4; i++)
- _charset._colorMap[i] = _charsetData[_charset.getCurID()][i];
+ _charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
if (_keepText) {
- _charset._strLeft = gdi._mask_left;
- _charset._strRight = gdi._mask_right;
- _charset._strTop = gdi._mask_top;
- _charset._strBottom = gdi._mask_bottom;
+ _charset->_strLeft = gdi._mask_left;
+ _charset->_strRight = gdi._mask_right;
+ _charset->_strTop = gdi._mask_top;
+ _charset->_strBottom = gdi._mask_bottom;
}
if (_talkDelay)
@@ -555,23 +192,23 @@
restoreCharsetBg();
}
- t = _charset._right - _string[0].xpos - 1;
- if (_charset._center) {
- if (t > _charset._nextLeft)
- t = _charset._nextLeft;
+ t = _charset->_right - _string[0].xpos - 1;
+ if (_charset->_center) {
+ if (t > _charset->_nextLeft)
+ t = _charset->_nextLeft;
t <<= 1;
}
- buffer = _charset._buffer + _charset._bufPos;
- _charset.addLinebreaks(0, buffer, 0, t);
+ buffer = _charset->_buffer + _charset->_bufPos;
+ _charset->addLinebreaks(0, buffer, 0, t);
- if (_charset._center) {
- _charset._nextLeft -= _charset.getStringWidth(0, buffer, 0) >> 1;
- if (_charset._nextLeft < 0)
- _charset._nextLeft = 0;
+ if (_charset->_center) {
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
+ if (_charset->_nextLeft < 0)
+ _charset->_nextLeft = 0;
}
- _charset._disableOffsX = _charset._firstChar = !_keepText;
+ _charset->_disableOffsX = _charset->_firstChar = !_keepText;
do {
c = *buffer++;
@@ -585,16 +222,16 @@
if (c == 13) {
newLine:;
if (_features & GF_OLD256) {
- _charset._nextTop = 8;
- _charset._nextLeft = 0;
+ _charset->_nextTop = 8;
+ _charset->_nextLeft = 0;
continue;
} else {
- _charset._nextLeft = _string[0].xpos;
- if (_charset._center) {
- _charset._nextLeft -= _charset.getStringWidth(0, buffer, 0) >> 1;
+ _charset->_nextLeft = _string[0].xpos;
+ if (_charset->_center) {
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
}
- _charset._nextTop += _charset.getFontPtr()[1];
- _charset._disableOffsX = true;
+ _charset->_nextTop += _charset->getFontPtr()[1];
+ _charset->_disableOffsX = true;
continue;
}
}
@@ -603,20 +240,20 @@
c = 0xFF;
if (c != 0xFF) {
- _charset._left = _charset._nextLeft;
- _charset._top = _charset._nextTop;
+ _charset->_left = _charset->_nextLeft;
+ _charset->_top = _charset->_nextTop;
if (_features & GF_OLD256)
- _charset.printCharOld(c);
+ _charset->printCharOld(c);
else if (!(_features & GF_AFTER_V6)) {
if (!(_haveMsg == 0xFE && _noSubtitles))
- _charset.printChar(c);
+ _charset->printChar(c);
} else {
if (!((_haveMsg == 0xFE || _haveMsg == 0xFF) && _noSubtitles))
- _charset.printChar(c);
+ _charset->printChar(c);
}
- _charset._nextLeft = _charset._left;
- _charset._nextTop = _charset._top;
+ _charset->_nextLeft = _charset->_left;
+ _charset->_nextTop = _charset->_top;
_talkDelay += _vars[VAR_CHARINC];
continue;
}
@@ -654,21 +291,21 @@
color = *buffer++;
color |= *buffer++ << 8;
if (color == 0xFF)
- _charset._color = _charsetColor;
+ _charset->_color = _charsetColor;
else
- _charset._color = color;
+ _charset->_color = color;
break;
case 13:
buffer += 2;
break;
case 14: {
- int oldy = _charset.getFontPtr()[1];
+ int oldy = _charset->getFontPtr()[1];
- _charset.setCurID(*buffer++);
+ _charset->setCurID(*buffer++);
buffer += 2;
for (i = 0; i < 4; i++)
- _charset._colorMap[i] = _charsetData[_charset.getCurID()][i];
- _charset._nextTop -= _charset.getFontPtr()[1] - oldy;
+ _charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
+ _charset->_nextTop -= _charset->getFontPtr()[1] - oldy;
break;
}
default:
@@ -689,12 +326,12 @@
if (a && has_anim)
a->startAnimActor(frme != -1 ? frme : a->talkFrame1);
- _charset._bufPos = buffer - _charset._buffer;
+ _charset->_bufPos = buffer - _charset->_buffer;
- gdi._mask_left = _charset._strLeft;
- gdi._mask_right = _charset._strRight;
- gdi._mask_top = _charset._strTop;
- gdi._mask_bottom = _charset._strBottom;
+ gdi._mask_left = _charset->_strLeft;
+ gdi._mask_right = _charset->_strRight;
+ gdi._mask_top = _charset->_strTop;
+ gdi._mask_bottom = _charset->_strBottom;
}
void Scumm::description()
@@ -702,22 +339,22 @@
int c;
byte *buffer;
- buffer = _charset._buffer;
+ buffer = _charset->_buffer;
_string[0].ypos = camera._cur.y + 88;
- _string[0].xpos = (_realWidth / 2) - (_charset.getStringWidth(0, buffer, 0) >> 1);
+ _string[0].xpos = (_realWidth / 2) - (_charset->getStringWidth(0, buffer, 0) >> 1);
if (_string[0].xpos < 0)
_string[0].xpos = 0;
- _charset._bufPos = 0;
- _charset._top = _string[0].ypos;
- _charset._startLeft = _charset._left = _string[0].xpos;
- _charset._right = _realWidth - 1;
- _charset._center = false;
- _charset._color = 15;
- _charset._disableOffsX = _charset._firstChar = true;
- _charset.setCurID(3);
- _charset._nextLeft = _string[0].xpos;
- _charset._nextTop = _string[0].ypos;
+ _charset->_bufPos = 0;
+ _charset->_top = _string[0].ypos;
+ _charset->_startLeft = _charset->_left = _string[0].xpos;
+ _charset->_right = _realWidth - 1;
+ _charset->_center = false;
+ _charset->_color = 15;
+ _charset->_disableOffsX = _charset->_firstChar = true;
+ _charset->setCurID(3);
+ _charset->_nextLeft = _string[0].xpos;
+ _charset->_nextTop = _string[0].ypos;
// FIXME: _talkdelay = 1 - display description, not correct ego actor talking,
// 0 - no display, correct ego actor talking
_talkDelay = 0;
@@ -731,19 +368,19 @@
break;
}
if (c != 0xFF) {
- _charset._left = _charset._nextLeft;
- _charset._top = _charset._nextTop;
- _charset.printChar(c);
- _charset._nextLeft = _charset._left;
- _charset._nextTop = _charset._top;
+ _charset->_left = _charset->_nextLeft;
+ _charset->_top = _charset->_nextTop;
+ _charset->printChar(c);
+ _charset->_nextLeft = _charset->_left;
+ _charset->_nextTop = _charset->_top;
continue;
}
} while (1);
- gdi._mask_left = _charset._strLeft;
- gdi._mask_right = _charset._strRight;
- gdi._mask_top = _charset._strTop;
- gdi._mask_bottom = _charset._strBottom;
+ gdi._mask_left = _charset->_strLeft;
+ gdi._mask_right = _charset->_strRight;
+ gdi._mask_top = _charset->_strTop;
+ gdi._mask_bottom = _charset->_strBottom;
}
void Scumm::drawDescString(byte *msg)
@@ -753,21 +390,21 @@
buf = _msgPtrToAdd = buffer;
addMessageToStack(msg);
- _charset._bufPos = 0;
- _charset._top = _string[0].ypos;
- _charset._startLeft = _charset._left = _string[0].xpos;
- _charset._right = _realWidth - 1;
- _charset._center = _string[0].center;
- _charset._color = _string[0].color;
- _charset._disableOffsX = _charset._firstChar = true;
- _charset.setCurID(_string[0].charset);
- _charset._nextLeft = _string[0].xpos;
- _charset._nextTop = _string[0].ypos;
+ _charset->_bufPos = 0;
+ _charset->_top = _string[0].ypos;
+ _charset->_startLeft = _charset->_left = _string[0].xpos;
+ _charset->_right = _realWidth - 1;
+ _charset->_center = _string[0].center;
+ _charset->_color = _string[0].color;
+ _charset->_disableOffsX = _charset->_firstChar = true;
+ _charset->setCurID(_string[0].charset);
+ _charset->_nextLeft = _string[0].xpos;
+ _charset->_nextTop = _string[0].ypos;
// Center text
- _charset._nextLeft -= _charset.getStringWidth(0, buffer, 0) >> 1;
- if (_charset._nextLeft < 0)
- _charset._nextLeft = 0;
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
+ if (_charset->_nextLeft < 0)
+ _charset->_nextLeft = 0;
_talkDelay = 1;
@@ -780,19 +417,19 @@
break;
}
if (c != 0xFF) {
- _charset._left = _charset._nextLeft;
- _charset._top = _charset._nextTop;
- _charset.printChar(c);
- _charset._nextLeft = _charset._left;
- _charset._nextTop = _charset._top;
+ _charset->_left = _charset->_nextLeft;
+ _charset->_top = _charset->_nextTop;
+ _charset->printChar(c);
+ _charset->_nextLeft = _charset->_left;
+ _charset->_nextTop = _charset->_top;
continue;
}
} while (1);
- gdi._mask_left = _charset._strLeft;
- gdi._mask_right = _charset._strRight;
- gdi._mask_top = _charset._strTop;
- gdi._mask_bottom = _charset._strBottom;
+ gdi._mask_left = _charset->_strLeft;
+ gdi._mask_right = _charset->_strRight;
+ gdi._mask_top = _charset->_strTop;
+ gdi._mask_bottom = _charset->_strBottom;
}
void Scumm::drawString(int a)
@@ -806,19 +443,19 @@
_msgPtrToAdd = buf;
_messagePtr = addMessageToStack(_messagePtr);
- _charset._top = _string[a].ypos;
- _charset._startLeft = _charset._left = _string[a].xpos;
- _charset._right = _string[a].right;
- _charset._center = _string[a].center;
- _charset._color = _string[a].color;
- _charset._disableOffsX = _charset._firstChar = true;
- _charset.setCurID(_string[a].charset);
+ _charset->_top = _string[a].ypos;
+ _charset->_startLeft = _charset->_left = _string[a].xpos;
+ _charset->_right = _string[a].right;
+ _charset->_center = _string[a].center;
+ _charset->_color = _string[a].color;
+ _charset->_disableOffsX = _charset->_firstChar = true;
+ _charset->setCurID(_string[a].charset);
if (!(_features & GF_OLD256)) {
for (i = 0; i < 4; i++)
- _charset._colorMap[i] = _charsetData[_charset.getCurID()][i];
+ _charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
- fontHeight = _charset.getFontPtr()[1];
+ fontHeight = _charset->getFontPtr()[1];
}
_msgPtrToAdd = buf;
@@ -836,12 +473,12 @@
}
if (space)
*space = '\0';
- if (_charset._center) {
- _charset._left -= _charset.getStringWidth(a, buf, 0) >> 1;
+ if (_charset->_center) {
+ _charset->_left -= _charset->getStringWidth(a, buf, 0) >> 1;
}
if (!(_features & GF_AFTER_V7))
- _charset._ignoreCharsetMask = true;
+ _charset->_ignoreCharsetMask = true;
// In Full Throttle (and other games?), verb text should always mask
@@ -868,55 +505,55 @@
break;
case 1:
case 8:
- if (_charset._center) {
- _charset._left = _charset._startLeft - _charset.getStringWidth(a, buf, i);
+ if (_charset->_center) {
+ _charset->_left = _charset->_startLeft - _charset->getStringWidth(a, buf, i);
} else {
- _charset._left = _charset._startLeft;
+ _charset->_left = _charset->_startLeft;
}
- _charset._top += fontHeight;
+ _charset->_top += fontHeight;
break;
case 12:
color = buf[i] + (buf[i + 1] << 8);
i += 2;
if (color == 0xFF)
- _charset._color = _string[a].color;
+ _charset->_color = _string[a].color;
else
- _charset._color = color;
+ _charset->_color = color;
break;
}
} else {
if (a == 1 && (_features & GF_AFTER_V6)) {
if (_string[a].no_talk_anim == 0)
- _charset._blitAlso = true;
+ _charset->_blitAlso = true;
}
if (_features & GF_OLD256)
- _charset.printCharOld(chr);
+ _charset->printCharOld(chr);
else
- _charset.printChar(chr);
- _charset._blitAlso = false;
+ _charset->printChar(chr);
+ _charset->_blitAlso = false;
}
}
- _charset._ignoreCharsetMask = false;
+ _charset->_ignoreCharsetMask = false;
if (a == 0) {
- _charset._nextLeft = _charset._left;
- _charset._nextTop = _charset._top;
+ _charset->_nextLeft = _charset->_left;
+ _charset->_nextTop = _charset->_top;
}
- _string[a].xpos = _charset._strRight + 8; // Indy3: Fixes Grail Diary text positioning
+ _string[a].xpos = _charset->_strRight + 8; // Indy3: Fixes Grail Diary text positioning
if (_features & GF_AFTER_V7) {
- _charset._hasMask = true;
- if (_charset._strLeft < gdi._mask_left)
- gdi._mask_left = _charset._strLeft;
- if (_charset._strRight > gdi._mask_right)
- gdi._mask_right = _charset._strRight;
- if (_charset._strTop < gdi._mask_top)
- gdi._mask_top = _charset._strTop;
- if (_charset._strBottom > gdi._mask_bottom)
- gdi._mask_bottom = _charset._strBottom;
+ _charset->_hasMask = true;
+ if (_charset->_strLeft < gdi._mask_left)
+ gdi._mask_left = _charset->_strLeft;
+ if (_charset->_strRight > gdi._mask_right)
+ gdi._mask_right = _charset->_strRight;
+ if (_charset->_strTop < gdi._mask_top)
+ gdi._mask_top = _charset->_strTop;
+ if (_charset->_strBottom > gdi._mask_bottom)
+ gdi._mask_bottom = _charset->_strBottom;
}
}
@@ -1118,7 +755,7 @@
_string[1].t_charset = charsetno;
for (i = 0; i < 16; i++)
- _charset._colorMap[i] = _charsetData[_charset.getCurID()][i];
+ _charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
}
void Scumm::loadLanguageBundle() {
File file;
Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- verbs.cpp 25 Dec 2002 12:01:04 -0000 1.13
+++ verbs.cpp 25 Dec 2002 21:04:47 -0000 1.14
@@ -21,9 +21,10 @@
*/
#include "stdafx.h"
-#include "scumm.h"
+#include "charset.h"
#include "object.h"
#include "resource.h"
+#include "scumm.h"
#include "verbs.h"
void Scumm::redrawVerbs()
@@ -156,18 +157,18 @@
return;
assert(_messagePtr);
- tmp = _charset._center;
- _charset._center = 0;
+ tmp = _charset->_center;
+ _charset->_center = 0;
drawString(4);
- _charset._center = tmp;
+ _charset->_center = tmp;
- vs->right = _charset._strRight;
- vs->bottom = _charset._strBottom;
- vs->oldleft = _charset._strLeft;
- vs->oldright = _charset._strRight;
- vs->oldtop = _charset._strTop;
- vs->oldbottom = _charset._strBottom;
- _charset._strLeft = _charset._strRight;
+ vs->right = _charset->_strRight;
+ vs->bottom = _charset->_strBottom;
+ vs->oldleft = _charset->_strLeft;
+ vs->oldright = _charset->_strRight;
+ vs->oldtop = _charset->_strTop;
+ vs->oldbottom = _charset->_strBottom;
+ _charset->_strLeft = _charset->_strRight;
} else {
restoreVerbBG(verb);
}
More information about the Scummvm-git-logs
mailing list