aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/animation_he.h1
-rw-r--r--engines/scumm/he/logic/football.cpp101
-rw-r--r--engines/scumm/he/script_v100he.cpp3
-rw-r--r--engines/scumm/he/script_v60he.cpp4
-rw-r--r--engines/scumm/he/wiz_he.cpp6
5 files changed, 104 insertions, 11 deletions
diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h
index 7fa31a195d..e17c1b9a39 100644
--- a/engines/scumm/he/animation_he.h
+++ b/engines/scumm/he/animation_he.h
@@ -55,7 +55,6 @@ private:
Video::VideoDecoder *_video;
- char baseName[40];
uint32 _flags;
uint32 _wizResNum;
};
diff --git a/engines/scumm/he/logic/football.cpp b/engines/scumm/he/logic/football.cpp
index b405d634a4..ea990ca86b 100644
--- a/engines/scumm/he/logic/football.cpp
+++ b/engines/scumm/he/logic/football.cpp
@@ -218,10 +218,10 @@ int LogicHEfootball::nextPoint(int32 *args) {
if (res >= (double)args[6]) {
var8 = (double)args[6] * var8 / res;
var10 = (double)args[6] * var10 / res;
- res = (double)args[6] * var6 / res;
+ var6 = (double)args[6] * var6 / res;
}
- writeScummVar(108, (int32)res);
+ writeScummVar(108, (int32)var6);
writeScummVar(109, (int32)var10);
writeScummVar(110, (int32)var8);
@@ -297,6 +297,15 @@ private:
int initScreenTranslations();
int getPlaybookFiles(int32 *args);
int largestFreeBlock();
+
+ float _var0;
+ float _var1;
+ float _var2;
+ float _var3;
+ float _var4;
+ float _angle;
+ int32 _maxX;
+ int32 _minX;
};
int32 LogicHEfootball2002::dispatch(int op, int numArgs, int32 *args) {
@@ -325,8 +334,16 @@ int32 LogicHEfootball2002::dispatch(int op, int numArgs, int32 *args) {
res = 1;
break;
+ case 1030:
+ // Get Computer Name (online play only)
+ break;
+
+ case 1515:
+ // Initialize Session (online play only)
+ break;
+
case 1516:
- // Start auto LAN game
+ // Start auto LAN game (online play only)
break;
default:
@@ -338,13 +355,74 @@ int32 LogicHEfootball2002::dispatch(int op, int numArgs, int32 *args) {
}
int LogicHEfootball2002::translateWorldToScreen(int32 *args) {
- // TODO: Implement modified 2002 version
- return LogicHEfootball::translateWorldToScreen(args);
+ // While this performs the same task as football's 1006 opcode,
+ // the implementation is different. Note that this is also the
+ // same as basketball's 1006 opcode with different constants!
+
+ double v9;
+ if (args[1] >= _minX) {
+ if (args[1] < _maxX) {
+ v9 = (sqrt(_var1 + args[1]) - sqrt(_var1)) / sqrt(_var0);
+ } else {
+ double v10 = sqrt(_var0 * (_maxX + _var1));
+ v9 = 1.0 / (v10 + v10) * (args[1] - _maxX) + 451.0;
+ }
+ } else {
+ double v8 = sqrt(_var0 * (_minX + _var1));
+ v9 = 1.0 / (v8 + v8) * (args[1] - _minX) - 29.0;
+ }
+
+ double v11 = tan(_angle);
+ double v12, v13;
+
+ if (v9 >= -29.0) {
+ if (v9 >= 451.0) {
+ v12 = 1517.0 - (451.0 / v11 + 451.0 / v11);
+ v13 = tan(1.570796326794895 - _angle) * 451.0;
+ } else {
+ v12 = 1517.0 - (v9 / v11 + v9 / v11);
+ v13 = tan(1.570796326794895 - _angle) * v9;
+ }
+ } else {
+ v12 = 1517.0 - (-29.0 / v11 + -29.0 / v11);
+ v13 = tan(1.570796326794895 - _angle) * -29.0;
+ }
+
+ writeScummVar(108, scummRound(v12 * args[0] / 12200.0 + v13 + 41.0));
+ writeScummVar(109, scummRound(611.0 - v9 - v12 * args[2] / 12200.0));
+
+ return 1;
}
int LogicHEfootball2002::translateScreenToWorld(int32 *args) {
- // TODO: Implement modified 2002 version
- return LogicHEfootball::translateScreenToWorld(args);
+ // While this performs the same task as football's 1010 opcode,
+ // the implementation is different. Note that this is also the
+ // same as basketball's 1010 opcode with different constants!
+
+ double v15 = 611.0 - args[1];
+ double v5 = tan(_angle);
+ double v4, v6, v7;
+
+ if (v15 >= -29.0) {
+ if (v15 >= 451.0) {
+ v4 = (_var2 * 902.0 + _var3) * (v15 - 451.0) + _maxX;
+ v6 = 1517.0 - (451.0 / v5 + 451.0 / v5);
+ v7 = tan(1.570796326794895 - _angle) * 451.0;
+ } else {
+ v4 = (v15 * _var2 + _var3) * v15 + _var4;
+ v6 = 1517.0 - (v15 / v5 + v15 / v5);
+ v7 = tan(1.570796326794895 - _angle) * v15;
+ }
+ } else {
+ v4 = (_var3 - _var2 * 58.0) * (v15 - -29.0) + _minX;
+ v6 = 1517.0 - (-29.0 / v5 + -29.0 / v5);
+ v7 = tan(1.570796326794895 - _angle) * -29.0;
+ }
+
+ writeScummVar(108, scummRound((args[0] - (v7 + 41.0)) * (12200.0 / v6)));
+ writeScummVar(109, scummRound(v4));
+
+ return 1;
}
int LogicHEfootball2002::getDayOfWeek() {
@@ -358,7 +436,14 @@ int LogicHEfootball2002::getDayOfWeek() {
}
int LogicHEfootball2002::initScreenTranslations() {
- // TODO: Set values used by translateWorldToScreen/translateScreenToWorld
+ // Set values used by translateWorldToScreen/translateScreenToWorld
+ _var0 = _var2 = 0.0029172597f;
+ _var1 = 4896.3755f;
+ _var3 = 7.5588355f;
+ _var4 = 0.0f;
+ _angle = (float)atan(2.899280575539569);
+ _maxX = 4002;
+ _minX = -217;
return 1;
}
diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index a2eb42214b..b024154c7f 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -2237,7 +2237,10 @@ void ScummEngine_v100he::o100_videoOps() {
switch (subOp) {
case 0:
memset(_videoParams.filename, 0, sizeof(_videoParams.filename));
+ _videoParams.status = 0;
+ _videoParams.flags = 0;
_videoParams.unk2 = pop();
+ _videoParams.wizResNum = 0;
break;
case 19:
_videoParams.status = 19;
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index 5e359385b6..bbd8725904 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -804,7 +804,7 @@ void ScummEngine_v60he::o60_readFile() {
int val;
// Fatty Bear uses positive values
- if (_game.platform == Common::kPlatformPC && _game.id == GID_FBEAR)
+ if (_game.platform == Common::kPlatformDOS && _game.id == GID_FBEAR)
size = -size;
assert(_hInFileTable[slot]);
@@ -834,7 +834,7 @@ void ScummEngine_v60he::o60_writeFile() {
int slot = pop();
// Fatty Bear uses positive values
- if (_game.platform == Common::kPlatformPC && _game.id == GID_FBEAR)
+ if (_game.platform == Common::kPlatformDOS && _game.id == GID_FBEAR)
size = -size;
assert(_hOutFileTable[slot]);
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 798f703db6..ca360803bd 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1548,12 +1548,18 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
if (rScreen.intersects(clip)) {
rScreen.clip(clip);
} else {
+ if (flags & kWIFBlitToMemBuffer)
+ free(dst);
+
return 0;
}
} else if (_rectOverrideEnabled) {
if (rScreen.intersects(_rectOverride)) {
rScreen.clip(_rectOverride);
} else {
+ if (flags & kWIFBlitToMemBuffer)
+ free(dst);
+
return 0;
}
}