Set scale in FF.

svn-id: r19640
This commit is contained in:
Travis Howell 2005-11-18 13:47:47 +00:00
parent 7f8222cd98
commit 95a45fc7a0
2 changed files with 33 additions and 12 deletions

View File

@ -767,6 +767,8 @@ protected:
void vc_write_var(uint var, int16 value);
void vc_skip_next_instruction();
int getScale(int y, int x);
bool itemIsSiblingOf(uint16 val);
bool itemIsParentOf(uint16 a, uint16 b);
bool vc_maybe_skip_proc_1(uint16 a, int16 b);

View File

@ -2051,8 +2051,30 @@ void SimonEngine::vc74_clearMark() {
_marks &= ~(1 << vc_read_next_byte());
}
int SimonEngine::getScale(int y, int x) {
int z;
if (y > _baseY) {
return((int)(x * (1 + ((y - _baseY) * _scale))));
} else {
if (x == 0)
return(0);
if (x < 0) {
z = ((int)((x * (1 - ((_baseY - y)* _scale))) - 0.5));
if (z >- 2)
return(-2);
return(z);
}
z=((int)((x * (1 - ((_baseY-y) * _scale))) + 0.5));
if (z < 2)
return(2);
return(z);
}
}
void SimonEngine::vc75_setScale() {
// Set scale
_baseY = vc_read_next_word();
_scale = (float)vc_read_next_word() / 1000000.;
}
@ -2060,33 +2082,30 @@ void SimonEngine::vc75_setScale() {
void SimonEngine::vc76_setScaleXOffs() {
VgaSprite *vsp = find_cur_sprite();
// Scale X related
vsp->image = vc_read_next_word();
int16 xoffs = vc_read_next_word();
int var = vc_read_next_word();
vsp->x += xoffs;
vsp->flags = 0x40;
vsp->x += getScale(vsp->x, xoffs);
_variableArray[var] = vsp->x;
debug(0, "STUB: vc76_setScaleXOffs: image %d xoffs %d var %d", vsp->image, xoffs, var);
if (_scrollXMax) {
// TODO: Scroll check
}
vsp->flags = 0x40;
}
void SimonEngine::vc77_setScaleYOffs() {
VgaSprite *vsp = find_cur_sprite();
// Scale Y related
vsp->image = vc_read_next_word();
int16 yoffs = vc_read_next_word();
int var = vc_read_next_word();
vsp->y += yoffs;
vsp->flags = 0x40;
vsp->y += getScale(vsp->y, yoffs);
_variableArray[var] = vsp->y;
debug(0, "STUB: vc77_setScaleYOffs: image %d yoffs %d var %d", vsp->image, yoffs, var);
vsp->flags = 0x40;
}
void SimonEngine::vc78_computeXY() {