Add centreScroll() for FF and hyperbox code differences in FF.

svn-id: r21712
This commit is contained in:
Travis Howell 2006-04-09 04:53:31 +00:00
parent a74fcf7cee
commit 202406e31b
7 changed files with 69 additions and 14 deletions

View file

@ -183,7 +183,7 @@ void SimonEngine::renderString(uint vga_sprite_id, uint color, uint width, uint
VgaPointersEntry *vpe = &_vgaBufferPointers[2];
byte *src, *dst, *p, *dst_org, chr;
const int textHeight = (getGameType() == GType_FF) ? 15: 10;
uint count;
uint count = 0;
if (vga_sprite_id >= 100) {
vga_sprite_id -= 100;
@ -192,9 +192,14 @@ void SimonEngine::renderString(uint vga_sprite_id, uint color, uint width, uint
src = dst = vpe->vgaFile2;
count = 4000;
if (vga_sprite_id == 1)
count *= 2;
if (getGameType() == GType_FF) {
if (vga_sprite_id == 1)
count = 11025;
} else {
count = 4000;
if (vga_sprite_id == 1)
count *= 2;
}
p = dst + vga_sprite_id * 8;
@ -207,7 +212,9 @@ void SimonEngine::renderString(uint vga_sprite_id, uint color, uint width, uint
}
dst += readUint32Wrapper(p);
memset(dst, 0, count);
if (count != 0)
memset(dst, 0, count);
if (_language == Common::HB_ISR)
dst += width - 1; // For Hebrew, start at the right edge, not the left.

View file

@ -1512,7 +1512,7 @@ void SimonEngine::o3_playSmack() {
void SimonEngine::o3_centreScroll() {
// 187
warning("STUB: script opcode 187");
centreScroll();
}
void SimonEngine::o3_resetPVCount() {

View file

@ -1554,6 +1554,7 @@ void SimonEngine::o_setup_cond_c() {
void SimonEngine::setup_cond_c_helper() {
HitArea *last;
uint id;
_noRightClick = 1;
@ -1644,7 +1645,14 @@ void SimonEngine::setup_cond_c_helper() {
inventoryDown(_lastHitArea->window);
} else if (_lastHitArea->item_ptr != NULL) {
_hitAreaObjectItem = _lastHitArea->item_ptr;
_variableArray[60] = (_lastHitArea->flags & kBFTextBox) ? (_lastHitArea->flags / 256) : 0xFFFF;
id = 0xFFFF;
if (_lastHitArea->flags & kBFTextBox) {
if (getGameType() == GType_FF && (_lastHitArea->flags & kBFHyperBox))
id = _lastHitArea->data;
else
id = _lastHitArea->flags / 256;
}
_variableArray[60] = id;
break;
}
}
@ -1950,8 +1958,12 @@ startOver:
if_1:;
_hitAreaSubjectItem = ha->item_ptr;
id = 0xFFFF;
if (ha->flags & kBFTextBox)
id = ha->flags / 256;
if (ha->flags & kBFTextBox) {
if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
id = ha->data;
else
id = ha->flags / 256;
}
_variableArray[60] = id;
displayName(ha);
if (_verbHitArea != 0)

View file

@ -67,6 +67,7 @@ struct HitArea {
uint16 width, height;
uint16 flags;
uint16 id;
uint16 data;
WindowBlock *window;
Item *item_ptr;
uint16 verb;
@ -1015,6 +1016,7 @@ protected:
int getScale(int y, int x);
void checkScrollX(int x, int xpos);
void checkScrollY(int y, int ypos);
void centreScroll();
bool itemIsSiblingOf(uint16 val);
bool itemIsParentOf(uint16 a, uint16 b);

View file

@ -125,8 +125,6 @@ bool SimonEngine::printNameOf(Item *item, uint x, uint y) {
}
void SimonEngine::printInteractText(uint16 num, const char *string) {
printf("printInteractText: num %d, string %s\n", num, string);
char convertedString[320];
char *convertedString2 = convertedString;
const char *string2 = string;

View file

@ -396,7 +396,7 @@ void SimonEngine::defineBox(int id, int x, int y, int width, int height, int fla
ha->item_ptr = item_ptr;
if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
// TODO
ha->data = _hyperLink;
ha->priority = 50;
}

View file

@ -2424,8 +2424,8 @@ void SimonEngine::vc78_computeXY() {
vsp->y = posy;
setBitFlag(85, false);
if (getBitFlag(74) == true) {
//centreScroll();
if (getBitFlag(74)) {
centreScroll();
}
}
@ -2569,4 +2569,40 @@ void SimonEngine::checkScrollY(int y, int ypos) {
}
}
void SimonEngine::centreScroll() {
int16 x, y, tmp;
if (_scrollXMax != 0) {
_scrollCount = 0;
x = _variableArray[15] - _scrollX;
if (getBitFlag(85) || x >= 624) {
x -= 320;
tmp = _scrollXMax - _scrollX;
if (tmp < x)
x = tmp;
_scrollCount = x;
} else if (x < 17) {
x -= 320;
if (_scrollX < -x)
x = -_scrollX;
_scrollCount = x;
}
} else if (_scrollYMax != 0) {
_scrollCount = 0;
y = _variableArray[16] - _scrollY;
if (y >= 460) {
y -= 240;
tmp = _scrollYMax - _scrollY;
if (tmp < y)
y = tmp;
_scrollCount = y;
} else if (y < 30) {
y -= 240;
if (_scrollY < -y)
y = -_scrollY;
_scrollCount = y;
}
}
}
} // End of namespace Simon