mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-11 04:06:12 +00:00
7d9890ff2e
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk ........ r43245 | lordhoto | 2009-08-11 11:24:15 +1000 (Tue, 11 Aug 2009) | 1 line Some fixes for the Kyrandia 1 Amiga outro. ........ r43246 | lordhoto | 2009-08-11 11:24:40 +1000 (Tue, 11 Aug 2009) | 1 line Finally fixed the string extraction for Kyrandia 1 Amiga. This should make the intro/outro strings work fine again. ........ r43247 | lordhoto | 2009-08-11 11:24:56 +1000 (Tue, 11 Aug 2009) | 1 line Some changes to get the Kyrandia 1 Amiga credits to show up at least. ........ r43248 | lordhoto | 2009-08-11 11:31:34 +1000 (Tue, 11 Aug 2009) | 1 line Fix in-game GUI text input field colors for Kyrandia 1 Amiga. ........ r43249 | lordhoto | 2009-08-11 11:47:29 +1000 (Tue, 11 Aug 2009) | 1 line Fix crash when using Will-O-Wisp in the grotto. ........ r43251 | lordhoto | 2009-08-11 12:12:09 +1000 (Tue, 11 Aug 2009) | 1 line Disable "Screen_LoK::fadeSpecialPalette" for Kyrandia 1 Amiga, like the original does. ........ r43252 | lordhoto | 2009-08-11 12:12:24 +1000 (Tue, 11 Aug 2009) | 1 line Implement palette differences for seq_playDrinkPotionAnim. ........ r43257 | anotherguest | 2009-08-11 17:52:59 +1000 (Tue, 11 Aug 2009) | 1 line Updated with m4.dat file ........ r43260 | anotherguest | 2009-08-11 18:01:41 +1000 (Tue, 11 Aug 2009) | 1 line Updated actions to support tinsel and made (from CE version) ........ r43262 | anotherguest | 2009-08-11 19:57:44 +1000 (Tue, 11 Aug 2009) | 1 line Enable virtual keyboard support, since qvga gfx is now supported. ........ r43263 | anotherguest | 2009-08-11 20:18:10 +1000 (Tue, 11 Aug 2009) | 1 line Include vkeybd default pack into installation file ........ r43264 | Hkz | 2009-08-11 20:28:15 +1000 (Tue, 11 Aug 2009) | 1 line Maniac Mansion NES: added workaround to fix dirty screen when loading a narrow room from a full width room ........ r43266 | Hkz | 2009-08-11 20:51:49 +1000 (Tue, 11 Aug 2009) | 1 line code formatting fixes ........ r43268 | waltervn | 2009-08-11 22:57:51 +1000 (Tue, 11 Aug 2009) | 2 lines SCI: Turn off logging in debugger. ........ r43269 | athrxx | 2009-08-12 00:34:33 +1000 (Wed, 12 Aug 2009) | 1 line LOL: some minor fixes ........ r43270 | Kirben | 2009-08-12 00:42:44 +1000 (Wed, 12 Aug 2009) | 1 line Add option to disable later games (Feeble Files, Puzzle Pack) in AGOS game engine, which require higher resolution. ........ r43272 | lordhoto | 2009-08-12 01:34:13 +1000 (Wed, 12 Aug 2009) | 1 line Fix Kallak's note displaying in Kyrandia 1 Amiga and Kyrandia 1 DOS CD. ........ r43273 | lordhoto | 2009-08-12 01:34:28 +1000 (Wed, 12 Aug 2009) | 1 line Implement differences in seq_winterScroll1 for Kyrandia 1 Amiga. ........ r43274 | lordhoto | 2009-08-12 01:34:55 +1000 (Wed, 12 Aug 2009) | 3 lines - Yet another minor difference in seq_winterScroll2 - Fix wrong offsets of flasks strings for Kyrandia 1 Amiga in kyra.dat - Increase kyra.dat version ........ r43275 | lordhoto | 2009-08-12 01:35:13 +1000 (Wed, 12 Aug 2009) | 1 line Fix bug in Amiga specific bits of o1_fadeSpecialPalette, this should make the cauldron water change color correctly. ........ r43276 | lordhoto | 2009-08-12 01:35:30 +1000 (Wed, 12 Aug 2009) | 1 line Fix AGOS compilation. ........ r43277 | lordhoto | 2009-08-12 02:18:01 +1000 (Wed, 12 Aug 2009) | 1 line Fix graphics glitch in Darm's abode in Kyrandia 1 Amiga. ........ r43278 | lordhoto | 2009-08-12 02:18:43 +1000 (Wed, 12 Aug 2009) | 1 line Fix thumbnails for savegames made via the in-game GUI of Kyrandia 1 Amiga. ........ r43279 | lordhoto | 2009-08-12 02:46:20 +1000 (Wed, 12 Aug 2009) | 1 line Cleanup. ........ r43280 | lordhoto | 2009-08-12 02:46:38 +1000 (Wed, 12 Aug 2009) | 1 line Enable dirty rect handling for the Amiga version again. ........ r43282 | buddha_ | 2009-08-12 03:44:06 +1000 (Wed, 12 Aug 2009) | 1 line Fix compilation on MSVC8/9 after r43270: Add ENABLE_AGOS2 and ENABLE_PN to global Visual Studio properties. ........ r43283 | lordhoto | 2009-08-12 04:16:21 +1000 (Wed, 12 Aug 2009) | 1 line Don't allow menu / inventory usage in o1_waitForConfirmationMouseClick, just like the original does. This prevents creating bad saves like in bug #2835715 "KYRA: GFX glitch in Amiga version at the bridge". ........ r43284 | lordhoto | 2009-08-12 04:17:07 +1000 (Wed, 12 Aug 2009) | 1 line Fix for bug #2835715 "KYRA: GFX glitch in Amiga version at the bridge", which was caused by featuring restoring of Brandon's position on save load, which the original did not support. ........ r43285 | lordhoto | 2009-08-12 04:17:53 +1000 (Wed, 12 Aug 2009) | 1 line Fix graphical glitches when loading saves where Brandon is in Will-O-Wisp form. ........ r43287 | dhewg | 2009-08-12 05:11:26 +1000 (Wed, 12 Aug 2009) | 1 line Fixed an endian bug in the ADPCM decoder (#2211901). ........ r43289 | waltervn | 2009-08-12 06:18:15 +1000 (Wed, 12 Aug 2009) | 2 lines SCI: Added a crude speed throttler. ........ r43290 | lordhoto | 2009-08-12 07:53:06 +1000 (Wed, 12 Aug 2009) | 1 line Mention support for Kyrandia 1 Amiga in 1.1.0. ........ r43292 | Kirben | 2009-08-12 09:40:07 +1000 (Wed, 12 Aug 2009) | 1 line vc22_setPaletteOld was renamed to vc22_setPalette, since function was virtualized. ........ r43294 | Kirben | 2009-08-12 10:53:35 +1000 (Wed, 12 Aug 2009) | 1 line Fix building with specific games disabled in MSVC. ........ r43299 | Kirben | 2009-08-12 11:21:25 +1000 (Wed, 12 Aug 2009) | 1 line Fix bug #2835822 - SSPP: Sounds from DIMP appearing randomly in other games. ........ r43301 | Kirben | 2009-08-12 11:35:42 +1000 (Wed, 12 Aug 2009) | 1 line Update status of Amiga version of The Legend of Kyrandia. ........ r43303 | Kirben | 2009-08-12 11:44:17 +1000 (Wed, 12 Aug 2009) | 1 line Update status of The Legend of Kyrandia. ........ r43304 | Kirben | 2009-08-12 12:24:03 +1000 (Wed, 12 Aug 2009) | 1 line Enable Personal Nightmare by default. ........ r43307 | sev | 2009-08-12 14:36:01 +1000 (Wed, 12 Aug 2009) | 2 lines Fix formatting ........ r43314 | dhewg | 2009-08-12 17:37:45 +1000 (Wed, 12 Aug 2009) | 1 line Removed duplicated functions. ........ r43318 | lordhoto | 2009-08-13 00:02:18 +1000 (Thu, 13 Aug 2009) | 1 line Change SJIS code guard to also check whether dynamic plugins are enabled. ........ r43320 | lordhoto | 2009-08-13 03:10:47 +1000 (Thu, 13 Aug 2009) | 1 line Implement difference for the Kyrandia 1 Amiga version in TextDisplayer::printCharacterText. ........ r43321 | lordhoto | 2009-08-13 03:11:04 +1000 (Thu, 13 Aug 2009) | 1 line Cleanup. ........ r43322 | lordhoto | 2009-08-13 03:13:46 +1000 (Thu, 13 Aug 2009) | 1 line Oops forgot a "{". ........ r43323 | lordhoto | 2009-08-13 04:05:41 +1000 (Thu, 13 Aug 2009) | 1 line Further cleaning up credits player code for Kyra1. ........ r43324 | lordhoto | 2009-08-13 04:06:32 +1000 (Thu, 13 Aug 2009) | 1 line Fix graphics glitch in credits of Kyrandia 1 German. ........ r43325 | lordhoto | 2009-08-13 04:07:27 +1000 (Thu, 13 Aug 2009) | 1 line Add a slight paranoia check to drawCharANSI. ........ r43326 | lordhoto | 2009-08-13 04:08:01 +1000 (Thu, 13 Aug 2009) | 1 line Put some more IHNM / SAGA2 specific code into compile guards. ........ r43329 | lordhoto | 2009-08-13 08:05:09 +1000 (Thu, 13 Aug 2009) | 1 line Implement special Kyrandia 1 Amiga credits text scroller. ........ r43332 | lordhoto | 2009-08-13 09:16:35 +1000 (Thu, 13 Aug 2009) | 1 line Properly respect users sfx/music config settings for MIDI output. ........ svn-id: r43343
536 lines
12 KiB
C++
536 lines
12 KiB
C++
/* ScummVM - Graphic Adventure Engine
|
|
*
|
|
* ScummVM is the legal property of its developers, whose names
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
* file distributed with this source distribution.
|
|
*
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* $URL$
|
|
* $Id$
|
|
*
|
|
*/
|
|
|
|
#ifdef ENABLE_HE
|
|
|
|
#include "common/config-file.h"
|
|
#include "common/config-manager.h"
|
|
#include "common/savefile.h"
|
|
#include "common/str.h"
|
|
|
|
#include "scumm/actor.h"
|
|
#include "scumm/charset.h"
|
|
#include "scumm/he/intern_he.h"
|
|
#include "scumm/object.h"
|
|
#include "scumm/resource.h"
|
|
#include "scumm/he/resource_he.h"
|
|
#include "scumm/scumm.h"
|
|
#include "scumm/he/sound_he.h"
|
|
|
|
namespace Scumm {
|
|
|
|
#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v80he, x)
|
|
|
|
void ScummEngine_v80he::setupOpcodes() {
|
|
ScummEngine_v72he::setupOpcodes();
|
|
|
|
OPCODE(0x45, o80_createSound);
|
|
OPCODE(0x46, o80_getFileSize);
|
|
OPCODE(0x48, o80_stringToInt);
|
|
OPCODE(0x49, o80_getSoundVar);
|
|
OPCODE(0x4a, o80_localizeArrayToRoom);
|
|
OPCODE(0x4c, o80_sourceDebug);
|
|
OPCODE(0x4d, o80_readConfigFile);
|
|
OPCODE(0x4e, o80_writeConfigFile);
|
|
_opcodes[0x69].setProc(0, 0);
|
|
OPCODE(0x6b, o80_cursorCommand);
|
|
OPCODE(0x70, o80_setState);
|
|
_opcodes[0x76].setProc(0, 0);
|
|
_opcodes[0x94].setProc(0, 0);
|
|
_opcodes[0x9e].setProc(0, 0);
|
|
_opcodes[0xa5].setProc(0, 0);
|
|
OPCODE(0xac, o80_drawWizPolygon);
|
|
OPCODE(0xe0, o80_drawLine);
|
|
OPCODE(0xe3, o80_pickVarRandom);
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_createSound() {
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
case 27:
|
|
createSound(_heSndResId, pop());
|
|
break;
|
|
case 217:
|
|
createSound(_heSndResId, -1);
|
|
break;
|
|
case 232:
|
|
_heSndResId = pop();
|
|
break;
|
|
case 255:
|
|
// dummy case
|
|
break;
|
|
default:
|
|
error("o80_createSound: default case %d", subOp);
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_getFileSize() {
|
|
byte buffer[256];
|
|
|
|
copyScriptString(buffer, sizeof(buffer));
|
|
const char *filename = (char *)buffer + convertFilePath(buffer, sizeof(buffer));
|
|
|
|
Common::SeekableReadStream *f = 0;
|
|
if (!_saveFileMan->listSavefiles(filename).empty()) {
|
|
f = _saveFileMan->openForLoading((const char *)filename);
|
|
} else {
|
|
Common::File *file = new Common::File();
|
|
file->open((const char *)filename);
|
|
if (!file->isOpen())
|
|
delete file;
|
|
else
|
|
f = file;
|
|
}
|
|
|
|
if (!f) {
|
|
push(-1);
|
|
} else {
|
|
push(f->size());
|
|
delete f;
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_stringToInt() {
|
|
int id, len, val;
|
|
byte *addr;
|
|
char string[100];
|
|
|
|
id = pop();
|
|
|
|
addr = getStringAddress(id);
|
|
if (!addr)
|
|
error("o80_stringToInt: Reference to zeroed array pointer (%d)", id);
|
|
|
|
len = resStrLen(getStringAddress(id)) + 1;
|
|
memcpy(string, addr, len);
|
|
val = atoi(string);
|
|
push(val);
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_getSoundVar() {
|
|
int var = pop();
|
|
int snd = pop();
|
|
push(((SoundHE *)_sound)->getSoundVar(snd, var));
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_localizeArrayToRoom() {
|
|
int slot = pop();
|
|
localizeArray(slot, 0xFF);
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_sourceDebug() {
|
|
fetchScriptDWord();
|
|
fetchScriptDWord();
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_readConfigFile() {
|
|
byte option[128], section[128], filename[256];
|
|
byte *data;
|
|
Common::String entry;
|
|
int len, r;
|
|
|
|
copyScriptString(option, sizeof(option));
|
|
copyScriptString(section, sizeof(section));
|
|
copyScriptString(filename, sizeof(filename));
|
|
|
|
r = convertFilePath(filename, sizeof(filename));
|
|
|
|
if (_game.id == GID_TREASUREHUNT) {
|
|
// WORKAROUND: Remove invalid characters
|
|
if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc1"))
|
|
memcpy(section, "BluesTreasureHunt-Disc1\0", 24);
|
|
else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2"))
|
|
memcpy(section, "BluesTreasureHunt-Disc2\0", 24);
|
|
}
|
|
|
|
Common::ConfigFile ConfFile;
|
|
if (!strcmp((char *)filename + r, "map.ini"))
|
|
ConfFile.loadFromFile((const char *)filename + r);
|
|
else
|
|
ConfFile.loadFromSaveFile((const char *)filename + r);
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
case 43: // HE 100
|
|
case 6: // number
|
|
ConfFile.getKey((const char *)option, (const char *)section, entry);
|
|
|
|
push(atoi(entry.c_str()));
|
|
break;
|
|
case 77: // HE 100
|
|
case 7: // string
|
|
ConfFile.getKey((const char *)option, (const char *)section, entry);
|
|
|
|
writeVar(0, 0);
|
|
len = resStrLen((const byte *)entry.c_str());
|
|
data = defineArray(0, kStringArray, 0, 0, 0, len);
|
|
memcpy(data, entry.c_str(), len);
|
|
push(readVar(0));
|
|
break;
|
|
default:
|
|
error("o80_readConfigFile: default type %d", subOp);
|
|
}
|
|
|
|
debug(1, "o80_readConfigFile: Filename %s Section %s Option %s Value %s", filename, section, option, entry.c_str());
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_writeConfigFile() {
|
|
byte filename[256], section[256], option[256], string[1024];
|
|
int r, value;
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
case 43: // HE 100
|
|
case 6: // number
|
|
value = pop();
|
|
sprintf((char *)string, "%d", value);
|
|
copyScriptString(option, sizeof(option));
|
|
copyScriptString(section, sizeof(section));
|
|
copyScriptString(filename, sizeof(filename));
|
|
break;
|
|
case 77: // HE 100
|
|
case 7: // string
|
|
copyScriptString(string, sizeof(string));
|
|
copyScriptString(option, sizeof(option));
|
|
copyScriptString(section, sizeof(section));
|
|
copyScriptString(filename, sizeof(filename));
|
|
break;
|
|
default:
|
|
error("o80_writeConfigFile: default type %d", subOp);
|
|
}
|
|
|
|
r = convertFilePath(filename, sizeof(filename));
|
|
|
|
if (_game.id == GID_TREASUREHUNT) {
|
|
// WORKAROUND: Remove invalid characters
|
|
if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc1"))
|
|
memcpy(section, "BluesTreasureHunt-Disc1\0", 24);
|
|
else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2"))
|
|
memcpy(section, "BluesTreasureHunt-Disc2\0", 24);
|
|
}
|
|
|
|
Common::ConfigFile ConfFile;
|
|
ConfFile.loadFromSaveFile((const char *)filename + r);
|
|
ConfFile.setKey((char *)option, (char *)section, (char *)string);
|
|
ConfFile.saveToSaveFile((const char *)filename + r);
|
|
|
|
debug(1,"o80_writeConfigFile: Filename %s Section %s Option %s String %s", filename, section, option, string);
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_cursorCommand() {
|
|
int a, b, i;
|
|
int args[16];
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
case 0x13:
|
|
case 0x14:
|
|
a = pop();
|
|
_wiz->loadWizCursor(a, 0);
|
|
break;
|
|
case 0x3C:
|
|
b = pop();
|
|
a = pop();
|
|
_wiz->loadWizCursor(a, b);
|
|
break;
|
|
case 0x90: // SO_CURSOR_ON Turn cursor on
|
|
_cursor.state = 1;
|
|
break;
|
|
case 0x91: // SO_CURSOR_OFF Turn cursor off
|
|
_cursor.state = 0;
|
|
break;
|
|
case 0x92: // SO_USERPUT_ON
|
|
_userPut = 1;
|
|
break;
|
|
case 0x93: // SO_USERPUT_OFF
|
|
_userPut = 0;
|
|
break;
|
|
case 0x94: // SO_CURSOR_SOFT_ON Turn soft cursor on
|
|
_cursor.state++;
|
|
if (_cursor.state > 1)
|
|
error("Cursor state greater than 1 in script");
|
|
break;
|
|
case 0x95: // SO_CURSOR_SOFT_OFF Turn soft cursor off
|
|
_cursor.state--;
|
|
break;
|
|
case 0x96: // SO_USERPUT_SOFT_ON
|
|
_userPut++;
|
|
break;
|
|
case 0x97: // SO_USERPUT_SOFT_OFF
|
|
_userPut--;
|
|
break;
|
|
case 0x9C: // SO_CHARSET_SET
|
|
initCharset(pop());
|
|
break;
|
|
case 0x9D: // SO_CHARSET_COLOR
|
|
getStackList(args, ARRAYSIZE(args));
|
|
for (i = 0; i < 16; i++)
|
|
_charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
|
|
break;
|
|
default:
|
|
error("o80_cursorCommand: default case %x", subOp);
|
|
}
|
|
|
|
VAR(VAR_CURSORSTATE) = _cursor.state;
|
|
VAR(VAR_USERPUT) = _userPut;
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_setState() {
|
|
int state = pop();
|
|
int obj = pop();
|
|
|
|
state &= 0x7FFF;
|
|
putState(obj, state);
|
|
removeObjectFromDrawQue(obj);
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_drawWizPolygon() {
|
|
WizImage wi;
|
|
wi.x1 = wi.y1 = pop();
|
|
wi.resNum = pop();
|
|
wi.state = 0;
|
|
wi.flags = kWIFIsPolygon;
|
|
_wiz->displayWizImage(&wi);
|
|
}
|
|
|
|
/**
|
|
* Draw a 'line' between two points.
|
|
*
|
|
* @param x1 the starting x coordinate
|
|
* @param y1 the starting y coordinate
|
|
* @param x the ending x coordinate
|
|
* @param y the ending y coordinate
|
|
* @param step the step size used to render the line, only ever 'step'th point is drawn
|
|
* @param type the line type -- points are rendered by drawing actors (type == 2),
|
|
* wiz images (type == 3), or pixels (any other type)
|
|
* @param id the id of an actor, wizimage or color (low bit) & flag (high bit)
|
|
*/
|
|
void ScummEngine_v80he::drawLine(int x1, int y1, int x, int y, int step, int type, int id) {
|
|
if (step < 0) {
|
|
step = -step;
|
|
}
|
|
if (step == 0) {
|
|
step = 1;
|
|
}
|
|
|
|
const int dx = x - x1;
|
|
const int dy = y - y1;
|
|
|
|
const int absDX = ABS(dx);
|
|
const int absDY = ABS(dy);
|
|
|
|
const int maxDist = MAX(absDX, absDY);
|
|
|
|
y = y1;
|
|
x = x1;
|
|
|
|
|
|
if (type == 2) {
|
|
ActorHE *a = (ActorHE *)derefActor(id, "drawLine");
|
|
a->drawActorToBackBuf(x, y);
|
|
} else if (type == 3) {
|
|
WizImage wi;
|
|
wi.flags = 0;
|
|
wi.y1 = y;
|
|
wi.x1 = x;
|
|
wi.resNum = id;
|
|
wi.state = 0;
|
|
_wiz->displayWizImage(&wi);
|
|
} else {
|
|
drawPixel(x, y, id);
|
|
}
|
|
|
|
int stepCount = 0;
|
|
int tmpX = 0;
|
|
int tmpY = 0;
|
|
for (int i = 0; i <= maxDist; i++) {
|
|
tmpX += absDX;
|
|
tmpY += absDY;
|
|
|
|
int drawFlag = 0;
|
|
|
|
if (tmpX > maxDist) {
|
|
drawFlag = 1;
|
|
tmpX -= maxDist;
|
|
|
|
if (dx >= 0) {
|
|
x++;
|
|
} else {
|
|
x--;
|
|
}
|
|
}
|
|
if (tmpY > maxDist) {
|
|
drawFlag = dy;
|
|
tmpY -= maxDist;
|
|
|
|
if (dy >= 0) {
|
|
y++;
|
|
} else {
|
|
y--;
|
|
}
|
|
}
|
|
|
|
if (drawFlag == 0)
|
|
continue;
|
|
|
|
if ((stepCount++ % step) != 0 && maxDist != i)
|
|
continue;
|
|
|
|
if (type == 2) {
|
|
ActorHE *a = (ActorHE *)derefActor(id, "drawLine");
|
|
a->drawActorToBackBuf(x, y);
|
|
} else if (type == 3) {
|
|
WizImage wi;
|
|
wi.flags = 0;
|
|
wi.y1 = y;
|
|
wi.x1 = x;
|
|
wi.resNum = id;
|
|
wi.state = 0;
|
|
_wiz->displayWizImage(&wi);
|
|
} else {
|
|
drawPixel(x, y, id);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v80he::drawPixel(int x, int y, int flags) {
|
|
byte *src, *dst;
|
|
VirtScreen *vs;
|
|
|
|
if (x < 0 || x > 639)
|
|
return;
|
|
|
|
if (y < 0)
|
|
return;
|
|
|
|
if ((vs = findVirtScreen(y)) == NULL)
|
|
return;
|
|
|
|
markRectAsDirty(vs->number, x, y, x, y + 1);
|
|
|
|
if ((flags & 0x4000) || (flags & 0x2000000)) {
|
|
src = vs->getPixels(x, y);
|
|
dst = vs->getBackPixels(x, y);
|
|
*dst = *src;
|
|
} else if ((flags & 0x2000) || (flags & 4000000)) {
|
|
src = vs->getBackPixels(x, y);
|
|
dst = vs->getPixels(x, y);
|
|
*dst = *src;
|
|
} else if (flags & 0x8000000) {
|
|
error("drawPixel: unsupported flag 0x%x", flags);
|
|
} else {
|
|
dst = vs->getPixels(x, y);
|
|
*dst = flags;
|
|
if ((flags & 0x8000) || (flags & 0x1000000)) {
|
|
dst = vs->getBackPixels(x, y);
|
|
*dst = flags;
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_drawLine() {
|
|
int id, step, x, y, x1, y1;
|
|
|
|
step = pop();
|
|
id = pop();
|
|
y = pop();
|
|
x = pop();
|
|
y1 = pop();
|
|
x1 = pop();
|
|
|
|
byte subOp = fetchScriptByte();
|
|
|
|
switch (subOp) {
|
|
case 55:
|
|
drawLine(x1, y1, x, y, step, 2, id);
|
|
break;
|
|
case 63:
|
|
drawLine(x1, y1, x, y, step, 3, id);
|
|
break;
|
|
case 66:
|
|
drawLine(x1, y1, x, y, step, 1, id);
|
|
break;
|
|
default:
|
|
error("o80_drawLine: default case %d", subOp);
|
|
}
|
|
|
|
}
|
|
|
|
void ScummEngine_v80he::o80_pickVarRandom() {
|
|
int num;
|
|
int args[100];
|
|
int32 dim1end;
|
|
|
|
num = getStackList(args, ARRAYSIZE(args));
|
|
int value = fetchScriptWord();
|
|
|
|
if (readVar(value) == 0) {
|
|
defineArray(value, kDwordArray, 0, 0, 0, num);
|
|
if (value & 0x8000)
|
|
localizeArray(readVar(value), 0xFF);
|
|
else if (value & 0x4000)
|
|
localizeArray(readVar(value), _currentScript);
|
|
|
|
if (num > 0) {
|
|
int16 counter = 0;
|
|
do {
|
|
writeArray(value, 0, counter + 1, args[counter]);
|
|
} while (++counter < num);
|
|
}
|
|
|
|
shuffleArray(value, 1, num);
|
|
writeArray(value, 0, 0, 2);
|
|
push(readArray(value, 0, 1));
|
|
return;
|
|
}
|
|
|
|
num = readArray(value, 0, 0);
|
|
|
|
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(value));
|
|
dim1end = FROM_LE_32(ah->dim1end);
|
|
|
|
if (dim1end < num) {
|
|
int32 var_2 = readArray(value, 0, num - 1);
|
|
shuffleArray(value, 1, dim1end);
|
|
num = 1;
|
|
if (readArray(value, 0, 1) == var_2 && dim1end >= 3) {
|
|
int32 tmp = readArray(value, 0, 2);
|
|
writeArray(value, 0, num, tmp);
|
|
writeArray(value, 0, 2, var_2);
|
|
}
|
|
}
|
|
|
|
writeArray(value, 0, 0, num + 1);
|
|
push(readArray(value, 0, num));
|
|
}
|
|
|
|
} // End of namespace Scumm
|
|
|
|
#endif // ENABLE_HE
|