Implement now spotted Logic opcode in funshops. Now need to find a place

where another one gets called.

svn-id: r18064
This commit is contained in:
Eugene Sandulenko 2005-05-11 21:35:19 +00:00
parent 3f2b92f3f2
commit 9e13005654
5 changed files with 54 additions and 11 deletions

View File

@ -954,6 +954,7 @@ protected:
byte VAR_WINDOWS_VERSION; byte VAR_WINDOWS_VERSION;
byte VAR_CURRENT_CHARSET; byte VAR_CURRENT_CHARSET;
byte VAR_U32_VERSION; byte VAR_U32_VERSION;
byte VAR_U32_ARRAY_UNK;
byte VAR_WIZ_TCOLOR; byte VAR_WIZ_TCOLOR;
}; };
@ -1008,9 +1009,9 @@ protected:
struct SpriteInfo; struct SpriteInfo;
struct SpriteGroup; struct SpriteGroup;
class LogicHE;
class ScummEngine_v90he : public ScummEngine_v80he { class ScummEngine_v90he : public ScummEngine_v80he {
friend class LogicHE;
protected: protected:
typedef void (ScummEngine_v90he::*OpcodeProcV90he)(); typedef void (ScummEngine_v90he::*OpcodeProcV90he)();
struct OpcodeEntryV90he { struct OpcodeEntryV90he {

View File

@ -26,7 +26,7 @@
namespace Scumm { namespace Scumm {
LogicHE::LogicHE(ScummEngine *vm) : _vm(vm) { LogicHE::LogicHE(ScummEngine_v90he *vm) : _vm(vm) {
// Originally it used 0x930 and stored both floats and doubles inside // Originally it used 0x930 and stored both floats and doubles inside
_userData = (float *)calloc(550, sizeof(float)); _userData = (float *)calloc(550, sizeof(float));
_userDataD = (double *)calloc(30, sizeof(double)); _userDataD = (double *)calloc(30, sizeof(double));
@ -41,8 +41,14 @@ int LogicHE::versionID() {
return 1; return 1;
} }
void LogicHE::processKeyStroke(int keyPressed) { int LogicHE::getFromArray(int arg0, int idx2, int idx1) {
// TODO _vm->VAR(_vm->VAR_U32_ARRAY_UNK) = arg0;
return _vm->readArray(116, idx2, idx1);
}
void LogicHE::putInArray(int arg0, int idx2, int idx1, int val) {
_vm->VAR(_vm->VAR_U32_ARRAY_UNK) = arg0;
_vm->writeArray(116, idx2, idx1, val);
} }
int32 LogicHE::dispatch(int op, int numArgs, int32 *args) { int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
@ -380,9 +386,42 @@ int32 LogicHEfunshop::dispatch(int op, int numArgs, int32 *args) {
} }
void LogicHEfunshop::op_1004(int32 *args) { void LogicHEfunshop::op_1004(int32 *args) {
error("STUB: LogicHE::dispatch(1004, 2, %d, %d). Please tell when it happened", args[0], args[1]);
} }
void LogicHEfunshop::op_1005(int32 *args) { void LogicHEfunshop::op_1005(int32 *args) {
double data[8];
double args1, args2;
double temp;
for (int i = 520; i <= 526; i += 2) {
data[i - 520] = getFromArray(args[0], 0, i - 1);
data[i - 520 + 1] = getFromArray(args[0], 0, i);
}
args1 = args[1] * 0.01 + 1;
args2 = args[2] * 0.01 + 1;
for (int i = 0; i < 4; i++) {
data[2 * i] *= args1;
data[2 * i + 1] *= args2;
}
for (int i = 520; i <= 526; i += 2) {
if (floor(data[i - 520]) + 0.5 > data[i - 520]) {
temp = ceil(data[i - 520]);
} else {
temp = floor(data[i - 520]);
}
putInArray(args[0], 0, i - 1, (int32)temp);
if (floor(data[i - 520 + 1]) + 0.5 > data[i - 520 + 1]) {
temp = ceil(data[i - 520 + 1]);
} else {
temp = floor(data[i - 520 + 1]);
}
putInArray(args[0], 0, i, (int32)temp);
}
} }
int LogicHEfunshop::checkShape(int arg_0, int arg_4, int arg_8, int arg_C, int arg_10, int arg_14, int arg_18, int arg_1C, int arg_20, int arg_24) { int LogicHEfunshop::checkShape(int arg_0, int arg_4, int arg_8, int arg_C, int arg_10, int arg_14, int arg_18, int arg_1C, int arg_20, int arg_24) {

View File

@ -29,18 +29,20 @@ class LogicHE {
public: public:
float *_userData; float *_userData;
double *_userDataD; double *_userDataD;
ScummEngine *_vm; ScummEngine_v90he *_vm;
LogicHE(ScummEngine *vm); LogicHE(ScummEngine_v90he *vm);
virtual ~LogicHE(); virtual ~LogicHE();
void writeScummVar(int var, int32 value) { _vm->writeVar(var, value); } void writeScummVar(int var, int32 value) { _vm->writeVar(var, value); }
int getFromArray(int arg0, int idx2, int idx1);
void putInArray(int arg0, int idx2, int idx1, int val);
void beforeBootScript(void) {}; void beforeBootScript(void) {};
void initOnce() {}; void initOnce() {};
void startOfFrame() {}; void startOfFrame() {};
void endOfFrame() {}; void endOfFrame() {};
void processKeyStroke(int keyPressed); void processKeyStroke(int keyPressed) {};
virtual int versionID(); virtual int versionID();
virtual int32 dispatch(int op, int numArgs, int32 *args); virtual int32 dispatch(int op, int numArgs, int32 *args);
@ -48,7 +50,7 @@ public:
class LogicHErace : public LogicHE { class LogicHErace : public LogicHE {
public: public:
LogicHErace(ScummEngine *vm) : LogicHE(vm) {} LogicHErace(ScummEngine_v90he *vm) : LogicHE(vm) {}
int versionID(); int versionID();
int32 dispatch(int op, int numArgs, int32 *args); int32 dispatch(int op, int numArgs, int32 *args);
@ -74,7 +76,7 @@ private:
class LogicHEfunshop : public LogicHE { class LogicHEfunshop : public LogicHE {
public: public:
LogicHEfunshop(ScummEngine *vm) : LogicHE(vm) {} LogicHEfunshop(ScummEngine_v90he *vm) : LogicHE(vm) {}
int versionID(); int versionID();
int32 dispatch(int op, int numArgs, int32 *args); int32 dispatch(int op, int numArgs, int32 *args);

View File

@ -364,7 +364,6 @@ class ScummEngine : public Engine {
friend class Insane; friend class Insane;
friend class CharsetRenderer; friend class CharsetRenderer;
friend class ResourceManager; friend class ResourceManager;
friend class LogicHE;
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
public: public:

View File

@ -292,6 +292,7 @@ void ScummEngine_v72he::setupScummVars() {
VAR_NUM_SPRITE_GROUPS = 105; VAR_NUM_SPRITE_GROUPS = 105;
VAR_NUM_SPRITES = 106; VAR_NUM_SPRITES = 106;
VAR_U32_VERSION = 107; VAR_U32_VERSION = 107;
VAR_U32_ARRAY_UNK = 116;
VAR_WIZ_TCOLOR = 117; VAR_WIZ_TCOLOR = 117;
} }
if (_heversion >= 98) { if (_heversion >= 98) {
@ -580,6 +581,7 @@ void ScummEngine_v90he::initScummVars() {
if (_heversion >= 98) { if (_heversion >= 98) {
VAR(VAR_U32_VERSION) = _logicHE->versionID(); VAR(VAR_U32_VERSION) = _logicHE->versionID();
VAR(VAR_U32_ARRAY_UNK) = 0;
} }
} }