From 4cdfd9c2beae3de73a9ee19ae1db8609b8667e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ko=C5=82odziejski?= Date: Tue, 18 Mar 2003 20:32:01 +0000 Subject: [PATCH] added script opcode for dig minigame svn-id: r6834 --- scumm/intern.h | 1 + scumm/script_v6.cpp | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/scumm/intern.h b/scumm/intern.h index 8af677560c4..4f9d704c872 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -377,6 +377,7 @@ protected: void o6_pickVarRandom(); void o6_getDateTime(); void o6_unknownE0(); + void o6_unknownE1(); void o6_unknownE4(); void o6_localizeArray(); void o6_shuffle(); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 23440e47c9b..009415172ca 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -323,7 +323,7 @@ void Scumm_v6::setupOpcodes() { OPCODE(o6_invalid), /* E0 */ OPCODE(o6_unknownE0), - OPCODE(o6_invalid), + OPCODE(o6_unknownE1), OPCODE(o6_localizeArray), OPCODE(o6_pickVarRandom), /* E4 */ @@ -2922,6 +2922,39 @@ void Scumm_v6::o6_getDateTime() { _vars[VAR_TIMEDATE_SECOND] = t->tm_sec; } +void Scumm_v6::o6_unknownE1() { + // this opcode check ground area in minigame in the dig + int x = pop(); + int y = pop(); + + if (x > _realWidth - 1) { + push(-1); + return; + } + if (x < 0) { + push(-1); + return; + } + + if (y < 0) { + push(-1); + return; + } + + VirtScreen *vs = findVirtScreen(y); + + if (vs == NULL) { + push(-1); + return; + } + + // FIXME: something is wrong, it take wrong position or wrong buffer check + int offset = (y - vs->topline) * _realWidth + x + vs->tdirty[0]; + + byte area = *(getResourceAddress(rtBuffer, vs->number + 1) + offset); + push(area); +} + void Scumm_v6::o6_unknownE0() { int a = fetchScriptByte(); warning("o6_unknownEO(%d) stub", a);