aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-11-18 13:47:47 +0000
committerTravis Howell2005-11-18 13:47:47 +0000
commit95a45fc7a05430e0952d5dc8e61a091bb10494ed (patch)
tree0ca3eeae892ad4b577e3c206612f71c13de90fbb
parent7f8222cd981950b5e32a51afdd7311a85fa6d966 (diff)
downloadscummvm-rg350-95a45fc7a05430e0952d5dc8e61a091bb10494ed.tar.gz
scummvm-rg350-95a45fc7a05430e0952d5dc8e61a091bb10494ed.tar.bz2
scummvm-rg350-95a45fc7a05430e0952d5dc8e61a091bb10494ed.zip
Set scale in FF.
svn-id: r19640
-rw-r--r--simon/simon.h2
-rw-r--r--simon/vga.cpp43
2 files changed, 33 insertions, 12 deletions
diff --git a/simon/simon.h b/simon/simon.h
index 5ee7ff9514..457fb4616f 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -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);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index c8b57e2253..71ded468ef 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -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() {