SCI: Renamed GfxControls to GfxControls16

This commit is contained in:
Filippos Karapetis 2011-10-26 01:48:20 +03:00
parent 764ffff578
commit ac559b0212
6 changed files with 37 additions and 34 deletions

View file

@ -39,7 +39,7 @@
#include "sci/graphics/animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/cache.h" #include "sci/graphics/cache.h"
#include "sci/graphics/compare.h" #include "sci/graphics/compare.h"
#include "sci/graphics/controls.h" #include "sci/graphics/controls16.h"
#include "sci/graphics/cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/palette.h" #include "sci/graphics/palette.h"
#include "sci/graphics/paint16.h" #include "sci/graphics/paint16.h"
@ -810,13 +810,13 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
switch (type) { switch (type) {
case SCI_CONTROLS_TYPE_BUTTON: case SCI_CONTROLS_TYPE_BUTTON:
debugC(kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y); debugC(kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y);
g_sci->_gfxControls->kernelDrawButton(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite); g_sci->_gfxControls16->kernelDrawButton(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite);
return; return;
case SCI_CONTROLS_TYPE_TEXT: case SCI_CONTROLS_TYPE_TEXT:
alignment = readSelectorValue(s->_segMan, controlObject, SELECTOR(mode)); alignment = readSelectorValue(s->_segMan, controlObject, SELECTOR(mode));
debugC(kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment); debugC(kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment);
g_sci->_gfxControls->kernelDrawText(rect, controlObject, g_sci->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite); g_sci->_gfxControls16->kernelDrawText(rect, controlObject, g_sci->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite);
s->r_acc = g_sci->_gfxText16->allocAndFillReferenceRectArray(); s->r_acc = g_sci->_gfxText16->allocAndFillReferenceRectArray();
return; return;
@ -830,7 +830,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
writeSelectorValue(s->_segMan, controlObject, SELECTOR(cursor), cursorPos); writeSelectorValue(s->_segMan, controlObject, SELECTOR(cursor), cursorPos);
} }
debugC(kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y); debugC(kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y);
g_sci->_gfxControls->kernelDrawTextEdit(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite); g_sci->_gfxControls16->kernelDrawTextEdit(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite);
return; return;
case SCI_CONTROLS_TYPE_ICON: case SCI_CONTROLS_TYPE_ICON:
@ -847,7 +847,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
priority = -1; priority = -1;
} }
debugC(kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y - 1); debugC(kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y - 1);
g_sci->_gfxControls->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite); g_sci->_gfxControls16->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite);
return; return;
case SCI_CONTROLS_TYPE_LIST: case SCI_CONTROLS_TYPE_LIST:
@ -895,7 +895,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
} }
debugC(kDebugLevelGraphics, "drawing list control %04x:%04x to %d,%d, diff %d", PRINT_REG(controlObject), x, y, SCI_MAX_SAVENAME_LENGTH); debugC(kDebugLevelGraphics, "drawing list control %04x:%04x to %d,%d, diff %d", PRINT_REG(controlObject), x, y, SCI_MAX_SAVENAME_LENGTH);
g_sci->_gfxControls->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite); g_sci->_gfxControls16->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite);
free(listEntries); free(listEntries);
delete[] listStrings; delete[] listStrings;
return; return;
@ -975,7 +975,10 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
switch (controlType) { switch (controlType) {
case SCI_CONTROLS_TYPE_TEXTEDIT: case SCI_CONTROLS_TYPE_TEXTEDIT:
// Only process textedit controls in here // Only process textedit controls in here
g_sci->_gfxControls->kernelTexteditChange(controlObject, eventObject); g_sci->_gfxControls16->kernelTexteditChange(controlObject, eventObject);
break;
default:
break;
} }
} }
return s->r_acc; return s->r_acc;

View file

@ -36,26 +36,26 @@
#include "sci/graphics/font.h" #include "sci/graphics/font.h"
#include "sci/graphics/screen.h" #include "sci/graphics/screen.h"
#include "sci/graphics/text16.h" #include "sci/graphics/text16.h"
#include "sci/graphics/controls.h" #include "sci/graphics/controls16.h"
namespace Sci { namespace Sci {
GfxControls::GfxControls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen) GfxControls16::GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen)
: _segMan(segMan), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen) { : _segMan(segMan), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen) {
init(); init();
} }
GfxControls::~GfxControls() { GfxControls16::~GfxControls16() {
} }
void GfxControls::init() { void GfxControls16::init() {
_texteditCursorVisible = false; _texteditCursorVisible = false;
} }
const char controlListUpArrow[2] = { 0x18, 0 }; const char controlListUpArrow[2] = { 0x18, 0 };
const char controlListDownArrow[2] = { 0x19, 0 }; const char controlListDownArrow[2] = { 0x19, 0 };
void GfxControls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) { void GfxControls16::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) {
Common::Rect workerRect = rect; Common::Rect workerRect = rect;
GuiResourceId oldFontId = _text16->GetFontId(); GuiResourceId oldFontId = _text16->GetFontId();
int16 oldPenColor = _ports->_curPort->penClr; int16 oldPenColor = _ports->_curPort->penClr;
@ -112,7 +112,7 @@ void GfxControls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars,
_text16->SetFont(oldFontId); _text16->SetFont(oldFontId);
} }
void GfxControls::texteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos) { void GfxControls16::texteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos) {
int16 textWidth, i; int16 textWidth, i;
if (!_texteditCursorVisible) { if (!_texteditCursorVisible) {
textWidth = 0; textWidth = 0;
@ -130,7 +130,7 @@ void GfxControls::texteditCursorDraw(Common::Rect rect, const char *text, uint16
} }
} }
void GfxControls::texteditCursorErase() { void GfxControls16::texteditCursorErase() {
if (_texteditCursorVisible) { if (_texteditCursorVisible) {
_paint16->invertRect(_texteditCursorRect); _paint16->invertRect(_texteditCursorRect);
_paint16->bitsShow(_texteditCursorRect); _paint16->bitsShow(_texteditCursorRect);
@ -139,11 +139,11 @@ void GfxControls::texteditCursorErase() {
texteditSetBlinkTime(); texteditSetBlinkTime();
} }
void GfxControls::texteditSetBlinkTime() { void GfxControls16::texteditSetBlinkTime() {
_texteditBlinkTime = g_system->getMillis() + (30 * 1000 / 60); _texteditBlinkTime = g_system->getMillis() + (30 * 1000 / 60);
} }
void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { void GfxControls16::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
uint16 cursorPos = readSelectorValue(_segMan, controlObject, SELECTOR(cursor)); uint16 cursorPos = readSelectorValue(_segMan, controlObject, SELECTOR(cursor));
uint16 maxChars = readSelectorValue(_segMan, controlObject, SELECTOR(max)); uint16 maxChars = readSelectorValue(_segMan, controlObject, SELECTOR(max));
reg_t textReference = readSelector(_segMan, controlObject, SELECTOR(text)); reg_t textReference = readSelector(_segMan, controlObject, SELECTOR(text));
@ -277,13 +277,13 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
writeSelectorValue(_segMan, controlObject, SELECTOR(cursor), cursorPos); writeSelectorValue(_segMan, controlObject, SELECTOR(cursor), cursorPos);
} }
int GfxControls::getPicNotValid() { int GfxControls16::getPicNotValid() {
if (getSciVersion() >= SCI_VERSION_1_1) if (getSciVersion() >= SCI_VERSION_1_1)
return _screen->_picNotValidSci11; return _screen->_picNotValidSci11;
return _screen->_picNotValid; return _screen->_picNotValid;
} }
void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) { void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
int16 sci0EarlyPen = 0, sci0EarlyBack = 0; int16 sci0EarlyPen = 0, sci0EarlyBack = 0;
if (!hilite) { if (!hilite) {
if (getSciVersion() == SCI_VERSION_0_EARLY) { if (getSciVersion() == SCI_VERSION_0_EARLY) {
@ -321,7 +321,7 @@ void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *tex
} }
} }
void GfxControls::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) { void GfxControls16::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) {
if (!hilite) { if (!hilite) {
rect.grow(1); rect.grow(1);
_paint16->eraseRect(rect); _paint16->eraseRect(rect);
@ -338,7 +338,7 @@ void GfxControls::kernelDrawText(Common::Rect rect, reg_t obj, const char *text,
} }
} }
void GfxControls::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) { void GfxControls16::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
Common::Rect textRect = rect; Common::Rect textRect = rect;
uint16 oldFontId = _text16->GetFontId(); uint16 oldFontId = _text16->GetFontId();
@ -359,7 +359,7 @@ void GfxControls::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *t
_paint16->bitsShow(rect); _paint16->bitsShow(rect);
} }
void GfxControls::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite) { void GfxControls16::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite) {
if (!hilite) { if (!hilite) {
_paint16->drawCelAndShow(viewId, loopNo, celNo, rect.left, rect.top, priority, 0); _paint16->drawCelAndShow(viewId, loopNo, celNo, rect.left, rect.top, priority, 0);
if (style & 0x20) { if (style & 0x20) {
@ -373,7 +373,7 @@ void GfxControls::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId vie
} }
} }
void GfxControls::kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) { void GfxControls16::kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
if (!hilite) { if (!hilite) {
drawListControl(rect, obj, maxChars, count, entries, fontId, upperPos, cursorPos, isAlias); drawListControl(rect, obj, maxChars, count, entries, fontId, upperPos, cursorPos, isAlias);
rect.grow(1); rect.grow(1);

View file

@ -20,8 +20,8 @@
* *
*/ */
#ifndef SCI_GRAPHICS_CONTROLS_H #ifndef SCI_GRAPHICS_CONTROLS16_H
#define SCI_GRAPHICS_CONTROLS_H #define SCI_GRAPHICS_CONTROLS16_H
namespace Sci { namespace Sci {
@ -50,10 +50,10 @@ class GfxScreen;
/** /**
* Controls class, handles drawing of controls in SCI16 (SCI0-SCI1.1) games * Controls class, handles drawing of controls in SCI16 (SCI0-SCI1.1) games
*/ */
class GfxControls { class GfxControls16 {
public: public:
GfxControls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen); GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen);
~GfxControls(); ~GfxControls16();
void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite);
void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite);

View file

@ -43,7 +43,7 @@ MODULE_OBJS := \
graphics/animate.o \ graphics/animate.o \
graphics/cache.o \ graphics/cache.o \
graphics/compare.o \ graphics/compare.o \
graphics/controls.o \ graphics/controls16.o \
graphics/coordadjuster.o \ graphics/coordadjuster.o \
graphics/cursor.o \ graphics/cursor.o \
graphics/font.o \ graphics/font.o \

View file

@ -46,7 +46,7 @@
#include "sci/graphics/animate.h" #include "sci/graphics/animate.h"
#include "sci/graphics/cache.h" #include "sci/graphics/cache.h"
#include "sci/graphics/compare.h" #include "sci/graphics/compare.h"
#include "sci/graphics/controls.h" #include "sci/graphics/controls16.h"
#include "sci/graphics/coordadjuster.h" #include "sci/graphics/coordadjuster.h"
#include "sci/graphics/cursor.h" #include "sci/graphics/cursor.h"
#include "sci/graphics/maciconbar.h" #include "sci/graphics/maciconbar.h"
@ -152,7 +152,7 @@ SciEngine::~SciEngine() {
delete _gfxFrameout; delete _gfxFrameout;
#endif #endif
delete _gfxMenu; delete _gfxMenu;
delete _gfxControls; delete _gfxControls16;
delete _gfxText16; delete _gfxText16;
delete _gfxAnimate; delete _gfxAnimate;
delete _gfxPaint; delete _gfxPaint;
@ -588,7 +588,7 @@ void SciEngine::initGraphics() {
_gfxAnimate = 0; _gfxAnimate = 0;
_gfxCache = 0; _gfxCache = 0;
_gfxCompare = 0; _gfxCompare = 0;
_gfxControls = 0; _gfxControls16 = 0;
_gfxCoordAdjuster = 0; _gfxCoordAdjuster = 0;
_gfxCursor = 0; _gfxCursor = 0;
_gfxMacIconBar = 0; _gfxMacIconBar = 0;
@ -636,7 +636,7 @@ void SciEngine::initGraphics() {
_gfxPaint = _gfxPaint16; _gfxPaint = _gfxPaint16;
_gfxAnimate = new GfxAnimate(_gamestate, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen, _gfxPalette, _gfxCursor, _gfxTransitions); _gfxAnimate = new GfxAnimate(_gamestate, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen, _gfxPalette, _gfxCursor, _gfxTransitions);
_gfxText16 = new GfxText16(_resMan, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen); _gfxText16 = new GfxText16(_resMan, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen);
_gfxControls = new GfxControls(_gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen); _gfxControls16 = new GfxControls16(_gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen);
_gfxMenu = new GfxMenu(_eventMan, _gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen, _gfxCursor); _gfxMenu = new GfxMenu(_eventMan, _gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen, _gfxCursor);
_gfxMenu->reset(); _gfxMenu->reset();

View file

@ -59,7 +59,7 @@ class SegManager;
class GfxAnimate; class GfxAnimate;
class GfxCache; class GfxCache;
class GfxCompare; class GfxCompare;
class GfxControls; class GfxControls16;
class GfxCoordAdjuster; class GfxCoordAdjuster;
class GfxCursor; class GfxCursor;
class GfxMacIconBar; class GfxMacIconBar;
@ -303,7 +303,7 @@ public:
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
GfxCache *_gfxCache; GfxCache *_gfxCache;
GfxCompare *_gfxCompare; GfxCompare *_gfxCompare;
GfxControls *_gfxControls; // Controls for 16-bit gfx GfxControls16 *_gfxControls16; // Controls for 16-bit gfx
GfxCoordAdjuster *_gfxCoordAdjuster; GfxCoordAdjuster *_gfxCoordAdjuster;
GfxCursor *_gfxCursor; GfxCursor *_gfxCursor;
GfxMenu *_gfxMenu; // Menu for 16-bit gfx GfxMenu *_gfxMenu; // Menu for 16-bit gfx