2011-07-19 10:26:40 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-06-15 21:03:00 +00:00
|
|
|
#include "dreamweb/dreamweb.h"
|
|
|
|
#include "engines/util.h"
|
2011-06-25 18:30:16 +00:00
|
|
|
#include "common/config-manager.h"
|
2011-06-15 21:03:00 +00:00
|
|
|
|
2011-06-16 12:31:17 +00:00
|
|
|
namespace DreamGen {
|
2011-06-15 21:03:00 +00:00
|
|
|
|
2011-12-04 09:11:28 +00:00
|
|
|
// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes
|
|
|
|
// into this, making it a ring buffer
|
|
|
|
uint8 g_keyBuffer[16];
|
|
|
|
|
2011-12-03 13:54:00 +00:00
|
|
|
const Room g_roomData[] = {
|
|
|
|
{ "DREAMWEB.R00", // Ryan's apartment
|
|
|
|
5,255,33,10,
|
|
|
|
255,255,255,0,
|
|
|
|
1,6,2,255,3,255,255,255,255,255,0 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R01",
|
|
|
|
1,255,44,10,
|
|
|
|
255,255,255,0,
|
|
|
|
7,2,255,255,255,255,6,255,255,255,1 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R02",
|
|
|
|
2,255,33,0,
|
|
|
|
255,255,255,0,
|
|
|
|
1,0,255,255,1,255,3,255,255,255,2 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R03",
|
|
|
|
5,255,33,10,
|
|
|
|
255,255,255,0,
|
|
|
|
2,2,0,2,4,255,0,255,255,255,3 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R04",
|
|
|
|
23,255,11,30,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,0,5,255,255,3,255,255,255,4 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R05",
|
|
|
|
5,255,22,30, // if demo: 22,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
1,2,0,4,255,255,3,255,255,255,5 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R06",
|
|
|
|
5,255,11,30,
|
|
|
|
255,255,255,0,
|
|
|
|
1,0,0,1,2,255,0,255,255,255,6 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R07",
|
|
|
|
255,255,0,20,
|
|
|
|
255,255,255,0,
|
|
|
|
2,2,255,255,255,255,0,255,255,255,7 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R08",
|
|
|
|
8,255,0,10,
|
|
|
|
255,255,255,0,
|
|
|
|
1,2,255,255,255,255,0,11,40,0,8 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R09",
|
|
|
|
9,255,22,10,
|
|
|
|
255,255,255,0,
|
|
|
|
4,6,255,255,255,255,0,255,255,255,9 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R10",
|
|
|
|
10,255,33,30,
|
|
|
|
255,255,255,0,
|
|
|
|
2,0,255,255,2,2,4,22,30,255,10 }, // 22,30,0 switches
|
|
|
|
// off path 0 in skip
|
|
|
|
{ "DREAMWEB.R11",
|
|
|
|
11,255,11,20,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,255,255,255,255,255,255,11 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R12",
|
|
|
|
12,255,22,20,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,255,255,255,255,255,255,255,255,12 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R13",
|
|
|
|
12,255,22,20,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,255,255,255,255,255,255,255,255,13 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R14",
|
|
|
|
14,255,44,20,
|
|
|
|
255,255,255,0,
|
|
|
|
0,6,255,255,255,255,255,255,255,255,14 },
|
|
|
|
|
|
|
|
{ "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
|
|
|
|
{ "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
|
|
|
|
{ "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
|
|
|
|
{ "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R19",
|
|
|
|
19,255,0,0,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,255,255,255,255,255,255,19 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R20",
|
|
|
|
22,255,0,20,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,2,15,255,255,255,255,255,255,20 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R21",
|
|
|
|
5,255,11,10, // if demo: 22,255,11,10,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,2,15,1,255,255,255,255,255,21 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R22",
|
|
|
|
22,255,22,10,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,1,255,255,255,255,255,22 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R23",
|
|
|
|
23,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,2,15,3,255,255,255,255,255,23 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R24",
|
|
|
|
5,255,44,0,
|
|
|
|
255,255,255,0,
|
|
|
|
1,6,2,15,255,255,255,255,255,255,24 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R25",
|
|
|
|
22,255,11,40,
|
|
|
|
255,255,255,0,
|
|
|
|
1,0,255,255,255,255,255,255,255,255,25 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R26",
|
|
|
|
9,255,22,20,
|
|
|
|
255,255,255,0,
|
|
|
|
4,2,255,255,255,255,255,255,255,255,26 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R27",
|
|
|
|
22,255,11,20,
|
|
|
|
255,255,255,0,
|
|
|
|
0,6,255,255,255,255,255,255,255,255,27 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R28",
|
|
|
|
5,255,11,30,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,2,255,255,255,255,255,28 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R29",
|
|
|
|
22,255,11,10,
|
|
|
|
255,255,255,0,
|
|
|
|
0,2,255,255,255,255,255,255,255,255,29 },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ "DREAMWEB.R05", // Duplicate of hotel lobby, but emerging from the lift.
|
|
|
|
5,255,22,10, // if demo: 22,255,22,10
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,1,15,255,255,255,255,255,255,5 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R04", // Duplicate of pool hall lobby,
|
|
|
|
23,255,22,20, // but emerging from the lift.
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,2,15,255,255,255,255,255,255,4 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R10", // entering alley via skip
|
|
|
|
10,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
3,6,255,255,255,255,255,255,255,255,10 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R12", // on the beach, getting up.
|
|
|
|
12,255,22,20,
|
|
|
|
255,255,255,0,
|
|
|
|
0,2,255,255,255,255,255,255,255,255,12 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R03", // Duplicate of Eden's lobby
|
|
|
|
5,255,44,0, // but emerging from the lift
|
|
|
|
255,255,255,0,
|
|
|
|
1,6,2,255,4,255,255,255,255,255,3 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R24", // Duplicate of Eden's flat
|
|
|
|
5,255,22,0, // but starting on the bed
|
|
|
|
255,255,255,0,
|
|
|
|
3,6,0,255,255,255,255,33,0,3,24 }, // 33,0,3 turns off path for lift
|
|
|
|
|
|
|
|
{ "DREAMWEB.R22", // Duplicate
|
|
|
|
22,255,22,20, // of hotel but in pool room
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,255,255,255,255,255,255,255,255,22 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R22", // Duplicate
|
|
|
|
22,255,22,20, // of hotel but in pool room
|
|
|
|
255,255,255,0, // coming out of bedroom
|
|
|
|
0,2,255,255,255,255,255,255,255,255,22 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R11", // Duplicate
|
|
|
|
11,255,22,30, // of carpark but getting
|
|
|
|
255,255,255,0, // up off the floor
|
|
|
|
0,0,255,255,255,255,255,255,255,255,11 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R28",
|
|
|
|
5,255,11,20,
|
|
|
|
255,255,255,0,
|
|
|
|
0,6,255,255,2,255,255,255,255,255,28 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R21",
|
|
|
|
5,255,11,10, // if demo: 22,255,11,10
|
|
|
|
255,255,255,0,
|
|
|
|
1,4,2,15,1,255,255,255,255,255,21 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R26",
|
|
|
|
9,255,0,40,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,26 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R19",
|
|
|
|
19,255,0,0,
|
|
|
|
255,255,255,0,
|
|
|
|
2,2,255,255,255,255,255,255,255,255,19 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R08", // leaving tvstudio into street
|
|
|
|
8,255,11,40,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,255,255,255,255,255,255,8 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R01",
|
|
|
|
1,255,44,10,
|
|
|
|
255,255,255,0,
|
|
|
|
3,6,255,255,255,255,255,255,255,255,1 },
|
|
|
|
|
|
|
|
|
|
|
|
{ "DREAMWEB.R45", // Dream room
|
|
|
|
35,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
0,6,255,255,255,255,255,255,255,255,45 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R46", // Dream room
|
|
|
|
35,255,22,40,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,255,255,255,255,255,255,46 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R47", // Dream room
|
|
|
|
35,255,0,0,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,47 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R45", // Dream room
|
|
|
|
35,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
4,0,255,255,255,255,255,255,255,255,45 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R46", // Dream room
|
|
|
|
35,255,22,50,
|
|
|
|
255,255,255,0,
|
|
|
|
0,4,255,255,255,255,255,255,255,255,46 },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ "DREAMWEB.R50", // Intro sequence one
|
|
|
|
35,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,50 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R51", // Intro sequence two
|
|
|
|
35,255,11,30,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,51 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R52", // Intro sequence three
|
|
|
|
35,255,22,30,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,52 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R53", // Intro sequence four
|
|
|
|
35,255,33,0,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,53 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R54", // Intro sequence five - wasteland
|
|
|
|
35,255,0,0,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,54 },
|
|
|
|
|
|
|
|
{ "DREAMWEB.R55", // End sequence
|
|
|
|
14,255,44,0,
|
|
|
|
255,255,255,0,
|
|
|
|
0,0,255,255,255,255,255,255,255,255,55 }
|
|
|
|
};
|
|
|
|
|
2011-12-03 18:50:25 +00:00
|
|
|
static const Atmosphere g_atmosphereList[] = {
|
|
|
|
// location,map x,y,sound,repeat
|
|
|
|
{ 0,33,10,15,255 },
|
|
|
|
{ 0,22,10,15,255 },
|
|
|
|
{ 0,22,0,15,255 },
|
|
|
|
{ 0,11,0,15,255 },
|
|
|
|
{ 0,11,10,15,255 },
|
|
|
|
{ 0,0,10,15,255 },
|
|
|
|
|
|
|
|
{ 1,44,10,6,255 },
|
|
|
|
{ 1,44,0,13,255 },
|
|
|
|
|
|
|
|
{ 2,33,0,6,255 },
|
|
|
|
{ 2,22,0,5,255 },
|
|
|
|
{ 2,22,10,16,255 },
|
|
|
|
{ 2,11,10,16,255 },
|
|
|
|
|
|
|
|
{ 3,44,0,15,255 },
|
|
|
|
{ 3,33,10,6,255 },
|
|
|
|
{ 3,33,0,5,255 },
|
|
|
|
|
|
|
|
{ 4,11,30,6,255 },
|
|
|
|
{ 4,22,30,5,255 },
|
|
|
|
{ 4,22,20,13,255 },
|
|
|
|
|
|
|
|
{ 10,33,30,6,255 },
|
|
|
|
{ 10,22,30,6,255 },
|
|
|
|
|
|
|
|
{ 9,22,10,6,255 },
|
|
|
|
{ 9,22,20,16,255 },
|
|
|
|
{ 9,22,30,16,255 },
|
|
|
|
{ 9,22,40,16,255 },
|
|
|
|
{ 9,22,50,16,255 },
|
|
|
|
|
|
|
|
{ 6,11,30,6,255 },
|
|
|
|
{ 6,0,10,15,255 },
|
|
|
|
{ 6,0,20,15,255 },
|
|
|
|
{ 6,11,20,15,255 },
|
|
|
|
{ 6,22,20,15,255 },
|
|
|
|
|
|
|
|
{ 7,11,20,6,255 },
|
|
|
|
{ 7,0,20,6,255 },
|
|
|
|
{ 7,0,30,6,255 },
|
|
|
|
|
|
|
|
{ 55,44,0,5,255 },
|
|
|
|
{ 55,44,10,5,255 },
|
|
|
|
|
|
|
|
{ 5,22,30,6,255 },
|
|
|
|
{ 5,22,20,15,255 }, // if demo: { 5,22,20,16,255 },
|
|
|
|
{ 5,22,10,15,255 }, // if demo: { 5,22,10,16,255 },
|
|
|
|
|
|
|
|
{ 24,22,0,15,255 },
|
|
|
|
{ 24,33,0,15,255 },
|
|
|
|
{ 24,44,0,15,255 },
|
|
|
|
{ 24,33,10,15,255 },
|
|
|
|
|
|
|
|
{ 8,0,10,6,255 },
|
|
|
|
{ 8,11,10,6,255 },
|
|
|
|
{ 8,22,10,6,255 },
|
|
|
|
{ 8,33,10,6,255 },
|
|
|
|
{ 8,33,20,6,255 },
|
|
|
|
{ 8,33,30,6,255 },
|
|
|
|
{ 8,33,40,6,255 },
|
|
|
|
{ 8,22,40,6,255 },
|
|
|
|
{ 8,11,40,6,255 },
|
|
|
|
|
|
|
|
{ 11,11,20,12,255 },
|
|
|
|
{ 11,11,30,12,255 },
|
|
|
|
{ 11,22,20,12,255 },
|
|
|
|
{ 11,22,30,12,255 },
|
|
|
|
|
|
|
|
{ 12,22,20,12,255 },
|
|
|
|
{ 13,22,20,12,255 },
|
|
|
|
{ 13,33,20,12,255 },
|
|
|
|
|
|
|
|
{ 14,44,20,12,255 },
|
|
|
|
{ 14,33,0,12,255 },
|
|
|
|
{ 14,33,10,12,255 },
|
|
|
|
{ 14,33,20,12,255 },
|
|
|
|
{ 14,33,30,12,255 },
|
|
|
|
{ 14,33,40,12,255 },
|
|
|
|
{ 14,22,0,16,255 },
|
|
|
|
|
|
|
|
{ 19,0,0,12,255 },
|
|
|
|
|
|
|
|
{ 20,0,20,16,255 },
|
|
|
|
{ 20,0,30,16,255 },
|
|
|
|
{ 20,11,30,16,255 },
|
|
|
|
{ 20,0,40,16,255 },
|
|
|
|
{ 20,11,40,16,255 },
|
|
|
|
|
|
|
|
{ 21,11,10,15,255 }, // if demo: { 21,11,10,16,255 },
|
|
|
|
{ 21,11,20,15,255 }, // if demo: { 21,11,20,16,255 },
|
|
|
|
{ 21, 0,20,15,255 }, // if demo: { 21,0,20,16,255 },
|
|
|
|
{ 21,22,20,15,255 }, // if demo: { 21,22,20,16,255 },
|
|
|
|
{ 21,33,20,15,255 }, // if demo: { 21,33,20,16,255 },
|
|
|
|
{ 21,44,20,15,255 }, // if demo: { 21,44,20,16,255 },
|
|
|
|
{ 21,44,10,15,255 }, // if demo: { 21,44,10,16,255 },
|
|
|
|
|
|
|
|
{ 22,22,10,16,255 },
|
|
|
|
{ 22,22,20,16,255 },
|
|
|
|
|
|
|
|
{ 23,22,30,13,255 },
|
|
|
|
{ 23,22,40,13,255 },
|
|
|
|
{ 23,33,40,13,255 },
|
|
|
|
{ 23,11,40,13,255 },
|
|
|
|
{ 23,0,40,13,255 },
|
|
|
|
{ 23,0,50,13,255 },
|
|
|
|
|
|
|
|
{ 25,11,40,16,255 },
|
|
|
|
{ 25,11,50,16,255 },
|
|
|
|
{ 25,0,50,16,255 },
|
|
|
|
|
|
|
|
{ 27,11,20,16,255 },
|
|
|
|
{ 27,11,30,16,255 },
|
|
|
|
|
|
|
|
{ 29,11,10,16,255 },
|
|
|
|
|
|
|
|
{ 45,22,30,12,255 },
|
|
|
|
{ 45,22,40,12,255 },
|
|
|
|
{ 45,22,50,12,255 },
|
|
|
|
|
|
|
|
{ 46,22,40,12,255 },
|
|
|
|
{ 46,11,50,12,255 },
|
|
|
|
{ 46,22,50,12,255 },
|
|
|
|
{ 46,33,50,12,255 },
|
|
|
|
|
|
|
|
{ 47,0,0,12,255 },
|
|
|
|
|
|
|
|
{ 26,22,20,16,255 },
|
|
|
|
{ 26,33,10,16,255 },
|
|
|
|
{ 26,33,20,16,255 },
|
|
|
|
{ 26,33,30,16,255 },
|
|
|
|
{ 26,44,30,16,255 },
|
|
|
|
{ 26,22,30,16,255 },
|
|
|
|
{ 26,11,30,16,255 },
|
|
|
|
{ 26,11,20,16,255 },
|
|
|
|
{ 26,0,20,16,255 },
|
|
|
|
{ 26,11,40,16,255 },
|
|
|
|
{ 26,0,40,16,255 },
|
|
|
|
{ 26,22,40,16,255 },
|
|
|
|
{ 26,11,50,16,255 },
|
|
|
|
|
|
|
|
{ 28,0,30,15,255 },
|
|
|
|
{ 28,0,20,15,255 },
|
|
|
|
{ 28,0,40,15,255 },
|
|
|
|
{ 28,11,30,15,255 },
|
|
|
|
{ 28,11,20,15,255 },
|
|
|
|
{ 28,22,30,15,255 },
|
|
|
|
{ 28,22,20,15,255 },
|
|
|
|
|
|
|
|
{ 255,255,255,255,255 }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2011-06-26 10:06:16 +00:00
|
|
|
void DreamGenContext::dreamweb() {
|
|
|
|
STACK_CHECK;
|
2011-11-15 21:11:32 +00:00
|
|
|
|
|
|
|
switch(engine->getLanguage()) {
|
|
|
|
case Common::EN_ANY:
|
|
|
|
case Common::EN_GRB:
|
|
|
|
case Common::EN_USA:
|
2011-11-16 02:51:51 +00:00
|
|
|
// Implicit data.byte(kForeignrelease) = 0
|
|
|
|
break;
|
2011-11-15 21:11:32 +00:00
|
|
|
default:
|
|
|
|
data.byte(kForeignrelease) = 1;
|
2011-11-16 02:51:51 +00:00
|
|
|
break;
|
2011-11-15 21:11:32 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
seeCommandTail();
|
2011-12-07 16:40:57 +00:00
|
|
|
// soundStartup used to be done here...
|
2011-12-07 20:20:02 +00:00
|
|
|
// setKeyboardInt used to be done here...
|
2011-12-01 19:43:43 +00:00
|
|
|
allocateBuffers();
|
2011-12-07 20:20:02 +00:00
|
|
|
|
|
|
|
// setMouse
|
|
|
|
data.word(kOldpointerx) = 0xffff;
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
fadeDOS();
|
2011-12-12 11:09:19 +00:00
|
|
|
getTime();
|
2011-12-01 19:43:43 +00:00
|
|
|
clearBuffers();
|
|
|
|
clearPalette();
|
|
|
|
set16ColPalette();
|
|
|
|
readSetData();
|
2011-06-26 10:06:16 +00:00
|
|
|
data.byte(kWongame) = 0;
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-12-04 22:43:32 +00:00
|
|
|
engine->loadSounds(0, "DREAMWEB.V99"); // basic sample
|
2011-06-26 10:06:16 +00:00
|
|
|
|
2011-06-25 14:40:41 +00:00
|
|
|
bool firstLoop = true;
|
|
|
|
|
2011-06-25 18:30:16 +00:00
|
|
|
int savegameId = Common::ConfigManager::instance().getInt("save_slot");
|
|
|
|
|
2011-06-25 14:40:41 +00:00
|
|
|
while (true) {
|
|
|
|
|
2011-12-03 14:18:45 +00:00
|
|
|
unsigned int count = scanForNames();
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
bool startNewGame = true;
|
|
|
|
|
2011-06-25 18:30:16 +00:00
|
|
|
if (firstLoop && savegameId >= 0) {
|
|
|
|
|
|
|
|
// loading a savegame requested from launcher/command line
|
|
|
|
|
|
|
|
cls();
|
2011-12-01 19:43:43 +00:00
|
|
|
setMode();
|
|
|
|
loadPalFromIFF();
|
|
|
|
clearPalette();
|
2011-06-25 18:30:16 +00:00
|
|
|
|
2011-12-03 15:54:39 +00:00
|
|
|
doLoad(savegameId);
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-01 19:43:43 +00:00
|
|
|
fadeScreenUp();
|
2011-06-25 18:30:16 +00:00
|
|
|
startNewGame = false;
|
|
|
|
|
2011-12-03 14:18:45 +00:00
|
|
|
} else if (count == 0 && firstLoop) {
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
// no savegames found, and we're not restarting.
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
setMode();
|
|
|
|
loadPalFromIFF();
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
// "doDecisions"
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
// Savegames found, so ask if we should load one.
|
|
|
|
// (If we're restarting after game over, we also always show these
|
|
|
|
// options.)
|
|
|
|
|
|
|
|
cls();
|
2011-12-01 19:43:43 +00:00
|
|
|
setMode();
|
2011-06-25 14:40:41 +00:00
|
|
|
decide();
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
if (data.byte(kGetback) == 4)
|
|
|
|
startNewGame = false; // savegame has been loaded
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
firstLoop = false;
|
|
|
|
|
|
|
|
if (startNewGame) {
|
2011-12-01 19:43:43 +00:00
|
|
|
// "playGame"
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-12-04 14:52:44 +00:00
|
|
|
// "titles"
|
|
|
|
clearPalette();
|
|
|
|
bibleQuote();
|
|
|
|
if (!quitRequested()) // "titlesearly"
|
|
|
|
intro();
|
|
|
|
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-12-02 12:18:39 +00:00
|
|
|
|
|
|
|
// "credits"
|
|
|
|
clearPalette();
|
|
|
|
realCredits();
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
clearChanges();
|
|
|
|
setMode();
|
|
|
|
loadPalFromIFF();
|
2011-06-25 14:40:41 +00:00
|
|
|
data.byte(kLocation) = 255;
|
|
|
|
data.byte(kRoomafterdream) = 1;
|
|
|
|
data.byte(kNewlocation) = 35;
|
|
|
|
data.byte(kVolume) = 7;
|
2011-12-01 19:43:43 +00:00
|
|
|
loadRoom();
|
|
|
|
clearSprites();
|
|
|
|
initMan();
|
|
|
|
entryTexts();
|
|
|
|
entryAnims();
|
2011-06-25 14:40:41 +00:00
|
|
|
data.byte(kDestpos) = 3;
|
2011-12-01 19:43:43 +00:00
|
|
|
initialInv();
|
2011-06-25 14:40:41 +00:00
|
|
|
data.byte(kLastflag) = 32;
|
|
|
|
startup1();
|
|
|
|
data.byte(kVolumeto) = 0;
|
2011-12-12 20:46:28 +00:00
|
|
|
data.byte(kVolumedirection) = (byte)-1;
|
2011-06-25 14:40:41 +00:00
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// main loop
|
|
|
|
while (true) {
|
|
|
|
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
screenUpdate();
|
2011-06-25 14:40:41 +00:00
|
|
|
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-11-15 19:59:03 +00:00
|
|
|
|
2011-06-25 14:40:41 +00:00
|
|
|
if (data.byte(kWongame) != 0) {
|
|
|
|
// "endofgame"
|
2011-12-01 19:43:43 +00:00
|
|
|
clearBeforeLoad();
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOn(200);
|
|
|
|
endGame();
|
|
|
|
quickQuit2();
|
2011-12-04 16:46:36 +00:00
|
|
|
goto done;
|
2011-06-25 14:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kMandead) == 1 || data.byte(kMandead) == 2)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (data.word(kWatchingtime) > 0) {
|
|
|
|
if (data.byte(kFinaldest) == data.byte(kManspath))
|
|
|
|
data.word(kWatchingtime)--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kWatchingtime) == 0) {
|
2011-12-01 19:43:43 +00:00
|
|
|
// "notWatching"
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
if (data.byte(kMandead) == 4)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (data.byte(kNewlocation) != 255) {
|
2011-12-01 19:43:43 +00:00
|
|
|
// "loadNew"
|
|
|
|
clearBeforeLoad();
|
|
|
|
loadRoom();
|
|
|
|
clearSprites();
|
|
|
|
initMan();
|
|
|
|
entryTexts();
|
|
|
|
entryAnims();
|
2011-06-25 14:40:41 +00:00
|
|
|
data.byte(kNewlocation) = 255;
|
|
|
|
startup();
|
|
|
|
data.byte(kCommandtype) = 255;
|
2011-12-01 19:43:43 +00:00
|
|
|
workToScreenM();
|
2011-06-25 14:40:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
// "gameOver"
|
|
|
|
clearBeforeLoad();
|
|
|
|
showGun();
|
|
|
|
fadeScreenDown();
|
|
|
|
hangOn(100);
|
2011-06-25 14:40:41 +00:00
|
|
|
|
|
|
|
}
|
2011-12-04 16:46:36 +00:00
|
|
|
done: // The engine will need some cleaner finalization, let's put it here for now
|
2011-12-11 10:48:26 +00:00
|
|
|
// FIXME: This triggers "Deallocating non existent segment" errors when
|
|
|
|
// quitting from a menu.
|
2011-12-04 16:46:36 +00:00
|
|
|
getRidOfAll();
|
2011-12-04 16:53:55 +00:00
|
|
|
engine->freeIcons1();
|
|
|
|
engine->freeIcons2();
|
2011-06-25 14:40:41 +00:00
|
|
|
}
|
2011-06-26 10:06:16 +00:00
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
bool DreamBase::quitRequested() {
|
2011-11-20 20:26:18 +00:00
|
|
|
return data.byte(kQuitrequested);
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::screenUpdate() {
|
|
|
|
newPlace();
|
|
|
|
mainScreen();
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-11-20 20:13:46 +00:00
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
animPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showPointer();
|
2011-11-20 20:13:46 +00:00
|
|
|
if ((data.word(kWatchingtime) == 0) && (data.byte(kNewlocation) != 0xff))
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
vSync();
|
2011-11-20 18:54:19 +00:00
|
|
|
uint16 mouseState = 0;
|
|
|
|
mouseState |= readMouseState();
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpTextLine();
|
|
|
|
delPointer();
|
|
|
|
autoLook();
|
|
|
|
spriteUpdate();
|
|
|
|
watchCount();
|
2011-11-20 20:13:46 +00:00
|
|
|
zoom();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showPointer();
|
2011-11-20 20:13:46 +00:00
|
|
|
if (data.byte(kWongame))
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
vSync();
|
2011-11-20 18:54:19 +00:00
|
|
|
mouseState |= readMouseState();
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpZoom();
|
|
|
|
delPointer();
|
|
|
|
delEverything();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
afterNewRoom();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showPointer();
|
|
|
|
vSync();
|
2011-11-20 18:54:19 +00:00
|
|
|
mouseState |= readMouseState();
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpMap();
|
|
|
|
dumpTimedText();
|
|
|
|
delPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showPointer();
|
|
|
|
vSync();
|
2011-11-20 18:54:19 +00:00
|
|
|
data.word(kOldbutton) = data.word(kMousebutton);
|
|
|
|
mouseState |= readMouseState();
|
|
|
|
data.word(kMousebutton) = mouseState;
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpPointer();
|
2011-11-20 18:54:19 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpWatch();
|
|
|
|
delPointer();
|
2011-11-20 20:13:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-20 18:53:58 +00:00
|
|
|
void DreamGenContext::startup() {
|
|
|
|
data.byte(kCurrentkey) = 0;
|
|
|
|
data.byte(kMainmode) = 0;
|
2011-12-01 19:43:43 +00:00
|
|
|
createPanel();
|
2011-11-20 18:53:58 +00:00
|
|
|
data.byte(kNewobs) = 1;
|
2011-12-01 19:43:43 +00:00
|
|
|
drawFloor();
|
|
|
|
showIcon();
|
|
|
|
getUnderZoom();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
|
|
|
underTextLine();
|
|
|
|
reelsOnScreen();
|
2011-11-20 18:53:58 +00:00
|
|
|
atmospheres();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::startup1() {
|
2011-12-01 19:43:43 +00:00
|
|
|
clearPalette();
|
2011-11-20 18:53:58 +00:00
|
|
|
data.byte(kThroughdoor) = 0;
|
2011-11-20 18:54:19 +00:00
|
|
|
|
|
|
|
startup();
|
|
|
|
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-01 19:43:43 +00:00
|
|
|
fadeScreenUp();
|
2011-11-20 18:53:58 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::switchRyanOn() {
|
2011-11-20 18:58:05 +00:00
|
|
|
data.byte(kRyanon) = 255;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::switchRyanOff() {
|
2011-11-20 18:58:05 +00:00
|
|
|
data.byte(kRyanon) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
uint8 *DreamBase::textUnder() {
|
2011-12-02 15:29:16 +00:00
|
|
|
return getSegment(data.word(kBuffers)).ptr(kTextunder, 0);
|
2011-11-18 05:30:12 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
uint16 DreamBase::standardLoad(const char *fileName, uint16 *outSizeInBytes) {
|
2011-12-03 14:47:24 +00:00
|
|
|
FileHeader header;
|
|
|
|
|
2011-12-09 14:34:39 +00:00
|
|
|
Common::File file;
|
|
|
|
file.open(fileName);
|
|
|
|
file.read((uint8 *)&header, sizeof(FileHeader));
|
2011-12-03 14:47:24 +00:00
|
|
|
uint16 sizeInBytes = header.len(0);
|
2011-12-04 16:53:55 +00:00
|
|
|
if (outSizeInBytes)
|
|
|
|
*outSizeInBytes = sizeInBytes;
|
2011-12-01 19:43:43 +00:00
|
|
|
uint16 result = allocateMem((sizeInBytes + 15) / 16);
|
2011-12-09 14:34:39 +00:00
|
|
|
file.read(getSegment(result).ptr(0, 0), sizeInBytes);
|
2011-11-17 17:21:34 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void *DreamBase::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {
|
2011-12-04 17:29:34 +00:00
|
|
|
uint16 sizeInBytes;
|
|
|
|
uint16 seg = standardLoad(fileName, &sizeInBytes);
|
|
|
|
void *buffer = malloc(sizeInBytes);
|
|
|
|
memcpy(buffer, getSegment(seg).ptr(0, 0), sizeInBytes);
|
|
|
|
deallocateMem(seg);
|
|
|
|
if (outSizeInBytes)
|
|
|
|
*outSizeInBytes = sizeInBytes;
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::loadIntoTemp(const char *fileName) {
|
2011-12-01 19:43:43 +00:00
|
|
|
data.word(kTempgraphics) = standardLoad(fileName);
|
2011-11-17 23:01:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::loadIntoTemp2(const char *fileName) {
|
2011-12-01 19:43:43 +00:00
|
|
|
data.word(kTempgraphics2) = standardLoad(fileName);
|
2011-11-17 23:01:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::loadIntoTemp3(const char *fileName) {
|
2011-12-01 19:43:43 +00:00
|
|
|
data.word(kTempgraphics3) = standardLoad(fileName);
|
2011-11-17 23:01:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::loadTempCharset(const char *fileName) {
|
|
|
|
engine->setTempCharset(standardLoadCPP(fileName));
|
2011-11-17 23:14:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamGenContext::hangOnCurs() {
|
|
|
|
hangOnCurs(cx);
|
2011-11-20 13:14:58 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::hangOnCurs(uint16 frameCount) {
|
2011-11-18 05:33:18 +00:00
|
|
|
for (uint16 i = 0; i < frameCount; ++i) {
|
2011-12-01 19:43:43 +00:00
|
|
|
printCurs();
|
|
|
|
vSync();
|
|
|
|
delCurs();
|
2011-11-18 05:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::seeCommandTail() {
|
2011-06-16 20:30:39 +00:00
|
|
|
data.byte(kBrightness) = 1;
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::randomNumber() {
|
2011-06-16 20:30:39 +00:00
|
|
|
al = engine->randomNumber();
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::quickQuit() {
|
2011-06-16 20:30:39 +00:00
|
|
|
engine->quit();
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::quickQuit2() {
|
2011-06-16 20:30:39 +00:00
|
|
|
engine->quit();
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::readMouse() {
|
2011-08-25 05:50:35 +00:00
|
|
|
data.word(kOldbutton) = data.word(kMousebutton);
|
2011-11-20 18:54:19 +00:00
|
|
|
uint16 state = readMouseState();
|
2011-08-25 05:50:35 +00:00
|
|
|
data.word(kMousebutton) = state;
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
uint16 DreamBase::readMouseState() {
|
2011-08-25 05:50:35 +00:00
|
|
|
data.word(kOldx) = data.word(kMousex);
|
|
|
|
data.word(kOldy) = data.word(kMousey);
|
|
|
|
uint16 x, y, state;
|
|
|
|
engine->mouseCall(&x, &y, &state);
|
|
|
|
data.word(kMousex) = x;
|
|
|
|
data.word(kMousey) = y;
|
2011-11-20 18:54:19 +00:00
|
|
|
return state;
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::dumpTextLine() {
|
2011-07-21 20:46:16 +00:00
|
|
|
if (data.byte(kNewtextline) != 1)
|
|
|
|
return;
|
|
|
|
data.byte(kNewtextline) = 0;
|
|
|
|
uint16 x = data.word(kTextaddressx);
|
|
|
|
uint16 y = data.word(kTextaddressy);
|
|
|
|
if (data.byte(kForeignrelease) != 0)
|
|
|
|
y -= 3;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiDump(x, y, 228, 13);
|
2011-07-21 20:46:16 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::getUnderTimed() {
|
2011-07-23 17:18:10 +00:00
|
|
|
uint16 y = data.byte(kTimedy);
|
|
|
|
if (data.byte(kForeignrelease))
|
|
|
|
y -= 3;
|
|
|
|
ds = data.word(kBuffers);
|
|
|
|
si = kUndertimedtext;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiGet(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
|
2011-07-23 17:18:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::putUnderTimed() {
|
2011-07-23 17:18:10 +00:00
|
|
|
uint16 y = data.byte(kTimedy);
|
|
|
|
if (data.byte(kForeignrelease))
|
|
|
|
y -= 3;
|
|
|
|
ds = data.word(kBuffers);
|
|
|
|
si = kUndertimedtext;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
|
2011-07-23 17:18:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 20:55:29 +00:00
|
|
|
void DreamBase::getUnderCentre() {
|
|
|
|
multiGet(mapStore(), 58, 72, 254, 110);
|
2011-12-12 20:43:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 20:55:29 +00:00
|
|
|
void DreamBase::putUnderCentre() {
|
|
|
|
multiPut(mapStore(), 58, 72, 254, 110);
|
2011-12-12 20:43:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::triggerMessage(uint16 index) {
|
|
|
|
multiGet(mapStore(), 174, 153, 200, 63);
|
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
|
|
|
|
uint16 y = 156;
|
|
|
|
printDirect(&string, 174, &y, 141, true);
|
|
|
|
hangOn(140);
|
|
|
|
workToScreenCPP();
|
|
|
|
hangOn(340);
|
|
|
|
multiPut(mapStore(), 174, 153, 200, 63);
|
|
|
|
workToScreenCPP();
|
|
|
|
data.byte(kLasttrigger) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::processTrigger() {
|
|
|
|
if (data.byte(kLasttrigger) == '1') {
|
2011-12-15 12:41:30 +00:00
|
|
|
setLocation(8);
|
2011-12-12 20:43:03 +00:00
|
|
|
triggerMessage(45);
|
|
|
|
} else if (data.byte(kLasttrigger) == '2') {
|
2011-12-15 12:41:30 +00:00
|
|
|
setLocation(9);
|
2011-12-12 20:43:03 +00:00
|
|
|
triggerMessage(55);
|
|
|
|
} else if (data.byte(kLasttrigger) == '3') {
|
2011-12-15 12:41:30 +00:00
|
|
|
setLocation(2);
|
2011-12-12 20:43:03 +00:00
|
|
|
triggerMessage(59);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::useTimedText() {
|
2011-07-23 17:18:10 +00:00
|
|
|
if (data.word(kTimecount) == 0)
|
|
|
|
return;
|
|
|
|
--data.word(kTimecount);
|
|
|
|
if (data.word(kTimecount) == 0) {
|
2011-12-01 19:43:43 +00:00
|
|
|
putUnderTimed();
|
2011-07-23 17:18:10 +00:00
|
|
|
data.byte(kNeedtodumptimed) = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kTimecount) == data.word(kCounttotimed))
|
2011-12-01 19:43:43 +00:00
|
|
|
getUnderTimed();
|
2011-07-23 17:18:10 +00:00
|
|
|
else if (data.word(kTimecount) > data.word(kCounttotimed))
|
|
|
|
return;
|
|
|
|
|
|
|
|
es = data.word(kTimedseg);
|
|
|
|
si = data.word(kTimedoffset);
|
2011-08-10 15:12:26 +00:00
|
|
|
const uint8 *string = es.ptr(si, 0);
|
2011-07-23 17:18:10 +00:00
|
|
|
uint16 y = data.byte(kTimedy);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(&string, data.byte(kTimedx), &y, 237, true);
|
2011-07-23 17:18:10 +00:00
|
|
|
data.byte(kNeedtodumptimed) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
|
2011-08-11 14:59:20 +00:00
|
|
|
#if 1 // if cd
|
|
|
|
if (voiceIndex != 0) {
|
2011-12-12 11:39:06 +00:00
|
|
|
if (loadSpeech('T', voiceIndex, 'T', textIndex)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
playChannel1(50+12);
|
2011-07-17 14:06:19 +00:00
|
|
|
}
|
2011-11-16 20:39:25 +00:00
|
|
|
|
|
|
|
// FIXME: This fallthrough does not properly support subtitles+speech
|
|
|
|
// mode. The parameters to setuptimedtemp() are sometimes different
|
|
|
|
// for speech and for subtitles. See e.g., madmantext()
|
2011-08-11 14:59:20 +00:00
|
|
|
if ((data.byte(kSpeechloaded) == 1) && (data.byte(kSubtitles) != 1))
|
|
|
|
return;
|
2011-07-17 14:06:19 +00:00
|
|
|
}
|
2011-08-11 14:59:20 +00:00
|
|
|
#endif
|
2011-07-17 14:06:19 +00:00
|
|
|
|
2011-08-11 14:59:20 +00:00
|
|
|
if (data.word(kTimecount) != 0)
|
|
|
|
return;
|
|
|
|
data.byte(kTimedy) = y;
|
|
|
|
data.byte(kTimedx) = x;
|
|
|
|
data.word(kCounttotimed) = countToTimed;
|
|
|
|
data.word(kTimecount) = timeCount + countToTimed;
|
|
|
|
data.word(kTimedseg) = data.word(kTextfile1);
|
2011-12-02 15:29:16 +00:00
|
|
|
data.word(kTimedoffset) = kTextstart + getSegment(data.word(kTextfile1)).word(textIndex * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kTextfile1)).ptr(data.word(kTimedoffset), 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, string);
|
2011-08-11 14:59:20 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::dumpTimedText() {
|
2011-08-11 13:24:06 +00:00
|
|
|
if (data.byte(kNeedtodumptimed) != 1)
|
|
|
|
return;
|
|
|
|
uint8 y = data.byte(kTimedy);
|
|
|
|
if (data.byte(kForeignrelease) != 0)
|
|
|
|
y -= 3;
|
2011-07-17 12:38:30 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
multiDump(data.byte(kTimedx), y, 240, kUndertimedysize);
|
2011-08-11 13:24:06 +00:00
|
|
|
data.byte(kNeedtodumptimed) = 0;
|
2011-07-17 12:38:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 11:09:19 +00:00
|
|
|
void DreamGenContext::getTime() {
|
|
|
|
TimeDate t;
|
|
|
|
g_system->getTimeAndDate(t);
|
|
|
|
debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec);
|
|
|
|
ch = t.tm_hour;
|
|
|
|
cl = t.tm_min;
|
|
|
|
dh = t.tm_sec;
|
|
|
|
data.byte(kSecondcount) = dh;
|
|
|
|
data.byte(kMinutecount) = cl;
|
|
|
|
data.byte(kHourcount) = ch;
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
uint16 DreamBase::allocateMem(uint16 paragraphs) {
|
2011-07-30 20:03:28 +00:00
|
|
|
uint size = (paragraphs + 2) * 16;
|
2011-06-15 21:03:00 +00:00
|
|
|
debug(1, "allocate mem, %u bytes", size);
|
2011-06-16 20:30:39 +00:00
|
|
|
SegmentRef seg = allocateSegment(size);
|
2011-07-30 20:03:28 +00:00
|
|
|
uint16 result = (uint16)seg;
|
|
|
|
debug(1, "\tsegment address -> %04x", result);
|
|
|
|
return result;
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::deallocateMem(uint16 segment) {
|
2011-11-18 06:29:38 +00:00
|
|
|
debug(1, "deallocating segment %04x", segment);
|
|
|
|
deallocateSegment(segment);
|
2011-06-15 21:03:00 +00:00
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
|
|
|
|
// FIXME: The following line used to be enabled with the comment: "fixing
|
|
|
|
// invalid entries in the sprite table"
|
|
|
|
// So if there are regressions with sprites, we may want to investigate this
|
|
|
|
// closer.
|
|
|
|
// es = data;
|
2011-06-15 21:03:00 +00:00
|
|
|
uint tsize = 16 * 32;
|
2011-06-16 20:30:39 +00:00
|
|
|
uint16 bseg = data.word(kBuffers);
|
2011-06-15 21:03:00 +00:00
|
|
|
if (!bseg)
|
|
|
|
return;
|
2011-12-02 20:27:45 +00:00
|
|
|
MutableSegmentRef buffers(this);
|
2011-06-15 21:03:00 +00:00
|
|
|
buffers = bseg;
|
|
|
|
uint8 *ptr = buffers.ptr(kSpritetable, tsize);
|
2011-12-08 09:02:51 +00:00
|
|
|
for (uint i = 0; i < tsize; i += 32) {
|
2011-06-15 21:03:00 +00:00
|
|
|
uint16 seg = READ_LE_UINT16(ptr + i + 6);
|
|
|
|
//debug(1, "sprite segment = %04x", seg);
|
2011-11-18 06:29:38 +00:00
|
|
|
if (seg == segment)
|
2011-06-15 21:03:00 +00:00
|
|
|
memset(ptr + i, 0xff, 32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::DOSReturn() {
|
2011-12-04 18:55:22 +00:00
|
|
|
if (data.byte(kCommandtype) != 250) {
|
2011-06-18 09:33:24 +00:00
|
|
|
data.byte(kCommandtype) = 250;
|
2011-12-04 18:55:22 +00:00
|
|
|
commandOnly(46);
|
2011-06-18 09:33:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-04 18:55:22 +00:00
|
|
|
if (data.word(kMousebutton) & 1) {
|
|
|
|
data.word(kMousebutton) = 0;
|
|
|
|
engine->quit();
|
|
|
|
}
|
2011-06-15 21:03:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::set16ColPalette() {
|
2011-06-18 10:29:10 +00:00
|
|
|
}
|
2011-06-15 21:03:00 +00:00
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::eraseOldObs() {
|
2011-06-26 13:17:19 +00:00
|
|
|
if (data.byte(kNewobs) == 0)
|
|
|
|
return;
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
Sprite *sprites = spriteTable();
|
2011-11-15 21:30:31 +00:00
|
|
|
for (size_t i = 0; i < 16; ++i) {
|
2011-06-26 13:17:19 +00:00
|
|
|
Sprite &sprite = sprites[i];
|
2011-07-30 13:52:28 +00:00
|
|
|
if (sprite.objData() != 0xffff) {
|
2011-06-26 13:17:19 +00:00
|
|
|
memset(&sprite, 0xff, sizeof(Sprite));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::lockMon() {
|
2011-07-16 09:04:49 +00:00
|
|
|
// Pressing space pauses text output in the monitor. We use the "hard"
|
|
|
|
// key because calling readkey() drains characters from the input
|
|
|
|
// buffer, we we want the user to be able to type ahead while the text
|
|
|
|
// is being printed.
|
|
|
|
if (data.byte(kLasthardkey) == 57) {
|
|
|
|
// Clear the keyboard buffer. Otherwise the space that caused
|
2011-07-16 09:07:22 +00:00
|
|
|
// the pause will be read immediately unpause the game.
|
2011-07-16 09:04:49 +00:00
|
|
|
do {
|
2011-12-01 19:43:43 +00:00
|
|
|
readKey();
|
2011-07-16 09:04:49 +00:00
|
|
|
} while (data.byte(kCurrentkey) != 0);
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
lockLightOn();
|
2011-07-16 09:04:49 +00:00
|
|
|
while (!engine->shouldQuit()) {
|
|
|
|
engine->waitForVSync();
|
2011-12-01 19:43:43 +00:00
|
|
|
readKey();
|
2011-07-16 09:04:49 +00:00
|
|
|
if (data.byte(kCurrentkey) == ' ')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Forget the last "hard" key, otherwise the space that caused
|
|
|
|
// the unpausing will immediately re-pause the game.
|
|
|
|
data.byte(kLasthardkey) = 0;
|
2011-12-01 19:43:43 +00:00
|
|
|
lockLightOff();
|
2011-07-16 09:04:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::makeBackOb(SetObject *objData) {
|
2011-07-27 15:53:50 +00:00
|
|
|
if (data.byte(kNewobs) == 0)
|
|
|
|
return;
|
2011-08-17 05:08:38 +00:00
|
|
|
uint8 priority = objData->priority;
|
|
|
|
uint8 type = objData->type;
|
2011-12-01 19:43:43 +00:00
|
|
|
Sprite *sprite = makeSprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0);
|
2011-07-27 15:53:50 +00:00
|
|
|
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0);
|
2011-08-23 12:41:28 +00:00
|
|
|
assert(objDataOffset % sizeof(SetObject) == 0);
|
|
|
|
assert(objDataOffset < 128 * sizeof(SetObject));
|
2011-08-17 05:08:38 +00:00
|
|
|
sprite->setObjData(objDataOffset);
|
2011-07-27 15:53:50 +00:00
|
|
|
if (priority == 255)
|
|
|
|
priority = 0;
|
|
|
|
sprite->priority = priority;
|
|
|
|
sprite->type = type;
|
|
|
|
sprite->b16 = 0;
|
|
|
|
sprite->delay = 0;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 0;
|
2011-07-27 15:53:50 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
uint16 DreamBase::allocateAndLoad(unsigned int size) {
|
2011-11-26 19:36:56 +00:00
|
|
|
// allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down
|
2011-12-01 19:43:43 +00:00
|
|
|
uint16 result = allocateMem(size / 16);
|
2011-12-02 15:29:16 +00:00
|
|
|
engine->readFromFile(getSegment(result).ptr(0, size), size);
|
2011-11-26 19:36:56 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::clearAndLoad(uint8 *buf, uint8 c,
|
2011-11-26 19:36:56 +00:00
|
|
|
unsigned int size, unsigned int maxSize) {
|
|
|
|
assert(size <= maxSize);
|
|
|
|
memset(buf, c, maxSize);
|
|
|
|
engine->readFromFile(buf, size);
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::clearAndLoad(uint16 seg, uint8 c,
|
2011-12-07 11:09:09 +00:00
|
|
|
unsigned int size, unsigned int maxSize) {
|
|
|
|
assert(size <= maxSize);
|
|
|
|
uint8 *buf = getSegment(seg).ptr(0, maxSize);
|
|
|
|
clearAndLoad(buf, c, size, maxSize);
|
|
|
|
}
|
|
|
|
|
2011-12-03 13:54:00 +00:00
|
|
|
void DreamGenContext::startLoading(const Room &room) {
|
2011-07-30 19:46:59 +00:00
|
|
|
data.byte(kCombatcount) = 0;
|
2011-12-03 13:54:00 +00:00
|
|
|
data.byte(kRoomssample) = room.roomsSample;
|
|
|
|
data.byte(kMapx) = room.mapX;
|
|
|
|
data.byte(kMapy) = room.mapY;
|
|
|
|
data.byte(kLiftflag) = room.liftFlag;
|
|
|
|
data.byte(kManspath) = room.b21;
|
|
|
|
data.byte(kDestination) = room.b21;
|
|
|
|
data.byte(kFinaldest) = room.b21;
|
|
|
|
data.byte(kFacing) = room.facing;
|
|
|
|
data.byte(kTurntoface) = room.facing;
|
|
|
|
data.byte(kCounttoopen) = room.countToOpen;
|
|
|
|
data.byte(kLiftpath) = room.liftPath;
|
|
|
|
data.byte(kDoorpath) = room.doorPath;
|
2011-10-15 09:21:02 +00:00
|
|
|
data.byte(kLastweapon) = (uint8)-1;
|
2011-07-30 19:46:59 +00:00
|
|
|
ah = data.byte(kReallocation);
|
2011-12-03 13:54:00 +00:00
|
|
|
data.byte(kReallocation) = room.realLocation;
|
2011-11-26 19:36:56 +00:00
|
|
|
|
|
|
|
loadRoomData(room, false);
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
findRoomInLoc();
|
|
|
|
deleteTaken();
|
|
|
|
setAllChanges();
|
|
|
|
autoAppear();
|
2011-12-03 13:54:00 +00:00
|
|
|
// const Room &newRoom = g_roomData[data.byte(kNewlocation)];
|
|
|
|
bx = 0x7fff; // TODO: bx used to be set to the offset of newRoom
|
|
|
|
// It seems to be unused (like newRoom itself), but set it
|
|
|
|
// to an invalid value to catch any missed use of it.
|
|
|
|
// (The push/pop of bx below is likely also unnecessary)
|
2011-10-15 09:21:02 +00:00
|
|
|
data.byte(kLastweapon) = (uint8)-1;
|
2011-07-30 19:46:59 +00:00
|
|
|
data.byte(kMandead) = 0;
|
|
|
|
data.word(kLookcounter) = 160;
|
|
|
|
data.byte(kNewlocation) = 255;
|
|
|
|
data.byte(kLinepointer) = 254;
|
2011-12-03 13:54:00 +00:00
|
|
|
if (room.b27 != 255) {
|
|
|
|
data.byte(kManspath) = room.b27;
|
2011-07-30 19:46:59 +00:00
|
|
|
push(bx);
|
2011-12-01 19:43:43 +00:00
|
|
|
autoSetWalk();
|
2011-07-30 19:46:59 +00:00
|
|
|
bx = pop();
|
|
|
|
}
|
2011-12-01 19:43:43 +00:00
|
|
|
findXYFromPath();
|
2011-07-30 19:46:59 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) {
|
2011-08-11 10:33:33 +00:00
|
|
|
uint8 type = firstParam - 220;
|
2011-07-30 21:21:43 +00:00
|
|
|
if (type == 0) {
|
2011-12-01 19:43:43 +00:00
|
|
|
placeSetObject(secondParam);
|
2011-07-30 21:21:43 +00:00
|
|
|
data.byte(kHavedoneobs) = 1;
|
|
|
|
} else if (type == 1) {
|
2011-12-01 19:43:43 +00:00
|
|
|
removeSetObject(secondParam);
|
2011-07-30 21:21:43 +00:00
|
|
|
data.byte(kHavedoneobs) = 1;
|
|
|
|
} else if (type == 2) {
|
2011-12-08 14:21:42 +00:00
|
|
|
placeFreeObject(secondParam);
|
2011-07-30 21:21:43 +00:00
|
|
|
data.byte(kHavedoneobs) = 1;
|
|
|
|
} else if (type == 3) {
|
2011-12-08 14:21:42 +00:00
|
|
|
removeFreeObject(secondParam);
|
2011-07-30 21:21:43 +00:00
|
|
|
data.byte(kHavedoneobs) = 1;
|
|
|
|
} else if (type == 4) {
|
2011-12-01 19:43:43 +00:00
|
|
|
switchRyanOff();
|
2011-07-30 21:21:43 +00:00
|
|
|
} else if (type == 5) {
|
2011-08-11 10:33:33 +00:00
|
|
|
data.byte(kTurntoface) = secondParam;
|
|
|
|
data.byte(kFacing) = secondParam;
|
2011-12-01 19:43:43 +00:00
|
|
|
switchRyanOn();
|
2011-07-30 21:21:43 +00:00
|
|
|
} else if (type == 6) {
|
2011-08-11 10:33:33 +00:00
|
|
|
data.byte(kNewlocation) = secondParam;
|
2011-07-30 21:21:43 +00:00
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
moveMap(secondParam);
|
2011-07-30 21:21:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 09:22:45 +00:00
|
|
|
void DreamGenContext::plotReel(uint16 &reelPointer) {
|
|
|
|
Reel *reel = getReelStart(reelPointer);
|
2011-11-15 21:30:31 +00:00
|
|
|
while (reel->x >= 220 && reel->x != 255) {
|
2011-12-01 19:43:43 +00:00
|
|
|
dealWithSpecial(reel->x, reel->y);
|
2011-12-08 09:22:45 +00:00
|
|
|
++reelPointer;
|
2011-08-03 16:11:19 +00:00
|
|
|
reel += 8;
|
2011-07-30 21:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < 8; ++i) {
|
2011-08-11 10:26:30 +00:00
|
|
|
if (reel->frame() != 0xffff)
|
2011-12-01 19:43:43 +00:00
|
|
|
showReelFrame(reel);
|
2011-08-03 16:11:19 +00:00
|
|
|
++reel;
|
2011-07-30 21:37:18 +00:00
|
|
|
}
|
2011-12-08 09:22:45 +00:00
|
|
|
soundOnReels(reelPointer);
|
2011-07-30 21:37:18 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:52:25 +00:00
|
|
|
void DreamBase::crosshair() {
|
2011-08-03 11:54:03 +00:00
|
|
|
uint8 frame;
|
|
|
|
if ((data.byte(kCommandtype) != 3) && (data.byte(kCommandtype) < 10)) {
|
|
|
|
frame = 9;
|
|
|
|
} else {
|
|
|
|
frame = 29;
|
|
|
|
}
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), kZoomx + 24, kZoomy + 19, frame, 0);
|
2011-08-03 11:54:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 09:54:28 +00:00
|
|
|
void DreamBase::delTextLine() {
|
2011-08-03 14:19:27 +00:00
|
|
|
uint16 x = data.word(kTextaddressx);
|
|
|
|
uint16 y = data.word(kTextaddressy);
|
|
|
|
if (data.byte(kForeignrelease) != 0)
|
|
|
|
y -= 3;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiPut(textUnder(), x, y, kUndertextsizex, kUndertextsizey);
|
2011-08-03 14:19:27 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::commandOnly() {
|
2011-12-15 11:23:00 +00:00
|
|
|
commandOnly(al);
|
2011-08-17 22:35:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::commandOnly(uint8 command) {
|
2011-12-01 19:43:43 +00:00
|
|
|
delTextLine();
|
2011-08-17 22:35:10 +00:00
|
|
|
uint16 index = command * 2;
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index);
|
2011-08-17 22:35:10 +00:00
|
|
|
uint16 y = data.word(kTextaddressy);
|
2011-12-02 15:29:16 +00:00
|
|
|
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(&string, data.word(kTextaddressx), &y, data.byte(kTextlen), (bool)(data.byte(kTextlen) & 1));
|
2011-08-17 22:35:10 +00:00
|
|
|
data.byte(kNewtextline) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkIfPerson() {
|
|
|
|
flags._z = !checkIfPerson(al, ah);
|
2011-08-11 21:13:17 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
|
2011-12-02 15:29:16 +00:00
|
|
|
People *people = (People *)getSegment(data.word(kBuffers)).ptr(kPeoplelist, 0);
|
2011-08-11 21:13:17 +00:00
|
|
|
|
|
|
|
for (size_t i = 0; i < 12; ++i, ++people) {
|
|
|
|
if (people->b4 == 255)
|
|
|
|
continue;
|
2011-12-08 09:22:45 +00:00
|
|
|
Reel *reel = getReelStart(people->reelPointer());
|
2011-08-11 21:13:17 +00:00
|
|
|
if (reel->frame() == 0xffff)
|
|
|
|
++reel;
|
2011-12-01 19:43:43 +00:00
|
|
|
const Frame *frame = getReelFrameAX(reel->frame());
|
2011-08-11 21:13:17 +00:00
|
|
|
uint8 xmin = reel->x + frame->x;
|
|
|
|
uint8 ymin = reel->y + frame->y;
|
|
|
|
uint8 xmax = xmin + frame->width;
|
|
|
|
uint8 ymax = ymin + frame->height;
|
|
|
|
if (x < xmin)
|
|
|
|
continue;
|
|
|
|
if (y < ymin)
|
|
|
|
continue;
|
|
|
|
if (x >= xmax)
|
|
|
|
continue;
|
|
|
|
if (y >= ymax)
|
|
|
|
continue;
|
2011-08-29 12:55:57 +00:00
|
|
|
data.word(kPersondata) = people->routinePointer();
|
2011-12-01 19:43:43 +00:00
|
|
|
obName(people->b4, 5);
|
2011-08-11 21:13:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkIfFree() {
|
|
|
|
flags._z = !checkIfFree(al, ah);
|
2011-08-22 12:46:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
bool DreamGenContext::checkIfFree(uint8 x, uint8 y) {
|
2011-12-02 15:29:16 +00:00
|
|
|
const ObjPos *freeList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
|
2011-08-22 12:46:06 +00:00
|
|
|
for (size_t i = 0; i < 80; ++i) {
|
|
|
|
const ObjPos *objPos = freeList + 79 - i;
|
2011-11-27 17:56:37 +00:00
|
|
|
if (objPos->index == 0xff || !objPos->contains(x,y))
|
2011-08-22 12:46:06 +00:00
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
obName(objPos->index, 2);
|
2011-08-22 12:46:06 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkIfEx() {
|
|
|
|
flags._z = !checkIfEx(al, ah);
|
2011-08-30 01:11:32 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
bool DreamGenContext::checkIfEx(uint8 x, uint8 y) {
|
2011-12-02 15:29:16 +00:00
|
|
|
const ObjPos *exList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos));
|
2011-08-30 01:11:32 +00:00
|
|
|
for (size_t i = 0; i < 100; ++i) {
|
|
|
|
const ObjPos *objPos = exList + 99 - i;
|
2011-11-27 17:56:37 +00:00
|
|
|
if (objPos->index == 0xff || !objPos->contains(x,y))
|
2011-08-30 01:11:32 +00:00
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
obName(objPos->index, 4);
|
2011-08-30 01:11:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) {
|
2011-08-15 12:02:50 +00:00
|
|
|
if (type == 5) {
|
2011-08-15 12:35:44 +00:00
|
|
|
uint16 i = 64 * 2 * (index & 127);
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext;
|
|
|
|
return getSegment(data.word(kPeople)).ptr(offset, 0);
|
2011-08-15 12:02:50 +00:00
|
|
|
} else if (type == 4) {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext;
|
|
|
|
return getSegment(data.word(kExtras)).ptr(offset, 0);
|
2011-08-15 12:02:50 +00:00
|
|
|
} else if (type == 2) {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext;
|
|
|
|
return getSegment(data.word(kFreedesc)).ptr(offset, 0);
|
2011-08-15 12:02:50 +00:00
|
|
|
} else if (type == 1) {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext;
|
|
|
|
return getSegment(data.word(kSetdesc)).ptr(offset, 0);
|
2011-08-15 12:02:50 +00:00
|
|
|
} else {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext;
|
|
|
|
return getSegment(data.word(kBlockdesc)).ptr(offset, 0);
|
2011-08-15 12:35:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::copyName() {
|
2011-12-07 09:40:17 +00:00
|
|
|
copyName(ah, al, data.ptr(di, 0));
|
2011-08-15 12:35:44 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::copyName(uint8 type, uint8 index, uint8 *dst) {
|
|
|
|
const uint8 *src = findObName(type, index);
|
2011-08-15 12:35:44 +00:00
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < 28; ++i) {
|
|
|
|
char c = src[i];
|
|
|
|
if (c == ':')
|
|
|
|
break;
|
|
|
|
if (c == 0)
|
|
|
|
break;
|
|
|
|
dst[i] = c;
|
2011-08-15 12:02:50 +00:00
|
|
|
}
|
2011-08-15 12:35:44 +00:00
|
|
|
dst[i] = 0;
|
2011-08-15 12:02:50 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::commandWithOb() {
|
|
|
|
commandWithOb(al, bh, bl);
|
2011-08-15 13:42:09 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::commandWithOb(uint8 command, uint8 type, uint8 index) {
|
2011-08-15 13:42:09 +00:00
|
|
|
uint8 commandLine[64] = "OBJECT NAME ONE ";
|
2011-12-01 19:43:43 +00:00
|
|
|
delTextLine();
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 commandText = kTextstart + getSegment(data.word(kCommandtext)).word(command * 2);
|
2011-08-15 13:42:09 +00:00
|
|
|
uint8 textLen = data.byte(kTextlen);
|
|
|
|
{
|
2011-12-02 15:29:16 +00:00
|
|
|
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(commandText, 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(string, data.word(kTextaddressx), data.word(kTextaddressy), textLen, (bool)(textLen & 1));
|
2011-08-15 13:42:09 +00:00
|
|
|
}
|
2011-12-01 19:43:43 +00:00
|
|
|
copyName(type, index, commandLine);
|
2011-08-15 13:42:09 +00:00
|
|
|
uint16 x = data.word(kLastxpos);
|
|
|
|
if (command != 0)
|
|
|
|
x += 5;
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(commandLine, x, data.word(kTextaddressy), textLen, (bool)(textLen & 1));
|
2011-08-15 13:42:09 +00:00
|
|
|
data.byte(kNewtextline) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::examineObText() {
|
|
|
|
commandWithOb(1, data.byte(kCommandtype), data.byte(kCommand));
|
2011-09-04 05:44:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::blockNameText() {
|
|
|
|
commandWithOb(0, data.byte(kCommandtype), data.byte(kCommand));
|
2011-08-18 20:09:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::personNameText() {
|
|
|
|
commandWithOb(2, data.byte(kCommandtype), data.byte(kCommand) & 127);
|
2011-08-18 20:09:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::walkToText() {
|
|
|
|
commandWithOb(3, data.byte(kCommandtype), data.byte(kCommand));
|
2011-08-18 20:09:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) {
|
2011-12-02 15:29:16 +00:00
|
|
|
Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
|
2011-11-15 21:30:31 +00:00
|
|
|
for (; change->index != 0xff; ++change) {
|
|
|
|
if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) {
|
2011-08-20 10:26:10 +00:00
|
|
|
change->value = value;
|
2011-08-19 08:35:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2011-11-15 21:30:31 +00:00
|
|
|
|
|
|
|
change->index = index;
|
|
|
|
change->location = data.byte(kReallocation);
|
|
|
|
change->value = value;
|
|
|
|
change->type = type;
|
2011-08-19 08:35:29 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::setAllChanges() {
|
2011-12-02 15:29:16 +00:00
|
|
|
Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
|
2011-11-15 21:30:31 +00:00
|
|
|
for (; change->index != 0xff; ++change)
|
2011-08-20 10:26:10 +00:00
|
|
|
if (change->location == data.byte(kReallocation))
|
2011-12-01 19:43:43 +00:00
|
|
|
doChange(change->index, change->value, change->type);
|
2011-08-19 09:42:13 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
DynObject *DreamBase::getFreeAd(uint8 index) {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0) + index;
|
2011-08-20 10:26:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
DynObject *DreamBase::getExAd(uint8 index) {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0) + index;
|
2011-08-23 12:35:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
DynObject *DreamBase::getEitherAdCPP() {
|
2011-08-23 13:03:28 +00:00
|
|
|
if (data.byte(kObjecttype) == 4)
|
2011-12-01 19:43:43 +00:00
|
|
|
return getExAd(data.byte(kItemframe));
|
2011-08-23 13:03:28 +00:00
|
|
|
else
|
2011-12-01 19:43:43 +00:00
|
|
|
return getFreeAd(data.byte(kItemframe));
|
2011-08-23 13:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) {
|
2011-08-31 09:24:34 +00:00
|
|
|
if (data.byte(kObjecttype) == 4) {
|
2011-12-01 19:43:43 +00:00
|
|
|
DynObject *exObject = getExAd(data.byte(kCommand));
|
2011-08-31 21:38:34 +00:00
|
|
|
*value1 = exObject->b7;
|
|
|
|
*value2 = exObject->b8;
|
2011-08-31 09:24:34 +00:00
|
|
|
return exObject;
|
|
|
|
} else if (data.byte(kObjecttype) == 2) {
|
2011-12-01 19:43:43 +00:00
|
|
|
DynObject *freeObject = getFreeAd(data.byte(kCommand));
|
2011-08-31 21:38:34 +00:00
|
|
|
*value1 = freeObject->b7;
|
|
|
|
*value2 = freeObject->b8;
|
2011-08-31 09:24:34 +00:00
|
|
|
return freeObject;
|
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
SetObject *setObject = getSetAd(data.byte(kCommand));
|
2011-08-31 21:38:34 +00:00
|
|
|
*value1 = setObject->b4;
|
|
|
|
*value2 = setObject->priority;
|
2011-08-31 09:24:34 +00:00
|
|
|
return setObject;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) {
|
2011-08-31 22:11:07 +00:00
|
|
|
if (flag == 4)
|
2011-12-01 19:43:43 +00:00
|
|
|
return getExAd(index);
|
2011-08-31 22:11:07 +00:00
|
|
|
else if (flag == 2)
|
2011-12-01 19:43:43 +00:00
|
|
|
return getFreeAd(index);
|
2011-08-31 22:11:07 +00:00
|
|
|
else
|
2011-12-01 19:43:43 +00:00
|
|
|
return getSetAd(index);
|
2011-08-31 22:11:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
SetObject *DreamBase::getSetAd(uint8 index) {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 0) + index;
|
2011-08-20 10:26:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) {
|
2011-08-20 10:26:10 +00:00
|
|
|
if (type == 0) { //object
|
2011-12-01 19:43:43 +00:00
|
|
|
getSetAd(index)->mapad[0] = value;
|
|
|
|
} else if (type == 1) { //freeObject
|
|
|
|
DynObject *freeObject = getFreeAd(index);
|
2011-08-30 01:26:19 +00:00
|
|
|
if (freeObject->mapad[0] == 0xff)
|
|
|
|
freeObject->mapad[0] = value;
|
2011-08-20 10:26:10 +00:00
|
|
|
} else { //path
|
|
|
|
bx = kPathdata + (type - 100) * 144 + index * 8;
|
|
|
|
es = data.word(kReels);
|
|
|
|
es.byte(bx+6) = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::deleteTaken() {
|
2011-12-02 15:29:16 +00:00
|
|
|
const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0);
|
|
|
|
DynObject *freeObjects = (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
|
2011-12-08 09:02:51 +00:00
|
|
|
for (size_t i = 0; i < kNumexobjects; ++i) {
|
2011-08-30 00:18:55 +00:00
|
|
|
uint8 location = extraObjects[i].initialLocation;
|
2011-08-20 10:33:21 +00:00
|
|
|
if (location == data.byte(kReallocation)) {
|
2011-08-23 12:41:28 +00:00
|
|
|
uint8 index = extraObjects[i].index;
|
2011-08-30 01:26:19 +00:00
|
|
|
freeObjects[index].mapad[0] = 0xfe;
|
2011-08-20 10:33:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::getExPos() {
|
2011-09-01 22:24:29 +00:00
|
|
|
es = data.word(kExtras);
|
2011-12-02 15:29:16 +00:00
|
|
|
const DynObject *objects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject));
|
2011-08-30 00:26:28 +00:00
|
|
|
for (size_t i = 0; i < kNumexobjects; ++i) {
|
2011-08-30 01:26:19 +00:00
|
|
|
if (objects[i].mapad[0] == 0xff) {
|
2011-09-01 23:05:32 +00:00
|
|
|
data.byte(kExpos) = i;
|
2011-09-01 22:24:29 +00:00
|
|
|
di = kExdata + i * sizeof(DynObject);
|
2011-08-30 00:26:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2011-09-01 23:05:32 +00:00
|
|
|
data.byte(kExpos) = kNumexobjects;
|
2011-09-01 22:24:29 +00:00
|
|
|
di = kExdata + kNumexobjects * sizeof(DynObject);
|
2011-08-30 00:26:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::placeSetObject() {
|
|
|
|
placeSetObject(al);
|
2011-08-20 11:23:47 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::placeSetObject(uint8 index) {
|
|
|
|
findOrMake(index, 0, 0);
|
|
|
|
getSetAd(index)->mapad[0] = 0;
|
2011-08-20 11:23:47 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::removeSetObject() {
|
|
|
|
removeSetObject(al);
|
2011-08-20 11:23:47 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::removeSetObject(uint8 index) {
|
|
|
|
findOrMake(index, 0xff, 0);
|
|
|
|
getSetAd(index)->mapad[0] = 0xff;
|
2011-08-20 11:23:47 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::finishedWalking() {
|
|
|
|
flags._z = finishedWalkingCPP();
|
2011-08-22 13:53:54 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
bool DreamGenContext::finishedWalkingCPP() {
|
2011-08-22 13:53:54 +00:00
|
|
|
return (data.byte(kLinepointer) == 254) && (data.byte(kFacing) == data.byte(kTurntoface));
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) {
|
2011-08-23 08:13:10 +00:00
|
|
|
uint8 type, flagX, flagY;
|
2011-12-01 19:43:43 +00:00
|
|
|
checkOne(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY);
|
2011-12-15 12:41:30 +00:00
|
|
|
data.byte(kLastflag) = *flag;
|
|
|
|
data.byte(kLastflagex) = *flagEx;
|
2011-08-23 08:13:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::walkAndExamine() {
|
|
|
|
if (!finishedWalkingCPP())
|
2011-08-23 08:40:52 +00:00
|
|
|
return;
|
|
|
|
data.byte(kCommandtype) = data.byte(kWalkexamtype);
|
|
|
|
data.byte(kCommand) = data.byte(kWalkexamnum);
|
|
|
|
data.byte(kWalkandexam) = 0;
|
|
|
|
if (data.byte(kCommandtype) != 5)
|
2011-12-01 19:43:43 +00:00
|
|
|
examineOb();
|
2011-08-23 08:40:52 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::obName() {
|
|
|
|
obName(al, ah);
|
2011-08-23 09:09:54 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::obName(uint8 command, uint8 commandType) {
|
2011-08-23 09:09:54 +00:00
|
|
|
if (data.byte(kReasseschanges) == 0) {
|
|
|
|
if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) {
|
|
|
|
if (data.byte(kWalkandexam) == 1) {
|
2011-12-01 19:43:43 +00:00
|
|
|
walkAndExamine();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else if (data.word(kMousebutton) == 0)
|
|
|
|
return;
|
|
|
|
else if ((data.byte(kCommandtype) == 3) && (data.byte(kLastflag) < 2))
|
|
|
|
return;
|
|
|
|
else if ((data.byte(kManspath) != data.byte(kPointerspath)) || (data.byte(kCommandtype) == 3)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
setWalk();
|
2011-08-23 09:09:54 +00:00
|
|
|
data.byte(kReasseschanges) = 1;
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
} else if (! finishedWalkingCPP())
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
else if (data.byte(kCommandtype) == 5) {
|
|
|
|
if (data.word(kWatchingtime) == 0)
|
|
|
|
talk();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (data.word(kWatchingtime) == 0)
|
2011-12-01 19:43:43 +00:00
|
|
|
examineOb();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
data.byte(kReasseschanges) = 0;
|
|
|
|
|
|
|
|
data.byte(kCommand) = command;
|
|
|
|
data.byte(kCommandtype) = commandType;
|
|
|
|
if ((data.byte(kLinepointer) != 254) || (data.word(kWatchingtime) != 0) || (data.byte(kFacing) != data.byte(kTurntoface))) {
|
2011-12-01 19:43:43 +00:00
|
|
|
blockNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else if (data.byte(kCommandtype) != 3) {
|
|
|
|
if (data.byte(kManspath) != data.byte(kPointerspath)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
walkToText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else if (data.byte(kCommandtype) == 3) {
|
2011-12-01 19:43:43 +00:00
|
|
|
blockNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else if (data.byte(kCommandtype) == 5) {
|
2011-12-01 19:43:43 +00:00
|
|
|
personNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
examineObText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (data.byte(kManspath) == data.byte(kPointerspath)) {
|
|
|
|
uint8 flag, flagEx, type, flagX, flagY;
|
2011-12-01 19:43:43 +00:00
|
|
|
checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY);
|
2011-08-23 09:09:54 +00:00
|
|
|
if (flag < 2) {
|
2011-12-01 19:43:43 +00:00
|
|
|
blockNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
uint8 flag, flagEx;
|
|
|
|
getFlagUnderP(&flag, &flagEx);
|
2011-08-23 09:09:54 +00:00
|
|
|
if (data.byte(kLastflag) < 2) {
|
2011-12-01 19:43:43 +00:00
|
|
|
blockNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else if (data.byte(kLastflag) >= 128) {
|
2011-12-01 19:43:43 +00:00
|
|
|
blockNameText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
walkToText();
|
2011-08-23 09:09:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::delPointer() {
|
2011-08-24 10:15:17 +00:00
|
|
|
if (data.word(kOldpointerx) == 0xffff)
|
|
|
|
return;
|
|
|
|
data.word(kDelherex) = data.word(kOldpointerx);
|
|
|
|
data.word(kDelherey) = data.word(kOldpointery);
|
|
|
|
data.byte(kDelxs) = data.byte(kPointerxs);
|
|
|
|
data.byte(kDelys) = data.byte(kPointerys);
|
2011-12-02 15:29:16 +00:00
|
|
|
multiPut(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys));
|
2011-08-24 10:15:17 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:52:25 +00:00
|
|
|
void DreamBase::showBlink() {
|
2011-08-24 11:20:18 +00:00
|
|
|
if (data.byte(kManisoffscreen) == 1)
|
|
|
|
return;
|
|
|
|
++data.byte(kBlinkcount);
|
|
|
|
if (data.byte(kShadeson) != 0)
|
|
|
|
return;
|
|
|
|
if (data.byte(kReallocation) >= 50) // eyesshut
|
|
|
|
return;
|
|
|
|
if (data.byte(kBlinkcount) != 3)
|
|
|
|
return;
|
|
|
|
data.byte(kBlinkcount) = 0;
|
|
|
|
uint8 blinkFrame = data.byte(kBlinkframe);
|
|
|
|
++blinkFrame; // Implicit %256
|
|
|
|
data.byte(kBlinkframe) = blinkFrame;
|
|
|
|
if (blinkFrame > 6)
|
|
|
|
blinkFrame = 6;
|
|
|
|
static const uint8 blinkTab[] = { 16,18,18,17,16,16,16 };
|
|
|
|
uint8 width, height;
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 44, 32, blinkTab[blinkFrame], 0, &width, &height);
|
2011-08-24 11:20:18 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:52:25 +00:00
|
|
|
void DreamBase::dumpBlink() {
|
2011-08-24 11:22:11 +00:00
|
|
|
if (data.byte(kShadeson) != 0)
|
|
|
|
return;
|
|
|
|
if (data.byte(kBlinkcount) != 0)
|
|
|
|
return;
|
|
|
|
if (data.byte(kBlinkframe) >= 6)
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiDump(44, 32, 16, 12);
|
2011-08-24 11:22:11 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:52:25 +00:00
|
|
|
void DreamBase::dumpPointer() {
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpBlink();
|
|
|
|
multiDump(data.word(kDelherex), data.word(kDelherey), data.byte(kDelxs), data.byte(kDelys));
|
2011-08-24 15:23:43 +00:00
|
|
|
if ((data.word(kOldpointerx) != data.word(kDelherex)) || (data.word(kOldpointery) != data.word(kDelherey)))
|
2011-12-01 19:43:43 +00:00
|
|
|
multiDump(data.word(kOldpointerx), data.word(kOldpointery), data.byte(kPointerxs), data.byte(kPointerys));
|
2011-08-24 15:23:43 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkCoords(const RectWithCallback *rectWithCallbacks) {
|
2011-08-24 13:04:53 +00:00
|
|
|
if (data.byte(kNewlocation) != 0xff)
|
|
|
|
return;
|
|
|
|
|
2011-11-14 20:38:40 +00:00
|
|
|
const RectWithCallback *r;
|
|
|
|
for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) {
|
|
|
|
if (r->contains(data.word(kMousex), data.word(kMousey))) {
|
|
|
|
(this->*(r->_callback))();
|
2011-08-24 13:04:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::showPointer() {
|
2011-12-01 19:43:43 +00:00
|
|
|
showBlink();
|
2011-08-24 21:01:53 +00:00
|
|
|
uint16 x = data.word(kMousex);
|
|
|
|
data.word(kOldpointerx) = data.word(kMousex);
|
|
|
|
uint16 y = data.word(kMousey);
|
|
|
|
data.word(kOldpointery) = data.word(kMousey);
|
|
|
|
if (data.byte(kPickup) == 1) {
|
|
|
|
const Frame *frames;
|
|
|
|
if (data.byte(kObjecttype) != 4)
|
2011-12-02 15:29:16 +00:00
|
|
|
frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
|
2011-08-24 21:01:53 +00:00
|
|
|
else
|
2011-12-02 15:29:16 +00:00
|
|
|
frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
2011-08-24 21:01:53 +00:00
|
|
|
const Frame *frame = frames + (3 * data.byte(kItemframe) + 1);
|
|
|
|
uint8 width = frame->width;
|
|
|
|
uint8 height = frame->height;
|
|
|
|
if (width < 12)
|
|
|
|
width = 12;
|
|
|
|
if (height < 12)
|
|
|
|
height = 12;
|
|
|
|
data.byte(kPointerxs) = width;
|
|
|
|
data.byte(kPointerys) = height;
|
2011-08-31 23:27:59 +00:00
|
|
|
uint16 xMin = (x >= width / 2) ? x - width / 2 : 0;
|
|
|
|
uint16 yMin = (y >= height / 2) ? y - height / 2 : 0;
|
|
|
|
data.word(kOldpointerx) = xMin;
|
|
|
|
data.word(kOldpointery) = yMin;
|
2011-12-02 15:29:16 +00:00
|
|
|
multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height);
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), x, y, 3, 128);
|
2011-08-24 21:01:53 +00:00
|
|
|
} else {
|
2011-12-04 17:32:55 +00:00
|
|
|
const Frame *frame = engine->icons1() + (data.byte(kPointerframe) + 20);
|
2011-08-24 21:01:53 +00:00
|
|
|
uint8 width = frame->width;
|
|
|
|
uint8 height = frame->height;
|
|
|
|
if (width < 12)
|
|
|
|
width = 12;
|
|
|
|
if (height < 12)
|
|
|
|
height = 12;
|
|
|
|
data.byte(kPointerxs) = width;
|
|
|
|
data.byte(kPointerys) = height;
|
2011-12-02 15:29:16 +00:00
|
|
|
multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height);
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), x, y, data.byte(kPointerframe) + 20, 0);
|
2011-08-24 21:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::animPointer() {
|
2011-08-25 05:02:57 +00:00
|
|
|
|
|
|
|
if (data.byte(kPointermode) == 2) {
|
|
|
|
data.byte(kPointerframe) = 0;
|
|
|
|
if ((data.byte(kReallocation) == 14) && (data.byte(kCommandtype) == 211))
|
|
|
|
data.byte(kPointerframe) = 5;
|
|
|
|
return;
|
|
|
|
} else if (data.byte(kPointermode) == 3) {
|
|
|
|
if (data.byte(kPointerspeed) != 0) {
|
|
|
|
--data.byte(kPointerspeed);
|
|
|
|
} else {
|
|
|
|
data.byte(kPointerspeed) = 5;
|
|
|
|
++data.byte(kPointercount);
|
|
|
|
if (data.byte(kPointercount) == 16)
|
|
|
|
data.byte(kPointercount) = 0;
|
|
|
|
}
|
|
|
|
static const uint8 flashMouseTab[] = { 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2 };
|
|
|
|
data.byte(kPointerframe) = flashMouseTab[data.byte(kPointercount)];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data.word(kWatchingtime) != 0) {
|
|
|
|
data.byte(kPointerframe) = 11;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.byte(kPointerframe) = 0;
|
|
|
|
if (data.byte(kInmaparea) == 0)
|
|
|
|
return;
|
|
|
|
if (data.byte(kPointerfirstpath) == 0)
|
|
|
|
return;
|
|
|
|
uint8 flag, flagEx;
|
2011-12-01 19:43:43 +00:00
|
|
|
getFlagUnderP(&flag, &flagEx);
|
2011-08-25 05:02:57 +00:00
|
|
|
if (flag < 2)
|
|
|
|
return;
|
|
|
|
if (flag >= 128)
|
|
|
|
return;
|
|
|
|
if (flag & 4) {
|
|
|
|
data.byte(kPointerframe) = 3;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (flag & 16) {
|
|
|
|
data.byte(kPointerframe) = 4;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (flag & 2) {
|
|
|
|
data.byte(kPointerframe) = 5;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (flag & 8) {
|
|
|
|
data.byte(kPointerframe) = 6;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.byte(kPointerframe) = 8;
|
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
|
2011-12-15 09:54:28 +00:00
|
|
|
printDirect(string, x, y, maxWidth, centered);
|
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) {
|
2011-12-15 09:54:28 +00:00
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
|
|
|
|
while (count--) {
|
|
|
|
findNextColon(&string);
|
|
|
|
}
|
|
|
|
printDirect(string, x, y, maxWidth, centered);
|
2011-08-29 09:55:21 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
static bool objectMatches(void *object, const char *id) {
|
2011-12-14 22:11:12 +00:00
|
|
|
const char *objId = (const char *)(((const uint8 *)object) + 12); // whether it is a DynObject or a SetObject
|
|
|
|
for (size_t i = 0; i < 4; ++i) {
|
|
|
|
if (id[i] != objId[i] + 'A')
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-08-31 22:06:30 +00:00
|
|
|
void DreamGenContext::compare() {
|
|
|
|
char id[4] = { cl, ch, dl, dh };
|
|
|
|
flags._z = compare(al, ah, id);
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) {
|
2011-12-14 22:11:12 +00:00
|
|
|
return objectMatches(getAnyAdDir(index, flag), id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::findSetObject() {
|
|
|
|
char id[5];
|
|
|
|
id[0] = al;
|
|
|
|
id[1] = ah;
|
|
|
|
id[2] = cl;
|
|
|
|
id[3] = ch;
|
|
|
|
id[4] = '\0';
|
|
|
|
al = findSetObject(id);
|
2011-12-14 22:18:27 +00:00
|
|
|
bx = al * 64;
|
2011-12-14 22:11:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 DreamGenContext::findSetObject(const char *id) {
|
2011-12-14 22:30:31 +00:00
|
|
|
for (uint16 index = 0; index < 128; index++) {
|
2011-12-14 22:11:12 +00:00
|
|
|
if (objectMatches(getSetAd(index), id))
|
|
|
|
return index;
|
2011-12-14 22:30:31 +00:00
|
|
|
}
|
2011-12-14 22:11:12 +00:00
|
|
|
|
2011-12-14 22:30:31 +00:00
|
|
|
return 128;
|
2011-12-14 22:11:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::findExObject() {
|
|
|
|
char id[5];
|
|
|
|
id[0] = al;
|
|
|
|
id[1] = ah;
|
|
|
|
id[2] = cl;
|
|
|
|
id[3] = ch;
|
|
|
|
id[4] = '\0';
|
|
|
|
al = findExObject(id);
|
2011-12-14 22:18:27 +00:00
|
|
|
bx = al * 16;
|
2011-12-14 22:11:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16 DreamGenContext::findExObject(const char *id) {
|
2011-12-14 22:30:31 +00:00
|
|
|
for (uint16 index = 0; index < kNumexobjects; index++) {
|
2011-12-14 22:11:12 +00:00
|
|
|
if (objectMatches(getExAd(index), id))
|
|
|
|
return index;
|
2011-12-14 22:30:31 +00:00
|
|
|
}
|
2011-12-14 22:11:12 +00:00
|
|
|
|
2011-12-14 22:30:31 +00:00
|
|
|
return kNumexobjects;
|
2011-08-31 22:06:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
bool DreamBase::isItDescribed(const ObjPos *pos) {
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
|
|
|
|
uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset);
|
2011-09-01 23:49:14 +00:00
|
|
|
return result != 0;
|
|
|
|
}
|
|
|
|
|
2011-08-16 01:15:43 +00:00
|
|
|
bool DreamGenContext::isCD() {
|
|
|
|
// The original sources has two codepaths depending if the game is 'if cd' or not
|
|
|
|
// This is a hack to guess which version to use with the assumption that if we have a cd version
|
|
|
|
// we managed to load the speech. At least it is isolated in this function and can be changed.
|
|
|
|
// Maybe detect the version during game id?
|
|
|
|
return (data.byte(kSpeechloaded) == 1);
|
|
|
|
}
|
2011-09-02 01:55:52 +00:00
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::showIcon() {
|
2011-11-05 13:13:57 +00:00
|
|
|
if (data.byte(kReallocation) < 50) {
|
2011-12-01 19:43:43 +00:00
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
roomName();
|
|
|
|
panelIcons1();
|
|
|
|
zoomIcon();
|
2011-11-05 13:13:57 +00:00
|
|
|
} else {
|
2011-12-02 15:29:16 +00:00
|
|
|
Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempSprites, 72, 2, 45, 0);
|
|
|
|
showFrame(tempSprites, 72+47, 2, 46, 0);
|
|
|
|
showFrame(tempSprites, 69-10, 21, 49, 0);
|
|
|
|
showFrame(tempSprites, 160+88, 2, 45, 4 & 0xfe);
|
|
|
|
showFrame(tempSprites, 160+43, 2, 46, 4 & 0xfe);
|
|
|
|
showFrame(tempSprites, 160+101, 21, 49, 4 & 0xfe);
|
|
|
|
middlePanel();
|
2011-11-05 13:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::checkIfSet() {
|
|
|
|
flags._z = !checkIfSet(al, ah);
|
2011-09-02 01:55:52 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
bool DreamGenContext::checkIfSet(uint8 x, uint8 y) {
|
2011-12-02 15:29:16 +00:00
|
|
|
const ObjPos *setList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128);
|
2011-09-02 01:55:52 +00:00
|
|
|
for (size_t i = 0; i < 128; ++i) {
|
|
|
|
const ObjPos *pos = setList + 127 - i;
|
2011-11-27 17:56:37 +00:00
|
|
|
if (pos->index == 0xff || !pos->contains(x,y))
|
2011-09-02 01:55:52 +00:00
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
if (! pixelCheckSet(pos, x, y))
|
2011-09-02 01:55:52 +00:00
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
if (! isItDescribed(pos))
|
2011-09-02 01:55:52 +00:00
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
obName(pos->index, 1);
|
2011-09-02 01:55:52 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::hangOn() {
|
|
|
|
hangOn(cx);
|
2011-09-06 20:10:02 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::hangOn(uint16 frameCount) {
|
2011-09-06 20:10:02 +00:00
|
|
|
while (frameCount) {
|
2011-12-01 19:43:43 +00:00
|
|
|
vSync();
|
2011-09-06 20:10:02 +00:00
|
|
|
--frameCount;
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-09-08 07:11:16 +00:00
|
|
|
break;
|
2011-09-06 20:10:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::hangOnW(uint16 frameCount) {
|
2011-11-26 16:13:44 +00:00
|
|
|
while (frameCount) {
|
2011-12-01 19:43:43 +00:00
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
animPointer();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
2011-11-26 16:13:44 +00:00
|
|
|
--frameCount;
|
|
|
|
if (quitRequested())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::hangOnP() {
|
|
|
|
hangOnP(cx);
|
2011-09-06 20:10:02 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::hangOnP(uint16 count) {
|
2011-09-06 20:10:02 +00:00
|
|
|
data.word(kMaintimer) = 0;
|
|
|
|
uint8 pointerFrame = data.byte(kPointerframe);
|
|
|
|
uint8 pickup = data.byte(kPickup);
|
|
|
|
data.byte(kPointermode) = 3;
|
|
|
|
data.byte(kPickup) = 0;
|
|
|
|
data.byte(kCommandtype) = 255;
|
2011-12-01 19:43:43 +00:00
|
|
|
readMouse();
|
|
|
|
animPointer();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
2011-11-19 17:35:47 +00:00
|
|
|
|
|
|
|
count *= 3;
|
|
|
|
for (uint16 i = 0; i < count; ++i) {
|
2011-12-01 19:43:43 +00:00
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
animPointer();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
2011-11-20 20:26:18 +00:00
|
|
|
if (quitRequested())
|
2011-09-08 07:11:16 +00:00
|
|
|
break;
|
2011-11-19 17:35:47 +00:00
|
|
|
if (data.word(kMousebutton) != 0 && data.word(kMousebutton) != data.word(kOldbutton))
|
2011-09-06 20:10:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
delPointer();
|
2011-09-06 20:10:02 +00:00
|
|
|
data.byte(kPointerframe) = pointerFrame;
|
|
|
|
data.byte(kPickup) = pickup;
|
|
|
|
data.byte(kPointermode) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::findNextColon() {
|
2011-12-14 11:17:32 +00:00
|
|
|
const uint8 *initialString = es.ptr(si, 0);
|
|
|
|
const uint8 *string = initialString;
|
2011-12-01 19:43:43 +00:00
|
|
|
al = findNextColon(&string);
|
2011-09-07 01:41:05 +00:00
|
|
|
si += (string - initialString);
|
|
|
|
}
|
|
|
|
|
2011-12-14 11:17:32 +00:00
|
|
|
uint8 DreamBase::findNextColon(const uint8 **string) {
|
2011-09-07 01:41:05 +00:00
|
|
|
uint8 c;
|
|
|
|
do {
|
|
|
|
c = **string;
|
|
|
|
++(*string);
|
|
|
|
} while ((c != 0) && (c != ':'));
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2011-12-14 11:17:32 +00:00
|
|
|
const uint8 *DreamGenContext::getObTextStartCPP() {
|
2011-09-07 01:44:40 +00:00
|
|
|
push(es);
|
|
|
|
push(si);
|
2011-12-01 19:43:43 +00:00
|
|
|
getObTextStart();
|
2011-12-14 11:17:32 +00:00
|
|
|
const uint8 *result = es.ptr(si, 0);
|
2011-09-07 01:44:40 +00:00
|
|
|
si = pop();
|
|
|
|
es = pop();
|
|
|
|
return result;
|
|
|
|
}
|
2011-09-07 01:41:05 +00:00
|
|
|
|
2011-12-03 19:10:15 +00:00
|
|
|
void DreamGenContext::enterSymbol() {
|
|
|
|
data.byte(kManisoffscreen) = 1;
|
|
|
|
getRidOfReels();
|
2011-12-03 19:17:41 +00:00
|
|
|
loadIntoTemp("DREAMWEB.G12"); // symbol graphics
|
2011-12-03 19:10:15 +00:00
|
|
|
data.byte(kSymboltopx) = 24;
|
|
|
|
data.byte(kSymboltopdir) = 0;
|
|
|
|
data.byte(kSymbolbotx) = 24;
|
|
|
|
data.byte(kSymbolbotdir) = 0;
|
|
|
|
redrawMainScrn();
|
|
|
|
showSymbol();
|
|
|
|
underTextLine();
|
|
|
|
workToScreenM();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
do {
|
|
|
|
delPointer();
|
|
|
|
updateSymbolTop();
|
|
|
|
updateSymbolBot();
|
|
|
|
showSymbol();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
dumpSymbol();
|
|
|
|
RectWithCallback symbolList[] = {
|
2011-12-15 12:41:30 +00:00
|
|
|
{ kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol },
|
|
|
|
{ kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft },
|
|
|
|
{ kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight },
|
|
|
|
{ kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamBase::setBotLeft },
|
|
|
|
{ kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamBase::setBotRight },
|
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-03 19:10:15 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
checkCoords(symbolList);
|
2011-12-03 19:43:54 +00:00
|
|
|
} while ((data.byte(kGetback) == 0) && !quitRequested());
|
2011-12-03 19:10:15 +00:00
|
|
|
if ((data.byte(kSymbolbotnum) == 3) && (data.byte(kSymboltopnum) == 5)) {
|
|
|
|
removeSetObject(43);
|
|
|
|
placeSetObject(46);
|
|
|
|
turnAnyPathOn(0, data.byte(kRoomnum) + 12);
|
|
|
|
data.byte(kManisoffscreen) = 0;
|
|
|
|
redrawMainScrn();
|
|
|
|
getRidOfTemp();
|
|
|
|
restoreReels();
|
|
|
|
workToScreenM();
|
|
|
|
playChannel1(13);
|
|
|
|
} else {
|
|
|
|
removeSetObject(46);
|
|
|
|
placeSetObject(43);
|
|
|
|
turnAnyPathOff(0, data.byte(kRoomnum) + 12);
|
|
|
|
data.byte(kManisoffscreen) = 0;
|
|
|
|
redrawMainScrn();
|
|
|
|
getRidOfTemp();
|
|
|
|
restoreReels();
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::zoomOnOff() {
|
2011-12-06 16:10:45 +00:00
|
|
|
if (data.word(kWatchingtime) != 0 || data.byte(kPointermode) == 2) {
|
2011-10-09 15:22:41 +00:00
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
2011-12-06 16:10:45 +00:00
|
|
|
|
2011-10-09 15:22:41 +00:00
|
|
|
if (data.byte(kCommandtype) != 222) {
|
|
|
|
data.byte(kCommandtype) = 222;
|
2011-12-01 19:43:43 +00:00
|
|
|
commandOnly(39);
|
2011-10-09 15:22:41 +00:00
|
|
|
}
|
2011-12-06 16:10:45 +00:00
|
|
|
|
|
|
|
if (!(data.word(kMousebutton) & 1) || (data.word(kMousebutton) == data.word(kOldbutton)))
|
2011-10-09 15:22:41 +00:00
|
|
|
return;
|
2011-12-06 16:10:45 +00:00
|
|
|
|
2011-10-09 15:22:41 +00:00
|
|
|
data.byte(kZoomon) ^= 1;
|
2011-12-01 19:43:43 +00:00
|
|
|
createPanel();
|
2011-10-09 15:22:41 +00:00
|
|
|
data.byte(kNewobs) = 0;
|
2011-12-01 19:43:43 +00:00
|
|
|
drawFloor();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
showIcon();
|
|
|
|
getUnderZoom();
|
|
|
|
underTextLine();
|
|
|
|
commandOnly(39);
|
|
|
|
readMouse();
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::sortOutMap() {
|
2011-11-30 14:05:04 +00:00
|
|
|
const uint8 *src = workspace();
|
2011-12-02 15:29:16 +00:00
|
|
|
uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
|
2011-09-04 10:44:05 +00:00
|
|
|
for (uint16 y = 0; y < kMaplength; ++y) {
|
|
|
|
memcpy(dst, src, kMapwidth);
|
|
|
|
dst += kMapwidth;
|
|
|
|
src += 132;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::showCity() {
|
|
|
|
clearWork();
|
|
|
|
showFrame(tempGraphics(), 57, 32, 0, 0);
|
|
|
|
showFrame(tempGraphics(), 120+57, 32, 1, 0);
|
2011-09-04 11:20:02 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::mainScreen() {
|
2011-11-14 19:18:06 +00:00
|
|
|
data.byte(kInmaparea) = 0;
|
2011-11-14 19:18:18 +00:00
|
|
|
if (data.byte(kWatchon) == 1) {
|
2011-12-01 19:43:43 +00:00
|
|
|
RectWithCallback mainList[] = {
|
2011-11-14 20:38:40 +00:00
|
|
|
{ 44,70,32,46,&DreamGenContext::look },
|
|
|
|
{ 0,50,0,180,&DreamGenContext::inventory },
|
2011-12-01 19:43:43 +00:00
|
|
|
{ 226,244,10,26,&DreamGenContext::zoomOnOff },
|
|
|
|
{ 226,244,26,40,&DreamGenContext::saveLoad },
|
|
|
|
{ 240,260,100,124,&DreamGenContext::madmanRun },
|
|
|
|
{ 0,320,0,200,&DreamGenContext::identifyOb },
|
2011-11-14 20:38:40 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
2011-12-01 19:43:43 +00:00
|
|
|
checkCoords(mainList);
|
2011-11-14 19:18:18 +00:00
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
RectWithCallback mainList2[] = {
|
2011-11-14 20:38:40 +00:00
|
|
|
{ 44,70,32,46,&DreamGenContext::look },
|
|
|
|
{ 0,50,0,180,&DreamGenContext::inventory },
|
2011-12-01 19:43:43 +00:00
|
|
|
{ 226+48,244+48,10,26,&DreamGenContext::zoomOnOff },
|
|
|
|
{ 226+48,244+48,26,40,&DreamGenContext::saveLoad },
|
|
|
|
{ 240,260,100,124,&DreamGenContext::madmanRun },
|
|
|
|
{ 0,320,0,200,&DreamGenContext::identifyOb },
|
2011-11-14 20:38:40 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
2011-12-01 19:43:43 +00:00
|
|
|
checkCoords(mainList2);
|
2011-11-14 19:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kWalkandexam) != 0)
|
2011-12-01 19:43:43 +00:00
|
|
|
walkAndExamine();
|
2011-11-14 19:18:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void DreamBase::showWatch() {
|
2011-11-15 10:05:30 +00:00
|
|
|
if (data.byte(kWatchon)) {
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 250, 1, 6, 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
showTime();
|
2011-11-15 10:05:30 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-14 19:18:06 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::dumpWatch() {
|
2011-11-20 18:04:33 +00:00
|
|
|
if (data.byte(kWatchdump) != 1)
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
multiDump(256, 21, 40, 12);
|
2011-11-20 18:04:33 +00:00
|
|
|
data.byte(kWatchdump) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void DreamBase::showTime() {
|
2011-11-16 23:18:28 +00:00
|
|
|
if (data.byte(kWatchon) == 0)
|
|
|
|
return;
|
2011-12-02 15:29:16 +00:00
|
|
|
Frame *charset = (Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
|
2011-11-16 23:18:28 +00:00
|
|
|
|
2011-12-12 11:09:19 +00:00
|
|
|
int seconds = data.byte(kSecondcount);
|
|
|
|
int minutes = data.byte(kMinutecount);
|
|
|
|
int hours = data.byte(kHourcount);
|
2011-11-16 22:09:39 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(charset, 282+5, 21, 91*3+10 + seconds / 10, 0);
|
|
|
|
showFrame(charset, 282+9, 21, 91*3+10 + seconds % 10, 0);
|
2011-11-16 22:09:39 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(charset, 270+5, 21, 91*3 + minutes / 10, 0);
|
|
|
|
showFrame(charset, 270+11, 21, 91*3 + minutes % 10, 0);
|
2011-11-16 22:09:39 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(charset, 256+5, 21, 91*3 + hours / 10, 0);
|
|
|
|
showFrame(charset, 256+11, 21, 91*3 + hours % 10, 0);
|
2011-11-16 23:18:28 +00:00
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(charset, 267+5, 21, 91*3+20, 0);
|
2011-11-16 23:18:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::watchCount() {
|
2011-11-16 19:09:47 +00:00
|
|
|
if (data.byte(kWatchon) == 0)
|
|
|
|
return;
|
|
|
|
++data.byte(kTimercount);
|
|
|
|
if (data.byte(kTimercount) == 9) {
|
2011-12-02 15:29:16 +00:00
|
|
|
showFrame((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0);
|
2011-11-16 19:09:47 +00:00
|
|
|
data.byte(kWatchdump) = 1;
|
|
|
|
} else if (data.byte(kTimercount) == 18) {
|
|
|
|
data.byte(kTimercount) = 0;
|
2011-12-12 11:09:19 +00:00
|
|
|
++data.byte(kSecondcount);
|
|
|
|
if (data.byte(kSecondcount) == 60) {
|
|
|
|
data.byte(kSecondcount) = 0;
|
|
|
|
++data.byte(kMinutecount);
|
|
|
|
if (data.byte(kMinutecount) == 60) {
|
|
|
|
data.byte(kMinutecount) = 0;
|
|
|
|
++data.byte(kHourcount);
|
|
|
|
if (data.byte(kHourcount) == 24)
|
|
|
|
data.byte(kHourcount) = 0;
|
|
|
|
}
|
|
|
|
}
|
2011-12-01 19:43:43 +00:00
|
|
|
showTime();
|
2011-11-16 19:09:47 +00:00
|
|
|
data.byte(kWatchdump) = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::roomName() {
|
2011-12-01 19:43:43 +00:00
|
|
|
printMessage(88, 18, 53, 240, false);
|
2011-11-14 18:49:19 +00:00
|
|
|
uint16 textIndex = data.byte(kRoomnum);
|
|
|
|
if (textIndex >= 32)
|
|
|
|
textIndex -= 32;
|
|
|
|
data.word(kLinespacing) = 7;
|
|
|
|
uint8 maxWidth = (data.byte(kWatchon) == 1) ? 120 : 160;
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 descOffset = getSegment(data.word(kRoomdesc)).word(kIntextdat + textIndex * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext + descOffset, 0);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(string, 88, 25, maxWidth, false);
|
2011-11-14 18:49:19 +00:00
|
|
|
data.word(kLinespacing) = 10;
|
2011-12-01 19:43:43 +00:00
|
|
|
useCharset1();
|
2011-11-14 18:49:19 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::zoomIcon() {
|
2011-11-16 20:00:46 +00:00
|
|
|
if (data.byte(kZoomon) == 0)
|
|
|
|
return;
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0);
|
2011-11-16 20:00:46 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::loadRoom() {
|
2011-11-16 20:23:51 +00:00
|
|
|
data.byte(kRoomloaded) = 1;
|
|
|
|
data.word(kTimecount) = 0;
|
|
|
|
data.word(kMaintimer) = 0;
|
|
|
|
data.word(kMapoffsetx) = 104;
|
|
|
|
data.word(kMapoffsety) = 38;
|
|
|
|
data.word(kTextaddressx) = 13;
|
|
|
|
data.word(kTextaddressy) = 182;
|
|
|
|
data.byte(kTextlen) = 240;
|
|
|
|
data.byte(kLocation) = data.byte(kNewlocation);
|
2011-12-03 13:54:00 +00:00
|
|
|
const Room &room = g_roomData[data.byte(kNewlocation)];
|
2011-12-01 19:43:43 +00:00
|
|
|
startLoading(room);
|
|
|
|
loadRoomsSample();
|
|
|
|
switchRyanOn();
|
|
|
|
drawFlags();
|
|
|
|
getDimension();
|
2011-11-16 20:23:51 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::readSetData() {
|
2011-12-04 16:24:16 +00:00
|
|
|
data.word(kCharset1) = standardLoad("DREAMWEB.C00");
|
2011-12-04 16:53:55 +00:00
|
|
|
|
2011-12-04 17:29:34 +00:00
|
|
|
void *icons1Buffer = standardLoadCPP("DREAMWEB.G00");
|
2011-12-04 16:53:55 +00:00
|
|
|
engine->setIcons1(icons1Buffer);
|
2011-12-04 17:29:34 +00:00
|
|
|
void *icons2Buffer = standardLoadCPP("DREAMWEB.G01");
|
2011-12-04 16:53:55 +00:00
|
|
|
engine->setIcons2(icons2Buffer);
|
|
|
|
|
2011-12-04 16:24:16 +00:00
|
|
|
data.word(kMainsprites) = standardLoad("DREAMWEB.S00");
|
|
|
|
data.word(kPuzzletext) = standardLoad("DREAMWEB.T80");
|
|
|
|
data.word(kCommandtext) = standardLoad("DREAMWEB.T84");
|
2011-12-04 17:44:58 +00:00
|
|
|
useCharset1();
|
2011-11-30 22:31:13 +00:00
|
|
|
|
2011-12-12 11:28:12 +00:00
|
|
|
// FIXME: Why is this commented out?
|
2011-11-30 22:31:13 +00:00
|
|
|
//engine->openFile("DREAMWEB.VOL");
|
2011-12-02 15:29:16 +00:00
|
|
|
//uint8 *volumeTab = getSegment(data.word(kSoundbuffer)).ptr(16384, 0);
|
2011-11-30 22:31:13 +00:00
|
|
|
//engine->readFromFile(volumeTab, 2048-256);
|
|
|
|
//engine->closeFile();
|
2011-11-17 16:44:19 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 09:14:37 +00:00
|
|
|
Frame * DreamBase::tempGraphics() {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kTempgraphics)).ptr(0, 0);
|
2011-11-20 13:06:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 09:14:37 +00:00
|
|
|
Frame * DreamBase::tempGraphics2() {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kTempgraphics2)).ptr(0, 0);
|
2011-11-20 13:06:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 09:14:37 +00:00
|
|
|
Frame * DreamBase::tempGraphics3() {
|
2011-12-02 15:29:16 +00:00
|
|
|
return (Frame *)getSegment(data.word(kTempgraphics3)).ptr(0, 0);
|
2011-11-20 13:06:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::findRoomInLoc() {
|
2011-11-22 22:53:35 +00:00
|
|
|
uint8 x = data.byte(kMapx) / 11;
|
|
|
|
uint8 y = data.byte(kMapy) / 10;
|
|
|
|
uint8 roomNum = y * 6 + x;
|
|
|
|
data.byte(kRoomnum) = roomNum;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::autoLook() {
|
2011-11-23 12:09:31 +00:00
|
|
|
if ((data.word(kMousex) != data.word(kOldx)) || (data.word(kMousey) != data.word(kOldy))) {
|
|
|
|
data.word(kLookcounter) = 1000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
--data.word(kLookcounter);
|
|
|
|
if (data.word(kLookcounter))
|
|
|
|
return;
|
|
|
|
if (data.word(kWatchingtime))
|
|
|
|
return;
|
2011-12-01 19:43:43 +00:00
|
|
|
doLook();
|
2011-11-23 12:09:31 +00:00
|
|
|
}
|
|
|
|
|
2011-11-23 14:49:49 +00:00
|
|
|
void DreamGenContext::look() {
|
|
|
|
if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data.byte(kCommandtype) != 241) {
|
|
|
|
data.byte(kCommandtype) = 241;
|
2011-12-01 19:43:43 +00:00
|
|
|
commandOnly(25);
|
2011-11-23 14:49:49 +00:00
|
|
|
}
|
|
|
|
if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton)))
|
2011-12-01 19:43:43 +00:00
|
|
|
doLook();
|
2011-11-23 14:49:49 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::doLook() {
|
|
|
|
createPanel();
|
|
|
|
showIcon();
|
|
|
|
underTextLine();
|
|
|
|
workToScreenM();
|
2011-11-23 20:50:35 +00:00
|
|
|
data.byte(kCommandtype) = 255;
|
2011-12-01 19:43:43 +00:00
|
|
|
dumpTextLine();
|
2011-11-23 20:50:35 +00:00
|
|
|
uint8 index = data.byte(kRoomnum) & 31;
|
2011-12-02 15:29:16 +00:00
|
|
|
uint16 offset = getSegment(data.word(kRoomdesc)).word(kIntextdat + index * 2);
|
2011-12-14 11:17:32 +00:00
|
|
|
const uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext, 0) + offset;
|
2011-12-01 19:43:43 +00:00
|
|
|
findNextColon(&string);
|
2011-11-23 20:50:35 +00:00
|
|
|
uint16 x;
|
|
|
|
if (data.byte(kReallocation) < 50)
|
|
|
|
x = 66;
|
|
|
|
else
|
|
|
|
x = 40;
|
2011-12-01 19:43:43 +00:00
|
|
|
if (printSlow(string, x, 80, 241, true) != 1)
|
|
|
|
hangOnP(400);
|
2011-11-23 20:50:35 +00:00
|
|
|
|
|
|
|
data.byte(kPointermode) = 0;
|
|
|
|
data.byte(kCommandtype) = 0;
|
2011-12-01 19:43:43 +00:00
|
|
|
redrawMainScrn();
|
|
|
|
workToScreenM();
|
2011-11-23 20:50:35 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::useCharset1() {
|
2011-12-04 17:44:58 +00:00
|
|
|
engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0));
|
2011-11-26 15:37:11 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::useTempCharset() {
|
2011-12-04 17:44:58 +00:00
|
|
|
engine->setCurrentCharset(engine->tempCharset());
|
2011-11-26 15:37:11 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTemp() {
|
2011-12-03 17:41:20 +00:00
|
|
|
deallocateMem(data.word(kTempgraphics));
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTempText() {
|
2011-12-03 17:41:20 +00:00
|
|
|
deallocateMem(data.word(kTextfile1));
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTemp2() {
|
2011-12-03 17:41:20 +00:00
|
|
|
deallocateMem(data.word(kTempgraphics2));
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTemp3() {
|
2011-12-03 17:41:20 +00:00
|
|
|
deallocateMem(data.word(kTempgraphics3));
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTempCharset() {
|
2011-12-04 17:44:58 +00:00
|
|
|
engine->freeTempCharset();
|
2011-12-03 17:41:20 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfTempsP() {
|
2011-12-03 17:41:20 +00:00
|
|
|
deallocateMem(data.word(kTempsprites));
|
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::getRidOfAll() {
|
2011-12-04 16:37:22 +00:00
|
|
|
deallocateMem(data.word(kBackdrop));
|
|
|
|
deallocateMem(data.word(kSetframes));
|
|
|
|
deallocateMem(data.word(kReel1));
|
|
|
|
deallocateMem(data.word(kReel2));
|
|
|
|
deallocateMem(data.word(kReel3));
|
|
|
|
deallocateMem(data.word(kReels));
|
|
|
|
deallocateMem(data.word(kPeople));
|
|
|
|
deallocateMem(data.word(kSetdesc));
|
|
|
|
deallocateMem(data.word(kBlockdesc));
|
|
|
|
deallocateMem(data.word(kRoomdesc));
|
|
|
|
deallocateMem(data.word(kFreeframes));
|
|
|
|
deallocateMem(data.word(kFreedesc));
|
|
|
|
}
|
|
|
|
|
2011-11-26 19:36:56 +00:00
|
|
|
// if skipDat, skip clearing and loading Setdat and Freedat
|
2011-12-13 13:21:21 +00:00
|
|
|
void DreamBase::loadRoomData(const Room &room, bool skipDat) {
|
2011-12-03 13:54:00 +00:00
|
|
|
engine->openFile(room.name);
|
2011-12-03 14:47:24 +00:00
|
|
|
|
|
|
|
FileHeader header;
|
2011-12-03 15:30:51 +00:00
|
|
|
engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
|
2011-11-26 19:36:56 +00:00
|
|
|
|
|
|
|
// read segment lengths from room file header
|
|
|
|
int len[15];
|
|
|
|
for (int i = 0; i < 15; ++i)
|
2011-12-03 14:47:24 +00:00
|
|
|
len[i] = header.len(i);
|
2011-11-26 19:36:56 +00:00
|
|
|
|
|
|
|
data.word(kBackdrop) = allocateAndLoad(len[0]);
|
2011-12-07 11:09:09 +00:00
|
|
|
clearAndLoad(workspace(), 0, len[1], 132*66); // 132*66 = maplen
|
2011-12-01 19:43:43 +00:00
|
|
|
sortOutMap();
|
2011-11-26 19:36:56 +00:00
|
|
|
data.word(kSetframes) = allocateAndLoad(len[2]);
|
|
|
|
if (!skipDat)
|
|
|
|
clearAndLoad(data.word(kSetdat), 255, len[3], kSetdatlen);
|
|
|
|
else
|
|
|
|
engine->skipBytes(len[3]);
|
|
|
|
// NB: The skipDat version of this function as called by restoreall
|
|
|
|
// had a 'call bloc' instead of 'call loadseg' for reel1,
|
|
|
|
// but 'bloc' was not defined.
|
|
|
|
data.word(kReel1) = allocateAndLoad(len[4]);
|
|
|
|
data.word(kReel2) = allocateAndLoad(len[5]);
|
|
|
|
data.word(kReel3) = allocateAndLoad(len[6]);
|
|
|
|
data.word(kReels) = allocateAndLoad(len[7]);
|
|
|
|
data.word(kPeople) = allocateAndLoad(len[8]);
|
|
|
|
data.word(kSetdesc) = allocateAndLoad(len[9]);
|
|
|
|
data.word(kBlockdesc) = allocateAndLoad(len[10]);
|
|
|
|
data.word(kRoomdesc) = allocateAndLoad(len[11]);
|
|
|
|
data.word(kFreeframes) = allocateAndLoad(len[12]);
|
|
|
|
if (!skipDat)
|
|
|
|
clearAndLoad(data.word(kFreedat), 255, len[13], kFreedatlen);
|
|
|
|
else
|
|
|
|
engine->skipBytes(len[13]);
|
|
|
|
data.word(kFreedesc) = allocateAndLoad(len[14]);
|
|
|
|
|
2011-12-09 14:34:39 +00:00
|
|
|
engine->closeFile();
|
2011-11-26 19:36:56 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::restoreAll() {
|
2011-12-03 13:54:00 +00:00
|
|
|
const Room &room = g_roomData[data.byte(kLocation)];
|
2011-11-26 19:36:56 +00:00
|
|
|
loadRoomData(room, true);
|
2011-12-01 19:43:43 +00:00
|
|
|
setAllChanges();
|
2011-11-26 19:24:23 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 13:09:53 +00:00
|
|
|
void DreamBase::restoreReels() {
|
2011-11-26 19:45:59 +00:00
|
|
|
if (data.byte(kRoomloaded) == 0)
|
|
|
|
return;
|
|
|
|
|
2011-12-03 13:54:00 +00:00
|
|
|
const Room &room = g_roomData[data.byte(kReallocation)];
|
2011-11-26 19:45:59 +00:00
|
|
|
|
2011-12-03 13:54:00 +00:00
|
|
|
engine->openFile(room.name);
|
2011-12-03 20:15:40 +00:00
|
|
|
|
|
|
|
FileHeader header;
|
|
|
|
engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
|
2011-11-26 19:45:59 +00:00
|
|
|
|
|
|
|
// read segment lengths from room file header
|
|
|
|
int len[15];
|
|
|
|
for (int i = 0; i < 15; ++i)
|
2011-12-03 20:15:40 +00:00
|
|
|
len[i] = header.len(i);
|
2011-11-26 19:45:59 +00:00
|
|
|
|
|
|
|
engine->skipBytes(len[0]);
|
|
|
|
engine->skipBytes(len[1]);
|
|
|
|
engine->skipBytes(len[2]);
|
|
|
|
engine->skipBytes(len[3]);
|
|
|
|
data.word(kReel1) = allocateAndLoad(len[4]);
|
|
|
|
data.word(kReel2) = allocateAndLoad(len[5]);
|
|
|
|
data.word(kReel3) = allocateAndLoad(len[6]);
|
|
|
|
|
2011-12-09 14:34:39 +00:00
|
|
|
engine->closeFile();
|
2011-11-26 19:45:23 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::loadFolder() {
|
2011-12-03 19:17:41 +00:00
|
|
|
loadIntoTemp("DREAMWEB.G09"); // folder graphics 1
|
|
|
|
loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2
|
|
|
|
loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3
|
|
|
|
loadTempCharset("DREAMWEB.C02"); // character set 3
|
|
|
|
loadTempText("DREAMWEB.T50"); // folder text
|
2011-11-29 17:05:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::showFolder() {
|
2011-11-28 11:10:48 +00:00
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
if (data.byte(kFolderpage)) {
|
2011-12-01 19:43:43 +00:00
|
|
|
useTempCharset();
|
|
|
|
createPanel2();
|
|
|
|
showFrame(tempGraphics(), 0, 0, 0, 0);
|
|
|
|
showFrame(tempGraphics(), 143, 0, 1, 0);
|
|
|
|
showFrame(tempGraphics(), 0, 92, 2, 0);
|
|
|
|
showFrame(tempGraphics(), 143, 92, 3, 0);
|
|
|
|
folderExit();
|
2011-11-28 11:10:48 +00:00
|
|
|
if (data.byte(kFolderpage) != 1)
|
2011-12-01 19:43:43 +00:00
|
|
|
showLeftPage();
|
2011-11-28 11:10:48 +00:00
|
|
|
if (data.byte(kFolderpage) != 12)
|
2011-12-01 19:43:43 +00:00
|
|
|
showRightPage();
|
|
|
|
useCharset1();
|
|
|
|
underTextLine();
|
2011-11-28 11:10:48 +00:00
|
|
|
} else {
|
2011-12-01 19:43:43 +00:00
|
|
|
createPanel2();
|
|
|
|
showFrame(tempGraphics3(), 143-28, 0, 0, 0);
|
|
|
|
showFrame(tempGraphics3(), 143-28, 92, 1, 0);
|
|
|
|
folderExit();
|
|
|
|
underTextLine();
|
2011-11-28 11:10:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::showLeftPage() {
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 0, 12, 3, 0);
|
2011-11-28 11:38:09 +00:00
|
|
|
uint16 y = 12+5;
|
|
|
|
for (size_t i = 0; i < 9; ++i) {
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 0, y, 4, 0);
|
2011-11-28 11:38:09 +00:00
|
|
|
y += 16;
|
|
|
|
}
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 0, y, 5, 0);
|
2011-11-28 11:38:09 +00:00
|
|
|
data.word(kLinespacing) = 8;
|
|
|
|
data.word(kCharshift) = 91;
|
|
|
|
data.byte(kKerning) = 1;
|
|
|
|
uint8 pageIndex = data.byte(kFolderpage) - 2;
|
2011-11-28 17:28:09 +00:00
|
|
|
const uint8 *string = getTextInFile1(pageIndex * 2);
|
2011-11-28 11:38:09 +00:00
|
|
|
y = 48;
|
|
|
|
for (size_t i = 0; i < 2; ++i) {
|
|
|
|
uint8 lastChar;
|
|
|
|
do {
|
2011-12-01 19:43:43 +00:00
|
|
|
lastChar = printDirect(&string, 2, &y, 140, false);
|
2011-11-28 11:38:09 +00:00
|
|
|
y += data.word(kLinespacing);
|
|
|
|
} while (lastChar != '\0');
|
|
|
|
}
|
|
|
|
data.byte(kKerning) = 0;
|
|
|
|
data.word(kCharshift) = 0;
|
|
|
|
data.word(kLinespacing) = 10;
|
|
|
|
uint8 *bufferToSwap = workspace() + (48*320)+2;
|
|
|
|
for (size_t i = 0; i < 120; ++i) {
|
|
|
|
for (size_t j = 0; j < 65; ++j) {
|
|
|
|
SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
|
|
|
|
}
|
|
|
|
bufferToSwap += 320;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::showRightPage() {
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 143, 12, 0, 0);
|
2011-11-28 15:17:50 +00:00
|
|
|
uint16 y = 12+37;
|
|
|
|
for (size_t i = 0; i < 7; ++i) {
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 143, y, 1, 0);
|
2011-11-28 15:17:50 +00:00
|
|
|
y += 16;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 143, y, 2, 0);
|
2011-11-28 15:17:50 +00:00
|
|
|
data.word(kLinespacing) = 8;
|
|
|
|
data.byte(kKerning) = 1;
|
|
|
|
uint8 pageIndex = data.byte(kFolderpage) - 1;
|
2011-11-28 17:28:09 +00:00
|
|
|
const uint8 *string = getTextInFile1(pageIndex * 2);
|
2011-11-28 15:17:50 +00:00
|
|
|
y = 48;
|
|
|
|
for (size_t i = 0; i < 2; ++i) {
|
|
|
|
uint8 lastChar;
|
|
|
|
do {
|
2011-12-01 19:43:43 +00:00
|
|
|
lastChar = printDirect(&string, 152, &y, 140, false);
|
2011-11-28 15:17:50 +00:00
|
|
|
y += data.word(kLinespacing);
|
|
|
|
} while (lastChar != '\0');
|
|
|
|
}
|
|
|
|
data.byte(kKerning) = 0;
|
|
|
|
data.word(kLinespacing) = 10;
|
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void DreamBase::showExit() {
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 274, 154, 11, 0);
|
2011-12-04 15:31:11 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void DreamBase::showMan() {
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 0, 0, 0, 0);
|
|
|
|
showFrame(engine->icons1(), 0, 114, 1, 0);
|
2011-12-04 15:40:03 +00:00
|
|
|
if (data.byte(kShadeson))
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 28, 25, 2, 0);
|
2011-12-04 15:40:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 08:07:55 +00:00
|
|
|
void DreamBase::panelIcons1() {
|
2011-12-04 15:47:43 +00:00
|
|
|
uint16 x;
|
|
|
|
if (data.byte(kWatchon) != 1)
|
|
|
|
x = 48;
|
|
|
|
else
|
|
|
|
x = 0;
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons2(), 204 + x, 4, 2, 0);
|
2011-12-04 15:47:43 +00:00
|
|
|
if (data.byte(kZoomon) != 1)
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons1(), 228 + x, 8, 5, 0);
|
2011-12-04 15:47:43 +00:00
|
|
|
showWatch();
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::examIcon() {
|
2011-12-04 17:32:55 +00:00
|
|
|
showFrame(engine->icons2(), 254, 5, 3, 0);
|
2011-12-04 16:04:51 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 20:55:29 +00:00
|
|
|
uint8 DreamBase::getLocation(uint8 index) {
|
2011-11-28 16:03:07 +00:00
|
|
|
return data.byte(kRoomscango + index);
|
|
|
|
}
|
|
|
|
|
2011-12-12 20:55:29 +00:00
|
|
|
void DreamBase::setLocation(uint8 index) {
|
2011-11-28 16:03:07 +00:00
|
|
|
data.byte(kRoomscango + index) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::setLocation() {
|
2011-12-12 20:55:29 +00:00
|
|
|
DreamBase::setLocation(al);
|
2011-11-28 16:03:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 12:15:04 +00:00
|
|
|
const uint8 *DreamBase::getTextInFile1(uint16 index) {
|
|
|
|
SegmentRef text = getSegment(data.word(kTextfile1));
|
|
|
|
uint16 offset = text.word(index * 2) + kTextstart;
|
|
|
|
const uint8 *string = text.ptr(offset, 0);
|
2011-11-28 17:28:09 +00:00
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
2011-11-29 09:27:02 +00:00
|
|
|
void DreamGenContext::checkFolderCoords() {
|
2011-12-01 19:43:43 +00:00
|
|
|
RectWithCallback folderList[] = {
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 280,320,160,200, &DreamBase::quitKey },
|
2011-12-01 19:43:43 +00:00
|
|
|
{ 143,300,6,194, &DreamGenContext::nextFolder },
|
|
|
|
{ 0,143,6,194, &DreamGenContext::lastFolder },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200, &DreamBase::blank },
|
2011-12-01 19:43:43 +00:00
|
|
|
{ 0xFFFF,0,0,0, 0 }
|
2011-11-29 09:27:02 +00:00
|
|
|
};
|
2011-12-01 19:43:43 +00:00
|
|
|
checkCoords(folderList);
|
2011-11-29 09:27:02 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::nextFolder() {
|
2011-11-29 09:27:02 +00:00
|
|
|
if (data.byte(kFolderpage) == 12) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data.byte(kCommandtype) != 201) {
|
|
|
|
data.byte(kCommandtype) = 201;
|
2011-12-01 19:43:43 +00:00
|
|
|
commandOnly(16);
|
2011-11-29 09:27:02 +00:00
|
|
|
}
|
|
|
|
if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton))) {
|
|
|
|
++data.byte(kFolderpage);
|
2011-12-01 19:43:43 +00:00
|
|
|
folderHints();
|
|
|
|
delPointer();
|
|
|
|
showFolder();
|
2011-11-29 09:27:02 +00:00
|
|
|
data.word(kMousebutton) = 0;
|
|
|
|
checkFolderCoords();
|
2011-12-01 19:43:43 +00:00
|
|
|
workToScreenM();
|
2011-11-29 09:27:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::lastFolder() {
|
2011-11-29 10:15:01 +00:00
|
|
|
if (data.byte(kFolderpage) == 0) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data.byte(kCommandtype) != 202) {
|
|
|
|
data.byte(kCommandtype) = 202;
|
2011-12-01 19:43:43 +00:00
|
|
|
commandOnly(17);
|
2011-11-29 10:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton))) {
|
|
|
|
--data.byte(kFolderpage);
|
2011-12-01 19:43:43 +00:00
|
|
|
delPointer();
|
|
|
|
showFolder();
|
2011-11-29 10:15:01 +00:00
|
|
|
data.word(kMousebutton) = 0;
|
|
|
|
checkFolderCoords();
|
2011-12-01 19:43:43 +00:00
|
|
|
workToScreenM();
|
2011-11-29 10:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::folderHints() {
|
2011-11-29 11:24:04 +00:00
|
|
|
if (data.byte(kFolderpage) == 5) {
|
2011-12-15 12:41:30 +00:00
|
|
|
if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) {
|
|
|
|
setLocation(13);
|
2011-12-01 19:43:43 +00:00
|
|
|
showFolder();
|
2011-11-29 11:24:04 +00:00
|
|
|
const uint8 *string = getTextInFile1(30);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(string, 0, 86, 141, true);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(200);
|
2011-11-29 11:24:04 +00:00
|
|
|
}
|
|
|
|
} else if (data.byte(kFolderpage) == 9) {
|
2011-12-15 12:41:30 +00:00
|
|
|
if (getLocation(7) != 1) {
|
|
|
|
setLocation(7);
|
2011-12-01 19:43:43 +00:00
|
|
|
showFolder();
|
2011-11-29 11:24:04 +00:00
|
|
|
const uint8 *string = getTextInFile1(31);
|
2011-12-01 19:43:43 +00:00
|
|
|
printDirect(string, 0, 86, 141, true);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(200);
|
2011-11-29 11:24:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::folderExit() {
|
2011-12-01 19:43:43 +00:00
|
|
|
showFrame(tempGraphics2(), 296, 178, 6, 0);
|
2011-11-29 14:18:17 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::loadTravelText() {
|
2011-12-03 19:17:41 +00:00
|
|
|
data.word(kTraveltext) = standardLoad("DREAMWEB.T81"); // location descs
|
2011-11-30 09:06:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::loadTempText(const char *fileName) {
|
2011-12-01 19:43:43 +00:00
|
|
|
data.word(kTextfile1) = standardLoad(fileName);
|
2011-11-30 09:06:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::drawFloor() {
|
|
|
|
eraseOldObs();
|
|
|
|
drawFlags();
|
|
|
|
calcMapAd();
|
|
|
|
doBlocks();
|
|
|
|
showAllObs();
|
|
|
|
showAllFree();
|
|
|
|
showAllEx();
|
|
|
|
panelToMap();
|
|
|
|
initRain();
|
2011-11-30 13:30:40 +00:00
|
|
|
data.byte(kNewobs) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-01 19:43:43 +00:00
|
|
|
void DreamGenContext::allocateBuffers() {
|
|
|
|
data.word(kExtras) = allocateMem(kLengthofextra/16);
|
|
|
|
data.word(kMapdata) = allocateMem(kLengthofmap/16);
|
|
|
|
data.word(kBuffers) = allocateMem(kLengthofbuffer/16);
|
|
|
|
data.word(kFreedat) = allocateMem(kFreedatlen/16);
|
|
|
|
data.word(kSetdat) = allocateMem(kSetdatlen/16);
|
|
|
|
data.word(kMapstore) = allocateMem(kLenofmapstore/16);
|
|
|
|
data.word(kSounddata) = allocateMem(2048/16);
|
|
|
|
data.word(kSounddata2) = allocateMem(2048/16);
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::workToScreenM() {
|
2011-12-01 19:43:43 +00:00
|
|
|
animPointer();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-01 19:43:43 +00:00
|
|
|
delPointer();
|
2011-11-30 23:01:54 +00:00
|
|
|
}
|
|
|
|
|
2011-12-03 14:44:29 +00:00
|
|
|
void DreamGenContext::loadMenu() {
|
2011-12-03 19:17:41 +00:00
|
|
|
loadIntoTemp("DREAMWEB.S02"); // sprite name 3
|
|
|
|
loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2
|
2011-12-03 14:44:29 +00:00
|
|
|
}
|
|
|
|
|
2011-12-03 14:46:43 +00:00
|
|
|
void DreamGenContext::showMenu() {
|
|
|
|
++data.byte(kMenucount);
|
|
|
|
if (data.byte(kMenucount) == 37*2)
|
|
|
|
data.byte(kMenucount) = 0;
|
|
|
|
showFrame(tempGraphics(), kMenux, kMenuy, data.byte(kMenucount) / 2, 0);
|
|
|
|
}
|
|
|
|
|
2011-12-03 14:57:47 +00:00
|
|
|
void DreamGenContext::dumpMenu() {
|
|
|
|
multiDump(kMenux, kMenuy, 48, 48);
|
|
|
|
}
|
|
|
|
|
2011-12-03 14:31:29 +00:00
|
|
|
void DreamGenContext::useMenu() {
|
|
|
|
getRidOfReels();
|
|
|
|
loadMenu();
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showIcon();
|
|
|
|
data.byte(kNewobs) = 0;
|
|
|
|
drawFloor();
|
|
|
|
printSprites();
|
|
|
|
showFrame(tempGraphics2(), kMenux-48, kMenuy-4, 4, 0);
|
|
|
|
getUnderMenu();
|
|
|
|
showFrame(tempGraphics2(), kMenux+54, kMenuy+72, 5, 0);
|
|
|
|
workToScreenM();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
do {
|
|
|
|
delPointer();
|
|
|
|
putUnderMenu();
|
|
|
|
showMenu();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpMenu();
|
|
|
|
dumpTextLine();
|
|
|
|
RectWithCallback menuList[] = {
|
2011-12-15 12:41:30 +00:00
|
|
|
{ kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey },
|
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-03 14:31:29 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
checkCoords(menuList);
|
|
|
|
} while ((data.byte(kGetback) != 1) && !quitRequested());
|
|
|
|
data.byte(kManisoffscreen) = 0;
|
|
|
|
redrawMainScrn();
|
|
|
|
getRidOfTemp();
|
|
|
|
getRidOfTemp2();
|
|
|
|
restoreReels();
|
|
|
|
workToScreenM();
|
|
|
|
}
|
2011-12-03 18:20:52 +00:00
|
|
|
|
|
|
|
void DreamGenContext::atmospheres() {
|
2011-12-03 18:50:25 +00:00
|
|
|
|
|
|
|
const Atmosphere *a = &g_atmosphereList[0];
|
|
|
|
|
|
|
|
for (; a->_location != 255; ++a) {
|
|
|
|
if (a->_location != data.byte(kReallocation))
|
|
|
|
continue;
|
|
|
|
if (a->_mapX != data.byte(kMapx) || a->_mapY != data.byte(kMapy))
|
|
|
|
continue;
|
|
|
|
if (a->_sound != data.byte(kCh0playing)) {
|
|
|
|
|
|
|
|
if (data.byte(kLocation) == 45 && data.word(kReeltowatch) == 45)
|
|
|
|
continue; // "web"
|
|
|
|
|
|
|
|
playChannel0(a->_sound, a->_repeat);
|
|
|
|
|
|
|
|
// NB: The asm here reads
|
|
|
|
// cmp reallocation,2
|
|
|
|
// cmp mapy,0
|
|
|
|
// jz fullvol
|
|
|
|
// jnz notlouisvol
|
|
|
|
// I'm interpreting this as if the cmp reallocation is below the jz
|
|
|
|
|
|
|
|
if (data.byte(kMapy) == 0) {
|
|
|
|
data.byte(kVolume) = 0; // "fullvol"
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kReallocation) == 2 && data.byte(kMapx) == 22 && data.byte(kMapy) == 10)
|
|
|
|
data.byte(kVolume) = 5; // "louisvol"
|
|
|
|
|
|
|
|
if (isCD() && data.byte(kReallocation) == 14) {
|
|
|
|
if (data.byte(kMapx) == 33) {
|
|
|
|
data.byte(kVolume) = 0; // "ismad2"
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kMapx) == 22) {
|
|
|
|
data.byte(kVolume) = 5;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kReallocation) == 2) {
|
|
|
|
if (data.byte(kMapx) == 22) {
|
|
|
|
data.byte(kVolume) = 5; // "louisvol"
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kMapx) == 11) {
|
|
|
|
data.byte(kVolume) = 0; // "fullvol"
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-03 18:20:52 +00:00
|
|
|
cancelCh0();
|
|
|
|
}
|
|
|
|
|
2011-12-04 19:03:16 +00:00
|
|
|
void DreamGenContext::readCityPic() {
|
|
|
|
loadIntoTemp("DREAMWEB.G04");
|
|
|
|
}
|
|
|
|
|
2011-12-04 19:18:08 +00:00
|
|
|
void DreamGenContext::readDestIcon() {
|
|
|
|
loadIntoTemp("DREAMWEB.G05");
|
|
|
|
loadIntoTemp2("DREAMWEB.G06");
|
|
|
|
loadIntoTemp3("DREAMWEB.G08");
|
|
|
|
}
|
|
|
|
|
2011-12-05 00:17:21 +00:00
|
|
|
uint8 DreamGenContext::nextSymbol(uint8 symbol) {
|
|
|
|
uint8 result = symbol + 1;
|
|
|
|
if (result == 6)
|
|
|
|
return 0;
|
|
|
|
if (result == 12)
|
|
|
|
return 6;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-12-04 23:50:51 +00:00
|
|
|
void DreamGenContext::showSymbol() {
|
|
|
|
showFrame(tempGraphics(), kSymbolx, kSymboly, 12, 0);
|
|
|
|
|
|
|
|
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx-44, kSymboly+20, data.byte(kSymboltopnum), 32);
|
2011-12-05 00:17:21 +00:00
|
|
|
uint8 nextTopSymbol = nextSymbol(data.byte(kSymboltopnum));
|
2011-12-04 23:50:51 +00:00
|
|
|
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
|
2011-12-05 00:17:21 +00:00
|
|
|
uint8 nextNextTopSymbol = nextSymbol(nextTopSymbol);
|
2011-12-04 23:50:51 +00:00
|
|
|
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
|
|
|
|
|
|
|
|
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx-44, kSymboly+49, 6 + data.byte(kSymbolbotnum), 32);
|
2011-12-05 00:17:21 +00:00
|
|
|
uint8 nextBotSymbol = nextSymbol(data.byte(kSymbolbotnum));
|
2011-12-04 23:50:51 +00:00
|
|
|
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
|
2011-12-05 00:17:21 +00:00
|
|
|
uint8 nextNextBotSymbol = nextSymbol(nextBotSymbol);
|
2011-12-04 23:50:51 +00:00
|
|
|
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
|
|
|
|
}
|
|
|
|
|
2011-12-08 14:21:42 +00:00
|
|
|
void DreamBase::readKey() {
|
2011-12-04 09:11:28 +00:00
|
|
|
uint16 bufOut = data.word(kBufferout);
|
|
|
|
|
|
|
|
if (bufOut == data.word(kBufferin)) {
|
|
|
|
// empty buffer
|
|
|
|
data.byte(kCurrentkey) = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bufOut = (bufOut + 1) & 15; // The buffer has size 16
|
|
|
|
data.byte(kCurrentkey) = g_keyBuffer[bufOut];
|
|
|
|
data.word(kBufferout) = bufOut;
|
2011-12-04 09:01:37 +00:00
|
|
|
}
|
2011-12-03 18:20:52 +00:00
|
|
|
|
2011-12-05 13:07:47 +00:00
|
|
|
void DreamGenContext::hangOne(uint16 delay) {
|
|
|
|
do {
|
|
|
|
vSync();
|
|
|
|
if (data.byte(kLasthardkey) == 1)
|
|
|
|
return; // "hangonearly"
|
|
|
|
} while (--delay);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::hangOne() {
|
|
|
|
hangOne(cx);
|
|
|
|
}
|
2011-12-03 18:20:52 +00:00
|
|
|
|
2011-12-05 16:02:46 +00:00
|
|
|
void DreamGenContext::bibleQuote() {
|
2011-12-06 02:33:36 +00:00
|
|
|
initGraphics(640, 480, true);
|
2011-12-05 16:02:46 +00:00
|
|
|
|
|
|
|
showPCX("DREAMWEB.I00");
|
|
|
|
fadeScreenUps();
|
|
|
|
|
|
|
|
hangOne(80);
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "biblequotearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
hangOne(560);
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "biblequotearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
|
|
|
|
hangOne(200);
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "biblequotearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
cancelCh0();
|
|
|
|
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-05 17:16:43 +00:00
|
|
|
void DreamGenContext::realCredits() {
|
|
|
|
data.byte(kRoomssample) = 33;
|
|
|
|
loadRoomsSample();
|
|
|
|
data.byte(kVolume) = 0;
|
|
|
|
|
2011-12-06 02:33:36 +00:00
|
|
|
initGraphics(640, 480, true);
|
2011-12-05 17:16:43 +00:00
|
|
|
hangOn(35);
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I01");
|
|
|
|
playChannel0(12, 0);
|
|
|
|
|
|
|
|
hangOne(2);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
allPalette();
|
|
|
|
hangOne(80);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I02");
|
|
|
|
playChannel0(12, 0);
|
|
|
|
hangOne(2);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
allPalette();
|
|
|
|
hangOne(80);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I03");
|
|
|
|
playChannel0(12, 0);
|
|
|
|
hangOne(2);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
allPalette();
|
|
|
|
hangOne(80);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I04");
|
|
|
|
playChannel0(12, 0);
|
|
|
|
hangOne(2);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
allPalette();
|
|
|
|
hangOne(80);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I05");
|
|
|
|
playChannel0(12, 0);
|
|
|
|
hangOne(2);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
allPalette();
|
|
|
|
hangOne(80);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
showPCX("DREAMWEB.I06");
|
|
|
|
fadeScreenUps();
|
|
|
|
hangOne(60);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
playChannel0(13, 0);
|
|
|
|
hangOne(350);
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "realcreditsearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOne(256);
|
|
|
|
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-07 22:41:11 +00:00
|
|
|
void DreamGenContext::runIntroSeq() {
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
vSync();
|
|
|
|
|
2011-12-07 23:08:25 +00:00
|
|
|
if (data.byte(kLasthardkey) == 1)
|
|
|
|
break;
|
2011-12-07 22:41:11 +00:00
|
|
|
|
|
|
|
spriteUpdate();
|
|
|
|
vSync();
|
|
|
|
|
2011-12-07 23:08:25 +00:00
|
|
|
if (data.byte(kLasthardkey) == 1)
|
|
|
|
break;
|
2011-12-07 22:41:11 +00:00
|
|
|
|
|
|
|
delEverything();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
afterIntroRoom();
|
|
|
|
useTimedText();
|
|
|
|
vSync();
|
|
|
|
|
2011-12-07 23:08:25 +00:00
|
|
|
if (data.byte(kLasthardkey) == 1)
|
|
|
|
break;
|
2011-12-07 22:41:11 +00:00
|
|
|
|
|
|
|
dumpMap();
|
|
|
|
dumpTimedText();
|
|
|
|
vSync();
|
|
|
|
|
2011-12-07 23:08:25 +00:00
|
|
|
if (data.byte(kLasthardkey) == 1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
} while (data.byte(kGetback) != 1);
|
2011-12-07 22:41:11 +00:00
|
|
|
|
2011-12-07 23:08:25 +00:00
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
getRidOfTempText();
|
|
|
|
clearBeforeLoad();
|
|
|
|
}
|
2011-12-07 22:41:11 +00:00
|
|
|
|
|
|
|
// These were not called in this program arc
|
|
|
|
// in the original code.. Bug?
|
|
|
|
//getRidOfTempText();
|
|
|
|
//clearBeforeLoad();
|
|
|
|
}
|
|
|
|
|
2011-12-05 18:50:34 +00:00
|
|
|
void DreamGenContext::intro() {
|
|
|
|
loadTempText("DREAMWEB.T82");
|
|
|
|
loadPalFromIFF();
|
|
|
|
setMode();
|
|
|
|
data.byte(kNewlocation) = 50;
|
|
|
|
clearPalette();
|
|
|
|
loadIntroRoom();
|
|
|
|
data.byte(kVolume) = 7;
|
2011-12-12 20:46:28 +00:00
|
|
|
data.byte(kVolumedirection) = (byte)-1;
|
2011-12-05 18:50:34 +00:00
|
|
|
data.byte(kVolumeto) = 4;
|
|
|
|
playChannel0(12, 255);
|
|
|
|
fadeScreenUps();
|
|
|
|
runIntroSeq();
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "introearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
clearBeforeLoad();
|
|
|
|
data.byte(kNewlocation) = 52;
|
|
|
|
loadIntroRoom();
|
|
|
|
runIntroSeq();
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "introearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
clearBeforeLoad();
|
|
|
|
data.byte(kNewlocation) = 53;
|
|
|
|
loadIntroRoom();
|
|
|
|
runIntroSeq();
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "introearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
clearBeforeLoad();
|
|
|
|
allPalette();
|
|
|
|
data.byte(kNewlocation) = 54;
|
|
|
|
loadIntroRoom();
|
|
|
|
runIntroSeq();
|
|
|
|
|
|
|
|
if (data.byte(kLasthardkey) == 1) {
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
return; // "introearly"
|
|
|
|
}
|
|
|
|
|
|
|
|
getRidOfTempText();
|
|
|
|
clearBeforeLoad();
|
|
|
|
|
|
|
|
data.byte(kLasthardkey) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::setTopLeft() {
|
2011-12-06 01:34:36 +00:00
|
|
|
if (data.byte(kSymboltopdir) != 0) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 210) {
|
|
|
|
data.byte(kCommandtype) = 210;
|
|
|
|
commandOnly(19);
|
|
|
|
}
|
|
|
|
|
2011-12-06 11:05:32 +00:00
|
|
|
if (data.word(kMousebutton) != 0)
|
2011-12-06 01:34:36 +00:00
|
|
|
data.byte(kSymboltopdir) = 0xFF;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::setTopRight() {
|
2011-12-06 01:34:36 +00:00
|
|
|
if (data.byte(kSymboltopdir) != 0) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 211) {
|
|
|
|
data.byte(kCommandtype) = 211;
|
|
|
|
commandOnly(20);
|
|
|
|
}
|
|
|
|
|
2011-12-06 11:05:32 +00:00
|
|
|
if (data.word(kMousebutton) != 0)
|
2011-12-06 01:34:36 +00:00
|
|
|
data.byte(kSymboltopdir) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::setBotLeft() {
|
2011-12-06 01:34:36 +00:00
|
|
|
if (data.byte(kSymbolbotdir) != 0) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 212) {
|
|
|
|
data.byte(kCommandtype) = 212;
|
|
|
|
commandOnly(21);
|
|
|
|
}
|
|
|
|
|
2011-12-06 11:05:32 +00:00
|
|
|
if (data.word(kMousebutton) != 0)
|
2011-12-06 01:34:36 +00:00
|
|
|
data.byte(kSymbolbotdir) = 0xFF;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::setBotRight() {
|
2011-12-06 01:34:36 +00:00
|
|
|
if (data.byte(kSymbolbotdir) != 0) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 213) {
|
|
|
|
data.byte(kCommandtype) = 213;
|
|
|
|
commandOnly(22);
|
|
|
|
}
|
|
|
|
|
2011-12-06 11:05:32 +00:00
|
|
|
if (data.word(kMousebutton) != 0)
|
2011-12-06 01:34:36 +00:00
|
|
|
data.byte(kSymbolbotdir) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-06 01:49:32 +00:00
|
|
|
void DreamGenContext::newGame() {
|
|
|
|
if (data.byte(kCommandtype) != 251) {
|
|
|
|
data.byte(kCommandtype) = 251;
|
|
|
|
commandOnly(47);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) == 1)
|
|
|
|
data.byte(kGetback) = 3;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::getBackFromOps() {
|
2011-12-06 01:49:32 +00:00
|
|
|
if (data.byte(kMandead) == 2)
|
|
|
|
blank();
|
|
|
|
else
|
|
|
|
getBack1();
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::getBackToOps() {
|
2011-12-06 01:49:32 +00:00
|
|
|
if (data.byte(kCommandtype) != 201) {
|
|
|
|
data.byte(kCommandtype) = 201;
|
|
|
|
commandOnly(42);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) != data.word(kOldbutton)) {
|
2011-12-06 07:28:34 +00:00
|
|
|
if (data.word(kMousebutton) & 1) {
|
2011-12-06 01:49:32 +00:00
|
|
|
oldToNames();
|
|
|
|
data.byte(kGetback) = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-06 01:59:45 +00:00
|
|
|
void DreamGenContext::pickupOb(uint8 command, uint8 pos) {
|
|
|
|
data.byte(kLastinvpos) = pos;
|
|
|
|
data.byte(kObjecttype) = 2;
|
|
|
|
data.byte(kItemframe) = command;
|
|
|
|
data.byte(kCommand) = command;
|
|
|
|
getAnyAd();
|
|
|
|
transferToEx();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::initialInv() {
|
|
|
|
if (data.byte(kReallocation) != 24)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pickupOb(11, 5);
|
|
|
|
pickupOb(12, 6);
|
|
|
|
pickupOb(13, 7);
|
|
|
|
pickupOb(14, 8);
|
|
|
|
pickupOb(18, 0);
|
|
|
|
pickupOb(19, 1);
|
|
|
|
pickupOb(20, 9);
|
|
|
|
pickupOb(16, 2);
|
|
|
|
data.byte(kWatchmode) = 1;
|
|
|
|
data.word(kReeltohold) = 0;
|
|
|
|
data.word(kEndofholdreel) = 6;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
}
|
|
|
|
|
2011-12-06 02:19:57 +00:00
|
|
|
void DreamGenContext::walkIntoRoom() {
|
|
|
|
if (data.byte(kLocation) == 14 && data.byte(kMapx) == 22) {
|
|
|
|
data.byte(kDestination) = 1;
|
|
|
|
data.byte(kFinaldest) = 1;
|
|
|
|
autoSetWalk();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::loadIntroRoom() {
|
|
|
|
data.byte(kIntrocount) = 0;
|
|
|
|
data.byte(kLocation) = 255;
|
|
|
|
loadRoom();
|
|
|
|
data.word(kMapoffsetx) = 72;
|
|
|
|
data.word(kMapoffsety) = 16;
|
|
|
|
clearSprites();
|
|
|
|
data.byte(kThroughdoor) = 0;
|
|
|
|
data.byte(kCurrentkey) = '0';
|
|
|
|
data.byte(kMainmode) = 0;
|
|
|
|
clearWork();
|
|
|
|
data.byte(kNewobs) = 1;
|
|
|
|
drawFloor();
|
|
|
|
reelsOnScreen();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 02:19:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::afterIntroRoom() {
|
|
|
|
if (data.byte(kNowinnewroom) == 0)
|
|
|
|
return; // notnewintro
|
|
|
|
|
|
|
|
clearWork();
|
|
|
|
findRoomInLoc();
|
|
|
|
data.byte(kNewobs) = 1;
|
|
|
|
drawFloor();
|
|
|
|
reelsOnScreen();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 02:19:57 +00:00
|
|
|
data.byte(kNowinnewroom) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::gettingShot() {
|
|
|
|
data.byte(kNewlocation) = 55;
|
|
|
|
clearPalette();
|
|
|
|
loadIntroRoom();
|
|
|
|
fadeScreenUps();
|
|
|
|
data.byte(kVolumeto) = 0;
|
2011-12-12 20:46:28 +00:00
|
|
|
data.byte(kVolumedirection) = (byte)-1;
|
2011-12-06 02:19:57 +00:00
|
|
|
runEndSeq();
|
|
|
|
clearBeforeLoad();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::redrawMainScrn() {
|
|
|
|
data.word(kTimecount) = 0;
|
|
|
|
createPanel();
|
|
|
|
data.byte(kNewobs) = 0;
|
|
|
|
drawFloor();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
showIcon();
|
|
|
|
getUnderZoom();
|
|
|
|
underTextLine();
|
|
|
|
readMouse();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
}
|
|
|
|
|
2011-12-15 11:23:00 +00:00
|
|
|
void DreamBase::blank() {
|
2011-12-06 02:33:36 +00:00
|
|
|
if (data.byte(kCommandtype) != 199) {
|
|
|
|
data.byte(kCommandtype) = 199;
|
|
|
|
commandOnly(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::allPointer() {
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
dumpPointer();
|
|
|
|
}
|
|
|
|
|
2011-12-06 10:59:18 +00:00
|
|
|
void DreamGenContext::makeMainScreen() {
|
|
|
|
createPanel();
|
|
|
|
data.byte(kNewobs) = 1;
|
|
|
|
drawFloor();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
showIcon();
|
|
|
|
getUnderZoom();
|
|
|
|
underTextLine();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
animPointer();
|
|
|
|
workToScreenM();
|
|
|
|
data.byte(kCommandtype) = 200;
|
|
|
|
data.byte(kManisoffscreen) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::openInv() {
|
2011-12-06 10:59:18 +00:00
|
|
|
data.byte(kInvopen) = 1;
|
|
|
|
printMessage(80, 58 - 10, 61, 240, (240 & 1));
|
|
|
|
fillRyan();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
}
|
2011-08-15 13:42:09 +00:00
|
|
|
|
2011-12-06 10:59:18 +00:00
|
|
|
void DreamGenContext::obsThatDoThings() {
|
2011-12-14 22:11:12 +00:00
|
|
|
if (!compare(data.byte(kCommand), data.byte(kObjecttype), "MEMB"))
|
2011-12-06 10:59:18 +00:00
|
|
|
return; // notlouiscard
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
if (getLocation(4) != 1) {
|
|
|
|
setLocation(4);
|
2011-12-06 10:59:18 +00:00
|
|
|
lookAtCard();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 00:09:17 +00:00
|
|
|
void DreamGenContext::describeOb() {
|
|
|
|
const uint8 *obText = getObTextStartCPP();
|
|
|
|
uint16 y = 92;
|
|
|
|
if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1)
|
|
|
|
y = 82;
|
|
|
|
data.word(kCharshift) = 91 + 91;
|
2011-12-15 10:24:48 +00:00
|
|
|
printDirect(&obText, 33, &y, 241, 241 & 1);
|
2011-12-15 00:09:17 +00:00
|
|
|
data.word(kCharshift) = 0;
|
2011-12-15 10:24:48 +00:00
|
|
|
y = 104;
|
2011-12-15 00:09:17 +00:00
|
|
|
if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1)
|
|
|
|
y = 94;
|
2011-12-15 10:24:48 +00:00
|
|
|
printDirect(&obText, 36, &y, 241, 241 & 1);
|
2011-12-15 00:09:17 +00:00
|
|
|
obsThatDoThings();
|
|
|
|
|
|
|
|
// Additional text
|
|
|
|
if (compare(data.byte(kCommand), data.byte(kObjecttype), "CUPE")) {
|
|
|
|
// Empty cup
|
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(40 * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
|
|
|
|
printDirect(string, 36, y + 10, 241, 241 & 1);
|
|
|
|
} else if (compare(data.byte(kCommand), data.byte(kObjecttype), "CUPF")) {
|
|
|
|
// Full cup
|
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(39 * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
|
|
|
|
printDirect(string, 36, y + 10, 241, 241 & 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-06 13:58:20 +00:00
|
|
|
void DreamGenContext::delEverything() {
|
2011-12-06 15:13:51 +00:00
|
|
|
if (data.byte(kMapysize) + data.word(kMapoffsety) < 182) {
|
2011-12-06 13:58:20 +00:00
|
|
|
mapToPanel();
|
|
|
|
} else {
|
|
|
|
// Big room
|
|
|
|
data.byte(kMapysize) -= 8;
|
|
|
|
mapToPanel();
|
|
|
|
data.byte(kMapysize) += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::errorMessage1() {
|
|
|
|
delPointer();
|
|
|
|
printMessage(76, 21, 58, 240, (240 & 1));
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 13:58:20 +00:00
|
|
|
delPointer();
|
|
|
|
hangOnP(50);
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
examIcon();
|
|
|
|
readMouse();
|
|
|
|
useOpened();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 13:58:20 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::errorMessage2() {
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
delPointer();
|
|
|
|
printMessage(76, 21, 59, 240, (240 & 1));
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 13:58:20 +00:00
|
|
|
delPointer();
|
|
|
|
hangOnP(50);
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
examIcon();
|
|
|
|
readMouse();
|
|
|
|
useOpened();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 13:58:20 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::errorMessage3() {
|
|
|
|
delPointer();
|
|
|
|
printMessage(76, 21, 60, 240, (240 & 1));
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(50);
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
examIcon();
|
|
|
|
readMouse();
|
|
|
|
useOpened();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 13:58:20 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
2011-12-06 14:46:26 +00:00
|
|
|
void DreamGenContext::reExFromOpen() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::nextDest() {
|
|
|
|
if (data.byte(kCommandtype) != 218) {
|
|
|
|
data.byte(kCommandtype) = 218;
|
|
|
|
commandOnly(28);
|
|
|
|
}
|
|
|
|
|
2011-12-06 15:42:50 +00:00
|
|
|
if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
|
2011-12-06 14:46:26 +00:00
|
|
|
return; // nodu
|
|
|
|
|
|
|
|
do {
|
|
|
|
data.byte(kDestpos)++;
|
|
|
|
if (data.byte(kDestpos) == 15)
|
|
|
|
data.byte(kDestpos) = 0; // last destination
|
|
|
|
|
|
|
|
getDestInfo();
|
2011-12-08 09:02:51 +00:00
|
|
|
} while (al == 0);
|
2011-12-06 14:46:26 +00:00
|
|
|
|
|
|
|
data.byte(kNewtextline) = 1;
|
|
|
|
delTextLine();
|
|
|
|
delPointer();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 14:46:26 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::lastDest() {
|
|
|
|
if (data.byte(kCommandtype) != 219) {
|
|
|
|
data.byte(kCommandtype) = 219;
|
|
|
|
commandOnly(29);
|
|
|
|
}
|
|
|
|
|
2011-12-06 15:42:50 +00:00
|
|
|
if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
|
2011-12-06 14:46:26 +00:00
|
|
|
return; // nodd
|
|
|
|
|
|
|
|
do {
|
|
|
|
data.byte(kDestpos)--;
|
|
|
|
if (data.byte(kDestpos) == 0xFF)
|
|
|
|
data.byte(kDestpos) = 15; // first destination
|
|
|
|
|
|
|
|
getDestInfo();
|
2011-12-08 09:02:51 +00:00
|
|
|
} while (al == 0);
|
2011-12-06 14:46:26 +00:00
|
|
|
|
|
|
|
data.byte(kNewtextline) = 1;
|
|
|
|
delTextLine();
|
|
|
|
delPointer();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 14:46:26 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::destSelect() {
|
|
|
|
if (data.byte(kCommandtype) != 222) {
|
|
|
|
data.byte(kCommandtype) = 222;
|
|
|
|
commandOnly(30);
|
|
|
|
}
|
|
|
|
|
2011-12-06 15:42:50 +00:00
|
|
|
if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
|
2011-12-06 14:46:26 +00:00
|
|
|
return; // notrav
|
|
|
|
|
|
|
|
getDestInfo();
|
|
|
|
data.byte(kNewlocation) = data.byte(kDestpos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::putBackObStuff() {
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
obIcons();
|
|
|
|
showExit();
|
|
|
|
obPicture();
|
|
|
|
describeOb();
|
|
|
|
underTextLine();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 14:46:26 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
2011-12-06 22:31:00 +00:00
|
|
|
void DreamGenContext::redes() {
|
|
|
|
if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) {
|
|
|
|
blank();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 217) {
|
|
|
|
data.byte(kCommandtype) = 217;
|
|
|
|
commandOnly(50);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(data.word(kMousebutton) & 1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showExit();
|
|
|
|
convIcons();
|
|
|
|
startTalk();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-06 22:31:00 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::moreTalk() {
|
|
|
|
if (data.byte(kTalkmode) != 0) {
|
|
|
|
redes();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 215) {
|
|
|
|
data.byte(kCommandtype) = 215;
|
|
|
|
commandOnly(49);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) == data.word(kOldbutton))
|
|
|
|
return; // nomore
|
|
|
|
|
|
|
|
if (!(data.word(kMousebutton) & 1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
data.byte(kTalkmode) = 2;
|
|
|
|
data.byte(kTalkpos) = 4;
|
|
|
|
|
2011-12-06 22:39:12 +00:00
|
|
|
if (data.byte(kCharacter) >= 100)
|
|
|
|
data.byte(kTalkpos) = 48; // second part
|
|
|
|
doSomeTalk();
|
2011-12-06 22:31:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-06 23:42:35 +00:00
|
|
|
bool DreamGenContext::isSetObOnMap(uint8 index) {
|
|
|
|
return (getSetAd(index)->mapad[0] == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::isSetObOnMap() {
|
|
|
|
flags._z = isSetObOnMap(al);
|
|
|
|
}
|
|
|
|
|
2011-12-07 07:25:14 +00:00
|
|
|
void DreamGenContext::dumpZoom() {
|
|
|
|
if (data.byte(kZoomon) == 1)
|
|
|
|
multiDump(kZoomx + 5, kZoomy + 4, 46, 40);
|
|
|
|
}
|
|
|
|
|
2011-12-07 18:36:18 +00:00
|
|
|
void DreamGenContext::selectLocation() {
|
|
|
|
data.byte(kInmaparea) = 0;
|
|
|
|
clearBeforeLoad();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
data.byte(kPointerframe) = 22;
|
|
|
|
readCityPic();
|
|
|
|
showCity();
|
|
|
|
getRidOfTemp();
|
|
|
|
readDestIcon();
|
|
|
|
loadTravelText();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
showExit();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
readMouse();
|
|
|
|
data.byte(kPointerframe) = 0;
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-07 18:36:18 +00:00
|
|
|
playChannel0(9, 255);
|
|
|
|
data.byte(kNewlocation) = 255;
|
|
|
|
|
|
|
|
while (data.byte(kNewlocation) == 255) {
|
|
|
|
if (quitRequested())
|
|
|
|
break;
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
|
|
|
|
if (data.byte(kGetback) == 1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
RectWithCallback destList[] = {
|
|
|
|
{ 238,258,4,44,&DreamGenContext::nextDest },
|
|
|
|
{ 104,124,4,44,&DreamGenContext::lastDest },
|
|
|
|
{ 280,308,4,44,&DreamGenContext::lookAtPlace },
|
|
|
|
{ 104,216,138,192,&DreamGenContext::destSelect },
|
|
|
|
{ 273,320,157,198,&DreamGenContext::getBack1 },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-07 18:36:18 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
checkCoords(destList);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) {
|
|
|
|
data.byte(kNewlocation) = data.byte(kReallocation);
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
getRidOfTemp();
|
|
|
|
getRidOfTemp2();
|
|
|
|
getRidOfTemp3();
|
|
|
|
deallocateMem(data.word(kTraveltext));
|
|
|
|
}
|
|
|
|
|
2011-12-07 22:57:14 +00:00
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::examineInventory() {
|
2011-12-07 22:57:14 +00:00
|
|
|
if (data.byte(kCommandtype) != 249) {
|
|
|
|
data.byte(kCommandtype) = 249;
|
|
|
|
commandOnly(32);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(data.word(kMousebutton) & 1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showExit();
|
|
|
|
examIcon();
|
|
|
|
data.byte(kPickup) = 0;
|
|
|
|
data.byte(kInvopen) = 2;
|
|
|
|
openInv();
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
|
2011-12-08 09:14:37 +00:00
|
|
|
void DreamBase::showArrows() {
|
2011-12-08 08:52:15 +00:00
|
|
|
showFrame(tempGraphics(), 116 - 12, 16, 0, 0);
|
|
|
|
showFrame(tempGraphics(), 226 + 12, 16, 1, 0);
|
|
|
|
showFrame(tempGraphics(), 280, 14, 2, 0);
|
|
|
|
}
|
|
|
|
|
2011-12-08 09:59:48 +00:00
|
|
|
void DreamBase::showOpBox() {
|
|
|
|
showFrame(tempGraphics(), kOpsx, kOpsy, 0, 0);
|
2011-12-11 21:27:05 +00:00
|
|
|
|
|
|
|
// CHECKME: There seem to be versions of dreamweb in which this call
|
|
|
|
// should be removed. It displays a red dot on the ops dialogs if left in.
|
2011-12-08 09:59:48 +00:00
|
|
|
showFrame(tempGraphics(), kOpsx, kOpsy + 55, 4, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::showLoadOps() {
|
|
|
|
showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
|
|
|
showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
|
|
|
printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::showSaveOps() {
|
|
|
|
showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
2011-12-09 10:12:38 +00:00
|
|
|
showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
2011-12-08 09:59:48 +00:00
|
|
|
printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1));
|
|
|
|
}
|
|
|
|
|
2011-12-08 10:10:43 +00:00
|
|
|
void DreamBase::middlePanel() {
|
|
|
|
Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
|
|
|
|
showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0);
|
|
|
|
showFrame(tempSprites, 72 + 19, 21, 47, 0);
|
|
|
|
showFrame(tempSprites, 160 + 23, 0, 48, 4);
|
|
|
|
showFrame(tempSprites, 160 + 71, 21, 47, 4);
|
|
|
|
}
|
|
|
|
|
2011-12-08 10:33:57 +00:00
|
|
|
void DreamBase::showDiary() {
|
|
|
|
showFrame(tempGraphics(), kDiaryx, kDiaryy + 37, 1, 0);
|
|
|
|
showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0);
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::underTextLine() {
|
2011-12-08 20:48:00 +00:00
|
|
|
uint16 y = data.word(kTextaddressy);
|
|
|
|
if (data.byte(kForeignrelease))
|
|
|
|
y -= 3;
|
2011-12-15 12:41:30 +00:00
|
|
|
multiGet(textUnder(), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey);
|
2011-12-08 20:48:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::showDecisions() {
|
|
|
|
createPanel2();
|
|
|
|
showOpBox();
|
|
|
|
showFrame(tempGraphics(), kOpsx + 17, kOpsy + 13, 6, 0);
|
|
|
|
underTextLine();
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::getUnderZoom() {
|
|
|
|
multiGet(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40);
|
2011-12-08 20:48:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::putUnderZoom() {
|
|
|
|
multiPut(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40);
|
2011-12-08 20:48:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 09:22:45 +00:00
|
|
|
void DreamGenContext::showWatchReel() {
|
|
|
|
uint16 reelPointer = data.word(kReeltowatch);
|
|
|
|
plotReel(reelPointer);
|
|
|
|
data.word(kReeltowatch) = reelPointer;
|
|
|
|
|
|
|
|
// check for shake
|
|
|
|
if (data.byte(kReallocation) == 26 && reelPointer == 104)
|
|
|
|
data.byte(kShakecounter) = 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::watchReel() {
|
|
|
|
if (data.word(kReeltowatch) != 0xFFFF) {
|
|
|
|
if (data.byte(kManspath) != data.byte(kFinaldest))
|
|
|
|
return; // Wait until stopped walking
|
|
|
|
if (data.byte(kTurntoface) != data.byte(kFacing))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (--data.byte(kSpeedcount) != 0xFF) {
|
|
|
|
showWatchReel();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.byte(kSpeedcount) = data.byte(kWatchspeed);
|
|
|
|
if (data.word(kReeltowatch) != data.word(kEndwatchreel)) {
|
|
|
|
++data.word(kReeltowatch);
|
|
|
|
showWatchReel();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data.word(kWatchingtime)) {
|
|
|
|
showWatchReel();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.word(kReeltowatch) = 0xFFFF;
|
|
|
|
data.byte(kWatchmode) = 0xFF;
|
|
|
|
if (data.word(kReeltohold) == 0xFFFF)
|
|
|
|
return; // No more reel
|
|
|
|
data.byte(kWatchmode) = 1;
|
|
|
|
} else if (data.byte(kWatchmode) != 1) {
|
|
|
|
if (data.byte(kWatchmode) != 2)
|
|
|
|
return; // "notreleasehold"
|
|
|
|
if (--data.byte(kSpeedcount) == 0xFF) {
|
|
|
|
data.byte(kSpeedcount) = data.byte(kWatchspeed);
|
|
|
|
++data.word(kReeltohold);
|
|
|
|
}
|
|
|
|
if (data.word(kReeltohold) == data.word(kEndofholdreel)) {
|
2011-12-08 18:47:55 +00:00
|
|
|
data.word(kReeltohold) = 0xFFFF;
|
|
|
|
data.byte(kWatchmode) = 0xFF;
|
2011-12-08 09:22:45 +00:00
|
|
|
data.byte(kDestination) = data.byte(kDestafterhold);
|
|
|
|
data.byte(kFinaldest) = data.byte(kDestafterhold);
|
|
|
|
autoSetWalk();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16 reelPointer = data.word(kReeltohold);
|
|
|
|
plotReel(reelPointer);
|
|
|
|
}
|
|
|
|
|
2011-12-08 19:54:58 +00:00
|
|
|
void DreamGenContext::afterNewRoom() {
|
|
|
|
if (data.byte(kNowinnewroom) == 0)
|
|
|
|
return; // notnew
|
|
|
|
|
|
|
|
data.word(kTimecount) = 0;
|
|
|
|
createPanel();
|
|
|
|
data.byte(kCommandtype) = 0;
|
|
|
|
findRoomInLoc();
|
|
|
|
if (data.byte(kRyanon) != 1) {
|
|
|
|
al = data.byte(kRyanx) + 12;
|
|
|
|
ah = data.byte(kRyany) + 12;
|
|
|
|
findPathOfPoint();
|
|
|
|
data.byte(kManspath) = dl;
|
|
|
|
findXYFromPath();
|
|
|
|
data.byte(kResetmanxy) = 1;
|
|
|
|
}
|
|
|
|
data.byte(kNewobs) = 1;
|
|
|
|
drawFloor();
|
|
|
|
data.word(kLookcounter) = 160;
|
|
|
|
data.byte(kNowinnewroom) = 0;
|
|
|
|
showIcon();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
|
|
|
underTextLine();
|
|
|
|
reelsOnScreen();
|
|
|
|
mainScreen();
|
|
|
|
getUnderZoom();
|
|
|
|
zoom();
|
|
|
|
workToScreenM();
|
|
|
|
walkIntoRoom();
|
|
|
|
reminders();
|
|
|
|
atmospheres();
|
|
|
|
}
|
|
|
|
|
2011-12-08 20:05:32 +00:00
|
|
|
void DreamGenContext::madmanRun() {
|
|
|
|
if (data.byte(kLocation) != 14 ||
|
|
|
|
data.byte(kMapx) != 22 ||
|
|
|
|
data.byte(kPointermode) != 2 ||
|
|
|
|
data.byte(kMadmanflag) != 0) {
|
|
|
|
identifyOb();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 211) {
|
|
|
|
data.byte(kCommandtype) = 211;
|
|
|
|
commandOnly(52);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) == 1 &&
|
|
|
|
data.word(kMousebutton) != data.word(kOldbutton))
|
|
|
|
data.byte(kLastweapon) = 8;
|
|
|
|
}
|
|
|
|
|
2011-12-08 21:05:31 +00:00
|
|
|
|
|
|
|
void DreamGenContext::decide() {
|
|
|
|
setMode();
|
|
|
|
loadPalFromIFF();
|
|
|
|
clearPalette();
|
|
|
|
data.byte(kPointermode) = 0;
|
|
|
|
data.word(kWatchingtime) = 0;
|
|
|
|
data.byte(kPointerframe) = 0;
|
|
|
|
data.word(kTextaddressx) = 70;
|
|
|
|
data.word(kTextaddressy) = 182 - 8;
|
|
|
|
data.byte(kTextlen) = 181;
|
|
|
|
data.byte(kManisoffscreen) = 1;
|
|
|
|
loadSaveBox();
|
|
|
|
showDecisions();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-08 21:05:31 +00:00
|
|
|
fadeScreenUp();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
|
2011-12-08 21:35:41 +00:00
|
|
|
RectWithCallback decideList[] = {
|
|
|
|
{ kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn },
|
2011-12-08 21:35:41 +00:00
|
|
|
{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-08 21:35:41 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
|
2011-12-08 21:05:31 +00:00
|
|
|
do {
|
|
|
|
if (data.byte(kQuitrequested) != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
delPointer();
|
2011-12-08 21:35:41 +00:00
|
|
|
checkCoords(decideList);
|
2011-12-08 21:05:31 +00:00
|
|
|
} while (!data.byte(kGetback));
|
|
|
|
|
|
|
|
if (data.byte(kGetback) != 4)
|
|
|
|
getRidOfTemp(); // room not loaded
|
|
|
|
|
|
|
|
data.word(kTextaddressx) = 13;
|
|
|
|
data.word(kTextaddressy) = 182;
|
|
|
|
data.byte(kTextlen) = 240;
|
|
|
|
}
|
|
|
|
|
2011-12-08 22:09:38 +00:00
|
|
|
void DreamGenContext::talk() {
|
|
|
|
data.byte(kTalkpos) = 0;
|
|
|
|
data.byte(kInmaparea) = 0;
|
|
|
|
data.byte(kCharacter) = data.byte(kCommand);
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showExit();
|
|
|
|
underTextLine();
|
|
|
|
convIcons();
|
|
|
|
startTalk();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-08 22:09:38 +00:00
|
|
|
|
|
|
|
RectWithCallback talkList[] = {
|
|
|
|
{ 273,320,157,198,&DreamGenContext::getBack1 },
|
|
|
|
{ 240,290,2,44,&DreamGenContext::moreTalk },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-08 22:09:38 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
do {
|
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
animPointer();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
checkCoords(talkList);
|
|
|
|
if (data.byte(kQuitrequested))
|
|
|
|
break;
|
|
|
|
} while (!data.byte(kGetback));
|
|
|
|
|
|
|
|
bx = data.word(kPersondata);
|
|
|
|
es = cs;
|
|
|
|
|
|
|
|
if (data.byte(kTalkpos) >= 4)
|
|
|
|
es.byte(bx+7) |= 128;
|
|
|
|
|
|
|
|
redrawMainScrn();
|
|
|
|
workToScreenM();
|
|
|
|
if (data.byte(kSpeechloaded) == 1) {
|
|
|
|
cancelCh1();
|
2011-12-12 20:46:28 +00:00
|
|
|
data.byte(kVolumedirection) = (byte)-1;
|
2011-12-08 22:09:38 +00:00
|
|
|
data.byte(kVolumeto) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-08 22:28:25 +00:00
|
|
|
|
|
|
|
void DreamGenContext::discOps() {
|
|
|
|
if (data.byte(kCommandtype) != 249) {
|
|
|
|
data.byte(kCommandtype) = 249;
|
|
|
|
commandOnly(43);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
scanForNames();
|
|
|
|
data.byte(kLoadingorsave) = 2;
|
|
|
|
showOpBox();
|
|
|
|
showDiscOps();
|
|
|
|
data.byte(kCurrentslot) = 0;
|
|
|
|
workToScreenM();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
|
|
|
|
RectWithCallback discOpsList[] = {
|
|
|
|
{ kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame },
|
|
|
|
{ kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame },
|
|
|
|
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-08 22:28:25 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (data.byte(kQuitrequested) != 0)
|
|
|
|
return; // quitdiscops
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
checkCoords(discOpsList);
|
|
|
|
} while (!data.byte(kGetback));
|
|
|
|
}
|
|
|
|
|
2011-12-08 23:53:20 +00:00
|
|
|
void DreamGenContext::hangOnPQ() {
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
|
|
|
|
RectWithCallback quitList[] = {
|
|
|
|
{ 273,320,157,198,&DreamGenContext::getBack1 },
|
2011-12-15 12:41:30 +00:00
|
|
|
{ 0,320,0,200,&DreamBase::blank },
|
2011-12-08 23:53:20 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
uint16 speechFlag = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
animPointer();
|
|
|
|
showPointer();
|
|
|
|
vSync();
|
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
checkCoords(quitList);
|
|
|
|
|
2011-12-09 07:04:17 +00:00
|
|
|
if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) {
|
2011-12-08 23:53:20 +00:00
|
|
|
// Quit conversation
|
|
|
|
delPointer();
|
|
|
|
data.byte(kPointermode) = 0;
|
|
|
|
cancelCh1();
|
|
|
|
flags._c = true;
|
2011-12-09 07:04:17 +00:00
|
|
|
return;
|
2011-12-08 23:53:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) {
|
|
|
|
speechFlag++;
|
|
|
|
if (speechFlag == 40)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (!data.word(kMousebutton) || data.word(kOldbutton));
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
data.byte(kPointermode) = 0;
|
|
|
|
flags._c = false;
|
|
|
|
}
|
|
|
|
|
2011-12-09 08:14:08 +00:00
|
|
|
void DreamGenContext::endGame() {
|
|
|
|
loadTempText("DREAMWEB.T83");
|
|
|
|
monkSpeaking();
|
|
|
|
gettingShot();
|
|
|
|
getRidOfTempText();
|
|
|
|
data.byte(kVolumeto) = 7;
|
|
|
|
data.byte(kVolumedirection) = 1;
|
|
|
|
hangOn(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::showGun() {
|
|
|
|
data.byte(kAddtored) = 0;
|
|
|
|
data.byte(kAddtogreen) = 0;
|
|
|
|
data.byte(kAddtoblue) = 0;
|
|
|
|
palToStartPal();
|
|
|
|
palToEndPal();
|
|
|
|
greyscaleSum();
|
|
|
|
data.byte(kFadedirection) = 1;
|
|
|
|
data.byte(kFadecount) = 63;
|
|
|
|
data.byte(kColourpos) = 0;
|
|
|
|
data.byte(kNumtofade) = 128;
|
|
|
|
hangOn(130);
|
|
|
|
endPalToStart();
|
|
|
|
clearEndPal();
|
|
|
|
data.byte(kFadedirection) = 1;
|
|
|
|
data.byte(kFadecount) = 63;
|
|
|
|
data.byte(kColourpos) = 0;
|
|
|
|
data.byte(kNumtofade) = 128;
|
|
|
|
hangOn(200);
|
|
|
|
data.byte(kRoomssample) = 34;
|
|
|
|
loadRoomsSample();
|
|
|
|
data.byte(kVolume) = 0;
|
|
|
|
loadIntoTemp("DREAMWEB.G13");
|
|
|
|
createPanel2();
|
|
|
|
showFrame(tempGraphics(), 100, 4, 0, 0);
|
|
|
|
showFrame(tempGraphics(), 158, 106, 1, 0);
|
2011-12-09 16:18:32 +00:00
|
|
|
workToScreenCPP();
|
2011-12-09 08:14:08 +00:00
|
|
|
getRidOfTemp();
|
|
|
|
fadeScreenUp();
|
|
|
|
hangOn(160);
|
|
|
|
playChannel0(12, 0);
|
|
|
|
loadTempText("DREAMWEB.T83");
|
|
|
|
rollEndCredits2();
|
|
|
|
getRidOfTempText();
|
|
|
|
}
|
|
|
|
|
2011-12-09 16:55:02 +00:00
|
|
|
void DreamGenContext::diaryKeyP() {
|
|
|
|
if (data.byte(kCommandtype) != 214) {
|
|
|
|
data.byte(kCommandtype) = 214;
|
|
|
|
commandOnly(23);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data.word(kMousebutton) ||
|
|
|
|
data.word(kOldbutton) == data.word(kMousebutton) ||
|
|
|
|
data.byte(kPresscount))
|
|
|
|
return; // notkeyp
|
|
|
|
|
|
|
|
playChannel1(16);
|
|
|
|
data.byte(kPresscount) = 12;
|
|
|
|
data.byte(kPressed) = 'P';
|
|
|
|
data.byte(kDiarypage)--;
|
|
|
|
|
|
|
|
if (data.byte(kDiarypage) == 0xFF)
|
|
|
|
data.byte(kDiarypage) = 11;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::diaryKeyN() {
|
|
|
|
if (data.byte(kCommandtype) != 213) {
|
|
|
|
data.byte(kCommandtype) = 213;
|
|
|
|
commandOnly(23);
|
|
|
|
}
|
|
|
|
|
2011-12-10 17:19:46 +00:00
|
|
|
if (!data.word(kMousebutton) ||
|
|
|
|
data.word(kOldbutton) == data.word(kMousebutton) ||
|
|
|
|
data.byte(kPresscount))
|
|
|
|
return; // notkeyn
|
|
|
|
|
2011-12-09 16:55:02 +00:00
|
|
|
playChannel1(16);
|
|
|
|
data.byte(kPresscount) = 12;
|
|
|
|
data.byte(kPressed) = 'N';
|
|
|
|
data.byte(kDiarypage)++;
|
|
|
|
|
|
|
|
if (data.byte(kDiarypage) == 12)
|
|
|
|
data.byte(kDiarypage) = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-11 18:54:00 +00:00
|
|
|
void DreamGenContext::dropError() {
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
delPointer();
|
|
|
|
printMessage(76, 21, 56, 240, 240 & 1);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(50);
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
examIcon();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::cantDrop() {
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
delPointer();
|
|
|
|
printMessage(76, 21, 24, 240, 240 & 1);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(50);
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
examIcon();
|
|
|
|
data.byte(kCommandtype) = 255;
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::getBack1() {
|
2011-12-11 19:21:20 +00:00
|
|
|
if (data.byte(kPickup) != 0) {
|
|
|
|
blank();
|
2011-12-11 21:27:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.byte(kCommandtype) != 202) {
|
2011-12-11 19:21:20 +00:00
|
|
|
data.byte(kCommandtype) = 202;
|
|
|
|
commandOnly(26);
|
2011-12-11 21:27:05 +00:00
|
|
|
}
|
2011-12-11 19:21:20 +00:00
|
|
|
|
2011-12-11 21:27:05 +00:00
|
|
|
if (data.word(kMousebutton) == data.word(kOldbutton))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) & 1) {
|
|
|
|
// Get back
|
|
|
|
data.byte(kGetback) = 1;
|
|
|
|
data.byte(kPickup) = 0;
|
2011-12-11 19:21:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::newPlace() {
|
|
|
|
if (data.byte(kNeedtotravel) == 1) {
|
|
|
|
data.byte(kNeedtotravel) = 0;
|
|
|
|
selectLocation();
|
|
|
|
} else if (data.byte(kAutolocation) != 0xFF) {
|
|
|
|
data.byte(kNewlocation) = data.byte(kAutolocation);
|
|
|
|
data.byte(kAutolocation) = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-12 00:46:15 +00:00
|
|
|
void DreamGenContext::showPuzText() {
|
|
|
|
showPuzText(al, cx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::showPuzText(uint16 command, uint16 count) {
|
|
|
|
createPanel();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showExit();
|
|
|
|
obIcons();
|
|
|
|
uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
|
2011-12-12 08:07:55 +00:00
|
|
|
printDirect(string, 36, 104, 241, 241 & 1);
|
2011-12-12 00:46:15 +00:00
|
|
|
workToScreenM();
|
|
|
|
hangOnP(count);
|
|
|
|
}
|
|
|
|
|
2011-12-12 02:18:17 +00:00
|
|
|
void DreamGenContext::monkSpeaking() {
|
2011-12-12 08:07:55 +00:00
|
|
|
// FIXME: This is the CD version only.
|
|
|
|
|
2011-12-12 02:18:17 +00:00
|
|
|
data.byte(kRoomssample) = 35;
|
|
|
|
loadRoomsSample();
|
|
|
|
loadIntoTemp("DREAMWEB.G15");
|
|
|
|
clearWork();
|
|
|
|
showFrame(tempGraphics(), 160, 72, 0, 128); // show monk
|
|
|
|
workToScreen();
|
|
|
|
data.byte(kVolume) = 7;
|
2011-12-12 20:46:28 +00:00
|
|
|
data.byte(kVolumedirection) = (byte)-1;
|
2011-12-12 02:18:17 +00:00
|
|
|
data.byte(kVolumeto) = 5;
|
|
|
|
playChannel0(12, 255);
|
|
|
|
fadeScreenUps();
|
|
|
|
hangOn(300);
|
|
|
|
|
2011-12-12 02:22:49 +00:00
|
|
|
for (int i = 40; i <= 48; i++) {
|
2011-12-12 11:39:06 +00:00
|
|
|
loadSpeech('T', 83, 'T', i);
|
2011-12-12 02:18:17 +00:00
|
|
|
|
|
|
|
playChannel1(50 + 12);
|
|
|
|
|
|
|
|
do {
|
|
|
|
engine->waitForVSync();
|
|
|
|
} while (data.byte(kCh1playing) != 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
data.byte(kVolumedirection) = 1;
|
|
|
|
data.byte(kVolumeto) = 7;
|
|
|
|
fadeScreenDowns();
|
|
|
|
hangOn(300);
|
|
|
|
getRidOfTemp();
|
|
|
|
}
|
|
|
|
|
2011-12-12 14:55:32 +00:00
|
|
|
void DreamGenContext::useButtonA() {
|
|
|
|
if (!isSetObOnMap(95)) {
|
|
|
|
showFirstUse();
|
|
|
|
turnAnyPathOn(0, data.byte(kRoomnum) - 1);
|
|
|
|
removeSetObject(9);
|
|
|
|
placeSetObject(95);
|
|
|
|
data.word(kWatchingtime) = 15 * 2;
|
|
|
|
data.word(kReeltowatch) = 71;
|
|
|
|
data.word(kEndwatchreel) = 85;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
data.byte(kGetback) = 1;
|
|
|
|
data.byte(kProgresspoints)++;
|
|
|
|
} else {
|
|
|
|
// Done this bit
|
|
|
|
showSecondUse();
|
|
|
|
putBackObStuff();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-12 15:49:34 +00:00
|
|
|
void DreamGenContext::autoAppear() {
|
|
|
|
if (data.byte(kLocation) == 32) {
|
|
|
|
// In alley
|
|
|
|
al = 5;
|
|
|
|
resetLocation();
|
2011-12-15 12:41:30 +00:00
|
|
|
setLocation(10);
|
2011-12-12 15:49:34 +00:00
|
|
|
data.byte(kDestpos) = 10;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.byte(kReallocation) == 24) {
|
|
|
|
// In Eden's apartment
|
|
|
|
if (data.byte(kGeneraldead) == 1) {
|
|
|
|
data.byte(kGeneraldead)++;
|
|
|
|
placeSetObject(44);
|
|
|
|
placeSetObject(18);
|
|
|
|
placeSetObject(93);
|
|
|
|
removeSetObject(92);
|
|
|
|
removeSetObject(55);
|
|
|
|
removeSetObject(75);
|
|
|
|
removeSetObject(84);
|
|
|
|
removeSetObject(85);
|
|
|
|
} else if (data.byte(kSartaindead) == 1) {
|
|
|
|
// Eden's part 2
|
|
|
|
removeSetObject(44);
|
|
|
|
removeSetObject(93);
|
|
|
|
placeSetObject(55);
|
|
|
|
data.byte(kSartaindead)++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Not in Eden's
|
|
|
|
if (data.byte(kReallocation) == 25) {
|
|
|
|
// Sart roof
|
|
|
|
data.byte(kNewsitem) = 3;
|
|
|
|
al = 6;
|
|
|
|
resetLocation();
|
2011-12-15 12:41:30 +00:00
|
|
|
setLocation(11);
|
2011-12-12 15:49:34 +00:00
|
|
|
data.byte(kDestpos) = 11;
|
|
|
|
} else {
|
|
|
|
if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0)
|
|
|
|
placeSetObject(23);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-15 12:41:30 +00:00
|
|
|
void DreamBase::quitKey() {
|
2011-12-12 17:16:56 +00:00
|
|
|
if (data.byte(kCommandtype) != 222) {
|
|
|
|
data.byte(kCommandtype) = 222;
|
|
|
|
commandOnly(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1))
|
|
|
|
data.byte(kGetback) = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-12 18:00:45 +00:00
|
|
|
void DreamGenContext::setupTimedUse() {
|
|
|
|
DreamBase::setupTimedUse(al, cx, dx, bl, bh);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) {
|
|
|
|
if (data.word(kTimecount) != 0)
|
|
|
|
return; // can't setup
|
|
|
|
|
|
|
|
data.byte(kTimedy) = y;
|
|
|
|
data.byte(kTimedx) = x;
|
|
|
|
data.word(kCounttotimed) = countToTimed;
|
|
|
|
data.word(kTimecount) = timeCount + countToTimed;
|
|
|
|
data.word(kTimedseg) = data.word(kPuzzletext);
|
|
|
|
data.word(kTimedoffset) = kTextstart + getSegment(data.word(kPuzzletext)).word(textIndex * 2);
|
|
|
|
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(data.word(kTimedoffset), 0);
|
|
|
|
debug(1, "setupTimedUse: %d => '%s'", textIndex, string);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamBase::entryTexts() {
|
|
|
|
switch (data.byte(kLocation)) {
|
|
|
|
case 21:
|
|
|
|
setupTimedUse(28, 60, 11, 68, 64);
|
|
|
|
break;
|
|
|
|
case 30:
|
|
|
|
setupTimedUse(27, 60, 11, 68, 64);
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
setupTimedUse(29, 60, 11, 68, 64);
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
setupTimedUse(30, 60, 11, 68, 64);
|
|
|
|
break;
|
2011-12-12 19:51:25 +00:00
|
|
|
case 20: // Sarter's 2
|
2011-12-12 18:00:45 +00:00
|
|
|
setupTimedUse(31, 60, 11, 68, 64);
|
|
|
|
break;
|
2011-12-12 19:51:25 +00:00
|
|
|
case 24: // Eden's lobby
|
2011-12-12 18:00:45 +00:00
|
|
|
setupTimedUse(32, 60, 3, 68, 64);
|
|
|
|
break;
|
2011-12-12 19:51:25 +00:00
|
|
|
case 34: // Eden 2
|
2011-12-12 18:00:45 +00:00
|
|
|
setupTimedUse(33, 60, 3, 68, 64);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-12 19:51:25 +00:00
|
|
|
void DreamGenContext::entryAnims() {
|
|
|
|
data.word(kReeltowatch) = 0xFFFF;
|
|
|
|
data.byte(kWatchmode) = (byte)-1;
|
|
|
|
|
|
|
|
switch (data.byte(kLocation)) {
|
|
|
|
case 33: // beach
|
|
|
|
switchRyanOff();
|
|
|
|
data.word(kWatchingtime) = 76 * 2;
|
|
|
|
data.word(kReeltowatch) = 0;
|
|
|
|
data.word(kEndwatchreel) = 76;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
break;
|
|
|
|
case 44: // Sparky's
|
|
|
|
al = 8;
|
|
|
|
resetLocation();
|
|
|
|
data.word(kWatchingtime) = 50*2;
|
|
|
|
data.word(kReeltowatch) = 247;
|
|
|
|
data.word(kEndwatchreel) = 297;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
break;
|
|
|
|
case 22: // lift
|
|
|
|
data.word(kWatchingtime) = 31 * 2;
|
|
|
|
data.word(kReeltowatch) = 0;
|
|
|
|
data.word(kEndwatchreel) = 30;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
break;
|
|
|
|
case 26: // under church
|
|
|
|
data.byte(kSymboltopnum) = 2;
|
|
|
|
data.byte(kSymbolbotnum) = 1;
|
|
|
|
break;
|
|
|
|
case 45: // entered Dreamweb
|
|
|
|
data.byte(kKeeperflag) = 0;
|
|
|
|
data.word(kWatchingtime) = 296;
|
|
|
|
data.word(kReeltowatch) = 45;
|
|
|
|
data.word(kEndwatchreel) = 198;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (data.byte(kReallocation) == 46 && data.byte(kSartaindead) == 1) { // Crystal
|
|
|
|
removeFreeObject(0);
|
2011-12-12 20:43:56 +00:00
|
|
|
} else if (data.byte(kLocation) == 9 && !checkIfPathIsOn(2) && data.byte(kAidedead) != 0) {
|
2011-12-12 19:51:25 +00:00
|
|
|
// Top of church
|
|
|
|
if (checkIfPathIsOn(3))
|
|
|
|
turnPathOn(2);
|
|
|
|
|
|
|
|
// Make doors open
|
|
|
|
removeSetObject(4);
|
|
|
|
placeSetObject(5);
|
|
|
|
} else if (data.byte(kLocation) == 47) { // Dream centre
|
|
|
|
placeSetObject(4);
|
|
|
|
placeSetObject(5);
|
|
|
|
} else if (data.byte(kLocation) == 38) { // Car park
|
|
|
|
data.word(kWatchingtime) = 57 * 2;
|
|
|
|
data.word(kReeltowatch) = 4;
|
|
|
|
data.word(kEndwatchreel) = 57;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
} else if (data.byte(kLocation) == 32) { // Alley
|
|
|
|
data.word(kWatchingtime) = 66 * 2;
|
|
|
|
data.word(kReeltowatch) = 0;
|
|
|
|
data.word(kEndwatchreel) = 66;
|
|
|
|
data.byte(kWatchspeed) = 1;
|
|
|
|
data.byte(kSpeedcount) = 1;
|
|
|
|
switchRyanOff();
|
|
|
|
} else if (data.byte(kLocation) == 24) { // Eden's again
|
|
|
|
turnAnyPathOn(2, data.byte(kRoomnum) - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-13 08:21:19 +00:00
|
|
|
void DreamGenContext::updateSymbolTop() {
|
|
|
|
if (!data.byte(kSymboltopdir))
|
|
|
|
return; // topfinished
|
|
|
|
|
|
|
|
if (data.byte(kSymboltopdir) == (byte)-1) {
|
|
|
|
// Backward
|
|
|
|
data.byte(kSymboltopx)--;
|
|
|
|
if (data.byte(kSymboltopx) != (byte)-1) {
|
|
|
|
// Not wrapping
|
|
|
|
if (data.byte(kSymboltopx) != 24)
|
|
|
|
return; // topfinished
|
|
|
|
data.byte(kSymboltopdir) = 0;
|
|
|
|
} else {
|
|
|
|
data.byte(kSymboltopx) = 48;
|
|
|
|
data.byte(kSymboltopnum)++;
|
|
|
|
if (data.byte(kSymboltopnum) != 6)
|
|
|
|
return; // topfinished
|
|
|
|
data.byte(kSymboltopnum) = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Forward
|
|
|
|
data.byte(kSymboltopx)++;
|
|
|
|
if (data.byte(kSymboltopx) != 49) {
|
|
|
|
// Not wrapping
|
|
|
|
if (data.byte(kSymboltopx) != 24)
|
|
|
|
return; // topfinished
|
|
|
|
data.byte(kSymboltopdir) = 0;
|
|
|
|
} else {
|
|
|
|
data.byte(kSymboltopx) = 0;
|
|
|
|
data.byte(kSymboltopnum)--;
|
|
|
|
if (data.byte(kSymboltopnum) != (byte)-1)
|
|
|
|
return; // topfinished
|
|
|
|
data.byte(kSymboltopnum) = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DreamGenContext::updateSymbolBot() {
|
|
|
|
if (!data.byte(kSymbolbotdir))
|
|
|
|
return; // botfinished
|
|
|
|
|
|
|
|
if (data.byte(kSymbolbotdir) == (byte)-1) {
|
|
|
|
// Backward
|
|
|
|
data.byte(kSymbolbotx)--;
|
|
|
|
if (data.byte(kSymbolbotx) != (byte)-1) {
|
|
|
|
// Not wrapping
|
|
|
|
if (data.byte(kSymbolbotx) != 24)
|
|
|
|
return; // botfinished
|
|
|
|
data.byte(kSymbolbotdir) = 0;
|
|
|
|
} else {
|
|
|
|
data.byte(kSymbolbotx) = 48;
|
|
|
|
data.byte(kSymbolbotnum)++;
|
|
|
|
if (data.byte(kSymbolbotnum) != 6)
|
|
|
|
return; // botfinished
|
|
|
|
data.byte(kSymbolbotnum) = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Forward
|
|
|
|
data.byte(kSymbolbotx)++;
|
|
|
|
if (data.byte(kSymbolbotx) != 49) {
|
|
|
|
// Not wrapping
|
|
|
|
if (data.byte(kSymbolbotx) != 24)
|
|
|
|
return; // botfinished
|
|
|
|
data.byte(kSymbolbotdir) = 0;
|
|
|
|
} else {
|
|
|
|
data.byte(kSymbolbotx) = 0;
|
|
|
|
data.byte(kSymbolbotnum)--;
|
|
|
|
if (data.byte(kSymbolbotnum) != (byte)-1)
|
|
|
|
return; // botfinished
|
|
|
|
data.byte(kSymbolbotnum) = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-13 22:47:29 +00:00
|
|
|
void DreamGenContext::showDiaryPage() {
|
|
|
|
showFrame(tempGraphics(), kDiaryx, kDiaryy, 0, 0);
|
|
|
|
data.byte(kKerning) = 1;
|
|
|
|
useTempCharset();
|
|
|
|
data.word(kCharshift) = 91+91;
|
2011-12-14 11:08:20 +00:00
|
|
|
const uint8 *string = getTextInFile1(data.byte(kDiarypage));
|
2011-12-13 22:47:29 +00:00
|
|
|
uint16 y = kDiaryy + 16;
|
|
|
|
printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1);
|
2011-12-14 11:02:59 +00:00
|
|
|
y = kDiaryy + 16;
|
2011-12-13 22:47:29 +00:00
|
|
|
printDirect(&string, kDiaryx + 129, &y, 240, 240 & 1);
|
|
|
|
y = kDiaryy + 23;
|
|
|
|
printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1);
|
|
|
|
data.byte(kKerning) = 0;
|
|
|
|
data.word(kCharshift) = 0;
|
|
|
|
useCharset1();
|
|
|
|
}
|
|
|
|
|
2011-12-13 23:03:57 +00:00
|
|
|
void DreamGenContext::dumpDiaryKeys() {
|
|
|
|
if (data.byte(kPresscount) == 1) {
|
2011-12-14 11:08:20 +00:00
|
|
|
if (data.byte(kSartaindead) != 1 && data.byte(kDiarypage) == 5 && getLocation(6) != 1) {
|
2011-12-13 23:03:57 +00:00
|
|
|
// Add Sartain Industries note
|
2011-12-14 11:08:20 +00:00
|
|
|
setLocation(6);
|
2011-12-13 23:03:57 +00:00
|
|
|
delPointer();
|
2011-12-14 11:08:20 +00:00
|
|
|
const uint8 *string = getTextInFile1(12);
|
|
|
|
printDirect(string, 70, 106, 241, 241 & 1);
|
2011-12-13 23:03:57 +00:00
|
|
|
workToScreenM();
|
|
|
|
hangOnP(200);
|
|
|
|
createPanel();
|
|
|
|
showIcon();
|
|
|
|
showDiary();
|
|
|
|
showDiaryPage();
|
|
|
|
workToScreenM();
|
|
|
|
showPointer();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
multiDump(kDiaryx + 48, kDiaryy + 15, 200, 16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
multiDump(kDiaryx + 94, kDiaryy + 97, 16, 16);
|
|
|
|
multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16);
|
|
|
|
}
|
|
|
|
|
2011-12-14 00:03:57 +00:00
|
|
|
void DreamGenContext::runEndSeq() {
|
|
|
|
atmospheres();
|
|
|
|
data.byte(kGetback) = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
vSync();
|
|
|
|
spriteUpdate();
|
|
|
|
vSync();
|
|
|
|
delEverything();
|
|
|
|
printSprites();
|
|
|
|
reelsOnScreen();
|
|
|
|
afterIntroRoom();
|
|
|
|
useTimedText();
|
|
|
|
vSync();
|
|
|
|
dumpMap();
|
|
|
|
dumpTimedText();
|
|
|
|
vSync();
|
|
|
|
} while (data.byte(kGetback) != 1);
|
|
|
|
}
|
|
|
|
|
2011-12-14 00:17:53 +00:00
|
|
|
void DreamGenContext::lookAtCard() {
|
|
|
|
data.byte(kManisoffscreen) = 1;
|
|
|
|
getRidOfReels();
|
|
|
|
loadKeypad();
|
|
|
|
createPanel2();
|
|
|
|
showFrame(tempGraphics(), 160, 80, 42, 128);
|
2011-12-14 11:17:32 +00:00
|
|
|
const uint8 *obText = getObTextStartCPP();
|
2011-12-14 00:17:53 +00:00
|
|
|
findNextColon(&obText);
|
|
|
|
findNextColon(&obText);
|
|
|
|
findNextColon(&obText);
|
2011-12-14 11:02:59 +00:00
|
|
|
uint16 y = 124;
|
|
|
|
printDirect(&obText, 36, &y, 241, 241 & 1);
|
2011-12-14 00:17:53 +00:00
|
|
|
workToScreenM();
|
|
|
|
hangOnW(280);
|
|
|
|
createPanel2();
|
|
|
|
showFrame(tempGraphics(), 160, 80, 42, 128);
|
|
|
|
printDirect(obText, 36, 130, 241, 241 & 1);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnW(200);
|
|
|
|
data.byte(kManisoffscreen) = 0;
|
|
|
|
getRidOfTemp();
|
|
|
|
restoreReels();
|
|
|
|
putBackObStuff();
|
|
|
|
}
|
|
|
|
|
2011-12-06 16:43:23 +00:00
|
|
|
} // End of namespace DreamGen
|