SCI21: Added some skeleton code for offsetting pictures vertically (not working yet). Some cleanup
This commit is contained in:
parent
632df09761
commit
75fb3b4ef8
3 changed files with 18 additions and 15 deletions
|
@ -1322,10 +1322,10 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
|
||||||
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
|
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
|
||||||
reg_t planeObj = argv[0];
|
reg_t planeObj = argv[0];
|
||||||
GuiResourceId pictureId = argv[1].toUint16();
|
GuiResourceId pictureId = argv[1].toUint16();
|
||||||
int16 forWidth = argv[2].toSint16();
|
int16 pictureX = argv[2].toSint16();
|
||||||
// argv[3] seems to be 0 most of the time
|
int16 pictureY = argv[3].toSint16();
|
||||||
|
|
||||||
g_sci->_gfxFrameout->kernelAddPicAt(planeObj, forWidth, pictureId);
|
g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY);
|
||||||
return s->r_acc;
|
return s->r_acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1334,12 +1334,7 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
|
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
|
||||||
// This kernel call likely seems to be doing the screen updates,
|
|
||||||
// as its called right after a view is updated
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
g_sci->_gfxFrameout->kernelFrameout();
|
g_sci->_gfxFrameout->kernelFrameout();
|
||||||
|
|
||||||
return NULL_REG;
|
return NULL_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,12 +198,13 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX) {
|
void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY) {
|
||||||
PlanePictureEntry newPicture;
|
PlanePictureEntry newPicture;
|
||||||
newPicture.object = object;
|
newPicture.object = object;
|
||||||
newPicture.pictureId = pictureId;
|
newPicture.pictureId = pictureId;
|
||||||
newPicture.picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false);
|
newPicture.picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false);
|
||||||
newPicture.startX = startX;
|
newPicture.startX = startX;
|
||||||
|
newPicture.startY = startY;
|
||||||
newPicture.pictureCels = 0;
|
newPicture.pictureCels = 0;
|
||||||
_planePictures.push_back(newPicture);
|
_planePictures.push_back(newPicture);
|
||||||
}
|
}
|
||||||
|
@ -275,9 +276,8 @@ int16 GfxFrameout::kernelGetHighPlanePri() {
|
||||||
return readSelectorValue(g_sci->getEngineState()->_segMan, _planes.back().object, SELECTOR(priority));
|
return readSelectorValue(g_sci->getEngineState()->_segMan, _planes.back().object, SELECTOR(priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: No idea yet how to implement this
|
void GfxFrameout::kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY) {
|
||||||
void GfxFrameout::kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId) {
|
addPlanePicture(planeObj, pictureId, pictureX, pictureY);
|
||||||
addPlanePicture(planeObj, pictureId, forWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) {
|
bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) {
|
||||||
|
@ -403,6 +403,7 @@ void GfxFrameout::kernelFrameout() {
|
||||||
picEntry->y = planePicture->getSci32celY(pictureCelNr);
|
picEntry->y = planePicture->getSci32celY(pictureCelNr);
|
||||||
picEntry->x = planePicture->getSci32celX(pictureCelNr);
|
picEntry->x = planePicture->getSci32celX(pictureCelNr);
|
||||||
picEntry->picStartX = pictureIt->startX;
|
picEntry->picStartX = pictureIt->startX;
|
||||||
|
picEntry->picStartY = pictureIt->startY;
|
||||||
|
|
||||||
picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
|
picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
|
||||||
|
|
||||||
|
@ -425,8 +426,9 @@ void GfxFrameout::kernelFrameout() {
|
||||||
itemEntry->y = ((itemEntry->y * _screen->getHeight()) / scriptsRunningHeight);
|
itemEntry->y = ((itemEntry->y * _screen->getHeight()) / scriptsRunningHeight);
|
||||||
itemEntry->x = ((itemEntry->x * _screen->getWidth()) / scriptsRunningWidth);
|
itemEntry->x = ((itemEntry->x * _screen->getWidth()) / scriptsRunningWidth);
|
||||||
itemEntry->picStartX = ((itemEntry->picStartX * _screen->getWidth()) / scriptsRunningWidth);
|
itemEntry->picStartX = ((itemEntry->picStartX * _screen->getWidth()) / scriptsRunningWidth);
|
||||||
|
itemEntry->picStartY = ((itemEntry->picStartY * _screen->getHeight()) / scriptsRunningHeight);
|
||||||
|
|
||||||
// Out of view
|
// Out of view horizontally (sanity checks)
|
||||||
int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x;
|
int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x;
|
||||||
int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo);
|
int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo);
|
||||||
int16 planeStartX = it->planeOffsetX;
|
int16 planeStartX = it->planeOffsetX;
|
||||||
|
@ -436,6 +438,9 @@ void GfxFrameout::kernelFrameout() {
|
||||||
if (pictureCelStartX > planeEndX)
|
if (pictureCelStartX > planeEndX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Out of view vertically (sanity checks)
|
||||||
|
// TODO
|
||||||
|
|
||||||
int16 pictureOffsetX = it->planeOffsetX;
|
int16 pictureOffsetX = it->planeOffsetX;
|
||||||
int16 pictureX = itemEntry->x;
|
int16 pictureX = itemEntry->x;
|
||||||
if ((it->planeOffsetX) || (itemEntry->picStartX)) {
|
if ((it->planeOffsetX) || (itemEntry->picStartX)) {
|
||||||
|
@ -447,6 +452,7 @@ void GfxFrameout::kernelFrameout() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: pictureOffsetY
|
||||||
itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, it->planePictureMirrored);
|
itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, it->planePictureMirrored);
|
||||||
// warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority);
|
// warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ struct FrameoutEntry {
|
||||||
Common::Rect celRect;
|
Common::Rect celRect;
|
||||||
GfxPicture *picture;
|
GfxPicture *picture;
|
||||||
int16 picStartX;
|
int16 picStartX;
|
||||||
|
int16 picStartY;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Common::List<FrameoutEntry *> FrameoutList;
|
typedef Common::List<FrameoutEntry *> FrameoutList;
|
||||||
|
@ -65,6 +66,7 @@ typedef Common::List<FrameoutEntry *> FrameoutList;
|
||||||
struct PlanePictureEntry {
|
struct PlanePictureEntry {
|
||||||
reg_t object;
|
reg_t object;
|
||||||
int16 startX;
|
int16 startX;
|
||||||
|
int16 startY;
|
||||||
GuiResourceId pictureId;
|
GuiResourceId pictureId;
|
||||||
GfxPicture *picture;
|
GfxPicture *picture;
|
||||||
FrameoutEntry *pictureCels; // temporary
|
FrameoutEntry *pictureCels; // temporary
|
||||||
|
@ -93,10 +95,10 @@ public:
|
||||||
void kernelUpdateScreenItem(reg_t object);
|
void kernelUpdateScreenItem(reg_t object);
|
||||||
void kernelDeleteScreenItem(reg_t object);
|
void kernelDeleteScreenItem(reg_t object);
|
||||||
int16 kernelGetHighPlanePri();
|
int16 kernelGetHighPlanePri();
|
||||||
void kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId);
|
void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY);
|
||||||
void kernelFrameout();
|
void kernelFrameout();
|
||||||
|
|
||||||
void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX);
|
void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY = 0);
|
||||||
void deletePlanePictures(reg_t object);
|
void deletePlanePictures(reg_t object);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue