diff options
author | Bertrand Augereau | 2011-07-30 15:04:25 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-07-30 15:04:25 +0200 |
commit | b2748740dbf5c9a8d7b648428d005e102ae41d7e (patch) | |
tree | 243ea8d3250f03f91d37513b6d96ced1c44c3d4a /engines/dreamweb | |
parent | 2d0dfffe00628125da8aa43ebe188377ab9331f7 (diff) | |
download | scummvm-rg350-b2748740dbf5c9a8d7b648428d005e102ae41d7e.tar.gz scummvm-rg350-b2748740dbf5c9a8d7b648428d005e102ae41d7e.tar.bz2 scummvm-rg350-b2748740dbf5c9a8d7b648428d005e102ae41d7e.zip |
DREAMWEB: Better API for 'showframe' and no more registers used (expect es:bx for diffdest blitting)
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/print.cpp | 3 | ||||
-rw-r--r-- | engines/dreamweb/sprite.cpp | 7 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 4 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 4 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 12 |
5 files changed, 15 insertions, 15 deletions
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 882b4578ce..d29a073960 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -90,7 +90,8 @@ void DreamGenContext::printchar(uint16 src, uint16* x, uint16 y, uint8 c, uint8 if (data.byte(kForeignrelease) != 0) y -= 3; uint16 tmp = c - 32 + data.word(kCharshift); - showframe(src, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height); + ds = src; + showframe(ds.ptr(0, 0), *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height); di = pop(); si = pop(); _cmp(data.byte(kKerning), 0); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 9987224cd7..9b8b060475 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -70,14 +70,15 @@ void DreamGenContext::printasprite(const Sprite *sprite) { else c = 0; uint8 width, height; - showframe(READ_LE_UINT16(&sprite->w6), x, y, sprite->b15, c, &width, &height); + ds = sprite->frameData(); + showframe(ds.ptr(0, 0), x, y, sprite->b15, c, &width, &height); } void DreamGenContext::clearsprites() { memset(spritetable(), 0xff, sizeof(Sprite) * 16); } -Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 somethingInDx, uint16 somethingInDi) { +Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) { Sprite *sprite = spritetable(); while (sprite->b15 != 0xff) { // NB: No boundchecking in the original code either ++sprite; @@ -86,7 +87,7 @@ Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uin sprite->setUpdateCallback(updateCallback); sprite->x = x; sprite->y = y; - WRITE_LE_UINT16(&sprite->w6, somethingInDx); + sprite->setFrameData(frameData); WRITE_LE_UINT16(&sprite->w8, somethingInDi); sprite->w2 = 0xffff; sprite->b15 = 0; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 0e0215f126..917c83b745 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -28,7 +28,9 @@ struct Sprite { void setUpdateCallback(uint16 v) { WRITE_LE_UINT16(&_updateCallback, v); } uint16 w2; uint16 w4; - uint16 w6; + uint16 _frameData; + uint16 frameData() const { return READ_LE_UINT16(&_frameData); } + void setFrameData(uint16 v) { WRITE_LE_UINT16(&_frameData, v); } uint16 w8; uint8 x; uint8 y; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0ae76419e9..cb0a87c22e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -58,7 +58,7 @@ uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width); Sprite *spritetable(); void showframe(); - void showframe(uint16 src, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); + void showframe(const void *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); void printasprite(const Sprite *sprite); void width160(); void multiput(uint16 x, uint16 y, uint8 width, uint8 height); @@ -66,7 +66,7 @@ void eraseoldobs(); void clearsprites(); void makesprite(); - Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 somethingInDx, uint16 somethingInDi); + Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi); void spriteupdate(); void initman(); void mainman(Sprite *sprite); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index b10ef811b3..e1622d69af 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -317,11 +317,8 @@ void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint } } -void DreamGenContext::showframe(uint16 src, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { - ds = src; - ah = effectsFlag; - - const Frame *frame = (const Frame *)ds.ptr(frameNumber * sizeof(Frame), 6); +void DreamGenContext::showframe(const void *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { + const Frame *frame = ((const Frame *)frameData) + frameNumber; if ((frame->width == 0) && (frame->height == 0)) { *width = 0; *height = 0; @@ -337,8 +334,7 @@ void DreamGenContext::showframe(uint16 src, uint16 x, uint16 y, uint16 frameNumb *width = frame->width; *height = frame->height; - si = frame->ptr() + 2080; - const uint8 *pSrc = ds.ptr(si, *width * *height); + const uint8 *pSrc = ((const uint8 *)frameData) + frame->ptr() + 2080; if (effectsFlag) { if (effectsFlag & 128) { //centred @@ -378,7 +374,7 @@ void DreamGenContext::showframe(uint16 src, uint16 x, uint16 y, uint16 frameNumb void DreamGenContext::showframe() { uint8 width, height; - showframe(ds, di, bx, ax & 0x1ff, ah & 0xfe, &width, &height); + showframe(ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height); cl = width; ch = height; } |