[Scummvm-cvs-logs] CVS: scummvm/scumm logic_he.cpp,NONE,2.1 logic_he.h,NONE,2.1 intern.h,2.477,2.478 module.mk,1.49,1.50 script_v90he.cpp,2.246,2.247 scumm.cpp,1.490,1.491 scumm.h,1.618,1.619 vars.cpp,1.131,1.132
Eugene Sandulenko
sev at users.sourceforge.net
Sat May 7 20:09:15 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8141
Modified Files:
intern.h module.mk script_v90he.cpp scumm.cpp scumm.h vars.cpp
Added Files:
logic_he.cpp logic_he.h
Log Message:
Initial support for intensive floating point compuitations used in
Putt-Putt Race. Still incomplete.
--- NEW FILE: logic_he.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/logic_he.cpp,v 2.1 2005/05/08 03:08:01 sev Exp $
*
*/
#include "stdafx.h"
#include "scumm/intern.h"
#include "scumm/logic_he.h"
namespace Scumm {
/***********************
* Putt-Putt Joins the Race
*
*/
LogicHE::LogicHE(ScummEngine *vm) : _vm(vm) {
_userData = (float *)calloc(0x930, 1);
}
LogicHE::~LogicHE() {
free(_userData);
}
void LogicHE::beforeBootScript() {
// void implementation
}
void LogicHE::initOnce() {
// void implementation
}
void LogicHE::startOfFrame() {
// void implementation
}
void LogicHE::endOfFrame() {
// void implementation
}
int LogicHE::versionID() {
return 1;
}
int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
int32 res;
switch (op) {
case 1003:
res = op_1003(args);
break;
case 1004:
res = op_1004(args);
break;
case 1100:
res = op_1100(args);
break;
case 1101:
res = op_1101(args);
break;
case 1102:
res = op_1102(args);
break;
case 1103:
res = op_1103(args);
break;
case 1110:
res = op_1110();
break;
case 1120:
res = op_1120(args);
break;
case 1130:
res = op_1130(args);
break;
case 1140:
res = op_1140(args);
break;
default:
res = 0;
break;
}
return res;
}
#define RAD2DEG 5.729577951308239e1
#define DEG2RAD 1.745329251994328e-2
int32 LogicHE::op_1003(int32 *args) {
int value = args[2] ? args[2] : 1;
_vm->writeVar(108, (int32)(atan(args[0] / args[1]) * RAD2DEG * value));
return 1;
}
int32 LogicHE::op_1004(int32 *args) {
int value = args[1] ? args[1] : 1;
_vm->writeVar(108, (int32)(sqrt(args[0]) * value));
return 1;
}
int32 LogicHE::op_1100(int32 *args) {
_userData[516] = args[0] / args[10];
_userData[517] = args[1] / args[10];
_userData[518] = args[2] / args[10];
_userData[519] = args[3] / args[10];
_userData[520] = (float)args[4] / args[10];
args[4] = args[10];
op_sub1(_userData[520]);
_userData[521] = (float)args[5] / args[4];
op_sub2(_userData[521]);
_userData[532] = args[10];
args[1] = args[8];
args[10] = args[9];
_userData[524] = args[1];
_userData[525] = args[10];
_userData[522] = args[6] / args[4];
_userData[523] = args[7] / args[4];
_userData[526] = args[6] / args[1] / args[4];
_userData[527] = args[7] / args[10] / args[4];
args[0] = args[7] / args[10];
_vm->writeVar(108, (int32)(args[6] / args[1] * args[4]));
_vm->writeVar(109, (int32)(args[0] * args[4]));
_userData[528] = _userData[519] - _userData[523] * 0.5;
_userData[529] = _userData[519] + _userData[523] * 0.5;
_vm->writeVar(110, (int32)(_userData[528] * args[4]));
_vm->writeVar(111, (int32)(_userData[529] * args[4]));
_userData[530] = _userData[517] * tan(_userData[529] * DEG2RAD);
_userData[531] = _userData[517] * tan(_userData[528] * DEG2RAD);
_vm->writeVar(112, (int32)(_userData[517] * tan(_userData[529] * DEG2RAD) * args[4]));
_vm->writeVar(113, (int32)(_userData[531] * args[4]));
return 1;
}
int32 LogicHE::op_1101(int32 *args) {
int32 retval = 1;
// TODO
return retval;
}
int32 LogicHE::op_1102(int32 *args) {
int32 retval = 1;
// TODO
return retval;
}
int32 LogicHE::op_1103(int32 *args) {
double angle = args[0] / args[1] * DEG2RAD;
_vm->writeVar(108, (int32)(sin(angle) * args[2]));
_vm->writeVar(109, (int32)(cos(angle) * args[2]));
return 1;
}
int32 LogicHE::op_1110() {
_vm->writeVar(108, (int32)(_userData[526] * _userData[532] * _userData[532]));
_vm->writeVar(109, (int32)(_userData[527] * _userData[532] * _userData[532]));
_vm->writeVar(110, (int32)(_userData[532]));
return 1;
}
int32 LogicHE::op_1120(int32 *args) {
// TODO
return 1;
}
int32 LogicHE::op_1130(int32 *args) {
float cs = cos(args[0] / _userData[532] * DEG2RAD);
float sn = sin(args[0] / _userData[532] * DEG2RAD);
_vm->writeVar(108, (int32)(cs * args[1] + sn * args[2]));
_vm->writeVar(109, (int32)(cs * args[2] - sn * args[1]));
return 1;
}
int32 LogicHE::op_1140(int32 *args) {
// TODO
return 1;
}
void LogicHE::op_sub1(float arg) {
}
void LogicHE::op_sub2(float arg) {
}
void LogicHE::op_sub3(float arg) {
}
} // End of namespace Scumm
--- NEW FILE: logic_he.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/scumm/logic_he.h,v 2.1 2005/05/08 03:08:01 sev Exp $
*
*/
#include "stdafx.h"
#include "scumm/intern.h"
namespace Scumm {
class LogicHE {
private:
float *_userData;
ScummEngine *_vm;
public:
LogicHE(ScummEngine *vm);
~LogicHE();
void beforeBootScript(void);
void initOnce();
void startOfFrame();
void endOfFrame();
int versionID();
int32 dispatch(int op, int numArgs, int32 *args);
private:
int32 op_1003(int32 *args);
int32 op_1004(int32 *args);
int32 op_1100(int32 *args);
int32 op_1101(int32 *args);
int32 op_1102(int32 *args);
int32 op_1103(int32 *args);
int32 op_1110();
int32 op_1120(int32 *args);
int32 op_1130(int32 *args);
int32 op_1140(int32 *args);
void op_sub1(float arg);
void op_sub2(float arg);
void op_sub3(float arg);
};
} // End of namespace Scumm
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.477
retrieving revision 2.478
diff -u -d -r2.477 -r2.478
--- intern.h 7 May 2005 07:57:56 -0000 2.477
+++ intern.h 8 May 2005 03:08:01 -0000 2.478
@@ -1008,6 +1008,8 @@
struct SpriteInfo;
struct SpriteGroup;
+class LogicHE;
+
class ScummEngine_v90he : public ScummEngine_v80he {
protected:
typedef void (ScummEngine_v90he::*OpcodeProcV90he)();
@@ -1045,8 +1047,12 @@
public:
ScummEngine_v90he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v80he(detector, syst, gs, md5sum) {}
+ ~ScummEngine_v90he();
+
virtual void scummInit();
+ LogicHE *_logicHE;
+
protected:
virtual void allocateArrays();
virtual void setupOpcodes();
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- module.mk 10 Apr 2005 01:23:33 -0000 1.49
+++ module.mk 8 May 2005 03:08:01 -0000 1.50
@@ -18,6 +18,7 @@
scumm/input.o \
scumm/instrument.o \
scumm/help.o \
+ scumm/logic_he.o \
scumm/midiparser_ro.o \
scumm/midiparser_eup.o \
scumm/nut_renderer.o \
Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.246
retrieving revision 2.247
diff -u -d -r2.246 -r2.247
--- script_v90he.cpp 7 May 2005 11:07:42 -0000 2.246
+++ script_v90he.cpp 8 May 2005 03:08:01 -0000 2.247
@@ -28,6 +28,7 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/intern.h"
+#include "scumm/logic_he.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/resource_v7he.h"
@@ -2538,8 +2539,8 @@
break;
case 2001:
// Used in football
- debug(0, "o90_kernelGetFunctions: U32 code %d (args %d)", args[1], num - 2);
- push(0);
+ debug(0, "o90_kernelGetFunctions: U32 code %d (args %d) %d", args[1], num - 2, args[2]);
+ push(_logicHE->dispatch(args[1], num - 2, &args[2]));
break;
default:
error("o90_kernelGetFunctions: default case %d", args[0]);
@@ -2604,7 +2605,8 @@
break;
case 2001:
// Used in SoccerMLS/Soccer2004
- debug(0, "o90_kernelSetFunctions: U32 code %d (args %d)", args[1], num - 2);
+ debug(0, "o90_kernelSetFunctions: U32 code %d (args %d) %d", args[1], num - 2, args[2]);
+ _logicHE->dispatch(args[1], num - 2, &args[2]);
break;
default:
error("o90_kernelSetFunctions: default case %d (param count %d)", args[0], num);
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.490
retrieving revision 1.491
diff -u -d -r1.490 -r1.491
--- scumm.cpp 8 May 2005 01:00:52 -0000 1.490
+++ scumm.cpp 8 May 2005 03:08:03 -0000 1.491
@@ -43,6 +43,7 @@
#include "scumm/imuse.h"
#include "scumm/insane/insane.h"
#include "scumm/intern.h"
+#include "scumm/logic_he.h"
#include "scumm/player_nes.h"
#include "scumm/player_v1.h"
#include "scumm/player_v2.h"
@@ -1310,6 +1311,13 @@
_heSBNGId = 0;
}
+ScummEngine_v90he::~ScummEngine_v90he() {
+ if (_heversion >= 98) {
+ delete _logicHE;
+ }
+}
+
+
ScummEngine_v7::ScummEngine_v7(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16])
: ScummEngine_v6(detector, syst, gs, md5sum) {
_existLanguageFile = false;
@@ -1737,6 +1745,10 @@
if (_features & GF_HE_CURSORLESS)
setDefaultCursor();
+
+ if (_heversion >= 98) {
+ _logicHE = new LogicHE(this);
+ }
}
void ScummEngine_v99he::scummInit() {
@@ -1852,6 +1864,10 @@
args[0] = _bootParam;
_saveLoadFlag = 0;
+ if (_heversion >= 98) {
+ ((ScummEngine_v90he *)this)->_logicHE->initOnce();
+ ((ScummEngine_v90he *)this)->_logicHE->beforeBootScript();
+ }
if (_gameId == GID_MANIAC && _demoMode)
runScript(9, 0, 0, args);
else
@@ -1912,6 +1928,10 @@
// that it will be in a different state each time you run the program.
_rnd.getRandomNumber(2);
+ if (_heversion >= 98) {
+ ((ScummEngine_v90he *)this)->_logicHE->startOfFrame();
+ }
+
if (_version > 2) {
VAR(VAR_TMR_1) += delta;
VAR(VAR_TMR_2) += delta;
@@ -2182,8 +2202,12 @@
/* show or hide mouse */
_system->showMouse(_cursor.state > 0);
- if (_heversion >= 90)
+ if (_heversion >= 90) {
((ScummEngine_v90he *)this)->spritesUpdateImages();
+ }
+ if (_heversion >= 98) {
+ ((ScummEngine_v90he *)this)->_logicHE->endOfFrame();
+ }
if (VAR_TIMER != 0xFF)
VAR(VAR_TIMER) = 0;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.618
retrieving revision 1.619
diff -u -d -r1.618 -r1.619
--- scumm.h 5 May 2005 14:30:37 -0000 1.618
+++ scumm.h 8 May 2005 03:08:10 -0000 1.619
@@ -353,6 +353,7 @@
friend class Insane;
friend class CharsetRenderer;
friend class ResourceManager;
+ friend class LogicHE;
void errorString(const char *buf_input, char *buf_output);
public:
Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- vars.cpp 1 May 2005 12:25:30 -0000 1.131
+++ vars.cpp 8 May 2005 03:08:11 -0000 1.132
@@ -24,6 +24,7 @@
#include "stdafx.h"
#include "common/config-manager.h"
#include "scumm/scumm.h"
+#include "scumm/logic_he.h"
#include "scumm/intern.h"
#include "sound/mididrv.h"
@@ -566,9 +567,12 @@
if (_heversion >= 95) {
VAR(VAR_NUM_SPRITE_GROUPS) = MAX(64, _numSprites / 4) - 1;
VAR(VAR_NUM_SPRITES) = _numSprites - 1;
- VAR(VAR_U32_VERSION) = -1;
VAR(VAR_WIZ_TCOLOR) = 5;
}
+
+ if (_heversion >= 98) {
+ VAR(VAR_U32_VERSION) = _logicHE->versionID();
+ }
}
void ScummEngine_v99he::initScummVars() {
More information about the Scummvm-git-logs
mailing list