2011-07-25 22:04:14 +00:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dreamweb/dreamweb.h"
|
|
|
|
|
|
|
|
namespace DreamGen {
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
Sprite *DreamGenContext::spriteTable() {
|
2011-12-02 15:29:16 +00:00
|
|
|
Sprite *sprite = (Sprite *)getSegment(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite));
|
2011-07-25 22:04:14 +00:00
|
|
|
return sprite;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::printSprites() {
|
2011-07-25 22:04:14 +00:00
|
|
|
for (size_t priority = 0; priority < 7; ++priority) {
|
2011-12-01 19:43:43 +00:00
|
|
|
Sprite *sprites = spriteTable();
|
2011-07-25 22:04:14 +00:00
|
|
|
for (size_t j = 0; j < 16; ++j) {
|
|
|
|
const Sprite &sprite = sprites[j];
|
2011-07-30 13:52:28 +00:00
|
|
|
if (sprite.updateCallback() == 0x0ffff)
|
2011-07-25 22:04:14 +00:00
|
|
|
continue;
|
|
|
|
if (priority != sprite.priority)
|
|
|
|
continue;
|
|
|
|
if (sprite.hidden == 1)
|
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
printASprite(&sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::printASprite(const Sprite *sprite) {
|
2011-07-25 22:56:24 +00:00
|
|
|
uint16 x, y;
|
|
|
|
if (sprite->y >= 220) {
|
|
|
|
y = data.word(kMapady) - (256 - sprite->y);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-07-25 22:56:24 +00:00
|
|
|
y = sprite->y + data.word(kMapady);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-07-25 22:56:24 +00:00
|
|
|
if (sprite->x >= 220) {
|
|
|
|
x = data.word(kMapadx) - (256 - sprite->x);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-07-25 22:56:24 +00:00
|
|
|
x = sprite->x + data.word(kMapadx);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8 c;
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->walkFrame != 0)
|
2011-07-25 22:04:14 +00:00
|
|
|
c = 8;
|
|
|
|
else
|
|
|
|
c = 0;
|
2011-12-02 15:29:16 +00:00
|
|
|
showFrame((const Frame *)getSegment(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::clearSprites() {
|
|
|
|
memset(spriteTable(), 0xff, sizeof(Sprite) * 16);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
Sprite *DreamGenContext::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
|
|
|
|
Sprite *sprite = spriteTable();
|
2011-11-18 21:34:46 +00:00
|
|
|
while (sprite->frameNumber != 0xff) { // NB: No boundchecking in the original code either
|
2011-07-25 22:04:14 +00:00
|
|
|
++sprite;
|
|
|
|
}
|
|
|
|
|
2011-07-30 13:52:28 +00:00
|
|
|
sprite->setUpdateCallback(updateCallback);
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->x = x;
|
|
|
|
sprite->y = y;
|
2011-07-30 13:04:25 +00:00
|
|
|
sprite->setFrameData(frameData);
|
2011-07-25 22:04:14 +00:00
|
|
|
WRITE_LE_UINT16(&sprite->w8, somethingInDi);
|
|
|
|
sprite->w2 = 0xffff;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->delay = 0;
|
|
|
|
return sprite;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::spriteUpdate() {
|
|
|
|
Sprite *sprites = spriteTable();
|
2011-07-25 22:04:14 +00:00
|
|
|
sprites[0].hidden = data.byte(kRyanon);
|
|
|
|
|
|
|
|
Sprite *sprite = sprites;
|
|
|
|
for (size_t i=0; i < 16; ++i) {
|
2011-07-30 13:52:28 +00:00
|
|
|
uint16 updateCallback = sprite->updateCallback();
|
2011-07-25 22:04:14 +00:00
|
|
|
if (updateCallback != 0xffff) {
|
|
|
|
sprite->w24 = sprite->w2;
|
|
|
|
if (updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++
|
2011-12-01 19:43:43 +00:00
|
|
|
mainMan(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
else {
|
|
|
|
assert(updateCallback == addr_backobject);
|
2011-12-01 19:43:43 +00:00
|
|
|
backObject(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kNowinnewroom) == 1)
|
|
|
|
break;
|
|
|
|
++sprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::initMan() {
|
|
|
|
Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->priority = 4;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->speed = 0;
|
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::mainMan() {
|
2011-07-28 23:12:29 +00:00
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::mainMan(Sprite *sprite) {
|
2011-07-25 22:04:14 +00:00
|
|
|
push(es);
|
|
|
|
push(ds);
|
|
|
|
|
|
|
|
// Recover es:bx from sprite
|
|
|
|
es = data.word(kBuffers);
|
|
|
|
bx = kSpritetable;
|
|
|
|
Sprite *sprites = (Sprite *)es.ptr(bx, sizeof(Sprite) * 16);
|
|
|
|
bx += 32 * (sprite - sprites);
|
|
|
|
//
|
|
|
|
|
|
|
|
if (data.byte(kResetmanxy) == 1) {
|
|
|
|
data.byte(kResetmanxy) = 0;
|
|
|
|
sprite->x = data.byte(kRyanx);
|
|
|
|
sprite->y = data.byte(kRyany);
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
--sprite->speed;
|
|
|
|
if (sprite->speed != 0xff) {
|
2011-07-25 22:04:14 +00:00
|
|
|
ds = pop();
|
|
|
|
es = pop();
|
|
|
|
return;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->speed = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
if (data.byte(kTurntoface) != data.byte(kFacing)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
aboutTurn(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
|
|
|
if ((data.byte(kTurndirection) != 0) && (data.byte(kLinepointer) == 254)) {
|
|
|
|
data.byte(kReasseschanges) = 1;
|
|
|
|
if (data.byte(kFacing) == data.byte(kLeavedirection))
|
2011-12-01 19:43:43 +00:00
|
|
|
checkForExit();
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
data.byte(kTurndirection) = 0;
|
|
|
|
if (data.byte(kLinepointer) == 254) {
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->walkFrame;
|
|
|
|
if (sprite->walkFrame == 11)
|
|
|
|
sprite->walkFrame = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
walking(sprite);
|
|
|
|
if (data.byte(kLinepointer) != 254) {
|
|
|
|
if ((data.byte(kFacing) & 1) == 0)
|
|
|
|
walking(sprite);
|
2011-11-18 21:48:34 +00:00
|
|
|
else if ((sprite->walkFrame != 2) && (sprite->walkFrame != 7))
|
2011-07-25 22:04:14 +00:00
|
|
|
walking(sprite);
|
|
|
|
}
|
|
|
|
if (data.byte(kLinepointer) == 254) {
|
|
|
|
if (data.byte(kTurntoface) == data.byte(kFacing)) {
|
|
|
|
data.byte(kReasseschanges) = 1;
|
|
|
|
if (data.byte(kFacing) == data.byte(kLeavedirection))
|
2011-12-01 19:43:43 +00:00
|
|
|
checkForExit();
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static const uint8 facelist[] = { 0,60,33,71,11,82,22,93 };
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = sprite->walkFrame + facelist[data.byte(kFacing)];
|
2011-07-25 22:04:14 +00:00
|
|
|
data.byte(kRyanx) = sprite->x;
|
|
|
|
data.byte(kRyany) = sprite->y;
|
|
|
|
|
|
|
|
ds = pop();
|
|
|
|
es = pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::walking(Sprite *sprite) {
|
|
|
|
uint8 comp;
|
|
|
|
if (data.byte(kLinedirection) != 0) {
|
|
|
|
--data.byte(kLinepointer);
|
|
|
|
comp = 200;
|
|
|
|
} else {
|
|
|
|
++data.byte(kLinepointer);
|
|
|
|
comp = data.byte(kLinelength);
|
|
|
|
}
|
|
|
|
if (data.byte(kLinepointer) < comp) {
|
2011-12-03 19:29:50 +00:00
|
|
|
sprite->x = (uint8)g_lineData[data.byte(kLinepointer)].x;
|
|
|
|
sprite->y = (uint8)g_lineData[data.byte(kLinepointer)].y;
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
data.byte(kLinepointer) = 254;
|
|
|
|
data.byte(kManspath) = data.byte(kDestination);
|
|
|
|
if (data.byte(kDestination) == data.byte(kFinaldest)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
faceRightWay();
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.byte(kDestination) = data.byte(kFinaldest);
|
|
|
|
push(es);
|
|
|
|
push(bx);
|
2011-12-01 19:43:43 +00:00
|
|
|
autoSetWalk();
|
2011-07-25 22:04:14 +00:00
|
|
|
bx = pop();
|
|
|
|
es = pop();
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::aboutTurn(Sprite *sprite) {
|
2011-07-25 22:04:14 +00:00
|
|
|
bool incdir = true;
|
|
|
|
|
|
|
|
if (data.byte(kTurndirection) == 1)
|
|
|
|
incdir = true;
|
|
|
|
else if ((int8)data.byte(kTurndirection) == -1)
|
|
|
|
incdir = false;
|
|
|
|
else {
|
|
|
|
if (data.byte(kFacing) < data.byte(kTurntoface)) {
|
|
|
|
uint8 delta = data.byte(kTurntoface) - data.byte(kFacing);
|
|
|
|
if (delta >= 4)
|
|
|
|
incdir = false;
|
|
|
|
else
|
|
|
|
incdir = true;
|
|
|
|
} else {
|
|
|
|
uint8 delta = data.byte(kFacing) - data.byte(kTurntoface);
|
|
|
|
if (delta >= 4)
|
|
|
|
incdir = true;
|
|
|
|
else
|
|
|
|
incdir = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (incdir) {
|
|
|
|
data.byte(kTurndirection) = 1;
|
|
|
|
data.byte(kFacing) = (data.byte(kFacing) + 1) & 7;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-10-15 09:21:02 +00:00
|
|
|
data.byte(kTurndirection) = (uint8)-1;
|
2011-07-25 22:04:14 +00:00
|
|
|
data.byte(kFacing) = (data.byte(kFacing) - 1) & 7;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::backObject() {
|
2011-07-28 23:12:29 +00:00
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::backObject(Sprite *sprite) {
|
2011-12-02 15:29:16 +00:00
|
|
|
SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->objData(), 0);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
if (sprite->delay != 0) {
|
|
|
|
--sprite->delay;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->delay = objData->delay;
|
|
|
|
if (objData->type == 6)
|
2011-12-01 19:43:43 +00:00
|
|
|
wideDoor(sprite, objData);
|
2011-07-25 22:04:14 +00:00
|
|
|
else if (objData->type == 5)
|
2011-12-04 14:08:17 +00:00
|
|
|
randomSprite(sprite, objData);
|
2011-07-25 22:04:14 +00:00
|
|
|
else if (objData->type == 4)
|
2011-12-01 19:43:43 +00:00
|
|
|
lockedDoorway(sprite, objData);
|
2011-07-25 22:04:14 +00:00
|
|
|
else if (objData->type == 3)
|
2011-12-01 19:43:43 +00:00
|
|
|
liftSprite(sprite, objData);
|
2011-07-25 22:04:14 +00:00
|
|
|
else if (objData->type == 2)
|
|
|
|
doorway(sprite, objData);
|
|
|
|
else if (objData->type == 1)
|
|
|
|
constant(sprite, objData);
|
|
|
|
else
|
|
|
|
steady(sprite, objData);
|
|
|
|
}
|
|
|
|
|
2011-08-23 12:41:28 +00:00
|
|
|
void DreamGenContext::constant(Sprite *sprite, SetObject *objData) {
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (objData->frames[sprite->animFrame] == 255) {
|
|
|
|
sprite->animFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
uint8 frame = objData->frames[sprite->animFrame];
|
|
|
|
objData->index = frame;
|
|
|
|
sprite->frameNumber = frame;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-04 14:08:17 +00:00
|
|
|
void DreamGenContext::randomSprite(Sprite *sprite, SetObject *objData) {
|
2011-12-03 19:02:10 +00:00
|
|
|
uint8 r = engine->randomNumber();
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->frames[r&7];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-08-23 12:41:28 +00:00
|
|
|
void DreamGenContext::doorway(Sprite *sprite, SetObject *objData) {
|
2011-11-16 22:27:14 +00:00
|
|
|
Common::Rect check(-24, -30, 10, 10);
|
2011-12-01 19:43:43 +00:00
|
|
|
doDoor(sprite, objData, check);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::wideDoor(Sprite *sprite, SetObject *objData) {
|
2011-11-16 22:27:14 +00:00
|
|
|
Common::Rect check(-24, -30, 24, 24);
|
2011-12-01 19:43:43 +00:00
|
|
|
doDoor(sprite, objData, check);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) {
|
2011-11-16 22:27:14 +00:00
|
|
|
int ryanx = data.byte(kRyanx);
|
|
|
|
int ryany = data.byte(kRyany);
|
|
|
|
|
|
|
|
// Automatically opening doors: check if Ryan is in range
|
|
|
|
|
|
|
|
check.translate(sprite->x, sprite->y);
|
|
|
|
bool openDoor = check.contains(ryanx, ryany);
|
|
|
|
|
|
|
|
if (openDoor) {
|
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if ((data.byte(kThroughdoor) == 1) && (sprite->animFrame == 0))
|
|
|
|
sprite->animFrame = 6;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 1) { // doorsound2
|
2011-11-21 13:33:36 +00:00
|
|
|
uint8 soundIndex;
|
2011-11-16 22:27:14 +00:00
|
|
|
if (data.byte(kReallocation) == 5) // hoteldoor2
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 13;
|
2011-11-16 22:27:14 +00:00
|
|
|
else
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 0;
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(soundIndex);
|
2011-11-16 22:27:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
if (objData->frames[sprite->animFrame] == 255)
|
|
|
|
--sprite->animFrame;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-11-16 22:27:14 +00:00
|
|
|
data.byte(kThroughdoor) = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
} else {
|
2011-11-16 22:27:14 +00:00
|
|
|
// shut door
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 5) { // doorsound1;
|
2011-11-21 13:33:36 +00:00
|
|
|
uint8 soundIndex;
|
2011-11-16 22:27:14 +00:00
|
|
|
if (data.byte(kReallocation) == 5) // hoteldoor1
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 13;
|
2011-11-16 22:27:14 +00:00
|
|
|
else
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 1;
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(soundIndex);
|
2011-11-16 22:27:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame != 0)
|
|
|
|
--sprite->animFrame;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
|
|
|
if (sprite->animFrame == 5) // nearly
|
2011-11-16 22:27:14 +00:00
|
|
|
data.byte(kThroughdoor) = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-23 12:41:28 +00:00
|
|
|
void DreamGenContext::steady(Sprite *sprite, SetObject *objData) {
|
2011-11-18 21:34:46 +00:00
|
|
|
uint8 frame = objData->frames[0];
|
|
|
|
objData->index = frame;
|
|
|
|
sprite->frameNumber = frame;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::lockedDoorway(Sprite *sprite, SetObject *objData) {
|
2011-11-16 22:56:52 +00:00
|
|
|
int ryanx = data.byte(kRyanx);
|
|
|
|
int ryany = data.byte(kRyany);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
Common::Rect check(-24, -30, 10, 12);
|
|
|
|
check.translate(sprite->x, sprite->y);
|
|
|
|
bool openDoor = check.contains(ryanx, ryany);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
if (data.byte(kThroughdoor) != 1 && data.byte(kLockstatus) == 1)
|
|
|
|
openDoor = false;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
if (openDoor) {
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 1) {
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(0);
|
2011-11-16 22:56:52 +00:00
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 6)
|
2011-12-01 19:43:43 +00:00
|
|
|
turnPathOn(data.byte(kDoorpath));
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (data.byte(kThroughdoor) == 1 && sprite->animFrame == 0)
|
|
|
|
sprite->animFrame = 6;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (objData->frames[sprite->animFrame] == 255)
|
|
|
|
--sprite->animFrame;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
|
|
|
if (sprite->animFrame == 5)
|
2011-11-16 22:56:52 +00:00
|
|
|
data.byte(kThroughdoor) = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
} else {
|
|
|
|
// shut door
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 5) {
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(1);
|
2011-11-16 22:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame != 0)
|
|
|
|
--sprite->animFrame;
|
2011-11-16 22:56:52 +00:00
|
|
|
|
|
|
|
data.byte(kThroughdoor) = 0;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-11-16 22:56:52 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 0) {
|
2011-12-01 19:43:43 +00:00
|
|
|
turnPathOff(data.byte(kDoorpath));
|
2011-11-16 22:56:52 +00:00
|
|
|
data.byte(kLockstatus) = 1;
|
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::liftSprite(Sprite *sprite, SetObject *objData) {
|
2011-07-25 22:04:14 +00:00
|
|
|
uint8 liftFlag = data.byte(kLiftflag);
|
|
|
|
if (liftFlag == 0) { //liftclosed
|
2011-12-01 19:43:43 +00:00
|
|
|
turnPathOff(data.byte(kLiftpath));
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
if (data.byte(kCounttoopen) != 0) {
|
|
|
|
_dec(data.byte(kCounttoopen));
|
|
|
|
if (data.byte(kCounttoopen) == 0)
|
|
|
|
data.byte(kLiftflag) = 3;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 0;
|
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
else if (liftFlag == 1) { //liftopen
|
2011-12-01 19:43:43 +00:00
|
|
|
turnPathOn(data.byte(kLiftpath));
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
if (data.byte(kCounttoclose) != 0) {
|
|
|
|
_dec(data.byte(kCounttoclose));
|
|
|
|
if (data.byte(kCounttoclose) == 0)
|
|
|
|
data.byte(kLiftflag) = 2;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 12;
|
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
else if (liftFlag == 3) { //openlift
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 12) {
|
2011-07-25 22:04:14 +00:00
|
|
|
data.byte(kLiftflag) = 1;
|
|
|
|
return;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 1) {
|
2011-12-06 00:34:01 +00:00
|
|
|
liftNoise(2);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
} else { //closeLift
|
|
|
|
assert(liftFlag == 2);
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 0) {
|
2011-07-25 22:04:14 +00:00
|
|
|
data.byte(kLiftflag) = 0;
|
|
|
|
return;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
--sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 11) {
|
2011-12-06 00:34:01 +00:00
|
|
|
liftNoise(3);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::faceRightWay() {
|
|
|
|
PathNode *paths = getRoomsPaths()->nodes;
|
2011-09-03 13:09:21 +00:00
|
|
|
uint8 dir = paths[data.byte(kManspath)].dir;
|
2011-07-26 05:54:25 +00:00
|
|
|
data.byte(kTurntoface) = dir;
|
|
|
|
data.byte(kLeavedirection) = dir;
|
|
|
|
}
|
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
// Locate the reel segment (reel1, reel2, reel3) this frame is stored in.
|
|
|
|
// The return value is a pointer to the start of the segment.
|
|
|
|
// data.word(kCurrentframe) - data.word(kTakeoff) is the number of the frame
|
|
|
|
// inside that segment
|
2011-12-01 19:43:43 +00:00
|
|
|
Frame *DreamGenContext::findSource() {
|
2011-07-30 13:19:22 +00:00
|
|
|
uint16 currentFrame = data.word(kCurrentframe);
|
|
|
|
if (currentFrame < 160) {
|
|
|
|
data.word(kTakeoff) = 0;
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kReel1)).ptr(0, 0);
|
2011-07-30 13:19:22 +00:00
|
|
|
} else if (currentFrame < 320) {
|
|
|
|
data.word(kTakeoff) = 160;
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kReel2)).ptr(0, 0);
|
2011-07-30 13:19:22 +00:00
|
|
|
} else {
|
|
|
|
data.word(kTakeoff) = 320;
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kReel3)).ptr(0, 0);
|
2011-07-30 13:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
Reel *DreamGenContext::getReelStart() {
|
2011-12-02 15:29:16 +00:00
|
|
|
Reel *reel = (Reel *)getSegment(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel));
|
2011-08-11 11:29:33 +00:00
|
|
|
return reel;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::showReelFrame(Reel *reel) {
|
2011-07-30 14:01:52 +00:00
|
|
|
uint16 x = reel->x + data.word(kMapadx);
|
|
|
|
uint16 y = reel->y + data.word(kMapady);
|
|
|
|
data.word(kCurrentframe) = reel->frame();
|
2011-12-01 19:43:43 +00:00
|
|
|
Frame *source = findSource();
|
2011-07-30 13:25:28 +00:00
|
|
|
uint16 frame = data.word(kCurrentframe) - data.word(kTakeoff);
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(source, x, y, frame, 8);
|
2011-07-30 13:25:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::showGameReel() {
|
|
|
|
showGameReel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
|
2011-08-29 12:54:21 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::showGameReel(ReelRoutine *routine) {
|
|
|
|
uint16 reelPointer = routine->reelPointer();
|
|
|
|
if (reelPointer >= 512)
|
2011-08-11 20:58:06 +00:00
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
data.word(kReelpointer) = reelPointer;
|
|
|
|
plotReel();
|
2011-08-29 12:54:21 +00:00
|
|
|
routine->setReelPointer(data.word(kReelpointer));
|
2011-08-11 20:58:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
const Frame *DreamGenContext::getReelFrameAX(uint16 frame) {
|
2011-08-11 21:13:17 +00:00
|
|
|
data.word(kCurrentframe) = frame;
|
2011-12-01 19:43:43 +00:00
|
|
|
Frame *source = findSource();
|
2011-08-11 21:13:17 +00:00
|
|
|
uint16 offset = data.word(kCurrentframe) - data.word(kTakeoff);
|
2011-08-17 21:54:57 +00:00
|
|
|
return source + offset;
|
2011-08-11 21:10:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::showRain() {
|
2011-12-02 15:29:16 +00:00
|
|
|
Rain *rain = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0);
|
2011-11-18 18:00:10 +00:00
|
|
|
|
|
|
|
// Do nothing if there's no rain at all
|
|
|
|
if (rain->x == 255)
|
|
|
|
return;
|
|
|
|
|
2011-08-03 12:16:09 +00:00
|
|
|
ds = data.word(kMainsprites);
|
2011-11-18 21:34:46 +00:00
|
|
|
si = 6*58; // Frame 58
|
|
|
|
ax = ds.word(si+2); // Frame::ptr
|
2011-08-03 12:16:09 +00:00
|
|
|
si = ax + 2080;
|
2011-11-18 18:00:10 +00:00
|
|
|
|
|
|
|
for (; rain->x != 255; ++rain) {
|
2011-08-03 12:16:09 +00:00
|
|
|
uint16 y = rain->y + data.word(kMapady) + data.word(kMapystart);
|
|
|
|
uint16 x = rain->x + data.word(kMapadx) + data.word(kMapxstart);
|
|
|
|
uint16 size = rain->size;
|
|
|
|
ax = ((uint16)(rain->w3() - rain->b5)) & 511;
|
|
|
|
rain->setW3(ax);
|
|
|
|
const uint8 *src = ds.ptr(si, 0) + ax;
|
|
|
|
uint8 *dst = workspace() + y * 320 + x;
|
|
|
|
for(uint16 i = 0; i < size; ++i) {
|
|
|
|
uint8 v = src[i];
|
|
|
|
if (v != 0)
|
|
|
|
*dst = v;
|
2011-11-18 21:34:46 +00:00
|
|
|
dst += 320-1; // advance diagonally
|
2011-08-03 12:16:09 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-18 18:00:10 +00:00
|
|
|
|
|
|
|
if (data.word(kCh1blockstocopy) != 0)
|
|
|
|
return;
|
|
|
|
if (data.byte(kReallocation) == 2 && data.byte(kBeenmugged) != 1)
|
|
|
|
return;
|
|
|
|
if (data.byte(kReallocation) == 55)
|
|
|
|
return;
|
2011-11-18 21:34:46 +00:00
|
|
|
|
|
|
|
if (engine->randomNumber() >= 1) // play thunder with 1 in 256 chance
|
2011-11-18 18:00:10 +00:00
|
|
|
return;
|
2011-11-18 21:34:46 +00:00
|
|
|
|
2011-11-21 13:33:36 +00:00
|
|
|
uint8 soundIndex;
|
2011-11-18 18:00:10 +00:00
|
|
|
if (data.byte(kCh0playing) != 6)
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 4;
|
2011-11-18 18:00:10 +00:00
|
|
|
else
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 7;
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(soundIndex);
|
2011-08-03 12:16:09 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::moveMap(uint8 param) {
|
2011-08-16 23:16:05 +00:00
|
|
|
switch (param) {
|
|
|
|
case 32:
|
|
|
|
data.byte(kMapy) -= 20;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
data.byte(kMapy) -= 10;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
data.byte(kMapy) += 10;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
data.byte(kMapx) += 11;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
data.byte(kMapx) -= 11;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
data.byte(kNowinnewroom) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkOne() {
|
2011-08-22 15:30:53 +00:00
|
|
|
uint8 flag, flagEx, type, flagX, flagY;
|
2011-12-01 19:43:43 +00:00
|
|
|
checkOne(cl, ch, &flag, &flagEx, &type, &flagX, &flagY);
|
2011-08-22 15:30:53 +00:00
|
|
|
|
|
|
|
cl = flag;
|
|
|
|
ch = flagEx;
|
|
|
|
dl = flagX;
|
|
|
|
dh = flagY;
|
|
|
|
al = type;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
|
2011-08-22 15:30:53 +00:00
|
|
|
*flagX = x / 16;
|
|
|
|
*flagY = y / 16;
|
2011-12-02 15:29:16 +00:00
|
|
|
const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3);
|
2011-08-22 15:30:53 +00:00
|
|
|
*flag = tileData[0];
|
|
|
|
*flagEx = tileData[1];
|
|
|
|
*type = tileData[2];
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::getBlockOfPixel() {
|
|
|
|
al = getBlockOfPixel(cl, ch);
|
2011-09-02 22:00:44 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
uint8 DreamGenContext::getBlockOfPixel(uint8 x, uint8 y) {
|
2011-09-02 22:00:44 +00:00
|
|
|
uint8 flag, flagEx, type, flagX, flagY;
|
2011-12-01 19:43:43 +00:00
|
|
|
checkOne(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY);
|
2011-09-02 22:00:44 +00:00
|
|
|
if (flag & 1)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
Rain *DreamGenContext::splitIntoLines(uint8 x, uint8 y, Rain *rain) {
|
2011-11-15 13:12:44 +00:00
|
|
|
do {
|
|
|
|
// Look for line start
|
2011-12-01 19:43:43 +00:00
|
|
|
while (!getBlockOfPixel(x, y)) {
|
2011-11-15 13:12:44 +00:00
|
|
|
--x;
|
|
|
|
++y;
|
2011-11-15 15:05:25 +00:00
|
|
|
if (x == 0 || y >= data.byte(kMapysize))
|
2011-11-15 13:12:44 +00:00
|
|
|
return rain;
|
2011-11-15 15:05:25 +00:00
|
|
|
}
|
2011-11-15 13:12:44 +00:00
|
|
|
|
|
|
|
rain->x = x;
|
|
|
|
rain->y = y;
|
|
|
|
|
|
|
|
uint8 length = 1;
|
|
|
|
|
|
|
|
// Look for line end
|
2011-12-01 19:43:43 +00:00
|
|
|
while (getBlockOfPixel(x, y)) {
|
2011-11-15 13:12:44 +00:00
|
|
|
--x;
|
|
|
|
++y;
|
2011-11-15 15:05:25 +00:00
|
|
|
if (x == 0 || y >= data.byte(kMapysize))
|
2011-11-15 13:12:44 +00:00
|
|
|
break;
|
|
|
|
++length;
|
2011-11-15 15:05:25 +00:00
|
|
|
}
|
2011-11-15 13:12:44 +00:00
|
|
|
|
|
|
|
rain->size = length;
|
|
|
|
rain->w3_lo = engine->randomNumber();
|
|
|
|
rain->w3_hi = engine->randomNumber();
|
|
|
|
rain->b5 = (engine->randomNumber() & 3) + 4;
|
|
|
|
++rain;
|
2011-11-15 15:05:25 +00:00
|
|
|
} while (x > 0 && y < data.byte(kMapysize));
|
|
|
|
|
2011-11-15 13:12:44 +00:00
|
|
|
return rain;
|
|
|
|
}
|
|
|
|
|
2011-11-15 16:31:19 +00:00
|
|
|
struct RainLocation {
|
|
|
|
uint8 location;
|
|
|
|
uint8 x, y;
|
2011-11-15 18:27:36 +00:00
|
|
|
uint8 rainSpacing;
|
|
|
|
};
|
|
|
|
|
2011-11-15 18:42:00 +00:00
|
|
|
static const RainLocation rainLocationList[] = {
|
2011-11-15 18:27:36 +00:00
|
|
|
{ 1,44,10,16 },
|
|
|
|
{ 4,11,30,14 },
|
|
|
|
{ 4,22,30,14 },
|
|
|
|
{ 3,33,10,14 },
|
|
|
|
{ 10,33,30,14 },
|
|
|
|
{ 10,22,30,24 },
|
|
|
|
{ 9,22,10,14 },
|
|
|
|
{ 2,33,0,14 },
|
|
|
|
{ 2,22,0,14 },
|
|
|
|
{ 6,11,30,14 },
|
|
|
|
{ 7,11,20,18 },
|
|
|
|
{ 7,0,20,18 },
|
|
|
|
{ 7,0,30,18 },
|
|
|
|
{ 55,44,0,14 },
|
|
|
|
{ 5,22,30,14 },
|
|
|
|
|
|
|
|
{ 8,0,10,18 },
|
|
|
|
{ 8,11,10,18 },
|
|
|
|
{ 8,22,10,18 },
|
|
|
|
{ 8,33,10,18 },
|
|
|
|
{ 8,33,20,18 },
|
|
|
|
{ 8,33,30,18 },
|
|
|
|
{ 8,33,40,18 },
|
|
|
|
{ 8,22,40,18 },
|
|
|
|
{ 8,11,40,18 },
|
|
|
|
|
|
|
|
{ 21,44,20,18 },
|
|
|
|
{ 255,0,0,0 }
|
2011-11-15 16:31:19 +00:00
|
|
|
};
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::initRain() {
|
2011-11-15 18:27:36 +00:00
|
|
|
const RainLocation *r = rainLocationList;
|
2011-12-02 15:29:16 +00:00
|
|
|
Rain *rainList = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0);
|
2011-11-15 16:31:19 +00:00
|
|
|
Rain *rain = rainList;
|
|
|
|
|
2011-11-15 18:27:36 +00:00
|
|
|
uint8 rainSpacing = 0;
|
|
|
|
|
|
|
|
// look up location in rainLocationList to determine rainSpacing
|
|
|
|
for (r = rainLocationList; r->location != 0xff; ++r) {
|
|
|
|
if (r->location == data.byte(kReallocation) &&
|
|
|
|
r->x == data.byte(kMapx) && r->y == data.byte(kMapy)) {
|
|
|
|
rainSpacing = r->rainSpacing;
|
2011-11-15 16:31:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-11-15 18:27:36 +00:00
|
|
|
}
|
2011-11-15 16:31:19 +00:00
|
|
|
|
2011-11-15 18:27:36 +00:00
|
|
|
if (rainSpacing == 0) {
|
|
|
|
// location not found in rainLocationList: no rain
|
|
|
|
rain->x = 0xff;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// start lines of rain from top of screen
|
2011-11-15 16:31:19 +00:00
|
|
|
uint8 x = 4;
|
|
|
|
do {
|
2011-11-15 18:27:36 +00:00
|
|
|
uint8 delta;
|
|
|
|
do {
|
|
|
|
delta = (engine->randomNumber() & 31) + 3;
|
|
|
|
} while (delta >= rainSpacing);
|
|
|
|
|
2011-11-15 16:31:19 +00:00
|
|
|
x += delta;
|
|
|
|
if (x >= data.byte(kMapxsize))
|
|
|
|
break;
|
2011-11-15 18:27:36 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
rain = splitIntoLines(x, 0, rain);
|
2011-11-15 16:31:19 +00:00
|
|
|
} while (true);
|
2011-11-15 18:27:36 +00:00
|
|
|
|
|
|
|
// start lines of rain from side of screen
|
2011-11-15 16:31:19 +00:00
|
|
|
uint8 y = 0;
|
|
|
|
do {
|
2011-11-15 18:27:36 +00:00
|
|
|
uint8 delta;
|
|
|
|
do {
|
|
|
|
delta = (engine->randomNumber() & 31) + 3;
|
|
|
|
} while (delta >= rainSpacing);
|
|
|
|
|
2011-11-15 16:31:19 +00:00
|
|
|
y += delta;
|
|
|
|
if (y >= data.byte(kMapysize))
|
|
|
|
break;
|
2011-11-15 18:27:36 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
rain = splitIntoLines(data.byte(kMapxsize) - 1, y, rain);
|
2011-11-15 16:31:19 +00:00
|
|
|
} while (true);
|
|
|
|
|
|
|
|
rain->x = 0xff;
|
|
|
|
}
|
|
|
|
|
2011-12-06 10:35:47 +00:00
|
|
|
void DreamGenContext::intro1Text() {
|
2011-12-06 13:21:30 +00:00
|
|
|
if (data.byte(kIntrocount) != 2 && data.byte(kIntrocount) != 4 && data.byte(kIntrocount) != 6)
|
|
|
|
return;
|
|
|
|
|
2011-12-06 18:02:23 +00:00
|
|
|
if (isCD() && data.byte(kCh1playing) != 255) {
|
2011-12-06 13:21:30 +00:00
|
|
|
data.byte(kIntrocount)--;
|
2011-12-06 10:35:47 +00:00
|
|
|
} else {
|
|
|
|
if (data.byte(kIntrocount) == 2)
|
|
|
|
setupTimedTemp(40, 82, 34, 130, 90, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 4)
|
|
|
|
setupTimedTemp(41, 82, 34, 130, 90, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 6)
|
|
|
|
setupTimedTemp(42, 82, 34, 130, 90, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::intro2Text() {
|
|
|
|
if (ax == 5)
|
|
|
|
setupTimedTemp(43, 82, 34, 40, 90, 1);
|
|
|
|
else if (ax == 15)
|
|
|
|
setupTimedTemp(44, 82, 34, 40, 90, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::intro3Text() {
|
|
|
|
if (ax == 107)
|
|
|
|
setupTimedTemp(45, 82, 36, 56, 100, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
else if (ax == (isCD() ? 108 : 109))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(46, 82, 36, 56, 100, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::monks2text() {
|
2011-12-06 13:21:30 +00:00
|
|
|
bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU;
|
|
|
|
|
2011-12-06 10:35:47 +00:00
|
|
|
if (data.byte(kIntrocount) == 1)
|
|
|
|
setupTimedTemp(8, 82, 36, 160, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isGermanCD ? 5 : 4))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(9, 82, 36, 160, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isGermanCD ? 9 : 7))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(10, 82, 36, 160, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isGermanCD ? 13 : 10)) {
|
|
|
|
data.byte(kIntrocount) = isCD() ? 14 : 12;
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(11, 82, 0, 105, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
} else if (data.byte(kIntrocount) == 19 && isGermanCD)
|
|
|
|
setupTimedTemp(14, 82, 36, 120, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 23 && isGermanCD)
|
|
|
|
setupTimedTemp(15, 82, 36, 120, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 27 && isGermanCD)
|
|
|
|
setupTimedTemp(16, 82, 36, 120, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 30 && isGermanCD)
|
|
|
|
setupTimedTemp(17, 82, 36, 120, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 35 && isGermanCD)
|
|
|
|
setupTimedTemp(18, 82, 36, 120, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 13 && !isGermanCD) {
|
|
|
|
if (isCD())
|
|
|
|
data.byte(kIntrocount) = 17;
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(12, 82, 0, 120, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
} else if (data.byte(kIntrocount) == 16)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(13, 82, 0, 135, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 19)
|
|
|
|
setupTimedTemp(14, 82, 36, 160, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 22)
|
|
|
|
setupTimedTemp(15, 82, 36, 160, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 25)
|
|
|
|
setupTimedTemp(16, 82, 36, 160, 120, 1);
|
2011-12-06 13:21:30 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isCD() ? 27 : 28))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(17, 82, 36, 160, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 31)
|
|
|
|
setupTimedTemp(18, 82, 36, 160, 120, 1);
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::textForEnd() {
|
2011-11-16 19:48:16 +00:00
|
|
|
if (data.byte(kIntrocount) == 20)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(0, 83, 34, 20, 60, 1);
|
2011-11-16 19:48:16 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isCD() ? 50 : 65))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(1, 83, 34, 20, 60, 1);
|
2011-11-16 19:48:16 +00:00
|
|
|
else if (data.byte(kIntrocount) == (isCD() ? 85 : 110))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(2, 83, 34, 20, 60, 1);
|
|
|
|
}
|
2011-11-16 19:48:16 +00:00
|
|
|
|
2011-12-06 10:35:47 +00:00
|
|
|
void DreamGenContext::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
|
|
|
|
if (isCD() && data.byte(kCh1playing) != 255)
|
|
|
|
data.byte(kIntrocount)--;
|
|
|
|
else
|
|
|
|
setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount);
|
2011-11-16 17:48:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::textForMonk() {
|
2011-12-06 10:35:47 +00:00
|
|
|
if (data.byte(kIntrocount) == 1)
|
|
|
|
textForMonkHelper(19, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 5)
|
|
|
|
textForMonkHelper(20, 82, 68, 38, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 9)
|
|
|
|
textForMonkHelper(21, 82, 48, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 13)
|
|
|
|
textForMonkHelper(22, 82, 68, 38, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == (isCD() ? 15 : 17))
|
|
|
|
textForMonkHelper(23, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 21)
|
|
|
|
textForMonkHelper(24, 82, 68, 38, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 25)
|
|
|
|
textForMonkHelper(25, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 29)
|
|
|
|
textForMonkHelper(26, 82, 68, 38, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 33)
|
|
|
|
textForMonkHelper(27, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 37)
|
|
|
|
textForMonkHelper(28, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 41)
|
|
|
|
textForMonkHelper(29, 82, 68, 38, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 45)
|
|
|
|
textForMonkHelper(30, 82, 68, 154, 120, 1);
|
|
|
|
else if (data.byte(kIntrocount) == (isCD() ? 52 : 49))
|
|
|
|
textForMonkHelper(31, 82, 68, 154, 220, 1);
|
|
|
|
else if (data.byte(kIntrocount) == 53) {
|
2011-12-01 19:43:43 +00:00
|
|
|
fadeScreenDowns();
|
2011-11-16 19:48:16 +00:00
|
|
|
if (isCD()) {
|
|
|
|
data.byte(kVolumeto) = 7;
|
|
|
|
data.byte(kVolumedirection) = 1;
|
|
|
|
}
|
2011-11-16 19:26:52 +00:00
|
|
|
}
|
2011-11-16 17:48:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::reelsOnScreen() {
|
2011-11-23 10:13:41 +00:00
|
|
|
reconstruct();
|
2011-12-01 19:43:43 +00:00
|
|
|
updatePeople();
|
|
|
|
watchReel();
|
|
|
|
showRain();
|
|
|
|
useTimedText();
|
2011-11-23 10:13:41 +00:00
|
|
|
}
|
|
|
|
|
2011-11-23 09:23:18 +00:00
|
|
|
void DreamGenContext::reconstruct() {
|
|
|
|
if (data.byte(kHavedoneobs) == 0)
|
|
|
|
return;
|
|
|
|
data.byte(kNewobs) = 1;
|
2011-12-01 19:43:43 +00:00
|
|
|
drawFloor();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
2011-11-23 09:23:18 +00:00
|
|
|
if ((data.byte(kForeignrelease) != 0) && (data.byte(kReallocation) == 20))
|
2011-12-01 19:43:43 +00:00
|
|
|
underTextLine();
|
2011-11-23 09:23:18 +00:00
|
|
|
data.byte(kHavedoneobs) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-03 21:09:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct ReelSound {
|
|
|
|
uint8 _sample;
|
|
|
|
uint16 _reelPointer;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound0[] = {
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound1[] = {
|
|
|
|
{ 15, 257 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound2[] = {
|
|
|
|
{ 12, 5 },
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 15, 35 }, // hitting floor?
|
|
|
|
{ 17, 50 },
|
|
|
|
{ 18, 103 },
|
|
|
|
{ 19, 108 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound6[] = {
|
|
|
|
{ 18, 19 },
|
|
|
|
{ 19, 23 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
static const ReelSound g_roomSound8[] = {
|
|
|
|
|
|
|
|
{ 12, 51 },
|
|
|
|
{ 13, 53 },
|
|
|
|
{ 14, 14 },
|
|
|
|
{ 15, 20 },
|
|
|
|
{ 0, 78 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
static const ReelSound g_roomSound9[] = {
|
|
|
|
|
|
|
|
{ 12, 119 },
|
|
|
|
{ 12, 145 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound10[] = {
|
|
|
|
{ 13, 16 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound11[] = {
|
|
|
|
{ 13, 20 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound12[] = {
|
|
|
|
{ 14, 16 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound13[] = {
|
|
|
|
{ 15, 4 },
|
|
|
|
{ 16, 8 },
|
|
|
|
{ 17, 134 },
|
|
|
|
{ 18, 153 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound14[] = {
|
|
|
|
{ 13, 108 },
|
|
|
|
{ 15, 326 },
|
|
|
|
{ 15, 331 },
|
|
|
|
{ 15, 336 },
|
|
|
|
{ 15, 342 },
|
|
|
|
{ 15, 348 },
|
|
|
|
{ 15, 354 },
|
|
|
|
{ 18, 159 },
|
|
|
|
{ 18, 178 },
|
|
|
|
{ 19+128, 217 },
|
|
|
|
{ 20+64, 228 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound20[] = {
|
|
|
|
{ 13, 20 },
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 15, 34 },
|
|
|
|
{ 13, 52 },
|
|
|
|
{ 13, 55 },
|
|
|
|
{ 25, 57 },
|
|
|
|
{ 21, 73 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound22[] = {
|
|
|
|
{ 13, 196 },
|
|
|
|
{ 13, 234 },
|
|
|
|
{ 13, 156 },
|
|
|
|
{ 14, 129 },
|
|
|
|
{ 13, 124 },
|
|
|
|
{ 15, 162 },
|
|
|
|
{ 15, 200 },
|
|
|
|
{ 15, 239 },
|
|
|
|
{ 17, 99 },
|
|
|
|
{ 12, 52 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound23[] = {
|
|
|
|
{ 15, 56 },
|
|
|
|
{ 16, 64 },
|
|
|
|
{ 19, 22 },
|
|
|
|
{ 20, 33 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound25[] = {
|
|
|
|
{ 20, 11 },
|
|
|
|
{ 20, 15 },
|
|
|
|
{ 15, 28 },
|
|
|
|
{ 13, 80 },
|
|
|
|
{ 21, 82 },
|
|
|
|
{ 19+128, 87 },
|
|
|
|
{ 23+64, 128 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound26[] = {
|
|
|
|
{ 12, 13 },
|
|
|
|
{ 14, 39 },
|
|
|
|
{ 12, 67 },
|
|
|
|
{ 12, 75 },
|
|
|
|
{ 12, 83 },
|
|
|
|
{ 12, 91 },
|
|
|
|
{ 15, 102 }, // was 90, should be mine cart
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound27[] = {
|
|
|
|
{ 22, 36 },
|
|
|
|
{ 13, 125 },
|
|
|
|
{ 18, 88 },
|
|
|
|
{ 15, 107 },
|
|
|
|
{ 14, 127 },
|
|
|
|
{ 14, 154 },
|
|
|
|
{ 19+128, 170 },
|
|
|
|
{ 23+64, 232 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound28[] = {
|
|
|
|
{ 21, 16 },
|
|
|
|
{ 21, 72 },
|
|
|
|
{ 21, 205 },
|
|
|
|
{ 22, 63 }, // 65
|
|
|
|
{ 23+128, 99 },
|
|
|
|
{ 24+64, 158 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound29[] = {
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 14, 24 },
|
|
|
|
{ 19+128, 50 },
|
|
|
|
{ 23+64, 75 },
|
|
|
|
{ 24, 128 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound29_German[] = {
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 14, 24 },
|
|
|
|
{ 19+128, 50 },
|
|
|
|
{ 23+64, 75 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound45[] = {
|
|
|
|
{ 19+64, 46 },
|
|
|
|
{ 16, 167 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound46[] = {
|
|
|
|
{ 16, 19 },
|
|
|
|
{ 14, 36 },
|
|
|
|
{ 16, 50 },
|
|
|
|
{ 14, 65 },
|
|
|
|
{ 16, 81 },
|
|
|
|
{ 14, 96 },
|
|
|
|
{ 16, 114 },
|
|
|
|
{ 14, 129 },
|
|
|
|
{ 16, 147 },
|
|
|
|
{ 14, 162 },
|
|
|
|
{ 16, 177 },
|
|
|
|
{ 14, 191 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound47[] = {
|
|
|
|
{ 13, 48 },
|
|
|
|
{ 14, 41 },
|
|
|
|
{ 15, 78 },
|
|
|
|
{ 16, 92 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound52[] = {
|
|
|
|
{ 16, 115 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound53[] = {
|
|
|
|
{ 21, 103 },
|
|
|
|
{ 20, 199 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound55[] = {
|
|
|
|
{ 17, 53 },
|
|
|
|
{ 17, 54 },
|
|
|
|
{ 17, 55 },
|
|
|
|
{ 17, 56 },
|
|
|
|
{ 17, 57 },
|
|
|
|
{ 17, 58 },
|
|
|
|
{ 17, 59 },
|
|
|
|
{ 17, 61 },
|
|
|
|
{ 17, 63 },
|
|
|
|
{ 17, 64 },
|
|
|
|
{ 17, 65 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound *g_roomByRoom[] = {
|
|
|
|
g_roomSound0,g_roomSound1,g_roomSound2,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound6,g_roomSound0,g_roomSound8,g_roomSound9,
|
|
|
|
g_roomSound10,g_roomSound11,g_roomSound12,g_roomSound13,g_roomSound14,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound20,g_roomSound0,g_roomSound22,g_roomSound23,g_roomSound0,
|
|
|
|
g_roomSound25,g_roomSound26,g_roomSound27,g_roomSound28,g_roomSound29,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound45,g_roomSound46,g_roomSound47,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound52,g_roomSound53,g_roomSound0,
|
|
|
|
g_roomSound55
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-12-03 20:43:32 +00:00
|
|
|
void DreamGenContext::soundOnReels() {
|
2011-12-03 21:09:21 +00:00
|
|
|
const ReelSound *r = g_roomByRoom[data.byte(kReallocation)];
|
|
|
|
|
2011-12-06 12:44:43 +00:00
|
|
|
if (engine->getLanguage() == Common::DE_DEU && r == g_roomSound29)
|
2011-12-03 21:09:21 +00:00
|
|
|
r = g_roomSound29_German;
|
|
|
|
|
|
|
|
for (; r->_sample != 255; ++r) {
|
|
|
|
if (r->_reelPointer != data.word(kReelpointer))
|
|
|
|
continue;
|
|
|
|
if (r->_reelPointer == data.word(kLastsoundreel))
|
|
|
|
continue;
|
|
|
|
data.word(kLastsoundreel) = r->_reelPointer;
|
|
|
|
if (r->_sample < 64) {
|
|
|
|
playChannel1(r->_sample);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (r->_sample < 128) {
|
|
|
|
playChannel0(r->_sample & 63, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
playChannel0(r->_sample & 63, 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kReelpointer) != data.word(kLastsoundreel))
|
|
|
|
data.word(kLastsoundreel) = -1;
|
2011-12-03 20:43:32 +00:00
|
|
|
}
|
|
|
|
|
2011-12-05 22:46:06 +00:00
|
|
|
void DreamGenContext::clearBeforeLoad() {
|
|
|
|
if (data.byte(kRoomloaded) != 1)
|
|
|
|
return /* (noclear) */;
|
|
|
|
|
|
|
|
clearReels();
|
|
|
|
clearRest();
|
|
|
|
data.byte(kRoomloaded) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::clearReels() {
|
|
|
|
deallocateMem(data.word(kReel1));
|
|
|
|
deallocateMem(data.word(kReel2));
|
|
|
|
deallocateMem(data.word(kReel3));
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::getRidOfReels() {
|
|
|
|
if (data.byte(kRoomloaded) == 0)
|
|
|
|
return /* (dontgetrid) */;
|
|
|
|
|
|
|
|
deallocateMem(data.word(kReel1));
|
|
|
|
deallocateMem(data.word(kReel2));
|
|
|
|
deallocateMem(data.word(kReel3));
|
|
|
|
}
|
|
|
|
|
2011-12-06 00:34:01 +00:00
|
|
|
void DreamGenContext::liftNoise(uint8 index) {
|
|
|
|
if (data.byte(kReallocation) == 5 || data.byte(kReallocation) == 21)
|
|
|
|
playChannel1(13); // hiss noise
|
|
|
|
else
|
|
|
|
playChannel1(index);
|
|
|
|
}
|
|
|
|
|
2011-07-25 22:04:14 +00:00
|
|
|
} /*namespace dreamgen */
|
|
|
|
|