SCI: putting most kGraph functions into GfxPaint16
svn-id: r47887
This commit is contained in:
parent
822e59288f
commit
e74bd30a2e
6 changed files with 66 additions and 65 deletions
|
@ -271,27 +271,27 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||||
if (!s->resMan->isVGA() && !s->resMan->isAmiga32color())
|
if (!s->resMan->isVGA() && !s->resMan->isAmiga32color())
|
||||||
color &= 0x0F;
|
color &= 0x0F;
|
||||||
|
|
||||||
s->_gui->graphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
|
s->_gfxPaint16->kernelGraphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_GRAPH_SAVE_BOX:
|
case K_GRAPH_SAVE_BOX:
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
screenMask = (argc > 5) ? argv[5].toUint16() : 0;
|
screenMask = (argc > 5) ? argv[5].toUint16() : 0;
|
||||||
return s->_gui->graphSaveBox(rect, screenMask);
|
return s->_gfxPaint16->kernelGraphSaveBox(rect, screenMask);
|
||||||
|
|
||||||
case K_GRAPH_RESTORE_BOX:
|
case K_GRAPH_RESTORE_BOX:
|
||||||
// This may be called with a memoryhandle from SAVE_BOX or SAVE_UPSCALEDHIRES_BOX
|
// This may be called with a memoryhandle from SAVE_BOX or SAVE_UPSCALEDHIRES_BOX
|
||||||
s->_gui->graphRestoreBox(argv[1]);
|
s->_gfxPaint16->kernelGraphRestoreBox(argv[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_GRAPH_FILL_BOX_BACKGROUND:
|
case K_GRAPH_FILL_BOX_BACKGROUND:
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
s->_gui->graphFillBoxBackground(rect);
|
s->_gfxPaint16->kernelGraphFillBoxBackground(rect);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_GRAPH_FILL_BOX_FOREGROUND:
|
case K_GRAPH_FILL_BOX_FOREGROUND:
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
s->_gui->graphFillBoxForeground(rect);
|
s->_gfxPaint16->kernelGraphFillBoxForeground(rect);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_GRAPH_FILL_BOX_ANY:
|
case K_GRAPH_FILL_BOX_ANY:
|
||||||
|
@ -301,14 +301,14 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||||
colorMask = argv[5].toUint16();
|
colorMask = argv[5].toUint16();
|
||||||
|
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
s->_gui->graphFillBox(rect, colorMask, color, priority, control);
|
s->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case K_GRAPH_UPDATE_BOX: {
|
case K_GRAPH_UPDATE_BOX: {
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
bool hiresMode = (argc > 6) ? true : false;
|
bool hiresMode = (argc > 6) ? true : false;
|
||||||
// argc == 7 on upscaled hires
|
// argc == 7 on upscaled hires
|
||||||
s->_gui->graphUpdateBox(rect, hiresMode);
|
s->_gfxPaint16->kernelGraphUpdateBox(rect, hiresMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
|
||||||
case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:
|
case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:
|
||||||
rect = kGraphCreateRect(x, y, x1, y1);
|
rect = kGraphCreateRect(x, y, x1, y1);
|
||||||
return s->_gui->graphSaveUpscaledHiresBox(rect);
|
return s->_gfxPaint16->kernelGraphSaveUpscaledHiresBox(rect);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
warning("Unsupported kGraph() operation %04x", argv[0].toSint16());
|
warning("Unsupported kGraph() operation %04x", argv[0].toSint16());
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "sci/engine/state.h"
|
#include "sci/engine/state.h"
|
||||||
#include "sci/engine/selector.h"
|
#include "sci/engine/selector.h"
|
||||||
#include "sci/engine/kernel.h"
|
#include "sci/engine/kernel.h"
|
||||||
#include "sci/graphics/gui.h"
|
#include "sci/graphics/paint16.h"
|
||||||
#include "sci/graphics/palette.h"
|
#include "sci/graphics/palette.h"
|
||||||
|
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
|
@ -307,7 +307,7 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty
|
||||||
p2.y = CLIP<int16>(p2.y, 0, height - 1);
|
p2.y = CLIP<int16>(p2.y, 0, height - 1);
|
||||||
|
|
||||||
assert(type >= 0 && type <= 3);
|
assert(type >= 0 && type <= 3);
|
||||||
s->_gui->graphDrawLine(p1, p2, poly_colors[type], 255, 255);
|
s->_gfxPaint16->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_point(EngineState *s, Common::Point p, int start, int width, int height) {
|
static void draw_point(EngineState *s, Common::Point p, int start, int width, int height) {
|
||||||
|
@ -328,7 +328,7 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in
|
||||||
rect.right = CLIP<int16>(rect.right, 0, width - 1);
|
rect.right = CLIP<int16>(rect.right, 0, width - 1);
|
||||||
|
|
||||||
assert(start >= 0 && start <= 1);
|
assert(start >= 0 && start <= 1);
|
||||||
s->_gui->graphFrameBox(rect, point_colors[start]);
|
s->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) {
|
static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) {
|
||||||
|
@ -1417,7 +1417,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the whole screen
|
// Update the whole screen
|
||||||
s->_gui->graphUpdateBox(Common::Rect(0, 0, width - 1, height - 1), width > 320);
|
s->_gfxPaint16->kernelGraphUpdateBox(Common::Rect(0, 0, width - 1, height - 1), width > 320);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathfindingState *p = convert_polygon_set(s, poly_list, start, end, width, height, opt);
|
PathfindingState *p = convert_polygon_set(s, poly_list, start, end, width, height, opt);
|
||||||
|
|
|
@ -276,50 +276,6 @@ void SciGui::drawMenuBar(bool clear) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SciGui::graphFillBoxForeground(Common::Rect rect) {
|
|
||||||
_paint16->paintRect(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphFillBoxBackground(Common::Rect rect) {
|
|
||||||
_paint16->eraseRect(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
|
|
||||||
_paint16->fillRect(rect, colorMask, color, priority, control);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphFrameBox(Common::Rect rect, int16 color) {
|
|
||||||
int16 oldColor = _ports->getPort()->penClr;
|
|
||||||
_ports->penColor(color);
|
|
||||||
_paint16->frameRect(rect);
|
|
||||||
_ports->penColor(oldColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
|
|
||||||
_ports->offsetLine(startPoint, endPoint);
|
|
||||||
_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
|
|
||||||
}
|
|
||||||
|
|
||||||
reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 screenMask) {
|
|
||||||
return _paint16->bitsSave(rect, screenMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
reg_t SciGui::graphSaveUpscaledHiresBox(Common::Rect rect) {
|
|
||||||
return _paint16->bitsSave(rect, SCI_SCREEN_MASK_DISPLAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphRestoreBox(reg_t handle) {
|
|
||||||
_paint16->bitsRestore(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphUpdateBox(Common::Rect rect, bool hiresMode) {
|
|
||||||
// some calls are hiresMode even under kq6 DOS, that's why we check for upscaled hires here
|
|
||||||
if ((!hiresMode) || (!_screen->getUpscaledHires()))
|
|
||||||
_paint16->bitsShow(rect);
|
|
||||||
else
|
|
||||||
_paint16->bitsShowHires(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SciGui::graphRedrawBox(Common::Rect rect) {
|
void SciGui::graphRedrawBox(Common::Rect rect) {
|
||||||
localToGlobal(&rect.left, &rect.top);
|
localToGlobal(&rect.left, &rect.top);
|
||||||
localToGlobal(&rect.right, &rect.bottom);
|
localToGlobal(&rect.right, &rect.bottom);
|
||||||
|
|
|
@ -76,15 +76,6 @@ public:
|
||||||
virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack);
|
virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack);
|
||||||
virtual void drawMenuBar(bool clear);
|
virtual void drawMenuBar(bool clear);
|
||||||
|
|
||||||
virtual void graphFillBoxForeground(Common::Rect rect);
|
|
||||||
virtual void graphFillBoxBackground(Common::Rect rect);
|
|
||||||
virtual void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
|
|
||||||
virtual void graphFrameBox(Common::Rect rect, int16 color);
|
|
||||||
virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
|
|
||||||
virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
|
|
||||||
virtual reg_t graphSaveUpscaledHiresBox(Common::Rect rect);
|
|
||||||
virtual void graphRestoreBox(reg_t handle);
|
|
||||||
virtual void graphUpdateBox(Common::Rect rect, bool hiresMode);
|
|
||||||
virtual void graphRedrawBox(Common::Rect rect);
|
virtual void graphRedrawBox(Common::Rect rect);
|
||||||
virtual void graphAdjustPriority(int top, int bottom);
|
virtual void graphAdjustPriority(int top, int bottom);
|
||||||
|
|
||||||
|
|
|
@ -356,4 +356,48 @@ void GfxPaint16::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo,
|
||||||
_palette->setOnScreen();
|
_palette->setOnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphFillBoxForeground(Common::Rect rect) {
|
||||||
|
paintRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphFillBoxBackground(Common::Rect rect) {
|
||||||
|
eraseRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
|
||||||
|
fillRect(rect, colorMask, color, priority, control);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphFrameBox(Common::Rect rect, int16 color) {
|
||||||
|
int16 oldColor = _ports->getPort()->penClr;
|
||||||
|
_ports->penColor(color);
|
||||||
|
frameRect(rect);
|
||||||
|
_ports->penColor(oldColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
|
||||||
|
_ports->offsetLine(startPoint, endPoint);
|
||||||
|
_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
|
||||||
|
}
|
||||||
|
|
||||||
|
reg_t GfxPaint16::kernelGraphSaveBox(Common::Rect rect, uint16 screenMask) {
|
||||||
|
return bitsSave(rect, screenMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
reg_t GfxPaint16::kernelGraphSaveUpscaledHiresBox(Common::Rect rect) {
|
||||||
|
return bitsSave(rect, SCI_SCREEN_MASK_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphRestoreBox(reg_t handle) {
|
||||||
|
bitsRestore(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GfxPaint16::kernelGraphUpdateBox(Common::Rect rect, bool hiresMode) {
|
||||||
|
// some calls are hiresMode even under kq6 DOS, that's why we check for upscaled hires here
|
||||||
|
if ((!hiresMode) || (!_screen->getUpscaledHires()))
|
||||||
|
bitsShow(rect);
|
||||||
|
else
|
||||||
|
bitsShowHires(rect);
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
|
@ -72,6 +72,16 @@ public:
|
||||||
void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo);
|
void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo);
|
||||||
void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle);
|
void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle);
|
||||||
|
|
||||||
|
void kernelGraphFillBoxForeground(Common::Rect rect);
|
||||||
|
void kernelGraphFillBoxBackground(Common::Rect rect);
|
||||||
|
void kernelGraphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
|
||||||
|
void kernelGraphFrameBox(Common::Rect rect, int16 color);
|
||||||
|
void kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
|
||||||
|
reg_t kernelGraphSaveBox(Common::Rect rect, uint16 flags);
|
||||||
|
reg_t kernelGraphSaveUpscaledHiresBox(Common::Rect rect);
|
||||||
|
void kernelGraphRestoreBox(reg_t handle);
|
||||||
|
void kernelGraphUpdateBox(Common::Rect rect, bool hiresMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResourceManager *_resMan;
|
ResourceManager *_resMan;
|
||||||
SegManager *_segMan;
|
SegManager *_segMan;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue