mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
DREAMWEB: Better API for 'showframe' and no more registers used (expect es:bx for diffdest blitting)
This commit is contained in:
parent
2d0dfffe00
commit
b2748740db
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user