diff options
| author | Eugene Sandulenko | 2005-05-11 21:35:19 +0000 | 
|---|---|---|
| committer | Eugene Sandulenko | 2005-05-11 21:35:19 +0000 | 
| commit | 9e13005654ccd04ca63c6ae9c18fa077a50cd39d (patch) | |
| tree | ba6f786567eb0b9c0ce0c260e7098c3043ccf10b | |
| parent | 3f2b92f3f27c32f5846ded7dcd9ad0bfa31fc187 (diff) | |
| download | scummvm-rg350-9e13005654ccd04ca63c6ae9c18fa077a50cd39d.tar.gz scummvm-rg350-9e13005654ccd04ca63c6ae9c18fa077a50cd39d.tar.bz2 scummvm-rg350-9e13005654ccd04ca63c6ae9c18fa077a50cd39d.zip | |
Implement now spotted Logic opcode in funshops. Now need to find a place
where another one gets called.
svn-id: r18064
| -rw-r--r-- | scumm/intern.h | 5 | ||||
| -rw-r--r-- | scumm/logic_he.cpp | 45 | ||||
| -rw-r--r-- | scumm/logic_he.h | 12 | ||||
| -rw-r--r-- | scumm/scumm.h | 1 | ||||
| -rw-r--r-- | scumm/vars.cpp | 2 | 
5 files changed, 54 insertions, 11 deletions
| diff --git a/scumm/intern.h b/scumm/intern.h index af549c4d77..bee950899e 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -954,6 +954,7 @@ protected:  	byte VAR_WINDOWS_VERSION;  	byte VAR_CURRENT_CHARSET;  	byte VAR_U32_VERSION; +	byte VAR_U32_ARRAY_UNK;  	byte VAR_WIZ_TCOLOR;  }; @@ -1008,9 +1009,9 @@ protected:  struct SpriteInfo;  struct SpriteGroup; -class LogicHE; -  class ScummEngine_v90he : public ScummEngine_v80he { +	friend class LogicHE; +  protected:  	typedef void (ScummEngine_v90he::*OpcodeProcV90he)();  	struct OpcodeEntryV90he { diff --git a/scumm/logic_he.cpp b/scumm/logic_he.cpp index 56728a4e45..1969c674bd 100644 --- a/scumm/logic_he.cpp +++ b/scumm/logic_he.cpp @@ -26,7 +26,7 @@  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  	_userData = (float *)calloc(550, sizeof(float));  	_userDataD = (double *)calloc(30, sizeof(double)); @@ -41,8 +41,14 @@ int LogicHE::versionID() {  	return 1;  } -void LogicHE::processKeyStroke(int keyPressed) { -	// TODO +int LogicHE::getFromArray(int arg0, int idx2, int idx1) { +	_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) { @@ -380,9 +386,42 @@ int32 LogicHEfunshop::dispatch(int op, int numArgs, 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) { +	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) { diff --git a/scumm/logic_he.h b/scumm/logic_he.h index 874f5171d1..46cf20d9a2 100644 --- a/scumm/logic_he.h +++ b/scumm/logic_he.h @@ -29,18 +29,20 @@ class LogicHE {  public:  	float *_userData;  	double *_userDataD; -	ScummEngine *_vm; +	ScummEngine_v90he *_vm; -	LogicHE(ScummEngine *vm); +	LogicHE(ScummEngine_v90he *vm);  	virtual ~LogicHE();  	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 initOnce() {};  	void startOfFrame() {};  	void endOfFrame() {}; -	void processKeyStroke(int keyPressed); +	void processKeyStroke(int keyPressed) {};  	virtual int versionID();  	virtual int32 dispatch(int op, int numArgs, int32 *args); @@ -48,7 +50,7 @@ public:  class LogicHErace : public LogicHE {  public: -	LogicHErace(ScummEngine *vm) : LogicHE(vm) {} +	LogicHErace(ScummEngine_v90he *vm) : LogicHE(vm) {}  	int versionID();  	int32 dispatch(int op, int numArgs, int32 *args); @@ -74,7 +76,7 @@ private:  class LogicHEfunshop : public LogicHE {  public: -	LogicHEfunshop(ScummEngine *vm) : LogicHE(vm) {} +	LogicHEfunshop(ScummEngine_v90he *vm) : LogicHE(vm) {}  	int versionID();  	int32 dispatch(int op, int numArgs, int32 *args); diff --git a/scumm/scumm.h b/scumm/scumm.h index c5b341a393..e4a20a3488 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -364,7 +364,6 @@ class ScummEngine : public Engine {  	friend class Insane;  	friend class CharsetRenderer;  	friend class ResourceManager; -	friend class LogicHE;  	void errorString(const char *buf_input, char *buf_output);  public: diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 079a02d600..e23e07295d 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -292,6 +292,7 @@ void ScummEngine_v72he::setupScummVars() {  		VAR_NUM_SPRITE_GROUPS = 105;  		VAR_NUM_SPRITES = 106;  		VAR_U32_VERSION = 107; +		VAR_U32_ARRAY_UNK = 116;  		VAR_WIZ_TCOLOR = 117;  	}  	if (_heversion >= 98) { @@ -580,6 +581,7 @@ void ScummEngine_v90he::initScummVars() {  	if (_heversion >= 98) {  		VAR(VAR_U32_VERSION) = _logicHE->versionID(); +		VAR(VAR_U32_ARRAY_UNK) = 0;  	}  } | 
