Initial commit
This commit is contained in:
2322
engines/agi/preagi/mickey.cpp
Normal file
2322
engines/agi/preagi/mickey.cpp
Normal file
File diff suppressed because it is too large
Load Diff
768
engines/agi/preagi/mickey.h
Normal file
768
engines/agi/preagi/mickey.h
Normal file
@@ -0,0 +1,768 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_MICKEY_H
|
||||
#define AGI_PREAGI_MICKEY_H
|
||||
|
||||
namespace Agi {
|
||||
|
||||
#define MSA_SAVEGAME_VERSION 2
|
||||
|
||||
// strings
|
||||
#define IDS_MSA_PATH_DAT "dat/%s"
|
||||
#define IDS_MSA_PATH_OBJ "obj/%s.ooo"
|
||||
#define IDS_MSA_PATH_PIC "%d.pic"
|
||||
#define IDS_MSA_PATH_LOGO "logos.bcg"
|
||||
|
||||
#define IDS_MSA_INVENTORY "MICKEY IS CARRYING THE FOLLOWING:"
|
||||
#define IDS_MSA_CRYSTALS "%s CRYSTALS"
|
||||
|
||||
const char IDS_MSA_CRYSTAL_NO[][3] = {
|
||||
"NO", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9"
|
||||
};
|
||||
const char IDS_MSA_TEMP_C[][5] = {
|
||||
" 20 ", " 480", "-200", " 430", "-185", "-230", "-130", "-150", "-215"
|
||||
};
|
||||
const char IDS_MSA_TEMP_F[][5] = {
|
||||
" 68 ", " 897", "-328", " 807", "-301", "-382", "-202", "-238", "-355"
|
||||
};
|
||||
const char IDS_MSA_PLANETS[][10] = {
|
||||
"EARTH. ", "VENUS. ", "TRITON. ", "MERCURY.", "TITAN. ",
|
||||
"PLUTO. ", "IO. ", "MARS. ", "OBERON. "
|
||||
};
|
||||
|
||||
const char IDS_MSA_ERRORS[][40] = {
|
||||
"THAT CANNOT BE UNDERSTOOD",
|
||||
"TRY GOING THERE INSTEAD",
|
||||
"THAT CAN'T BE DONE",
|
||||
"MICKEY WOULDN'T WANT TO DO THAT!",
|
||||
"WHICH DIRECTION?",
|
||||
"THAT DOESN'T MAKE SENSE!",
|
||||
"MICKEY WOULDN'T WANT TO DO THAT!"
|
||||
};
|
||||
|
||||
// patch Mickey.exe offset 0x21E to value 0x01 to enable debug mode
|
||||
|
||||
const char IDS_MSA_INSERT_DISK[][40] = {
|
||||
"Please insert disk 1 and press any key", "Please insert disk 2 and press any key"
|
||||
};
|
||||
|
||||
// max values
|
||||
|
||||
#define IDI_MSA_MAX_PLANET 9
|
||||
#define IDI_MSA_MAX_DAT 10
|
||||
#define IDI_MSA_MAX_PIC_ROOM 224
|
||||
#define IDI_MSA_MAX_ROOM 160
|
||||
|
||||
#define IDI_MSA_MAX_BUTTON 6
|
||||
#define IDI_MSA_MAX_ITEM 11
|
||||
|
||||
#define IDI_MSA_ANIM_DELAY 25
|
||||
|
||||
#define IDI_MSA_LEN_STORY 1372
|
||||
|
||||
// rows
|
||||
|
||||
#define IDI_MSA_ROW_MENU_0 20
|
||||
#define IDI_MSA_ROW_MENU_1 21
|
||||
#define IDI_MSA_ROW_INV_TITLE 2
|
||||
#define IDI_MSA_ROW_INV_CRYSTALS 4
|
||||
#define IDI_MSA_ROW_INV_ITEMS 5
|
||||
#define IDI_MSA_ROW_TEMPERATURE 21
|
||||
#define IDI_MSA_ROW_PLANET 22
|
||||
#define IDI_MSA_ROW_INSERT_DISK 23
|
||||
|
||||
#define IDI_MSA_COL_INV_TITLE 4
|
||||
#define IDI_MSA_COL_INV_ITEMS 15
|
||||
#define IDI_MSA_COL_PLANET 28
|
||||
#define IDI_MSA_COL_INSERT_DISK 1
|
||||
|
||||
// screen
|
||||
|
||||
#define IDI_MSA_PIC_WIDTH 140
|
||||
#define IDI_MSA_PIC_HEIGHT 159
|
||||
#define IDI_MSA_PIC_X0 10
|
||||
#define IDI_MSA_PIC_Y0 0
|
||||
|
||||
// pictures
|
||||
|
||||
#define IDI_MSA_PIC_EARTH_TIRE_SWING 1
|
||||
#define IDI_MSA_PIC_EARTH_TIRE_SWING_1 200 // rope taken, swing on ground
|
||||
#define IDI_MSA_PIC_EARTH_DOGHOUSE 2
|
||||
#define IDI_MSA_PIC_EARTH_IN_DOGHOUSE 154
|
||||
#define IDI_MSA_PIC_EARTH_TREE 3
|
||||
#define IDI_MSA_PIC_EARTH_GARDEN 4
|
||||
#define IDI_MSA_PIC_EARTH_FRONT_HOUSE 5
|
||||
#define IDI_MSA_PIC_EARTH_HAMMOCK 6
|
||||
#define IDI_MSA_PIC_EARTH_BUTTERFLY 7
|
||||
#define IDI_MSA_PIC_EARTH_MAILBOX 8
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_0 9
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_1 10
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_2 11
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_3 12
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_4 13 // starting room
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_5 14
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_6 15
|
||||
#define IDI_MSA_PIC_EARTH_ROAD_7 18
|
||||
#define IDI_MSA_PIC_EARTH_UNDER_TREE 16
|
||||
#define IDI_MSA_PIC_EARTH_UP_IN_TREE 155 // CRYSTAL
|
||||
#define IDI_MSA_PIC_EARTH_SHIP 17
|
||||
#define IDI_MSA_PIC_EARTH_LIVING_ROOM 19
|
||||
#define IDI_MSA_PIC_EARTH_KITCHEN 20
|
||||
#define IDI_MSA_PIC_EARTH_KITCHEN_1 159 // cupboard open
|
||||
#define IDI_MSA_PIC_EARTH_GARAGE 21
|
||||
#define IDI_MSA_PIC_EARTH_GARAGE_1 160 // cabinet open
|
||||
#define IDI_MSA_PIC_EARTH_BEDROOM 22
|
||||
#define IDI_MSA_PIC_EARTH_BEDROOM_1 161 // closet open
|
||||
#define IDI_MSA_PIC_EARTH_BATHROOM 23 // WEIGH MICKEY
|
||||
#define IDI_MSA_PIC_EARTH_SHIP_LEAVING 24
|
||||
#define IDI_MSA_PIC_EARTH_MINNIE 25
|
||||
|
||||
#define IDI_MSA_PIC_SHIP_AIRLOCK 25
|
||||
#define IDI_MSA_PIC_SHIP_AIRLOCK_0 201 // door closed
|
||||
#define IDI_MSA_PIC_SHIP_AIRLOCK_1 202 // door open
|
||||
#define IDI_MSA_PIC_SHIP_AIRLOCK_2 203 // door closed, spacesuits on
|
||||
#define IDI_MSA_PIC_SHIP_AIRLOCK_3 204 // door open, spacesuits on
|
||||
#define IDI_MSA_PIC_SHIP_BEDROOM 29
|
||||
#define IDI_MSA_PIC_SHIP_CONTROLS 26
|
||||
#define IDI_MSA_PIC_SHIP_CORRIDOR 27
|
||||
#define IDI_MSA_PIC_SHIP_KITCHEN 28
|
||||
#define IDI_MSA_PIC_SHIP_KITCHEN_1 172 // cabinet open
|
||||
|
||||
#define IDI_MSA_PIC_SHIP_VENUS 146
|
||||
#define IDI_MSA_PIC_SHIP_NEPTUNE 147
|
||||
#define IDI_MSA_PIC_SHIP_MERCURY 148
|
||||
#define IDI_MSA_PIC_SHIP_SATURN 149
|
||||
#define IDI_MSA_PIC_SHIP_PLUTO 150
|
||||
#define IDI_MSA_PIC_SHIP_JUPITER 151
|
||||
#define IDI_MSA_PIC_SHIP_MARS 152
|
||||
#define IDI_MSA_PIC_SHIP_URANUS 153
|
||||
|
||||
#define IDI_MSA_PIC_VENUS_0 30
|
||||
#define IDI_MSA_PIC_VENUS_1 31
|
||||
#define IDI_MSA_PIC_VENUS_2 32
|
||||
#define IDI_MSA_PIC_VENUS_3 34
|
||||
#define IDI_MSA_PIC_VENUS_4 36
|
||||
#define IDI_MSA_PIC_VENUS_5 38
|
||||
#define IDI_MSA_PIC_VENUS_CHASM 35
|
||||
#define IDI_MSA_PIC_VENUS_CHASM_1 183 // rope lowered
|
||||
#define IDI_MSA_PIC_VENUS_PROBE 39 // CRYSTAL, USE WRENCH
|
||||
#define IDI_MSA_PIC_VENUS_PROBE_1 184 // hatch open
|
||||
#define IDI_MSA_PIC_VENUS_SHIP 33
|
||||
#define IDI_MSA_PIC_VENUS_WEIGH 37 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_NEPTUNE_0 40
|
||||
#define IDI_MSA_PIC_NEPTUNE_1 42
|
||||
#define IDI_MSA_PIC_NEPTUNE_2 43
|
||||
#define IDI_MSA_PIC_NEPTUNE_3 44
|
||||
#define IDI_MSA_PIC_NEPTUNE_4 45
|
||||
#define IDI_MSA_PIC_NEPTUNE_5 48
|
||||
#define IDI_MSA_PIC_NEPTUNE_6 50
|
||||
#define IDI_MSA_PIC_NEPTUNE_7 52
|
||||
#define IDI_MSA_PIC_NEPTUNE_8 53
|
||||
#define IDI_MSA_PIC_NEPTUNE_9 54
|
||||
#define IDI_MSA_PIC_NEPTUNE_10 55
|
||||
#define IDI_MSA_PIC_NEPTUNE_11 56
|
||||
#define IDI_MSA_PIC_NEPTUNE_BABIES 61
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_0 46
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_1 51
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_2 57
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_3 58
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_4 59
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_5 60
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_6 66
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_7 67
|
||||
#define IDI_MSA_PIC_NEPTUNE_CASTLE_8 68
|
||||
#define IDI_MSA_PIC_NEPTUNE_EATING_AREA 62
|
||||
#define IDI_MSA_PIC_NEPTUNE_ENTRANCE 47
|
||||
#define IDI_MSA_PIC_NEPTUNE_ENTRANCE_1 185 // entrance open
|
||||
#define IDI_MSA_PIC_NEPTUNE_ENTRYWAY 63
|
||||
#define IDI_MSA_PIC_NEPTUNE_GUARD 69
|
||||
#define IDI_MSA_PIC_NEPTUNE_LEADER 64 // CRYSTAL, GIVE SCARF
|
||||
#define IDI_MSA_PIC_NEPTUNE_SHIP 49
|
||||
#define IDI_MSA_PIC_NEPTUNE_SLEEP_AREA 65
|
||||
#define IDI_MSA_PIC_NEPTUNE_WEIGH 41
|
||||
|
||||
#define IDI_MSA_PIC_MERCURY_0 71
|
||||
#define IDI_MSA_PIC_MERCURY_1 73
|
||||
#define IDI_MSA_PIC_MERCURY_2 75
|
||||
#define IDI_MSA_PIC_MERCURY_3 77
|
||||
#define IDI_MSA_PIC_MERCURY_4 80
|
||||
#define IDI_MSA_PIC_MERCURY_ALIEN_0 72 // CRYSTAL, GIVE SUNGLASSES
|
||||
#define IDI_MSA_PIC_MERCURY_ALIEN_1 74
|
||||
#define IDI_MSA_PIC_MERCURY_ALIEN_2 81
|
||||
#define IDI_MSA_PIC_MERCURY_CAVE_0 70 // hidden feature, press '2' here
|
||||
#define IDI_MSA_PIC_MERCURY_CAVE_1 78
|
||||
#define IDI_MSA_PIC_MERCURY_CAVE_2 79
|
||||
#define IDI_MSA_PIC_MERCURY_SHIP 76
|
||||
#define IDI_MSA_PIC_MERCURY_WEIGH 82
|
||||
|
||||
#define IDI_MSA_PIC_SATURN_0 84
|
||||
#define IDI_MSA_PIC_SATURN_1 86
|
||||
#define IDI_MSA_PIC_SATURN_2 90
|
||||
#define IDI_MSA_PIC_SATURN_3 91
|
||||
#define IDI_MSA_PIC_SATURN_ISLAND 89 // CRYSTAL
|
||||
#define IDI_MSA_PIC_SATURN_LAKE_0 85 // USE MATTRESS
|
||||
#define IDI_MSA_PIC_SATURN_LAKE_1 88 // USE MATTRESS
|
||||
#define IDI_MSA_PIC_SATURN_LAKE_2 92 // USE MATTRESS
|
||||
#define IDI_MSA_PIC_SATURN_SHIP 87
|
||||
#define IDI_MSA_PIC_SATURN_WEIGH 83 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_PLUTO_0 93
|
||||
#define IDI_MSA_PIC_PLUTO_1 96
|
||||
#define IDI_MSA_PIC_PLUTO_2 97
|
||||
#define IDI_MSA_PIC_PLUTO_3 98
|
||||
#define IDI_MSA_PIC_PLUTO_4 101
|
||||
#define IDI_MSA_PIC_PLUTO_ALIENS 100 // CRYSTAL, GIVE BONE
|
||||
#define IDI_MSA_PIC_PLUTO_CAVE_0 99
|
||||
#define IDI_MSA_PIC_PLUTO_CAVE_1 103
|
||||
#define IDI_MSA_PIC_PLUTO_CRATER 102
|
||||
#define IDI_MSA_PIC_PLUTO_SHIP 95
|
||||
#define IDI_MSA_PIC_PLUTO_WEIGH 94 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_JUPITER_0 106
|
||||
#define IDI_MSA_PIC_JUPITER_1 107
|
||||
#define IDI_MSA_PIC_JUPITER_2 108
|
||||
#define IDI_MSA_PIC_JUPITER_3 109
|
||||
#define IDI_MSA_PIC_JUPITER_4 113
|
||||
#define IDI_MSA_PIC_JUPITER_5 116
|
||||
#define IDI_MSA_PIC_JUPITER_6 117
|
||||
#define IDI_MSA_PIC_JUPITER_7 120
|
||||
#define IDI_MSA_PIC_JUPITER_CRACK 114
|
||||
#define IDI_MSA_PIC_JUPITER_LAVA 110 // CRYSTAL, THROW ROCK
|
||||
#define IDI_MSA_PIC_JUPITER_ROCK_0 112 // GET ROCK
|
||||
#define IDI_MSA_PIC_JUPITER_ROCK_1 119 // GET ROCK
|
||||
#define IDI_MSA_PIC_JUPITER_SHIP 115
|
||||
#define IDI_MSA_PIC_JUPITER_WEIGH 118 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_MARS_0 121
|
||||
#define IDI_MSA_PIC_MARS_1 124
|
||||
#define IDI_MSA_PIC_MARS_2 125
|
||||
#define IDI_MSA_PIC_MARS_3 126
|
||||
#define IDI_MSA_PIC_MARS_4 127
|
||||
#define IDI_MSA_PIC_MARS_5 128
|
||||
#define IDI_MSA_PIC_MARS_6 130
|
||||
#define IDI_MSA_PIC_MARS_SHIP 123
|
||||
#define IDI_MSA_PIC_MARS_TUBE_0 129
|
||||
#define IDI_MSA_PIC_MARS_TUBE_1 131
|
||||
#define IDI_MSA_PIC_MARS_VOLCANO 132 // CRYSTAL, DIG PLUTO
|
||||
#define IDI_MSA_PIC_MARS_WEIGH 122 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_URANUS_0 133
|
||||
#define IDI_MSA_PIC_URANUS_1 134
|
||||
#define IDI_MSA_PIC_URANUS_2 135
|
||||
#define IDI_MSA_PIC_URANUS_3 138
|
||||
#define IDI_MSA_PIC_URANUS_4 139
|
||||
#define IDI_MSA_PIC_URANUS_5 140
|
||||
#define IDI_MSA_PIC_URANUS_6 142
|
||||
#define IDI_MSA_PIC_URANUS_CHAMBER 145 // CRYSTAL, USE CROWBAR
|
||||
#define IDI_MSA_PIC_URANUS_SHIP 137
|
||||
#define IDI_MSA_PIC_URANUS_STEPS 144
|
||||
#define IDI_MSA_PIC_URANUS_ENTRANCE 141 // ENTER TEMPLE
|
||||
#define IDI_MSA_PIC_URANUS_TEMPLE 143 // USE CRYSTAL, ENTER DOOR
|
||||
#define IDI_MSA_PIC_URANUS_TEMPLE_1 206 // crystal used
|
||||
#define IDI_MSA_PIC_URANUS_TEMPLE_2 207 // door open
|
||||
#define IDI_MSA_PIC_URANUS_WEIGH 136 // WEIGH MICKEY
|
||||
|
||||
#define IDI_MSA_PIC_STAR_MAP 165
|
||||
#define IDI_MSA_PIC_TITLE 240
|
||||
|
||||
// objects
|
||||
|
||||
enum ENUM_MSA_OBJECT {
|
||||
IDI_MSA_OBJECT_NONE = -1,
|
||||
IDI_MSA_OBJECT_ROCK_0,
|
||||
IDI_MSA_OBJECT_WRENCH,
|
||||
IDI_MSA_OBJECT_SCALE,
|
||||
IDI_MSA_OBJECT_CROWBAR,
|
||||
IDI_MSA_OBJECT_BONE,
|
||||
IDI_MSA_OBJECT_SUNGLASSES,
|
||||
IDI_MSA_OBJECT_DESK_STUFF,
|
||||
IDI_MSA_OBJECT_MATTRESS,
|
||||
IDI_MSA_OBJECT_SCARF,
|
||||
IDI_MSA_OBJECT_FLASHLIGHT,
|
||||
IDI_MSA_OBJECT_ROPE,
|
||||
IDI_MSA_OBJECT_ROCK_1,
|
||||
IDI_MSA_OBJECT_SCARF_C64,
|
||||
IDI_MSA_OBJECT_ROCK_2,
|
||||
IDI_MSA_OBJECT_ROCK_3,
|
||||
IDI_MSA_OBJECT_W_EARTH,
|
||||
IDI_MSA_OBJECT_W_VENUS,
|
||||
IDI_MSA_OBJECT_W_TRITON,
|
||||
IDI_MSA_OBJECT_W_MERCURY,
|
||||
IDI_MSA_OBJECT_W_TITAN,
|
||||
IDI_MSA_OBJECT_W_PLUTO,
|
||||
IDI_MSA_OBJECT_W_IO,
|
||||
IDI_MSA_OBJECT_W_MARS,
|
||||
IDI_MSA_OBJECT_W_OBERON,
|
||||
IDI_MSA_OBJECT_W_SPACE,
|
||||
IDI_MSA_OBJECT_XL31,
|
||||
IDI_MSA_OBJECT_XL31E,
|
||||
IDI_MSA_OBJECT_XL32,
|
||||
IDI_MSA_OBJECT_XL32E,
|
||||
IDI_MSA_OBJECT_XL33,
|
||||
IDI_MSA_OBJECT_XL33E,
|
||||
IDI_MSA_OBJECT_CRYSTAL
|
||||
};
|
||||
|
||||
const char IDS_MSA_NAME_OBJ[][9] = {
|
||||
"rok1", "wrench", "scale", "cbar", "bone", "glasses", "deskstuf", "raft",
|
||||
"scarf", "flashlit", "rope", "rok1", "scarfc64", "rok2", "rock35", "earthw",
|
||||
"venw", "trw", "merw", "titw", "plw", "iow", "mrw", "obw", "spw", "xl31",
|
||||
"xl31e", "xl32", "xl32e", "xl33", "xl33e", "crys1"
|
||||
};
|
||||
|
||||
const int IDI_MSA_XTAL_ROOM_XY[IDI_MSA_MAX_PLANET][3] = {
|
||||
// room x y
|
||||
{IDI_MSA_PIC_EARTH_UP_IN_TREE, 14, 76},
|
||||
{IDI_MSA_PIC_VENUS_PROBE, 74, 80},
|
||||
{IDI_MSA_PIC_NEPTUNE_LEADER, 70, 27},
|
||||
{IDI_MSA_PIC_MERCURY_ALIEN_0, 123, 64},
|
||||
{IDI_MSA_PIC_SATURN_ISLAND, 110, 115},
|
||||
{IDI_MSA_PIC_PLUTO_ALIENS, 60, 104},
|
||||
{IDI_MSA_PIC_JUPITER_LAVA, 56, 54},
|
||||
{IDI_MSA_PIC_MARS_VOLCANO, 107, 100},
|
||||
{IDI_MSA_PIC_URANUS_CHAMBER, 90, 4}
|
||||
};
|
||||
|
||||
// planets
|
||||
|
||||
enum ENUM_MSA_PLANET {
|
||||
IDI_MSA_PLANET_EARTH = 0,
|
||||
IDI_MSA_PLANET_VENUS,
|
||||
IDI_MSA_PLANET_NEPTUNE,
|
||||
IDI_MSA_PLANET_MERCURY,
|
||||
IDI_MSA_PLANET_SATURN,
|
||||
IDI_MSA_PLANET_PLUTO,
|
||||
IDI_MSA_PLANET_JUPITER,
|
||||
IDI_MSA_PLANET_MARS,
|
||||
IDI_MSA_PLANET_URANUS,
|
||||
IDI_MSA_PLANET_SPACESHIP
|
||||
};
|
||||
|
||||
const char IDS_MSA_NAME_DAT[][13] = {
|
||||
"earth.dat", "venus.dat", "neptune.dat", "mercury.dat", "saturn.dat",
|
||||
"pluto.dat", "jupiter.dat", "mars.dat", "uranus.dat", "spacship.dat"
|
||||
};
|
||||
|
||||
const char IDS_MSA_NAME_PLANET[][10] = {
|
||||
"EARTH", "VENUS", "TRITON", "MERCURY", "TITAN",
|
||||
"PLUTO", "IO", "MARS", "OBERON"
|
||||
};
|
||||
|
||||
const char IDS_MSA_NAME_PLANET_2[][10] = {
|
||||
"EARTH", "VENUS", "NEPTUNE", "MERCURY", "SATURN",
|
||||
"PLUTO", "JUPITER", "MARS", "URANUS"
|
||||
};
|
||||
|
||||
const char IDS_MSA_ADDR_PLANET[][7] = {
|
||||
"OB", "B", "OOBBB", "O", "OOBB",
|
||||
"OOOBBB", "OBB", "OOB", "OOOBB"
|
||||
};
|
||||
|
||||
const int IDI_MSA_HOME_PLANET[] = {
|
||||
IDI_MSA_PIC_EARTH_SHIP, IDI_MSA_PIC_VENUS_SHIP, IDI_MSA_PIC_NEPTUNE_SHIP, IDI_MSA_PIC_MERCURY_SHIP,
|
||||
IDI_MSA_PIC_SATURN_SHIP, IDI_MSA_PIC_PLUTO_SHIP, IDI_MSA_PIC_JUPITER_SHIP, IDI_MSA_PIC_MARS_SHIP,
|
||||
IDI_MSA_PIC_URANUS_SHIP
|
||||
};
|
||||
|
||||
const int IDI_MSA_SHIP_PLANET[] = {
|
||||
0, IDI_MSA_PIC_SHIP_VENUS, IDI_MSA_PIC_SHIP_NEPTUNE, IDI_MSA_PIC_SHIP_MERCURY, IDI_MSA_PIC_SHIP_SATURN,
|
||||
IDI_MSA_PIC_SHIP_PLUTO, IDI_MSA_PIC_SHIP_JUPITER, IDI_MSA_PIC_SHIP_MARS, IDI_MSA_PIC_SHIP_URANUS
|
||||
};
|
||||
|
||||
// items
|
||||
|
||||
enum ENUM_MSA_ITEM {
|
||||
IDI_MSA_ITEM_FLASHLIGHT = 0,
|
||||
IDI_MSA_ITEM_ROPE,
|
||||
IDI_MSA_ITEM_BONE,
|
||||
IDI_MSA_ITEM_LETTER,
|
||||
IDI_MSA_ITEM_CROWBAR,
|
||||
IDI_MSA_ITEM_WRENCH,
|
||||
IDI_MSA_ITEM_MATTRESS,
|
||||
IDI_MSA_ITEM_SCARF,
|
||||
IDI_MSA_ITEM_SUNGLASSES,
|
||||
IDI_MSA_ITEM_SCALE,
|
||||
IDI_MSA_ITEM_ROCK
|
||||
};
|
||||
|
||||
const char IDS_MSA_NAME_ITEM[][15] = {
|
||||
"A FLASHLIGHT", "A ROPE ", "A BONE ", "A LETTER", "A CROWBAR", "A WRENCH",
|
||||
"A MATTRESS", "A SCARF", "SUNGLASSES", "A SCALE ", "A ROCK "
|
||||
};
|
||||
|
||||
// buttons
|
||||
|
||||
#define IDI_MSA_BUTTON_ORANGE 0x4F // 'O'
|
||||
#define IDI_MSA_BUTTON_BLUE 0x42 // 'B'
|
||||
|
||||
// file structures
|
||||
|
||||
struct MSA_TEXT_ENTRY {
|
||||
uint8 x0;
|
||||
uint8 szText[11];
|
||||
};
|
||||
|
||||
struct MSA_TEXT_BLOCK {
|
||||
uint8 count;
|
||||
MSA_TEXT_ENTRY entry[5];
|
||||
};
|
||||
|
||||
struct MSA_MSG_BLOCK {
|
||||
uint8 data[5];
|
||||
};
|
||||
|
||||
struct MSA_MENU {
|
||||
MSA_TEXT_BLOCK row[2];
|
||||
MSA_MSG_BLOCK cmd[5];
|
||||
MSA_MSG_BLOCK arg[5];
|
||||
};
|
||||
|
||||
struct MSA_DAT_HEADER {
|
||||
uint16 filelen;
|
||||
uint16 ofsRoom[IDI_MSA_MAX_ROOM];
|
||||
uint16 ofsDesc[IDI_MSA_MAX_ROOM];
|
||||
uint16 ofsStr[IDI_MSA_MAX_ROOM];
|
||||
};
|
||||
|
||||
struct MSA_SND_NOTE {
|
||||
uint16 counter; // freq = 1193180 / counter
|
||||
uint8 length; // msec = length / 0.0182
|
||||
};
|
||||
|
||||
// file offset modifiers
|
||||
|
||||
#define IDI_MSA_OFS_DAT 0x0002
|
||||
#define IDI_MSA_OFS_EXE 0x35C0
|
||||
|
||||
// actions
|
||||
|
||||
#define IDI_MSA_ACTION_GOTO_ROOM 0x00
|
||||
#define IDI_MSA_ACTION_SHOW_INT_STR 0x01
|
||||
#define IDI_MSA_ACTION_UNUSED 0x02
|
||||
#define IDI_MSA_ACTION_SHOW_DAT_STR 0x03
|
||||
|
||||
#define IDI_MSA_ACTION_GET_ROPE 0x7F
|
||||
#define IDI_MSA_ACTION_UNTIE_ROPE 0x80
|
||||
#define IDI_MSA_ACTION_GET_BONE 0x81
|
||||
#define IDI_MSA_ACTION_GET_XTAL_EARTH 0x82
|
||||
#define IDI_MSA_ACTION_LOOK_DESK 0x83
|
||||
#define IDI_MSA_ACTION_WRITE_LETTER 0x84
|
||||
#define IDI_MSA_ACTION_MAIL_LETTER 0x85
|
||||
#define IDI_MSA_ACTION_OPEN_CUPBOARD 0x86
|
||||
#define IDI_MSA_ACTION_GET_FLASHLIGHT 0x87
|
||||
#define IDI_MSA_ACTION_OPEN_CABINET 0x88
|
||||
#define IDI_MSA_ACTION_GET_CROWBAR 0x89
|
||||
#define IDI_MSA_ACTION_GET_WRENCH 0x8A
|
||||
#define IDI_MSA_ACTION_OPEN_CLOSET 0x8B
|
||||
#define IDI_MSA_ACTION_GET_MATTRESS 0x8C
|
||||
#define IDI_MSA_ACTION_GET_SCARF 0x8D
|
||||
#define IDI_MSA_ACTION_GET_SUNGLASSES 0x8E
|
||||
#define IDI_MSA_ACTION_GET_SCALE 0x8F
|
||||
#define IDI_MSA_ACTION_GOTO_SPACESHIP 0x90
|
||||
|
||||
#define IDI_MSA_ACTION_DOWN_CHASM 0x91
|
||||
#define IDI_MSA_ACTION_DOWN_ROPE 0x92
|
||||
#define IDI_MSA_ACTION_USE_ROPE 0x93
|
||||
#define IDI_MSA_ACTION_OPEN_HATCH 0x94
|
||||
#define IDI_MSA_ACTION_USE_WRENCH 0x95
|
||||
#define IDI_MSA_ACTION_GET_XTAL_VENUS 0x96
|
||||
|
||||
#define IDI_MSA_ACTION_LOOK_CASTLE 0x97
|
||||
#define IDI_MSA_ACTION_ENTER_OPENING 0x98
|
||||
#define IDI_MSA_ACTION_USE_CROWBAR 0x99
|
||||
#define IDI_MSA_ACTION_GET_XTAL_NEPTUNE 0x9A
|
||||
#define IDI_MSA_ACTION_TALK_LEADER 0x9B
|
||||
#define IDI_MSA_ACTION_GIVE_SCARF 0x9C
|
||||
|
||||
#define IDI_MSA_ACTION_GET_XTAL_MERCURY 0x9D
|
||||
#define IDI_MSA_ACTION_GIVE_SUNGLASSES 0x9E
|
||||
#define IDI_MSA_ACTION_CROSS_LAKE 0x9F
|
||||
#define IDI_MSA_ACTION_USE_MATTRESS 0xA0
|
||||
#define IDI_MSA_ACTION_GET_XTAL_SATURN 0xA1
|
||||
#define IDI_MSA_ACTION_LEAVE_ISLAND 0xA2
|
||||
|
||||
#define IDI_MSA_ACTION_GET_XTAL_PLUTO 0xA3
|
||||
#define IDI_MSA_ACTION_GIVE_BONE 0xA4
|
||||
|
||||
#define IDI_MSA_ACTION_GET_ROCK_0 0xA5
|
||||
#define IDI_MSA_ACTION_GET_ROCK_1 0xA6
|
||||
#define IDI_MSA_ACTION_GET_XTAL_JUPITER 0xA7
|
||||
#define IDI_MSA_ACTION_THROW_ROCK 0xA8
|
||||
|
||||
#define IDI_MSA_ACTION_GO_TUBE 0xA9
|
||||
#define IDI_MSA_ACTION_USE_FLASHLIGHT 0xAA
|
||||
#define IDI_MSA_ACTION_PLUTO_DIG 0xAB
|
||||
#define IDI_MSA_ACTION_GET_XTAL_MARS 0xAC
|
||||
|
||||
#define IDI_MSA_ACTION_USE_CRYSTAL 0xAD
|
||||
#define IDI_MSA_ACTION_OPEN_DOOR 0xAE
|
||||
#define IDI_MSA_ACTION_ENTER_DOOR 0xAF
|
||||
#define IDI_MSA_ACTION_GET_XTAL_URANUS 0xB0
|
||||
#define IDI_MSA_ACTION_USE_CROWBAR_1 0xB1
|
||||
|
||||
#define IDI_MSA_ACTION_GO_NORTH 0xB2
|
||||
#define IDI_MSA_ACTION_GO_PLANET 0xB3
|
||||
#define IDI_MSA_ACTION_PRESS_BUTTON 0xB4
|
||||
#define IDI_MSA_ACTION_WEAR_SPACESUIT 0xB5
|
||||
#define IDI_MSA_ACTION_READ_GAUGE 0xB6
|
||||
#define IDI_MSA_ACTION_PRESS_ORANGE 0xB7
|
||||
#define IDI_MSA_ACTION_PRESS_BLUE 0xB8
|
||||
#define IDI_MSA_ACTION_FLIP_SWITCH 0xB9
|
||||
#define IDI_MSA_ACTION_PUSH_THROTTLE 0xBA
|
||||
#define IDI_MSA_ACTION_PULL_THROTTLE 0xBB
|
||||
#define IDI_MSA_ACTION_LEAVE_ROOM 0xBC
|
||||
#define IDI_MSA_ACTION_OPEN_CABINET_1 0xBD
|
||||
#define IDI_MSA_ACTION_READ_MAP 0xBE
|
||||
#define IDI_MSA_ACTION_GO_WEST 0xBF
|
||||
|
||||
#define IDI_MSA_ACTION_PLANET_INFO 0xC0
|
||||
#define IDI_MSA_ACTION_ENTER_TEMPLE 0xC1
|
||||
#define IDI_MSA_ACTION_OPEN_MAILBOX 0xC2
|
||||
#define IDI_MSA_ACTION_SAVE_GAME 0xC3
|
||||
#define IDI_MSA_ACTION_LOOK_MICKEY 0xC4
|
||||
|
||||
// sounds
|
||||
|
||||
enum ENUM_MSA_SOUND {
|
||||
IDI_MSA_SND_THEME,
|
||||
IDI_MSA_SND_CRYSTAL,
|
||||
IDI_MSA_SND_TAKE,
|
||||
IDI_MSA_SND_GAME_OVER,
|
||||
IDI_MSA_SND_PRESS_BLUE,
|
||||
IDI_MSA_SND_PRESS_ORANGE,
|
||||
IDI_MSA_SND_SHIP_LAND,
|
||||
IDI_MSA_SND_XL30
|
||||
};
|
||||
|
||||
// message offsets within mickey.exe
|
||||
|
||||
const int IDO_MSA_HIDDEN_MSG[] = {
|
||||
0x8C44, 0x8C83, 0x8D23, 0x8D97, 0x8E2A
|
||||
};
|
||||
|
||||
const int IDO_MSA_GAME_OVER[] = {
|
||||
0x7914, 0x7978, 0x7A17, 0x7A94, 0x7B04, 0x7B8F, 0x7BEB, 0x7C79
|
||||
};
|
||||
|
||||
const int IDO_MSA_SAVE_GAME[] = {
|
||||
0x73FA, 0x7436, 0x746C, 0x74E9, 0x75F6, 0x766A, 0x758B
|
||||
// do you have a formatted disk, insert disk, insert disk 2, save by number
|
||||
// everything will be lost, previous game will be lost, game saved
|
||||
};
|
||||
|
||||
const int IDO_MSA_LOAD_GAME[] = {
|
||||
0x76CE, 0x770B, 0x7777
|
||||
// do you want to load game, insert game save disk, game restored
|
||||
};
|
||||
|
||||
const int IDO_MSA_AIR_SUPPLY[] = {
|
||||
0x7D10, 0x7D31, 0x7D51, 0x7D9B
|
||||
// be aware, low, dangerously low, out of air
|
||||
};
|
||||
|
||||
const int IDI_MSA_AIR_SUPPLY[] = { 30, 20, 10, 0 };
|
||||
|
||||
// planet information
|
||||
|
||||
const int IDO_MSA_PLANET_INFO[IDI_MSA_MAX_PLANET][4] = {
|
||||
{0x6313, 0x63B2, 0x6449, 0}, // EARTH
|
||||
{0x61EB, 0x6288, 0, 0}, // VENUS
|
||||
{0x6B64, 0x6C06, 0x6CA3, 0}, // NEPTUNE
|
||||
{0x609B, 0x612C, 0x61CA, 0}, // MERCURY
|
||||
{0x6879, 0x6916, 0x6984, 0}, // SATURN
|
||||
{0x6CCF, 0x6D72, 0x6E10, 0}, // PLUTO
|
||||
{0x667C, 0x6714, 0x67B1, 0x684E}, // JUPITER
|
||||
{0x6471, 0x650F, 0x65AD, 0x6651}, // MARS
|
||||
{0x69C3, 0x6A62, 0x6B00, 0} // URANUS
|
||||
};
|
||||
|
||||
// next crystal piece hints
|
||||
|
||||
const int IDO_MSA_NEXT_PIECE[IDI_MSA_MAX_PLANET][5] = {
|
||||
{0, 0, 0, 0, 0}, // earth
|
||||
{0x4DCC, 0x4E20, 0x4E64, 0x4E9E, 0x4F0B}, // venus
|
||||
{0x5900, 0x599B, 0x5A07, 0x5A8E, 0x5B07}, // neptune
|
||||
{0x4F57, 0x4FA3, 0x4FF1, 0x5056, 0x50BD}, // mercury
|
||||
{0x5471, 0x54DF, 0x5548, 0x55C2, 0x562A}, // saturn
|
||||
{0x5B78, 0x5BB6, 0x5C29, 0x5C76, 0x5CE1}, // pluto
|
||||
{0x526B, 0x52DA, 0x5340, 0x53A1, 0x540C}, // jupiter
|
||||
{0x50F6, 0x512C, 0x5170, 0x51D5, 0x5228}, // mars
|
||||
{0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus
|
||||
};
|
||||
|
||||
// message offsets
|
||||
|
||||
#define IDO_MSA_COPYRIGHT 0x7801
|
||||
#define IDO_MSA_INTRO 0x4679
|
||||
#define IDO_MSA_GAME_STORY 0x6E9C
|
||||
|
||||
#define IDO_MSA_PRESS_1_TO_9 0x7530
|
||||
#define IDO_MSA_PRESS_YES_OR_NO 0x480D
|
||||
#define IDO_MSA_MICKEY_HAS_PRESSED 0x5D90
|
||||
#define IDO_MSA_TOO_MANY_BUTTONS_PRESSED 0x5DF7
|
||||
|
||||
#define IDO_MSA_XL30_SPEAKING 0x4725
|
||||
#define IDO_MSA_CRYSTAL_PIECE_FOUND 0x600C
|
||||
|
||||
#define IDO_MSA_ROOM_TEXT_OFFSETS 0x8B01
|
||||
#define IDO_MSA_ROOM_OBJECT_XY_OFFSETS 0x8EA8
|
||||
#define IDO_MSA_ROOM_MENU_FIX 0x4a27
|
||||
|
||||
// offsets to offset arrays
|
||||
|
||||
#define IDOFS_MSA_MENU_PATCHES 0x5e7a
|
||||
#define IDOFS_MSA_SOUND_DATA 0x9deb
|
||||
|
||||
// game structure
|
||||
|
||||
struct MSA_GAME {
|
||||
uint8 iRoom;
|
||||
uint8 iPlanet;
|
||||
uint8 iDisk;
|
||||
|
||||
uint8 nAir;
|
||||
uint8 nButtons;
|
||||
uint8 nRocks;
|
||||
|
||||
uint8 nXtals;
|
||||
uint8 iPlanetXtal[IDI_MSA_MAX_DAT];
|
||||
uint16 iClue[IDI_MSA_MAX_PLANET];
|
||||
char szAddr[IDI_MSA_MAX_BUTTON + 1];
|
||||
|
||||
// Flags
|
||||
bool fHasXtal;
|
||||
bool fIntro;
|
||||
bool fSuit;
|
||||
bool fShipDoorOpen;
|
||||
bool fFlying;
|
||||
bool fStoryShown;
|
||||
bool fPlanetsInitialized;
|
||||
bool fTempleDoorOpen;
|
||||
bool fAnimXL30;
|
||||
bool fItem[IDI_MSA_MAX_ITEM];
|
||||
bool fItemUsed[IDI_MSA_MAX_ITEM];
|
||||
|
||||
int8 iItem[IDI_MSA_MAX_ITEM];
|
||||
uint8 nItems;
|
||||
|
||||
//uint8 fRmTxt[IDI_MSA_MAX_ROOM];
|
||||
int8 iRmObj[IDI_MSA_MAX_ROOM];
|
||||
uint8 iRmPic[IDI_MSA_MAX_ROOM];
|
||||
uint16 oRmTxt[IDI_MSA_MAX_ROOM];
|
||||
|
||||
uint8 iRmMenu[IDI_MSA_MAX_ROOM];
|
||||
uint8 nRmMenu[IDI_MSA_MAX_ROOM];
|
||||
|
||||
int8 nFrame;
|
||||
};
|
||||
|
||||
class PreAgiEngine;
|
||||
class PictureMgr_Mickey_Winnie;
|
||||
|
||||
class MickeyEngine : public PreAgiEngine {
|
||||
public:
|
||||
MickeyEngine(OSystem *syst, const AGIGameDescription *gameDesc);
|
||||
~MickeyEngine() override;
|
||||
|
||||
void init();
|
||||
Common::Error go() override;
|
||||
|
||||
void debugCurRoom();
|
||||
void debugGotoRoom(int);
|
||||
void drawPic(int);
|
||||
void drawObj(ENUM_MSA_OBJECT, int, int);
|
||||
|
||||
protected:
|
||||
PictureMgr_Mickey_Winnie *_picture;
|
||||
|
||||
MSA_GAME _gameStateMickey;
|
||||
bool _clickToMove;
|
||||
bool _isGameOver;
|
||||
|
||||
int getDat(int);
|
||||
void readExe(int, uint8 *, long);
|
||||
void getDatFileName(int, char *);
|
||||
void readDatHdr(char *, MSA_DAT_HEADER *);
|
||||
void readOfsData(int, int, uint8 *, long);
|
||||
bool chooseY_N(int, bool);
|
||||
int choose1to9(int);
|
||||
void printStr(char *);
|
||||
void printLine(const char *);
|
||||
void printExeStr(int);
|
||||
void printExeMsg(int);
|
||||
void printDesc(int);
|
||||
bool checkMenu();
|
||||
void drawMenu(MSA_MENU &, int, int);
|
||||
void getMouseMenuSelRow(MSA_MENU &, int *, int *, int, int, int);
|
||||
bool getMenuSelRow(MSA_MENU &, int *, int *, int);
|
||||
void getMenuSel(char *, int *, int *);
|
||||
void centerMenu(MSA_MENU *);
|
||||
void patchMenu(MSA_MENU *);
|
||||
void printDatString(int);
|
||||
void printDatMessage(int);
|
||||
bool playNote(MSA_SND_NOTE note, WaitOptions options);
|
||||
bool playSound(ENUM_MSA_SOUND iSound, WaitOptions options = kWaitProcessEvents);
|
||||
void drawRoomAnimation();
|
||||
void drawRoom();
|
||||
bool drawLogo();
|
||||
void animate();
|
||||
void printRoomDesc();
|
||||
bool loadGame();
|
||||
void saveGame();
|
||||
void showPlanetInfo();
|
||||
void printStory();
|
||||
int getPlanet();
|
||||
void pressOB(int);
|
||||
void insertDisk(int);
|
||||
void gameOver();
|
||||
void inventory();
|
||||
void intro();
|
||||
void getItem(ENUM_MSA_ITEM);
|
||||
void getXtal(int);
|
||||
bool parse(int, int);
|
||||
void flipSwitch();
|
||||
void waitAnyKey(bool anim = false);
|
||||
|
||||
bool planetIsAlreadyAssigned(int planet) {
|
||||
for (int j = 0; j < IDI_MSA_MAX_PLANET; j++) {
|
||||
if (_gameStateMickey.iPlanetXtal[j] == planet)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mickeyHasItem(int item) {
|
||||
if (_gameStateMickey.fItem[item]) {
|
||||
printDatMessage(90); // Mickey already has item
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isCrystalOnCurrentPlanet() const;
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif
|
||||
348
engines/agi/preagi/picture_mickey_winnie.cpp
Normal file
348
engines/agi/preagi/picture_mickey_winnie.cpp
Normal file
@@ -0,0 +1,348 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "agi/agi.h"
|
||||
#include "agi/graphics.h"
|
||||
#include "agi/picture.h"
|
||||
|
||||
#include "agi/preagi/picture_mickey_winnie.h"
|
||||
|
||||
namespace Agi {
|
||||
|
||||
// PictureMgr_Mickey_Winnie decodes and draws picture resources in Mickey's
|
||||
// Space Adventure (DOS) and Winnie the Pooh (DOS/Amiga/A2/C64/CoCo).
|
||||
//
|
||||
// Mickey and Winnie DOS/Amiga use the same format. The picture code in
|
||||
// their executables appears to be the same.
|
||||
//
|
||||
// The A2/C64/CoCo versions of Winnie use a completely different format, but
|
||||
// they do support the same features. These games start in ScummVM but they
|
||||
// don't really work yet. TODO: display the right colors, figure out the line
|
||||
// differences, support these versions.
|
||||
//
|
||||
// Both formats support lines, flood fills, and patterns. No priority screen.
|
||||
//
|
||||
// Unique features to these formats:
|
||||
//
|
||||
// 1. Pictures can be drawn on top of others at arbitrary locations. Used to
|
||||
// draw items in rooms, and to draw room pictures with a buffer on each side
|
||||
// in DOS/Amiga. The pictures don't fill the screen width because they were
|
||||
// designed for the Apple II.
|
||||
//
|
||||
// 2. Mickey's crystals animate. Most of the work is done in MickeyEngine;
|
||||
// this class just allows the engine to set a maximum number of picture
|
||||
// instructions to execute. Unclear if this is same effect as the original.
|
||||
//
|
||||
// 3. The pattern opcode draws solid circles in up to 17 sizes.
|
||||
//
|
||||
// Mickey features animating spaceship lights, but the engine handles that.
|
||||
// The lights are a picture whose instructions are modified before drawing.
|
||||
//
|
||||
// TODO: There are extremely minor inaccuracies in several Winnie pictures.
|
||||
// The F1 opcode's effects are not fully understood, and it creates subtle
|
||||
// discrepancies. It may be related to dithering. However, so few pictures
|
||||
// contain F3, and even fewer are affected by ignoring it or not, and only
|
||||
// by a few pixels, that it doesn't matter except for completeness.
|
||||
// See: picture 34 door handles (Rabbit's kitchen)
|
||||
|
||||
PictureMgr_Mickey_Winnie::PictureMgr_Mickey_Winnie(AgiBase *agi, GfxMgr *gfx) :
|
||||
PictureMgr(agi, gfx) {
|
||||
|
||||
switch (agi->getPlatform()) {
|
||||
case Common::kPlatformAmiga:
|
||||
case Common::kPlatformDOS:
|
||||
_isDosOrAmiga = true;
|
||||
break;
|
||||
default:
|
||||
_isDosOrAmiga = false;
|
||||
_minCommand = 0xe0;
|
||||
break;
|
||||
}
|
||||
|
||||
_xOffset = 0;
|
||||
_yOffset = 0;
|
||||
_maxStep = 0;
|
||||
}
|
||||
|
||||
void PictureMgr_Mickey_Winnie::drawPicture() {
|
||||
debugC(kDebugLevelPictures, "Drawing picture");
|
||||
|
||||
_dataOffset = 0;
|
||||
_dataOffsetNibble = false;
|
||||
_patCode = 0;
|
||||
_patNum = 0;
|
||||
_priOn = false;
|
||||
_scrOn = false;
|
||||
_priColor = 4;
|
||||
|
||||
if (_isDosOrAmiga) {
|
||||
_scrColor = 15;
|
||||
drawPicture_DOS_Amiga();
|
||||
} else {
|
||||
_scrColor = 0;
|
||||
drawPicture_A2_C64_CoCo();
|
||||
}
|
||||
}
|
||||
|
||||
void PictureMgr_Mickey_Winnie::drawPicture_DOS_Amiga() {
|
||||
int step = 0;
|
||||
while (_dataOffset < _dataSize) {
|
||||
byte curByte = getNextByte();
|
||||
|
||||
switch (curByte) {
|
||||
case 0xf0:
|
||||
draw_SetColor();
|
||||
_scrOn = true;
|
||||
break;
|
||||
case 0xf1:
|
||||
_scrOn = false;
|
||||
break;
|
||||
case 0xf4:
|
||||
yCorner();
|
||||
break;
|
||||
case 0xf5:
|
||||
xCorner();
|
||||
break;
|
||||
case 0xf6:
|
||||
draw_LineAbsolute();
|
||||
break;
|
||||
case 0xf7:
|
||||
draw_LineShort();
|
||||
break;
|
||||
case 0xf8: {
|
||||
// The screen-on flag does not prevent PreAGI flood fills.
|
||||
// Winnie picture 7 (Roo) contains F1 before several fills.
|
||||
byte prevScrOn = _scrOn;
|
||||
_scrOn = true;
|
||||
PictureMgr::draw_Fill();
|
||||
_scrOn = prevScrOn;
|
||||
break;
|
||||
}
|
||||
case 0xf9:
|
||||
plotBrush();
|
||||
break;
|
||||
case 0xff: // end of data
|
||||
return;
|
||||
default:
|
||||
warning("Unknown picture opcode %02x at %04x", curByte, _dataOffset - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// Limit drawing to the optional maximum number of opcodes.
|
||||
// Used by Mickey for crystal animation.
|
||||
step++;
|
||||
if (step == _maxStep) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PictureMgr_Mickey_Winnie::drawPicture_A2_C64_CoCo() {
|
||||
while (_dataOffset < _dataSize) {
|
||||
byte curByte = getNextByte();
|
||||
|
||||
if ((curByte >= 0xF0) && (curByte <= 0xFE)) {
|
||||
_scrColor = curByte & 0x0F;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (curByte) {
|
||||
case 0xe0: // x-corner
|
||||
xCorner();
|
||||
break;
|
||||
case 0xe1: // y-corner
|
||||
yCorner();
|
||||
break;
|
||||
case 0xe2: // dynamic draw lines
|
||||
draw_LineShort();
|
||||
break;
|
||||
case 0xe3: // absolute draw lines
|
||||
draw_LineAbsolute();
|
||||
break;
|
||||
case 0xe4: // fill
|
||||
draw_SetColor();
|
||||
PictureMgr::draw_Fill();
|
||||
break;
|
||||
case 0xe5: // enable screen drawing
|
||||
_scrOn = true;
|
||||
break;
|
||||
case 0xe6: // plot brush
|
||||
plotBrush();
|
||||
break;
|
||||
case 0xff: // end of data
|
||||
return;
|
||||
default:
|
||||
warning("Unknown picture opcode %02x at %04x", curByte, _dataOffset - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* plotBrush (PreAGI)
|
||||
*
|
||||
* Plots the given brush pattern. All brushes are solid circles.
|
||||
*/
|
||||
void PictureMgr_Mickey_Winnie::plotBrush() {
|
||||
_patCode = getNextByte();
|
||||
if (_patCode > 12) {
|
||||
_patCode = 12;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
byte x, y;
|
||||
if (!getNextCoordinates(x, y))
|
||||
break;
|
||||
|
||||
plotPattern(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* plotPattern
|
||||
*
|
||||
* Draws a solid circle. Size is determined by the pattern code.
|
||||
*/
|
||||
void PictureMgr_Mickey_Winnie::plotPattern(byte x, byte y) {
|
||||
// PreAGI patterns are 13 solid circles
|
||||
static const byte circleData[] = {
|
||||
0x00,
|
||||
0x01, 0x01,
|
||||
0x01, 0x02, 0x02,
|
||||
0x01, 0x02, 0x03, 0x03,
|
||||
0x02, 0x03, 0x04, 0x04, 0x04,
|
||||
0x02, 0x03, 0x04, 0x05, 0x05, 0x05,
|
||||
0x02, 0x04, 0x05, 0x05, 0x06, 0x06, 0x06,
|
||||
0x02, 0x04, 0x05, 0x06, 0x06, 0x07, 0x07, 0x07,
|
||||
0x02, 0x04, 0x06, 0x06, 0x07, 0x07, 0x08, 0x08, 0x08,
|
||||
0x03, 0x05, 0x06, 0x07, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09,
|
||||
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a,
|
||||
0x03, 0x05, 0x07, 0x08, 0x09, 0x09, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b,
|
||||
0x03, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c
|
||||
};
|
||||
|
||||
int circleDataIndex = (_patCode * (_patCode + 1)) / 2;
|
||||
|
||||
// draw the circle by drawing its vertical lines two at a time, starting at the
|
||||
// left and right edges and working inwards. circles have odd widths, so the
|
||||
// final iteration draws the middle line twice.
|
||||
for (int i = _patCode; i >= 0; i--) {
|
||||
const byte height = circleData[circleDataIndex++];
|
||||
int16 x1, y1, x2, y2;
|
||||
|
||||
// left vertical line
|
||||
x1 = x - i;
|
||||
x2 = x1;
|
||||
y1 = y - height;
|
||||
y2 = y + height;
|
||||
draw_Line(x1, y1, x2, y2);
|
||||
|
||||
// right vertical line
|
||||
x1 = x + i;
|
||||
x2 = x1;
|
||||
draw_Line(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flood fills from a start position, with a clipped height.
|
||||
*/
|
||||
void PictureMgr_Mickey_Winnie::draw_Fill(int16 x, int16 y) {
|
||||
// Flood fill does extra height clipping, and pictures rely on this.
|
||||
// The get-coordinates routine clips to (139, 159) and then the
|
||||
// flood fill routine checks if y >= 159 and decrements to 158.
|
||||
// The flood fill clip is not in in Apple II/C64/CoCo versions
|
||||
// of Winnie, as can be seen by the table edge being a different
|
||||
// color than Winnie's shirt in the first room, but the same
|
||||
// color as the shirt in DOS/Amiga. (Picture 28)
|
||||
if (_isDosOrAmiga) {
|
||||
if (y >= _height) { // 159
|
||||
debugC(kDebugLevelPictures, "clipping %c from %d to %d", 'y', y, _height - 1);
|
||||
y = _height - 1; // 158
|
||||
}
|
||||
}
|
||||
|
||||
PictureMgr::draw_Fill(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next x coordinate in the current picture instruction,
|
||||
* and clip it to the picture width. Many Winnie pictures contain
|
||||
* out of bounds coordinates and rely on this clipping.
|
||||
*/
|
||||
bool PictureMgr_Mickey_Winnie::getNextXCoordinate(byte &x) {
|
||||
if (!getNextParamByte(x)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_isDosOrAmiga) {
|
||||
if (x >= _width) { // 140
|
||||
debugC(kDebugLevelPictures, "clipping %c from %d to %d", 'x', x, _width - 1);
|
||||
x = _width - 1; // 139
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next y coordinate in the current picture instruction,
|
||||
* and clip it to the picture height. Many Winnie pictures contain
|
||||
* out of bounds coordinates and rely on this clipping.
|
||||
*/
|
||||
bool PictureMgr_Mickey_Winnie::getNextYCoordinate(byte &y) {
|
||||
if (!getNextParamByte(y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_isDosOrAmiga) {
|
||||
// note that this is a different clip than for the x coordinate
|
||||
if (y > _height) { // 159
|
||||
debugC(kDebugLevelPictures, "clipping %c from %d to %d", 'y', y, _height);
|
||||
y = _height; // 159
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates picture coordinates and translates them to GfxMgr coordinates.
|
||||
*
|
||||
* This function applies the current picture object and validates that the
|
||||
* graphics coordinates are within GfxMgr's boundaries. Validation is necessary
|
||||
* because Winnie places tall objects at the bottom of the screen in several
|
||||
* rooms, and GfxMgr does not validate coordinates.
|
||||
*/
|
||||
bool PictureMgr_Mickey_Winnie::getGraphicsCoordinates(int16 &x, int16 &y) {
|
||||
// validate that the coordinates are within the picture's boundaries
|
||||
if (!PictureMgr::getGraphicsCoordinates(x, y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
x += _xOffset;
|
||||
y += _yOffset;
|
||||
|
||||
// validate that the offset coordinates are within the screen's boundaries
|
||||
return (x < SCRIPT_WIDTH && y < SCRIPT_HEIGHT);
|
||||
}
|
||||
|
||||
} // End of namespace Agi
|
||||
62
engines/agi/preagi/picture_mickey_winnie.h
Normal file
62
engines/agi/preagi/picture_mickey_winnie.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_PICTURE_MICKEY_WINNIE_H
|
||||
#define AGI_PREAGI_PICTURE_MICKEY_WINNIE_H
|
||||
|
||||
namespace Agi {
|
||||
|
||||
class PictureMgr_Mickey_Winnie : public PictureMgr {
|
||||
public:
|
||||
PictureMgr_Mickey_Winnie(AgiBase *agi, GfxMgr *gfx);
|
||||
|
||||
void drawPicture() override;
|
||||
void drawPicture_DOS_Amiga();
|
||||
void drawPicture_A2_C64_CoCo();
|
||||
|
||||
void plotPattern(byte x, byte y) override;
|
||||
void plotBrush() override;
|
||||
|
||||
void draw_Fill(int16 x, int16 y) override;
|
||||
|
||||
bool getNextXCoordinate(byte &x) override;
|
||||
bool getNextYCoordinate(byte &y) override;
|
||||
|
||||
bool getGraphicsCoordinates(int16 &x, int16 &y) override;
|
||||
|
||||
void setOffset(int xOffset, int yOffset) {
|
||||
_xOffset = xOffset;
|
||||
_yOffset = yOffset;
|
||||
}
|
||||
|
||||
void setMaxStep(int maxStep) { _maxStep = maxStep; }
|
||||
int getMaxStep() const { return _maxStep; }
|
||||
|
||||
private:
|
||||
bool _isDosOrAmiga;
|
||||
int16 _xOffset;
|
||||
int16 _yOffset;
|
||||
int _maxStep; // Max opcodes to draw, zero for all. Used by Mickey
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif
|
||||
184
engines/agi/preagi/picture_troll.cpp
Normal file
184
engines/agi/preagi/picture_troll.cpp
Normal file
@@ -0,0 +1,184 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "agi/agi.h"
|
||||
#include "agi/graphics.h"
|
||||
#include "agi/picture.h"
|
||||
|
||||
#include "agi/preagi/picture_troll.h"
|
||||
|
||||
namespace Agi {
|
||||
|
||||
// PictureMgr_Troll decodes and draws Troll's Tale picture resources.
|
||||
//
|
||||
// Troll's Tale supports lines and flood fills. There is no priority screen.
|
||||
//
|
||||
// There are two unique picture features:
|
||||
//
|
||||
// 1. The F3 opcode can dynamically act as a no-op or terminator (FF).
|
||||
// This allows pictures to have an optional set of instructions for
|
||||
// drawing or hiding a room's object or the king's crown.
|
||||
//
|
||||
// 2. A custom flood fill technique is used for drawing the Troll over
|
||||
// room pictures. Normally, flood fill requires an empty (white) area.
|
||||
//
|
||||
// One quirk is that the xCorner and yCorner instructions contain a redundant
|
||||
// coordinate, even though it is ignored because it is derived from the others.
|
||||
//
|
||||
// Each room picture depends on the game first drawing a frame within the entire
|
||||
// picture area. This is not decorative; the flood fill routines rely on this
|
||||
// border because they do not do boundary test, and pictures are drawn for it.
|
||||
|
||||
PictureMgr_Troll::PictureMgr_Troll(AgiBase *agi, GfxMgr *gfx) :
|
||||
PictureMgr(agi, gfx) {
|
||||
_stopOnF3 = false;
|
||||
_trollMode = false;
|
||||
}
|
||||
|
||||
void PictureMgr_Troll::drawPicture() {
|
||||
debugC(kDebugLevelPictures, "Drawing picture");
|
||||
|
||||
_dataOffset = 0;
|
||||
_dataOffsetNibble = false;
|
||||
_patCode = 0;
|
||||
_patNum = 0;
|
||||
_priOn = false;
|
||||
_scrOn = false;
|
||||
_priColor = 4;
|
||||
_scrColor = 15;
|
||||
|
||||
while (_dataOffset < _dataSize) {
|
||||
byte curByte = getNextByte();
|
||||
|
||||
switch (curByte) {
|
||||
case 0xf0: // F0 is in all Troll's Tale pictures, but it is a no-op.
|
||||
break; // Confirmed in disassembly of opcode table.
|
||||
case 0xf1:
|
||||
draw_SetColor();
|
||||
_scrOn = true;
|
||||
break;
|
||||
case 0xf3: // F3 would impersonate opcode F0 (no-op) or FF (terminator)
|
||||
if (_stopOnF3)
|
||||
return;
|
||||
break;
|
||||
case 0xf8:
|
||||
yCorner(true); // skip extra (redundant) coordinates when parsing
|
||||
break;
|
||||
case 0xf9:
|
||||
xCorner(true); // skip extra (redundant) coordinates when parsing
|
||||
break;
|
||||
case 0xfa: // FA and FB are both used, but they are the same.
|
||||
case 0xfb: // Confirmed in disassembly of opcode table.
|
||||
draw_LineAbsolute();
|
||||
break;
|
||||
case 0xfe:
|
||||
draw_Fill();
|
||||
break;
|
||||
case 0xff: // end of data
|
||||
return;
|
||||
default:
|
||||
warning("Unknown picture opcode %02x at %04x", curByte, _dataOffset - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flood fills from a series of start positions.
|
||||
*
|
||||
* Troll's Tale contains two separate flood fill implementations to handle the
|
||||
* special case of drawing the Troll. The game sets a global before drawing to
|
||||
* to activate Troll mode. We implement this by overriding this method and
|
||||
* the check method.
|
||||
*/
|
||||
void PictureMgr_Troll::draw_Fill() {
|
||||
draw_SetColor();
|
||||
_scrOn = true;
|
||||
|
||||
byte x, y;
|
||||
if (_scrColor == 15) { // white
|
||||
// White flood fills are only allowed when drawing the Troll, otherwise they
|
||||
// are completely ignored. Several room pictures contain white flood fills.
|
||||
while (getNextCoordinates(x, y)) {
|
||||
if (_trollMode) {
|
||||
PictureMgr::draw_Fill(x, y);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// When not drawing the Troll, do a regular flood fill.
|
||||
// When drawing the Troll, first fill with white, and then fill normally.
|
||||
byte fillColor = _scrColor;
|
||||
while (getNextCoordinates(x, y)) {
|
||||
if (_trollMode) {
|
||||
_scrColor = 15; // white
|
||||
PictureMgr::draw_Fill(x, y);
|
||||
_scrColor = fillColor;
|
||||
}
|
||||
PictureMgr::draw_Fill(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if flood fill is allowed at a position.
|
||||
*
|
||||
* Troll's Tale contains two separate flood fill implementations to handle the
|
||||
* special case of drawing the Troll. The game sets a global before drawing to
|
||||
* to activate Troll mode.
|
||||
*
|
||||
* The Troll is a large picture with flood fills that is drawn over many busy
|
||||
* room pictures, and always in the same location. This is a problem because the
|
||||
* picture format is only meant to fill white areas. Sierra handled this by
|
||||
* reserving a color for the Troll's lines (11, light blue) and implementing a
|
||||
* second set of routines that fill white and treat the Troll's color as a
|
||||
* boundary, and sometimes white as well. When drawing the Troll, a non-white
|
||||
* fill is preceded by a special white fill to clear the area. This does not
|
||||
* work well if there are existing white pixels, and rooms do have these.
|
||||
* The Troll has incomplete fills in these rooms, but this is original behavior.
|
||||
* In some rooms, such as those with white checkered floors, the results are
|
||||
* so bad that Sierra added them to the list of rooms the Troll never visits.
|
||||
*
|
||||
* We implement Troll mode without a second flood fill algorithm; instead we
|
||||
* override the check method, and our AGI algorithm in the base class provides
|
||||
* the context so we know which of the two color checks to use.
|
||||
*/
|
||||
bool PictureMgr_Troll::draw_FillCheck(int16 x, int16 y, bool horizontalCheck) {
|
||||
if (_trollMode && _scrColor == 15) {
|
||||
if (!getGraphicsCoordinates(x, y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
byte screenColor = _gfx->getColor(x, y);
|
||||
|
||||
// when filling white during troll mode...
|
||||
if (horizontalCheck) {
|
||||
// horizontal checks only stop on troll line color
|
||||
return (screenColor != 11);
|
||||
} else {
|
||||
// all other checks stop on troll line color or white
|
||||
return (screenColor != 11) && (screenColor != 15);
|
||||
}
|
||||
}
|
||||
|
||||
return PictureMgr::draw_FillCheck(x, y, horizontalCheck);
|
||||
}
|
||||
|
||||
} // End of namespace Agi
|
||||
46
engines/agi/preagi/picture_troll.h
Normal file
46
engines/agi/preagi/picture_troll.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_PICTURE_TROLL_H
|
||||
#define AGI_PREAGI_PICTURE_TROLL_H
|
||||
|
||||
namespace Agi {
|
||||
|
||||
class PictureMgr_Troll : public PictureMgr {
|
||||
public:
|
||||
PictureMgr_Troll(AgiBase *agi, GfxMgr *gfx);
|
||||
|
||||
void drawPicture() override;
|
||||
|
||||
void draw_Fill() override;
|
||||
bool draw_FillCheck(int16 x, int16 y, bool horizontalCheck) override;
|
||||
|
||||
void setStopOnF3(bool stopOnF3) { _stopOnF3 = stopOnF3; }
|
||||
void setTrollMode(bool trollMode) { _trollMode = trollMode; }
|
||||
|
||||
private:
|
||||
bool _stopOnF3;
|
||||
bool _trollMode;
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif
|
||||
351
engines/agi/preagi/preagi.cpp
Normal file
351
engines/agi/preagi/preagi.cpp
Normal file
@@ -0,0 +1,351 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/mixer.h"
|
||||
#include "audio/softsynth/pcspk.h"
|
||||
|
||||
#include "common/debug-channels.h"
|
||||
#include "common/events.h"
|
||||
#include "common/random.h"
|
||||
|
||||
#include "agi/preagi/preagi.h"
|
||||
#include "agi/graphics.h"
|
||||
|
||||
namespace Agi {
|
||||
|
||||
PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) {
|
||||
|
||||
// Setup mixer
|
||||
syncSoundSettings();
|
||||
|
||||
memset(&_debug, 0, sizeof(struct AgiDebug));
|
||||
}
|
||||
|
||||
void PreAgiEngine::initialize() {
|
||||
initRenderMode();
|
||||
|
||||
_font = new GfxFont(this);
|
||||
_gfx = new GfxMgr(this, _font);
|
||||
|
||||
_font->init();
|
||||
|
||||
//_game._vm->_text->charAttrib_Set(15, 0);
|
||||
|
||||
_defaultColor = IDA_DEFAULT;
|
||||
|
||||
//_game._vm->_text->configureScreen(0); // hardcoded
|
||||
|
||||
_gfx->initVideo();
|
||||
|
||||
_speaker = new Audio::PCSpeaker();
|
||||
_speaker->init();
|
||||
|
||||
debugC(2, kDebugLevelMain, "Detect game");
|
||||
|
||||
// clear all resources and events
|
||||
for (int i = 0; i < MAX_DIRECTORY_ENTRIES; i++) {
|
||||
_game.pictures[i].reset();
|
||||
_game.sounds[i] = nullptr; // _game.sounds contains pointers now
|
||||
_game.dirPic[i].reset();
|
||||
_game.dirSound[i].reset();
|
||||
}
|
||||
}
|
||||
|
||||
PreAgiEngine::~PreAgiEngine() {
|
||||
delete _speaker;
|
||||
|
||||
delete _gfx;
|
||||
delete _font;
|
||||
}
|
||||
|
||||
int PreAgiEngine::rnd(int max) {
|
||||
return (_rnd->getRandomNumber(max - 1) + 1);
|
||||
}
|
||||
|
||||
// Screen functions
|
||||
void PreAgiEngine::clearScreen(int attr, bool overrideDefault) {
|
||||
if (overrideDefault)
|
||||
_defaultColor = attr;
|
||||
|
||||
_gfx->clearDisplay((attr & 0xF0) / 0x10);
|
||||
}
|
||||
|
||||
void PreAgiEngine::clearGfxScreen(int attr) {
|
||||
_gfx->drawDisplayRect(0, 0, DISPLAY_DEFAULT_WIDTH - 1, IDI_MAX_ROW_PIC * 8 - 1, (attr & 0xF0) / 0x10);
|
||||
}
|
||||
|
||||
byte PreAgiEngine::getWhite() const {
|
||||
switch (_renderMode) {
|
||||
case Common::kRenderCGA:
|
||||
return 3;
|
||||
case Common::kRenderHercA:
|
||||
case Common::kRenderHercG:
|
||||
return 1;
|
||||
default:
|
||||
return 15;
|
||||
}
|
||||
}
|
||||
|
||||
// String functions
|
||||
|
||||
void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
|
||||
if (attr == kColorDefault)
|
||||
attr = _defaultColor;
|
||||
|
||||
byte foreground = attr & 0x0f;
|
||||
byte background = attr >> 4;
|
||||
|
||||
// Simplistic CGA and Hercules mapping that handles all text
|
||||
// in Mickey and Winnie. Troll text is handled correctly in
|
||||
// graphics mode, but the original switched to CGA 16 color
|
||||
// text mode for some parts, and we are not doing that.
|
||||
switch (_renderMode) {
|
||||
case Common::kRenderCGA:
|
||||
// Map non-black text to white
|
||||
if (foreground != 0) {
|
||||
foreground = 3;
|
||||
}
|
||||
// Map white background to white
|
||||
if (background == 15) {
|
||||
background = 3;
|
||||
}
|
||||
break;
|
||||
case Common::kRenderHercA:
|
||||
case Common::kRenderHercG:
|
||||
// Map non-black text to amber/green
|
||||
if (foreground != 0) {
|
||||
foreground = 1;
|
||||
}
|
||||
// Map white background to amber/green,
|
||||
// all others to black
|
||||
if (background == 0x0f) {
|
||||
background = 1;
|
||||
} else {
|
||||
background = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const int stringLength = (int)strlen(buffer);
|
||||
for (int iChar = 0; iChar < stringLength; iChar++) {
|
||||
int code = buffer[iChar];
|
||||
|
||||
switch (code) {
|
||||
case '\n':
|
||||
case '\r': // winnie
|
||||
case 0x8D:
|
||||
if (++row == 200 / 8) return;
|
||||
col = 0;
|
||||
break;
|
||||
|
||||
case '|':
|
||||
// swap attribute nibbles
|
||||
break;
|
||||
|
||||
default:
|
||||
_gfx->drawCharacter(row, col, code, foreground, background, false);
|
||||
|
||||
if (++col == 320 / 8) {
|
||||
col = 0;
|
||||
if (++row == 200 / 8) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreAgiEngine::clearTextArea() {
|
||||
int start = IDI_MAX_ROW_PIC;
|
||||
|
||||
if (getGameID() == GID_TROLL)
|
||||
start = 21;
|
||||
|
||||
for (int row = start; row < 200 / 8; row++) {
|
||||
clearRow(row);
|
||||
}
|
||||
}
|
||||
|
||||
void PreAgiEngine::clearRow(int row) {
|
||||
drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces
|
||||
}
|
||||
|
||||
void PreAgiEngine::printStr(const char *szMsg) {
|
||||
clearTextArea();
|
||||
drawStr(21, 0, IDA_DEFAULT, szMsg);
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
void PreAgiEngine::XOR80(char *buffer) {
|
||||
for (size_t i = 0; i < strlen(buffer); i++)
|
||||
if (buffer[i] & 0x80)
|
||||
buffer[i] ^= 0x80;
|
||||
}
|
||||
|
||||
void PreAgiEngine::printStrXOR(char *szMsg) {
|
||||
XOR80(szMsg);
|
||||
printStr(szMsg);
|
||||
}
|
||||
|
||||
// Input functions
|
||||
|
||||
int PreAgiEngine::getSelection(SelectionTypes type) {
|
||||
Common::Event event;
|
||||
|
||||
while (!shouldQuit()) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_RETURN_TO_LAUNCHER:
|
||||
case Common::EVENT_QUIT:
|
||||
return 0;
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
return 0;
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
if (type == kSelYesNo || type == kSelAnyKey || type == kSelBackspace)
|
||||
return 1;
|
||||
break;
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags & Common::KBD_NON_STICKY) {
|
||||
break;
|
||||
}
|
||||
switch (event.kbd.keycode) {
|
||||
case Common::KEYCODE_y:
|
||||
if (type == kSelYesNo)
|
||||
return 1;
|
||||
break;
|
||||
case Common::KEYCODE_n:
|
||||
if (type == kSelYesNo)
|
||||
return 0;
|
||||
break;
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
if (type == kSelNumber || type == kSelAnyKey)
|
||||
return 0;
|
||||
break;
|
||||
case Common::KEYCODE_1:
|
||||
case Common::KEYCODE_2:
|
||||
case Common::KEYCODE_3:
|
||||
case Common::KEYCODE_4:
|
||||
case Common::KEYCODE_5:
|
||||
case Common::KEYCODE_6:
|
||||
case Common::KEYCODE_7:
|
||||
case Common::KEYCODE_8:
|
||||
case Common::KEYCODE_9:
|
||||
if (type == kSelNumber)
|
||||
return event.kbd.keycode - Common::KEYCODE_1 + 1;
|
||||
break;
|
||||
case Common::KEYCODE_SPACE:
|
||||
if (type == kSelSpace)
|
||||
return 1;
|
||||
break;
|
||||
case Common::KEYCODE_BACKSPACE:
|
||||
if (type == kSelBackspace)
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (type == kSelYesNo) {
|
||||
return 2;
|
||||
} else if (type == kSelNumber) {
|
||||
return 10;
|
||||
} else if (type == kSelAnyKey || type == kSelBackspace) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool PreAgiEngine::playSpeakerNote(int16 frequency, int32 length, WaitOptions options) {
|
||||
// play note, unless this is a pause
|
||||
if (frequency != 0) {
|
||||
_speaker->play(Audio::PCSpeaker::kWaveFormSquare, frequency, length);
|
||||
}
|
||||
|
||||
// wait for note length
|
||||
bool completed = wait(length, options);
|
||||
|
||||
// stop note if the wait was interrupted
|
||||
if (!completed) {
|
||||
if (frequency != 0) {
|
||||
_speaker->stop();
|
||||
}
|
||||
}
|
||||
|
||||
return completed;
|
||||
}
|
||||
|
||||
// A wait function that updates the screen, optionally allows events to be
|
||||
// processed, and optionally allows keyboard and mouse events to interrupt
|
||||
// the wait. Processing events keeps the program window responsive, but for
|
||||
// very short delays it may be better to not process events so that they
|
||||
// are buffered and not lost.
|
||||
bool PreAgiEngine::wait(uint32 delay, WaitOptions options) {
|
||||
Common::Event event;
|
||||
uint32 startTime = _system->getMillis();
|
||||
|
||||
bool processEvents = (options & kWaitProcessEvents) != 0;
|
||||
bool allowInterrupt = (options == kWaitAllowInterrupt);
|
||||
|
||||
while (!shouldQuit()) {
|
||||
// process events
|
||||
if (processEvents) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// don't interrupt if a modifier is pressed
|
||||
if (event.kbd.flags & Common::KBD_NON_STICKY) {
|
||||
continue;
|
||||
}
|
||||
// fall through
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
if (!allowInterrupt) {
|
||||
continue;
|
||||
}
|
||||
// fall through
|
||||
case Common::EVENT_RETURN_TO_LAUNCHER:
|
||||
case Common::EVENT_QUIT:
|
||||
return false; // interrupted by quit or input
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_system->getMillis() - startTime >= delay) {
|
||||
return true; // delay completed
|
||||
}
|
||||
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
|
||||
return false; // interrupted by quit
|
||||
}
|
||||
|
||||
} // End of namespace Agi
|
||||
120
engines/agi/preagi/preagi.h
Normal file
120
engines/agi/preagi/preagi.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_PREAGI_H
|
||||
#define AGI_PREAGI_PREAGI_H
|
||||
|
||||
#include "agi/agi.h"
|
||||
|
||||
namespace Audio {
|
||||
class PCSpeaker;
|
||||
}
|
||||
|
||||
namespace Agi {
|
||||
|
||||
// default attributes
|
||||
#define IDA_DEFAULT 0x0F
|
||||
#define IDA_DEFAULT_REV 0xF0
|
||||
|
||||
#define IDI_SND_OSCILLATOR_FREQUENCY 1193180
|
||||
#define IDI_SND_TIMER_RESOLUTION 0.0182
|
||||
|
||||
#define kColorDefault 0x1337
|
||||
|
||||
#define IDI_MAX_ROW_PIC 20
|
||||
|
||||
enum SelectionTypes {
|
||||
kSelYesNo,
|
||||
kSelNumber,
|
||||
kSelSpace,
|
||||
kSelAnyKey,
|
||||
kSelBackspace
|
||||
};
|
||||
|
||||
// Options for controlling behavior during waits and sound playback
|
||||
enum WaitOptions {
|
||||
kWaitBlock = 0x00, // no event processing, cannot be interrupted
|
||||
kWaitProcessEvents = 0x01, // process events, stops on quit
|
||||
kWaitAllowInterrupt = 0x03 // process events, stops on input or quit
|
||||
};
|
||||
|
||||
class PreAgiEngine : public AgiBase {
|
||||
int _gameId;
|
||||
|
||||
protected:
|
||||
void initialize() override;
|
||||
|
||||
int getKeypress() override { return 0; }
|
||||
bool isKeypress() override { return false; }
|
||||
void clearKeyQueue() override {}
|
||||
|
||||
PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
|
||||
~PreAgiEngine() override;
|
||||
int getGameId() const { return _gameId; }
|
||||
|
||||
void clearImageStack() override {}
|
||||
void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
|
||||
int16 p4, int16 p5, int16 p6, int16 p7) override {}
|
||||
void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
|
||||
int16 p4, int16 p5, int16 p6, int16 p7) override {}
|
||||
void releaseImageStack() override {}
|
||||
int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; }
|
||||
int loadGame(const Common::String &fileName, bool checkId = true) { return -1; }
|
||||
|
||||
// Game
|
||||
Common::String getTargetName() const { return _targetName; }
|
||||
|
||||
// Screen
|
||||
void clearScreen(int attr, bool overrideDefault = true);
|
||||
void clearGfxScreen(int attr);
|
||||
void setDefaultTextColor(int attr) { _defaultColor = attr; }
|
||||
byte getWhite() const;
|
||||
|
||||
// Keyboard
|
||||
int getSelection(SelectionTypes type);
|
||||
|
||||
// Random number between 1 and max. Example: rnd(2) returns 1 or 2.
|
||||
int rnd(int max);
|
||||
|
||||
// Text
|
||||
void drawStr(int row, int col, int attr, const char *buffer);
|
||||
void clearTextArea();
|
||||
void clearRow(int row);
|
||||
static void XOR80(char *buffer);
|
||||
void printStr(const char *szMsg);
|
||||
void printStrXOR(char *szMsg);
|
||||
|
||||
// Saved Games
|
||||
Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
|
||||
|
||||
bool playSpeakerNote(int16 frequency, int32 length, WaitOptions options);
|
||||
bool wait(uint32 delay, WaitOptions options = kWaitProcessEvents);
|
||||
|
||||
private:
|
||||
int _defaultColor;
|
||||
|
||||
Audio::PCSpeaker *_speaker;
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
|
||||
#endif
|
||||
767
engines/agi/preagi/troll.cpp
Normal file
767
engines/agi/preagi/troll.cpp
Normal file
@@ -0,0 +1,767 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "agi/preagi/preagi.h"
|
||||
#include "agi/preagi/picture_troll.h"
|
||||
#include "agi/preagi/troll.h"
|
||||
#include "agi/graphics.h"
|
||||
|
||||
#include "common/events.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
|
||||
namespace Agi {
|
||||
|
||||
TrollEngine::TrollEngine(OSystem *syst, const AGIGameDescription *gameDesc) : PreAgiEngine(syst, gameDesc) {
|
||||
_picture = nullptr;
|
||||
}
|
||||
|
||||
TrollEngine::~TrollEngine() {
|
||||
delete _picture;
|
||||
}
|
||||
|
||||
// User Interface
|
||||
|
||||
void TrollEngine::pressAnyKey(int col) {
|
||||
drawStr(24, col, kColorDefault, IDS_TRO_PRESSANYKEY);
|
||||
_system->updateScreen();
|
||||
getSelection(kSelAnyKey);
|
||||
}
|
||||
|
||||
void TrollEngine::drawMenu(const char *szMenu, int iSel) {
|
||||
clearTextArea();
|
||||
drawStr(21, 0, kColorDefault, szMenu);
|
||||
drawStr(22 + iSel, 0, kColorDefault, " *");
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
bool TrollEngine::getMenuSel(const char *szMenu, int *iSel, int nSel) {
|
||||
Common::Event event;
|
||||
int y;
|
||||
|
||||
drawMenu(szMenu, *iSel);
|
||||
|
||||
while (!shouldQuit()) {
|
||||
while (_system->getEventManager()->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_RETURN_TO_LAUNCHER:
|
||||
case Common::EVENT_QUIT:
|
||||
return 0;
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
y = event.mouse.y / 8;
|
||||
|
||||
if (y >= 22)
|
||||
if (nSel > y - 22)
|
||||
*iSel = y - 22;
|
||||
|
||||
drawMenu(szMenu, *iSel);
|
||||
break;
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
return true;
|
||||
case Common::EVENT_KEYDOWN:
|
||||
switch (event.kbd.keycode) {
|
||||
case Common::KEYCODE_t:
|
||||
case Common::KEYCODE_f:
|
||||
inventory();
|
||||
|
||||
return false;
|
||||
case Common::KEYCODE_DOWN:
|
||||
case Common::KEYCODE_SPACE:
|
||||
*iSel += 1;
|
||||
|
||||
if (*iSel == nSel)
|
||||
*iSel = IDI_TRO_SEL_OPTION_1;
|
||||
|
||||
drawMenu(szMenu, *iSel);
|
||||
break;
|
||||
case Common::KEYCODE_UP:
|
||||
*iSel -= 1;
|
||||
|
||||
if (*iSel == IDI_TRO_SEL_OPTION_1 - 1)
|
||||
*iSel = nSel - 1;
|
||||
|
||||
drawMenu(szMenu, *iSel);
|
||||
break;
|
||||
case Common::KEYCODE_RETURN:
|
||||
case Common::KEYCODE_KP_ENTER:
|
||||
return true;
|
||||
case Common::KEYCODE_s:
|
||||
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
|
||||
if (_soundOn) {
|
||||
playTune(2, 1);
|
||||
_soundOn = !_soundOn;
|
||||
} else {
|
||||
_soundOn = !_soundOn;
|
||||
playTune(3, 1);
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Graphics
|
||||
|
||||
void TrollEngine::drawPic(int iPic, bool f3IsCont, bool clr, bool troll) {
|
||||
if (clr) {
|
||||
clearScreen(0x0f, false);
|
||||
}
|
||||
|
||||
// draw the frame picture
|
||||
_picture->setStopOnF3(false);
|
||||
_picture->setTrollMode(false);
|
||||
_picture->decodePictureFromBuffer(_gameData + IDO_TRO_FRAMEPIC, 4096, clr, IDI_TRO_PIC_WIDTH, IDI_TRO_PIC_HEIGHT);
|
||||
|
||||
// draw the picture
|
||||
_picture->setStopOnF3(!f3IsCont);
|
||||
_picture->setTrollMode(troll);
|
||||
_picture->decodePictureFromBuffer(_gameData + _pictureOffsets[iPic], 4096, false, IDI_TRO_PIC_WIDTH, IDI_TRO_PIC_HEIGHT);
|
||||
|
||||
_picture->showPicture(0, 0, IDI_TRO_PIC_WIDTH, IDI_TRO_PIC_HEIGHT);
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
// Game Logic
|
||||
|
||||
void TrollEngine::inventory() {
|
||||
clearScreen(0x07);
|
||||
drawStr(1, 12, kColorDefault, IDS_TRO_TREASURE_0);
|
||||
drawStr(2, 12, kColorDefault, IDS_TRO_TREASURE_1);
|
||||
|
||||
for (int i = 0; i < IDI_TRO_MAX_TREASURE - _treasuresLeft; i++) {
|
||||
int n = _inventory[i] - 1;
|
||||
drawStr(2 + i, 10, _items[n].bg << 4 | 0x0f, Common::String::format(" %2d ", i + 1).c_str());
|
||||
drawStr(2 + i, 14, _items[n].bg << 4 | _items[n].fg, _items[n].name);
|
||||
}
|
||||
|
||||
switch (_treasuresLeft) {
|
||||
case 1:
|
||||
drawStr(20, 10, kColorDefault, Common::String::format(IDS_TRO_TREASURE_5, _treasuresLeft).c_str());
|
||||
break;
|
||||
case 0:
|
||||
drawStr(20, 1, kColorDefault, IDS_TRO_TREASURE_6);
|
||||
break;
|
||||
case IDI_TRO_MAX_TREASURE:
|
||||
drawStr(3, 17, kColorDefault, IDS_TRO_TREASURE_2);
|
||||
break;
|
||||
default:
|
||||
drawStr(20, 10, kColorDefault, Common::String::format(IDS_TRO_TREASURE_4, _treasuresLeft).c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
pressAnyKey(6);
|
||||
}
|
||||
|
||||
void TrollEngine::waitAnyKeyIntro() {
|
||||
Common::Event event;
|
||||
int iMsg = 0;
|
||||
|
||||
while (!shouldQuit()) {
|
||||
while (_system->getEventManager()->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// don't interrupt if a modifier is pressed
|
||||
if (event.kbd.flags & Common::KBD_NON_STICKY) {
|
||||
continue;
|
||||
}
|
||||
// fall through
|
||||
case Common::EVENT_RETURN_TO_LAUNCHER:
|
||||
case Common::EVENT_QUIT:
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (iMsg) {
|
||||
case 200:
|
||||
iMsg = 0;
|
||||
// fall through
|
||||
case 0:
|
||||
drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_2);
|
||||
break;
|
||||
case 100:
|
||||
drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
iMsg++;
|
||||
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
}
|
||||
|
||||
void TrollEngine::credits() {
|
||||
clearScreen(0x07);
|
||||
|
||||
drawStr(1, 2, kColorDefault, IDS_TRO_CREDITS_0);
|
||||
|
||||
int color = 10;
|
||||
char str[2];
|
||||
|
||||
str[1] = 0;
|
||||
|
||||
for (uint i = 0; i < strlen(IDS_TRO_CREDITS_1); i++) {
|
||||
str[0] = IDS_TRO_CREDITS_1[i];
|
||||
drawStr(7, 19 + i, color++, str);
|
||||
if (color > 15)
|
||||
color = 9;
|
||||
}
|
||||
|
||||
drawStr(8, 19, kColorDefault, IDS_TRO_CREDITS_2);
|
||||
|
||||
drawStr(13, 11, 9, IDS_TRO_CREDITS_3);
|
||||
drawStr(15, 8, 10, IDS_TRO_CREDITS_4);
|
||||
drawStr(17, 7, 12, IDS_TRO_CREDITS_5);
|
||||
drawStr(19, 2, 14, IDS_TRO_CREDITS_6);
|
||||
|
||||
_system->updateScreen();
|
||||
|
||||
pressAnyKey();
|
||||
}
|
||||
|
||||
void TrollEngine::tutorial() {
|
||||
bool done = false;
|
||||
int iSel = 0;
|
||||
//char szTreasure[16] = {0};
|
||||
|
||||
while (!shouldQuit()) {
|
||||
clearScreen(0xFF);
|
||||
|
||||
printStr(IDS_TRO_TUTORIAL_0);
|
||||
getSelection(kSelSpace);
|
||||
|
||||
clearScreen(0x55);
|
||||
setDefaultTextColor(0x0F);
|
||||
|
||||
done = false;
|
||||
while (!done && !shouldQuit()) {
|
||||
getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION);
|
||||
|
||||
switch (iSel) {
|
||||
case IDI_TRO_SEL_OPTION_1:
|
||||
clearScreen(0x22, false);
|
||||
_system->updateScreen();
|
||||
break;
|
||||
case IDI_TRO_SEL_OPTION_2:
|
||||
clearScreen(0x00, false);
|
||||
_system->updateScreen();
|
||||
break;
|
||||
case IDI_TRO_SEL_OPTION_3:
|
||||
done = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// do you need more practice ?
|
||||
clearScreen(0x4F);
|
||||
drawStr(7, 4, kColorDefault, IDS_TRO_TUTORIAL_5);
|
||||
drawStr(9, 4, kColorDefault, IDS_TRO_TUTORIAL_6);
|
||||
_system->updateScreen();
|
||||
|
||||
if (!getSelection(kSelYesNo))
|
||||
break;
|
||||
}
|
||||
|
||||
// show info texts
|
||||
clearScreen(0x5F);
|
||||
drawStr(4, 1, kColorDefault, IDS_TRO_TUTORIAL_7);
|
||||
drawStr(5, 1, kColorDefault, IDS_TRO_TUTORIAL_8);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
clearScreen(0x2F);
|
||||
drawStr(6, 1, kColorDefault, IDS_TRO_TUTORIAL_9);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
clearScreen(0x19);
|
||||
drawStr(7, 1, kColorDefault, IDS_TRO_TUTORIAL_10);
|
||||
drawStr(8, 1, kColorDefault, IDS_TRO_TUTORIAL_11);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
clearScreen(0x6E);
|
||||
drawStr(9, 1, kColorDefault, IDS_TRO_TUTORIAL_12);
|
||||
drawStr(10, 1, kColorDefault, IDS_TRO_TUTORIAL_13);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
clearScreen(0x4C);
|
||||
drawStr(11, 1, kColorDefault, IDS_TRO_TUTORIAL_14);
|
||||
drawStr(12, 1, kColorDefault, IDS_TRO_TUTORIAL_15);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
clearScreen(0x5D);
|
||||
drawStr(13, 1, kColorDefault, IDS_TRO_TUTORIAL_16);
|
||||
drawStr(14, 1, kColorDefault, IDS_TRO_TUTORIAL_17);
|
||||
drawStr(15, 1, kColorDefault, IDS_TRO_TUTORIAL_18);
|
||||
_system->updateScreen();
|
||||
pressAnyKey();
|
||||
|
||||
// show treasures
|
||||
clearScreen(0x2A);
|
||||
drawStr(2, 1, kColorDefault, IDS_TRO_TUTORIAL_19);
|
||||
for (int i = 0; i < IDI_TRO_MAX_TREASURE; i++)
|
||||
drawStr(19 - i, 11, kColorDefault, _items[i].name);
|
||||
|
||||
_system->updateScreen();
|
||||
|
||||
pressAnyKey();
|
||||
}
|
||||
|
||||
void TrollEngine::intro() {
|
||||
// sierra on-line presents
|
||||
clearScreen(0x2F);
|
||||
drawStr(9, 10, kColorDefault, IDS_TRO_INTRO_0);
|
||||
drawStr(14, 15, kColorDefault, IDS_TRO_INTRO_1);
|
||||
wait(3200);
|
||||
|
||||
CursorMan.showMouse(true);
|
||||
|
||||
// Draw logo
|
||||
setDefaultTextColor(0x0f);
|
||||
drawPic(45, false, true);
|
||||
_system->updateScreen();
|
||||
|
||||
// wait for keypress and alternate message
|
||||
waitAnyKeyIntro();
|
||||
|
||||
// have you played this game before?
|
||||
drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_4);
|
||||
drawStr(23, 6, kColorDefault, IDS_TRO_INTRO_5);
|
||||
_system->updateScreen();
|
||||
|
||||
if (!getSelection(kSelYesNo))
|
||||
tutorial();
|
||||
|
||||
credits();
|
||||
}
|
||||
|
||||
void TrollEngine::gameOver() {
|
||||
// We do a check to see if the game should quit. Without this, the game show the picture, plays the
|
||||
// music, and then quits. So if the game is quitting, we shouldn't run the "game over" part.
|
||||
if (shouldQuit())
|
||||
return;
|
||||
|
||||
char szMoves[40];
|
||||
|
||||
clearTextArea();
|
||||
drawPic(42, true, true);
|
||||
|
||||
playTune(4, 25);
|
||||
|
||||
printUserMessage(16);
|
||||
|
||||
printUserMessage(33);
|
||||
|
||||
clearTextArea();
|
||||
|
||||
drawPic(46, true, true);
|
||||
|
||||
Common::sprintf_s(szMoves, IDS_TRO_GAMEOVER_0, _moves);
|
||||
drawStr(21, 1, kColorDefault, szMoves);
|
||||
drawStr(22, 1, kColorDefault, IDS_TRO_GAMEOVER_1);
|
||||
_system->updateScreen();
|
||||
|
||||
pressAnyKey();
|
||||
}
|
||||
|
||||
void TrollEngine::drawTroll() {
|
||||
for (int i = 0; i < IDI_TRO_NUM_NONTROLL; i++)
|
||||
if (_currentRoom == _nonTrollRooms[i]) {
|
||||
_isTrollAway = true;
|
||||
return;
|
||||
}
|
||||
|
||||
drawPic(43, false, false, true);
|
||||
}
|
||||
|
||||
int TrollEngine::drawRoom(char *menu) {
|
||||
bool contFlag = false;
|
||||
|
||||
if (_currentRoom == 1) {
|
||||
clearScreen(0x00, false);
|
||||
} else {
|
||||
|
||||
if (_currentRoom != 42) {
|
||||
if (_roomPicDeltas[_currentRoom]) {
|
||||
contFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
drawPic(_currentRoom, contFlag, true);
|
||||
_system->updateScreen();
|
||||
|
||||
if (_currentRoom == 42) {
|
||||
drawPic(44, false, false); // don't clear
|
||||
} else {
|
||||
if (!_isTrollAway) {
|
||||
drawTroll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_system->updateScreen();
|
||||
|
||||
int n = 0;
|
||||
menu[0] = ' '; // leading space
|
||||
menu[1] = '\0';
|
||||
strncat(menu, (char *)_gameData + _locMessagesIdx[_currentRoom], 39);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (_roomDescs[_roomPicture - 1].options[i]) {
|
||||
strncat(menu, Common::String::format(" %d.", i + 1).c_str(), 4);
|
||||
|
||||
strncat(menu, (char *)_gameData + _options[_roomDescs[_roomPicture - 1].options[i] - 1], 35);
|
||||
menu[(i + 2) * 40 - 1] = ' ';
|
||||
menu[(i + 2) * 40] = '\0';
|
||||
|
||||
n = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void TrollEngine::playTune(int tune, int len) {
|
||||
if (!_soundOn)
|
||||
return;
|
||||
|
||||
int ptr = _tunes[tune - 1];
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
int freq = READ_LE_UINT16(_gameData + ptr);
|
||||
ptr += 2;
|
||||
int duration = READ_LE_UINT16(_gameData + ptr);
|
||||
ptr += 2;
|
||||
|
||||
// Play note without processing events.
|
||||
// The sounds are so short in this game that we don't
|
||||
// need to process events while playing notes.
|
||||
playSpeakerNote(freq, duration, kWaitBlock);
|
||||
}
|
||||
}
|
||||
|
||||
void TrollEngine::pickupTreasure(int treasureId) {
|
||||
_inventory[IDI_TRO_MAX_TREASURE - _treasuresLeft] = treasureId;
|
||||
|
||||
if (_currentRoom != 24) {
|
||||
clearTextArea();
|
||||
drawPic(_currentRoom, false, true);
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
printUserMessage(treasureId + 16);
|
||||
|
||||
clearTextArea();
|
||||
|
||||
_treasuresLeft--;
|
||||
|
||||
switch (_treasuresLeft) {
|
||||
case 1:
|
||||
drawStr(22, 1, kColorDefault, IDS_TRO_TREASURE_7);
|
||||
break;
|
||||
case 0:
|
||||
drawStr(22, 1, kColorDefault, IDS_TRO_TREASURE_8);
|
||||
drawStr(23, 4, kColorDefault, IDS_TRO_TREASURE_9);
|
||||
|
||||
_roomStates[6] = 1;
|
||||
|
||||
_locMessagesIdx[6] = IDO_TRO_ALLTREASURES;
|
||||
break;
|
||||
default:
|
||||
drawStr(22, 1, kColorDefault, Common::String::format(IDS_TRO_TREASURE_3, _treasuresLeft).c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
pressAnyKey();
|
||||
}
|
||||
|
||||
void TrollEngine::printUserMessage(int msgId) {
|
||||
int i;
|
||||
|
||||
clearTextArea();
|
||||
|
||||
for (i = 0; i < _userMessages[msgId - 1].num; i++) {
|
||||
drawStr(21 + i, 1, kColorDefault, _userMessages[msgId - 1].msg[i]);
|
||||
}
|
||||
|
||||
if (msgId == 34) {
|
||||
for (i = 0; i < 2; i++)
|
||||
playTune(5, 11);
|
||||
}
|
||||
pressAnyKey();
|
||||
}
|
||||
|
||||
void TrollEngine::gameLoop() {
|
||||
bool done = false;
|
||||
char menu[160 + 5];
|
||||
int currentOption, numberOfOptions;
|
||||
int roomParam;
|
||||
int haveFlashlight;
|
||||
|
||||
_moves = 0;
|
||||
_roomPicture = 1;
|
||||
_treasuresLeft = IDI_TRO_MAX_TREASURE;
|
||||
haveFlashlight = false;
|
||||
_currentRoom = 0;
|
||||
_isTrollAway = true;
|
||||
_soundOn = true;
|
||||
|
||||
memset(_roomStates, 0, sizeof(_roomStates));
|
||||
|
||||
memset(_inventory, 0, sizeof(_inventory));
|
||||
|
||||
while (!done && !shouldQuit()) {
|
||||
currentOption = 0;
|
||||
|
||||
numberOfOptions = drawRoom(menu);
|
||||
|
||||
if (getMenuSel(menu, ¤tOption, numberOfOptions)) {
|
||||
_moves++;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
roomParam = _roomDescs[_roomPicture - 1].roomDescIndex[currentOption];
|
||||
|
||||
switch (_roomDescs[_roomPicture - 1].optionTypes[currentOption]) {
|
||||
case OT_FLASHLIGHT:
|
||||
if (!haveFlashlight) {
|
||||
printUserMessage(13);
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case OT_GO:
|
||||
_currentRoom = roomParam;
|
||||
_roomPicture = _roomPicStartIdx[_currentRoom];
|
||||
_roomPicture += _roomStates[_currentRoom];
|
||||
|
||||
if (_currentRoom < 6 || _treasuresLeft == 0) {
|
||||
_isTrollAway = true;
|
||||
} else { // make odd 1:3
|
||||
_isTrollAway = (rnd(3) != 2);
|
||||
}
|
||||
break;
|
||||
case OT_GET:
|
||||
if (!_isTrollAway) {
|
||||
printUserMessage(34);
|
||||
} else {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
playTune(1, 3);
|
||||
// delayMillis()
|
||||
}
|
||||
|
||||
_roomStates[_currentRoom] = 1;
|
||||
_roomPicDeltas[_currentRoom] = 0;
|
||||
|
||||
_roomPicture++;
|
||||
|
||||
if (_roomConnects[roomParam - 1] != 0xff) {
|
||||
_roomStates[_roomConnects[roomParam - 1]] = 1;
|
||||
}
|
||||
|
||||
if (roomParam == 1)
|
||||
haveFlashlight = true;
|
||||
|
||||
_locMessagesIdx[_currentRoom] = IDO_TRO_LOCMESSAGES +
|
||||
(roomParam + 42) * 39;
|
||||
|
||||
pickupTreasure(roomParam);
|
||||
}
|
||||
break;
|
||||
case OT_DO:
|
||||
if (roomParam != 16) {
|
||||
printUserMessage(roomParam);
|
||||
break;
|
||||
}
|
||||
|
||||
done = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TrollEngine::fillOffsets() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < IDI_TRO_PICNUM; i++)
|
||||
_pictureOffsets[i] = READ_LE_UINT16(_gameData + IDO_TRO_PIC_START + i * 2);
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_OPTIONS; i++)
|
||||
_options[i] = READ_LE_UINT16(_gameData + IDO_TRO_OPTIONS + i * 2);
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_NUMROOMS; i++) {
|
||||
_roomPicStartIdx[i] = _gameData[IDO_TRO_PICSTARTIDX + i];
|
||||
_roomPicDeltas[i] = _gameData[IDO_TRO_ROOMPICDELTAS + i];
|
||||
_roomConnects[i] = _gameData[IDO_TRO_ROOMCONNECTS + i];
|
||||
}
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_LOCDESCS; i++)
|
||||
_locMessagesIdx[i] = IDO_TRO_LOCMESSAGES + i * 39;
|
||||
|
||||
int start = READ_LE_UINT16(_gameData + IDO_TRO_ROOMDESCS);
|
||||
int ptr;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_ROOMDESCS; i++, start += 2) {
|
||||
ptr = READ_LE_UINT16(_gameData + start);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
_roomDescs[i].options[j] = _gameData[ptr++];
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
switch (_gameData[ptr++]) {
|
||||
case 0:
|
||||
_roomDescs[i].optionTypes[j] = OT_GO;
|
||||
break;
|
||||
case 1:
|
||||
_roomDescs[i].optionTypes[j] = OT_GET;
|
||||
break;
|
||||
case 2:
|
||||
_roomDescs[i].optionTypes[j] = OT_DO;
|
||||
break;
|
||||
case 3:
|
||||
_roomDescs[i].optionTypes[j] = OT_FLASHLIGHT;
|
||||
break;
|
||||
default:
|
||||
error("Bad data @ (%x) %d", ptr - 1, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
_roomDescs[i].roomDescIndex[j] = _gameData[ptr++];
|
||||
}
|
||||
|
||||
start = IDO_TRO_USERMESSAGES;
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_USERMSGS; i++, start += 2) {
|
||||
ptr = READ_LE_UINT16(_gameData + start);
|
||||
|
||||
_userMessages[i].num = _gameData[ptr++];
|
||||
|
||||
for (j = 0; j < _userMessages[i].num; j++, ptr += 39) {
|
||||
memcpy(_userMessages[i].msg[j], _gameData + ptr, 39);
|
||||
_userMessages[i].msg[j][39] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
start = IDO_TRO_ITEMS;
|
||||
|
||||
for (i = 0; i < IDI_TRO_MAX_TREASURE; i++, start += 2) {
|
||||
ptr = READ_LE_UINT16(_gameData + start);
|
||||
_items[i].bg = _gameData[ptr++];
|
||||
_items[i].fg = _gameData[ptr++];
|
||||
memcpy(_items[i].name, _gameData + ptr, 15);
|
||||
_items[i].name[15] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < IDI_TRO_NUM_NONTROLL; i++)
|
||||
_nonTrollRooms[i] = _gameData[IDO_TRO_NONTROLLROOMS + i];
|
||||
|
||||
_tunes[0] = 0x3BFD;
|
||||
_tunes[1] = 0x3C09;
|
||||
_tunes[2] = 0x3C0D;
|
||||
_tunes[3] = 0x3C11;
|
||||
_tunes[4] = 0x3C79;
|
||||
_tunes[5] = 0x3CA5;
|
||||
}
|
||||
|
||||
// Init
|
||||
|
||||
void TrollEngine::init() {
|
||||
_picture = new PictureMgr_Troll(this, _gfx);
|
||||
//SetScreenPar(320, 200, (char *)ibm_fontdata);
|
||||
|
||||
const int gaps[] = { 0x3A40, 0x4600, 0x4800, 0x5800, 0x5a00, 0x6a00,
|
||||
0x6c00, 0x7400, 0x7600, 0x7c00, 0x7e00, 0x8e00,
|
||||
0x9000, 0xa000, 0xa200, 0xb200, 0xb400, 0xc400,
|
||||
0xc600, 0xd600, 0xd800, 0xe800, 0xea00, 0xfa00,
|
||||
0xfc00, 0x10c00, 0x10e00, 0x11e00, 0x12000, 0x13000
|
||||
};
|
||||
|
||||
Common::File infile;
|
||||
if (!infile.open(IDA_TRO_BINNAME))
|
||||
return;
|
||||
|
||||
_gameData = (byte *)malloc(0xD9C0);
|
||||
|
||||
bool flip = true;
|
||||
byte *ptr = _gameData;
|
||||
int diff;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(gaps) - 1; i++) {
|
||||
diff = gaps[i + 1] - gaps[i];
|
||||
|
||||
if (flip) {
|
||||
infile.seek(gaps[i]);
|
||||
infile.read(ptr, diff);
|
||||
ptr += diff;
|
||||
} else {
|
||||
}
|
||||
flip = !flip;
|
||||
}
|
||||
|
||||
// One sector is off
|
||||
infile.seek(0x18470);
|
||||
infile.read(_gameData + 15632, 592);
|
||||
|
||||
infile.close();
|
||||
|
||||
fillOffsets();
|
||||
}
|
||||
|
||||
Common::Error TrollEngine::go() {
|
||||
init();
|
||||
|
||||
while (!shouldQuit()) {
|
||||
intro();
|
||||
gameLoop();
|
||||
gameOver();
|
||||
}
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // End of namespace Agi
|
||||
228
engines/agi/preagi/troll.h
Normal file
228
engines/agi/preagi/troll.h
Normal file
@@ -0,0 +1,228 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_TROLL_H
|
||||
#define AGI_PREAGI_TROLL_H
|
||||
|
||||
namespace Agi {
|
||||
|
||||
// strings
|
||||
|
||||
#define IDS_TRO_DISK "ERROR ERROR !"
|
||||
#define IDS_TRO_PATH_PIC "%s"
|
||||
|
||||
#define IDS_TRO_PRESSANYKEY "PRESS ANY KEY TO CONTINUE:"
|
||||
|
||||
#define IDS_TRO_INTRO_0 "SIERRA ON-LINE INC."
|
||||
#define IDS_TRO_INTRO_1 "Presents :"
|
||||
#define IDS_TRO_INTRO_2 "Copyright 1984 Sierra On-Line Inc."
|
||||
#define IDS_TRO_INTRO_3 " Press any key to continue. "
|
||||
#define IDS_TRO_INTRO_4 "HAVE YOU PLAYED THIS GAME BEFORE ?"
|
||||
#define IDS_TRO_INTRO_5 "PRESS <Y> OR <N>"
|
||||
|
||||
#define IDS_TRO_TUTORIAL_0 " First press the <space bar>.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n *3. SEE a SURPRISE, and then more."
|
||||
#define IDS_TRO_TUTORIAL_1 " Press <return> to make your choice.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n 3. SEE a SURPRISE, and then more."
|
||||
//#define IDS_TRO_TUTORIAL_0 "First press the <space bar>."
|
||||
//#define IDS_TRO_TUTORIAL_1 "1. Turn the screen GREEN."
|
||||
//#define IDS_TRO_TUTORIAL_2 "2. Turn the screen BLACK."
|
||||
//#define IDS_TRO_TUTORIAL_3 "3. SEE a SURPRISE, and then more."
|
||||
//#define IDS_TRO_TUTORIAL_4 "Press <return> to make your choice."
|
||||
#define IDS_TRO_TUTORIAL_5 "Would you like more practice ?"
|
||||
#define IDS_TRO_TUTORIAL_6 "Press <Y> for yes, <N> for no."
|
||||
#define IDS_TRO_TUTORIAL_7 "The evil TROLL has hidden all the"
|
||||
#define IDS_TRO_TUTORIAL_8 "Treasures of MARK, the Dwarf King."
|
||||
#define IDS_TRO_TUTORIAL_9 "Help KING MARK find his Treasures."
|
||||
#define IDS_TRO_TUTORIAL_10 "You can't take a Treasure if the TROLL"
|
||||
#define IDS_TRO_TUTORIAL_11 "is in the same picture as the Treasure."
|
||||
#define IDS_TRO_TUTORIAL_12 "To make the TROLL go away you have to"
|
||||
#define IDS_TRO_TUTORIAL_13 "make the picture change."
|
||||
#define IDS_TRO_TUTORIAL_14 "During the game see the Treasures you"
|
||||
#define IDS_TRO_TUTORIAL_15 "have already found by pressing <F>."
|
||||
#define IDS_TRO_TUTORIAL_16 "During the game you can turn the sound"
|
||||
#define IDS_TRO_TUTORIAL_17 "on or off by pressing the <S> key "
|
||||
#define IDS_TRO_TUTORIAL_18 "while holding down the <Ctrl> key."
|
||||
#define IDS_TRO_TUTORIAL_19 "The TROLL has hidden these Treasures:"
|
||||
|
||||
#define IDS_TRO_CREDITS_0 "Prepare to enter the world of . . ."
|
||||
#define IDS_TRO_CREDITS_1 "TROLL'S TALE (tm)"
|
||||
#define IDS_TRO_CREDITS_2 "------------"
|
||||
#define IDS_TRO_CREDITS_3 "Written by MIKE MACCHESNEY"
|
||||
#define IDS_TRO_CREDITS_4 "Conversion by PETER OLIPHANT"
|
||||
#define IDS_TRO_CREDITS_5 "Graphic Art by DOUG MACNEILL"
|
||||
#define IDS_TRO_CREDITS_6 "Original Version by AL LOWE"
|
||||
|
||||
#define IDS_TRO_TREASURE_0 "TREASURES FOUND"
|
||||
#define IDS_TRO_TREASURE_1 "---------------"
|
||||
#define IDS_TRO_TREASURE_2 "NONE"
|
||||
#define IDS_TRO_TREASURE_3 "THERE ARE STILL %d TREASURES TO FIND"
|
||||
#define IDS_TRO_TREASURE_4 "%d TREASURES TO FIND"
|
||||
#define IDS_TRO_TREASURE_5 "%d TREASURE TO FIND"
|
||||
#define IDS_TRO_TREASURE_6 "YOU HAVE FOUND ALL OF THE TREASURES!!"
|
||||
#define IDS_TRO_TREASURE_7 "THERE'S ONLY ONE MORE TREASURE TO FIND."
|
||||
#define IDS_TRO_TREASURE_8 "GREAT!! YOU HAVE FOUND EVERY TREASURE."
|
||||
#define IDS_TRO_TREASURE_9 "TAKE THE TREASURES TO THE GUARD."
|
||||
|
||||
#define IDS_TRO_GAMEOVER_0 "You took %d moves to complete TROLL'S"
|
||||
#define IDS_TRO_GAMEOVER_1 "TALE. Do you think you can do better?"
|
||||
|
||||
// picture
|
||||
|
||||
#define IDI_TRO_PICNUM 47
|
||||
|
||||
#define IDI_TRO_PIC_WIDTH 160
|
||||
#define IDI_TRO_PIC_HEIGHT 168
|
||||
#define IDI_TRO_PIC_X0 0
|
||||
#define IDI_TRO_PIC_Y0 0
|
||||
#define IDI_TRO_PIC_FLAGS IDF_AGI_PIC_V15
|
||||
|
||||
// max values
|
||||
|
||||
#define IDI_TRO_MAX_TREASURE 16
|
||||
#define IDI_TRO_MAX_OPTION 3
|
||||
|
||||
#define IDI_TRO_SEL_OPTION_1 0
|
||||
#define IDI_TRO_SEL_OPTION_2 1
|
||||
#define IDI_TRO_SEL_OPTION_3 2
|
||||
|
||||
#define IDI_TRO_MAX_ROW_PIC 21
|
||||
|
||||
#define IDI_TRO_NUM_ROOMDESCS 65
|
||||
#define IDI_TRO_NUM_OPTIONS 129
|
||||
#define IDI_TRO_NUM_NUMROOMS 43
|
||||
|
||||
#define IDI_TRO_NUM_USERMSGS 34
|
||||
|
||||
#define IDI_TRO_NUM_LOCDESCS 59
|
||||
|
||||
#define IDI_TRO_NUM_NONTROLL 9
|
||||
|
||||
// offsets
|
||||
|
||||
#define IDA_TRO_BINNAME "troll.img"
|
||||
|
||||
#define IDO_TRO_DATA_START 0x3A40
|
||||
#define IDO_TRO_PIC_START 0x3EF5
|
||||
#define IDO_TRO_LOCMESSAGES 0x1F7C
|
||||
#define IDO_TRO_USERMESSAGES 0x34A4
|
||||
#define IDO_TRO_ROOMDESCS 0x0082
|
||||
#define IDO_TRO_OPTIONS 0x0364
|
||||
#define IDO_TRO_PICSTARTIDX 0x02CD
|
||||
#define IDO_TRO_ROOMPICDELTAS 0x030C
|
||||
#define IDO_TRO_ALLTREASURES 0x3B24
|
||||
#define IDO_TRO_ITEMS 0x34E8
|
||||
#define IDO_TRO_FRAMEPIC 0x3EC2
|
||||
#define IDO_TRO_ROOMCONNECTS 0x02FA
|
||||
#define IDO_TRO_NONTROLLROOMS 0x3CF9
|
||||
|
||||
enum OptionType {
|
||||
OT_GO,
|
||||
OT_GET,
|
||||
OT_DO,
|
||||
OT_FLASHLIGHT
|
||||
};
|
||||
|
||||
struct RoomDesc {
|
||||
int options[3];
|
||||
OptionType optionTypes[3];
|
||||
int roomDescIndex[3];
|
||||
};
|
||||
|
||||
struct UserMsg {
|
||||
int num;
|
||||
char msg[3][40];
|
||||
};
|
||||
|
||||
struct Item {
|
||||
byte bg;
|
||||
byte fg;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
class PictureMgr_Troll;
|
||||
|
||||
class TrollEngine : public PreAgiEngine {
|
||||
public:
|
||||
TrollEngine(OSystem *syst, const AGIGameDescription *gameDesc);
|
||||
~TrollEngine() override;
|
||||
|
||||
Common::Error go() override;
|
||||
|
||||
private:
|
||||
PictureMgr_Troll *_picture;
|
||||
|
||||
int _roomPicture;
|
||||
int _treasuresLeft;
|
||||
int _currentRoom;
|
||||
int _moves;
|
||||
|
||||
bool _isTrollAway;
|
||||
|
||||
int _inventory[IDI_TRO_MAX_TREASURE];
|
||||
|
||||
bool _soundOn;
|
||||
|
||||
byte *_gameData;
|
||||
|
||||
void init();
|
||||
void intro();
|
||||
void drawPic(int iPic, bool f3IsCont, bool clear, bool troll = false);
|
||||
void drawTroll();
|
||||
void gameLoop();
|
||||
void gameOver();
|
||||
void tutorial();
|
||||
void credits();
|
||||
|
||||
void inventory();
|
||||
void pickupTreasure(int treasureId);
|
||||
|
||||
int drawRoom(char *menu);
|
||||
void printUserMessage(int msgId);
|
||||
|
||||
void pressAnyKey(int col = 4);
|
||||
void waitAnyKeyIntro();
|
||||
|
||||
void playTune(int tune, int len);
|
||||
|
||||
bool getMenuSel(const char *, int *, int);
|
||||
|
||||
void drawMenu(const char *szMenu, int iSel);
|
||||
|
||||
void fillOffsets();
|
||||
|
||||
// These are come from game data
|
||||
int _pictureOffsets[IDI_TRO_PICNUM];
|
||||
int _roomPicStartIdx[IDI_TRO_NUM_NUMROOMS];
|
||||
int _roomPicDeltas[IDI_TRO_NUM_NUMROOMS];
|
||||
int _roomStates[IDI_TRO_NUM_NUMROOMS];
|
||||
UserMsg _userMessages[IDI_TRO_NUM_USERMSGS];
|
||||
int _locMessagesIdx[IDI_TRO_NUM_LOCDESCS];
|
||||
RoomDesc _roomDescs[IDI_TRO_NUM_ROOMDESCS];
|
||||
int _options[IDI_TRO_NUM_OPTIONS];
|
||||
Item _items[IDI_TRO_MAX_TREASURE];
|
||||
int _roomConnects[IDI_TRO_NUM_OPTIONS];
|
||||
int _nonTrollRooms[IDI_TRO_NUM_NONTROLL];
|
||||
|
||||
int _tunes[6];
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif
|
||||
1552
engines/agi/preagi/winnie.cpp
Normal file
1552
engines/agi/preagi/winnie.cpp
Normal file
File diff suppressed because it is too large
Load Diff
375
engines/agi/preagi/winnie.h
Normal file
375
engines/agi/preagi/winnie.h
Normal file
@@ -0,0 +1,375 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGI_PREAGI_WINNIE_H
|
||||
#define AGI_PREAGI_WINNIE_H
|
||||
|
||||
namespace Agi {
|
||||
|
||||
#define WTP_SAVEGAME_VERSION 1
|
||||
#define IDI_XOR_KEY 0x80
|
||||
|
||||
// strings
|
||||
#define IDS_WTP_ROOM_DOS "rooms/rm.%02d"
|
||||
#define IDS_WTP_ROOM_AMIGA "rooms/room.%d"
|
||||
#define IDS_WTP_ROOM_C64 "room%02d"
|
||||
#define IDS_WTP_ROOM_APPLE "room%d.obj"
|
||||
#define IDS_WTP_ROOM_COCO "room%02d"
|
||||
#define IDS_WTP_OBJ_DOS "obj.%02d"
|
||||
#define IDS_WTP_OBJ_AMIGA "objects/object.%d"
|
||||
#define IDS_WTP_OBJ_C64 "object%02d"
|
||||
#define IDS_WTP_OBJ_APPLE "object%d.obj"
|
||||
#define IDS_WTP_OBJ_COCO "obj%02d"
|
||||
#define IDS_WTP_SND_DOS "snd.%02d"
|
||||
#define IDS_WTP_SND_AMIGA "Sounds"
|
||||
#define IDS_WTP_SND_C64 "sound.obj"
|
||||
#define IDS_WTP_SND_APPLE "sound.obj"
|
||||
|
||||
#define IDS_WTP_FILE_LOGO "logo"
|
||||
#define IDS_WTP_FILE_TITLE "title"
|
||||
#define IDS_WTP_FILE_SAVEGAME "savegame"
|
||||
#define IDS_WTP_FILE_RND "rnd"
|
||||
|
||||
#define IDS_WTP_DISK_ERROR "There is a problem with your disk drive.Please make sure your Winnie-the-Pooh disk is in the drive correctly."
|
||||
|
||||
#define IDS_WTP_INTRO_0 " PRESENT"
|
||||
#define IDS_WTP_INTRO_1 " TM designates trademark of\n Sierra On-Line, Inc.\n (c) 1985 Walt Disney Productions"
|
||||
|
||||
#define IDS_WTP_HELP_0 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. Press the <Backspace> key to see what you just finished reading."
|
||||
#define IDS_WTP_HELP_1 "Press <C> to see what you are carrying. <Ctrl-S> turns the sound off and on. <ESC> takes you to the playroom (in caseyou get lost or want to save the game)."
|
||||
|
||||
#define IDS_WTP_GAME_OVER_0 "Congratulations!! You did it! You returned everything that was lost. Now,Christopher Robin invites you to a Hero party."
|
||||
#define IDS_WTP_GAME_OVER_1 "The good news is: YOU are the Hero!! The bad news is: you have to find the party by yourself. Good luck!"
|
||||
|
||||
#define IDS_WTP_OWL_0 "\"For example, that object you are carrying now is interesting. I know I've seen it before. Hmmm. Let me think about this . . .\""
|
||||
#define IDS_WTP_OWL_1 "\"You know, this object here beside me isfamiliar. I'm sure I could give you some sort of clue about it. Let me see. . .\""
|
||||
|
||||
#define IDS_WTP_WIND_0 "Oh, no! The Blustery Wind begins to howl. It has returned, and mixed up all the objects in the Wood."
|
||||
#define IDS_WTP_WIND_1 "But don't worry. Everyone still has theobjects you returned to them.\n\n (Today must be Winds-day!)"
|
||||
#define IDS_WTP_TIGGER "\"Hallooooo, there!!!! It's ME, Tigger! Let's BOUNCE!\""
|
||||
#define IDS_WTP_MIST "Oh, look out! The mysterious mist is coming in. It gets so thick that you can't see through it. Just keep walkingand it will soon clear up."
|
||||
|
||||
#define IDS_WTP_SONG_0 "Winnie-the-Pooh, Winnie-the-Pooh, Tubby little cubby all stuffed with fluff, He's Winnie-the-Pooh, Winnie-the-Pooh, Willy, nilly, silly, old bear."
|
||||
#define IDS_WTP_SONG_1 "Deep in the Hundred Acre Wood, Where Christopher Robin plays, You will find the enchanted neighborhoodof Christopher's childhood days."
|
||||
#define IDS_WTP_SONG_2 "A donkey named Eeyore is his friend, and Kanga and little Roo. There's Rabbit and Piglet and there's Owl But most of all Winnie-the-Pooh!"
|
||||
|
||||
#define IDS_WTP_NSEW "North South East West"
|
||||
#define IDS_WTP_TAKE "Take"
|
||||
#define IDS_WTP_DROP "Drop"
|
||||
#define IDS_WTP_CANT_GO "\nSorry, but you can't go that way."
|
||||
#define IDS_WTP_CANT_TAKE "You can't take it. You can only carry one object at a time."
|
||||
#define IDS_WTP_CANT_DROP "You can't drop it. Another object is already here."
|
||||
#define IDS_WTP_WRONG_PLACE "\nOk, but it doesn't belong here."
|
||||
#define IDS_WTP_OK "\nOk."
|
||||
|
||||
#define IDS_WTP_INVENTORY_0 "You are carrying nothing."
|
||||
#define IDS_WTP_INVENTORY_1 "Number of objects still missing: %d"
|
||||
|
||||
// COMMODORE 64 version strings
|
||||
|
||||
#define IDS_WTP_FILE_SAVEGAME_C64 "saved game"
|
||||
#define IDS_WTP_DISK_ERROR_C64 "There is a problem with your disk drive.Please make sure your disk is in the drive correctly."
|
||||
#define IDS_WTP_HELP_0_C64 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. <F1> brings back what you have already read."
|
||||
#define IDS_WTP_HELP_1_C64 "<F3> takes you back to the playroom (if you get lost, or want to save the game).<F5> turns the sound off and on. <F7> shows what you're carrying."
|
||||
#define IDS_WTP_WRONG_PLACE_C64 "\nOk, but this is not the right place."
|
||||
|
||||
// Amiga strings
|
||||
|
||||
// original strings from the executable and edited versions for our four-line interface
|
||||
#define IDS_WTP_AMIGA_HELP_0 "Use the mouse to select your choice from\nthe bottom of the screen or the menu.\n\nTo use the keyboard instead of the\nmouse, press the NUMBER or first LETTER\nof what you want."
|
||||
#define IDS_WTP_AMIGA_HELP_1 "From the keyboard you can also press:\n 'l' to look at the scene you're in.\n 'o' to look at an object in the room.\n 'c' to see what you're carrying and\n how you're doing.\n CTRL-S to turn the sound on or off."
|
||||
#define IDS_WTP_AMIGA_HELP_EDITED_0 "Use the mouse to select your choice fromthe bottom of the screen or the menu.\nTo use the keyboard instead of the\nmouse, press the NUMBER or first LETTER."
|
||||
#define IDS_WTP_AMIGA_HELP_EDITED_1 "From the keyboard you can also press:\n <C> to see what you're carrying and\n how you're doing.\n <CTRL-S> to turn the sound on or off."
|
||||
|
||||
// maximum values
|
||||
|
||||
#define IDI_WTP_MAX_OBJ_MISSING 10
|
||||
|
||||
#define IDI_WTP_MAX_ROOM 62
|
||||
#define IDI_WTP_MAX_OBJ 40
|
||||
#define IDI_WTP_MAX_SND 14
|
||||
#define IDI_WTP_MAX_PIC 2
|
||||
|
||||
#define IDI_WTP_MAX_ROOM_NORMAL 57
|
||||
#define IDI_WTP_MAX_ROOM_TELEPORT 30
|
||||
#define IDI_WTP_MAX_ROOM_OBJ 42
|
||||
#define IDI_WTP_MAX_BLOCK 4
|
||||
#define IDI_WTP_MAX_STR 6
|
||||
#define IDI_WTP_MAX_OBJ_STR 4
|
||||
#define IDI_WTP_MAX_OBJ_STR_END 2
|
||||
#define IDI_WTP_MAX_FLAG 40
|
||||
#define IDI_WTP_MAX_OPTION 3
|
||||
#define IDI_WTP_MAX_DIR 4
|
||||
#define IDI_WTP_MAX_MOVES_UNTIL_WIND 150
|
||||
|
||||
#define IDI_WTP_TIMER_INTERVAL (10 * 60 * 1000) // 10 minutes on DOS
|
||||
|
||||
// positions
|
||||
|
||||
#define IDI_WTP_ROW_MENU 21
|
||||
#define IDI_WTP_ROW_OPTION_1 21
|
||||
#define IDI_WTP_ROW_OPTION_2 22
|
||||
#define IDI_WTP_ROW_OPTION_3 23
|
||||
#define IDI_WTP_ROW_OPTION_4 24
|
||||
|
||||
#define IDI_WTP_COL_MENU 0
|
||||
#define IDI_WTP_COL_OPTION 1
|
||||
#define IDI_WTP_COL_NSEW 1
|
||||
#define IDI_WTP_COL_NORTH 1
|
||||
#define IDI_WTP_COL_SOUTH 8
|
||||
#define IDI_WTP_COL_EAST 15
|
||||
#define IDI_WTP_COL_WEST 21
|
||||
#define IDI_WTP_COL_TAKE 29
|
||||
#define IDI_WTP_COL_DROP 35
|
||||
#define IDI_WTP_COL_PRESENT 17
|
||||
|
||||
// data file offset modifiers
|
||||
|
||||
#define IDI_WTP_OFS_ROOM 0x5400
|
||||
#define IDI_WTP_OFS_OBJ 0x0800
|
||||
|
||||
// picture
|
||||
|
||||
#define IDI_WTP_PIC_WIDTH 140
|
||||
#define IDI_WTP_PIC_HEIGHT 159
|
||||
#define IDI_WTP_PIC_X0 10
|
||||
#define IDI_WTP_PIC_Y0 0
|
||||
#define IDI_WTP_PIC_FLAGS IDF_AGI_PIC_V2
|
||||
|
||||
// selections
|
||||
|
||||
enum {
|
||||
IDI_WTP_SEL_HOME = -2,
|
||||
IDI_WTP_SEL_BACK,
|
||||
IDI_WTP_SEL_OPT_1,
|
||||
IDI_WTP_SEL_OPT_2,
|
||||
IDI_WTP_SEL_OPT_3,
|
||||
IDI_WTP_SEL_NORTH,
|
||||
IDI_WTP_SEL_SOUTH,
|
||||
IDI_WTP_SEL_EAST,
|
||||
IDI_WTP_SEL_WEST,
|
||||
IDI_WTP_SEL_TAKE,
|
||||
IDI_WTP_SEL_DROP,
|
||||
IDI_WTP_SEL_REAL_OPT_1,
|
||||
IDI_WTP_SEL_REAL_OPT_2,
|
||||
IDI_WTP_SEL_REAL_OPT_3,
|
||||
IDI_WTP_SEL_TIMER_EVENT
|
||||
};
|
||||
|
||||
#define IDI_WTP_SEL_LAST IDI_WTP_SEL_REAL_OPT_3
|
||||
|
||||
// rooms
|
||||
|
||||
enum {
|
||||
IDI_WTP_ROOM_NONE = -1,
|
||||
IDI_WTP_ROOM_NORTH,
|
||||
IDI_WTP_ROOM_SOUTH,
|
||||
IDI_WTP_ROOM_EAST,
|
||||
IDI_WTP_ROOM_WEST
|
||||
};
|
||||
|
||||
#define IDI_WTP_ROOM_HIDE 0
|
||||
|
||||
#define IDI_WTP_ROOM_PICNIC 2
|
||||
#define IDI_WTP_ROOM_HOME 28
|
||||
#define IDI_WTP_ROOM_PARTY 58
|
||||
#define IDI_WTP_ROOM_MIST 59
|
||||
#define IDI_WTP_ROOM_TIGGER 61
|
||||
|
||||
// sound
|
||||
|
||||
enum ENUM_WTP_SOUND {
|
||||
IDI_WTP_SND_POOH_0 = 1,
|
||||
IDI_WTP_SND_TIGGER,
|
||||
IDI_WTP_SND_TAKE,
|
||||
IDI_WTP_SND_DROP,
|
||||
IDI_WTP_SND_DROP_OK,
|
||||
IDI_WTP_SND_FANFARE,
|
||||
IDI_WTP_SND_POOH_1,
|
||||
IDI_WTP_SND_KEYHELP,
|
||||
IDI_WTP_SND_POOH_2,
|
||||
IDI_WTP_SND_WIND_0,
|
||||
IDI_WTP_SND_WIND_1
|
||||
};
|
||||
|
||||
// script opcodes
|
||||
|
||||
#define IDO_WTP_GOTO_ROOM 0x06
|
||||
#define IDO_WTP_PRINT_MSG 0x08
|
||||
#define IDO_WTP_PRINT_STR 0x0A
|
||||
#define IDO_WTP_DROP_OBJ 0x0C
|
||||
#define IDO_WTP_FLAG_CLEAR 0x0E
|
||||
#define IDO_WTP_FLAG_SET 0x10
|
||||
#define IDO_WTP_GAME_OVER 0x12
|
||||
#define IDO_WTP_WALK_MIST 0x14
|
||||
#define IDO_WTP_PLAY_SOUND 0x16
|
||||
#define IDO_WTP_SAVE_GAME 0x18
|
||||
#define IDO_WTP_LOAD_GAME 0x1A
|
||||
#define IDO_WTP_OWL_HELP 0x1C
|
||||
#define IDO_WTP_GOTO_RND 0x1E
|
||||
|
||||
#define IDO_WTP_OPTION_0 0x15
|
||||
#define IDO_WTP_OPTION_1 0x16
|
||||
#define IDO_WTP_OPTION_2 0x17
|
||||
|
||||
enum {
|
||||
IDI_WTP_OBJ_DESC = 0,
|
||||
IDI_WTP_OBJ_TAKE,
|
||||
IDI_WTP_OBJ_DROP,
|
||||
IDI_WTP_OBJ_HELP
|
||||
};
|
||||
|
||||
enum {
|
||||
IDI_WTP_PAR_OK = 0,
|
||||
IDI_WTP_PAR_GOTO,
|
||||
IDI_WTP_PAR_BACK,
|
||||
IDI_WTP_PAR_RELOAD
|
||||
};
|
||||
|
||||
// room file option block
|
||||
|
||||
struct WTP_ROOM_BLOCK {
|
||||
uint16 ofsOpt[IDI_WTP_MAX_BLOCK];
|
||||
};
|
||||
|
||||
// room file header
|
||||
|
||||
struct WTP_ROOM_HDR {
|
||||
uint8 roomNumber;
|
||||
uint8 objId;
|
||||
uint16 ofsPic;
|
||||
uint16 fileLen;
|
||||
uint16 reserved0;
|
||||
int8 roomNew[IDI_WTP_MAX_DIR];
|
||||
uint8 objX;
|
||||
uint8 objY;
|
||||
uint16 reserved1;
|
||||
uint16 ofsDesc[IDI_WTP_MAX_BLOCK];
|
||||
uint16 ofsBlock[IDI_WTP_MAX_BLOCK];
|
||||
uint16 ofsStr[IDI_WTP_MAX_STR];
|
||||
uint32 reserved2;
|
||||
WTP_ROOM_BLOCK opt[IDI_WTP_MAX_BLOCK];
|
||||
};
|
||||
|
||||
// object file header
|
||||
|
||||
struct WTP_OBJ_HDR {
|
||||
uint16 fileLen;
|
||||
uint16 objId;
|
||||
uint16 ofsEndStr[IDI_WTP_MAX_OBJ_STR_END];
|
||||
uint16 ofsStr[IDI_WTP_MAX_OBJ_STR];
|
||||
uint16 ofsPic;
|
||||
};
|
||||
|
||||
// savegame
|
||||
|
||||
struct WTP_SAVE_GAME {
|
||||
uint8 fSound;
|
||||
uint8 nMoves;
|
||||
uint8 nObjMiss;
|
||||
uint8 nObjRet;
|
||||
uint8 iObjHave;
|
||||
uint8 fGame[IDI_WTP_MAX_FLAG];
|
||||
uint8 iUsedObj[IDI_WTP_MAX_OBJ_MISSING];
|
||||
uint8 iObjRoom[IDI_WTP_MAX_ROOM_OBJ];
|
||||
};
|
||||
|
||||
class PreAgiEngine;
|
||||
class PictureMgr_Mickey_Winnie;
|
||||
|
||||
class WinnieEngine : public PreAgiEngine {
|
||||
public:
|
||||
WinnieEngine(OSystem *syst, const AGIGameDescription *gameDesc);
|
||||
~WinnieEngine() override;
|
||||
|
||||
void init();
|
||||
Common::Error go() override;
|
||||
|
||||
void debugCurRoom();
|
||||
|
||||
private:
|
||||
PictureMgr_Mickey_Winnie *_picture;
|
||||
|
||||
WTP_SAVE_GAME _gameStateWinnie;
|
||||
int _room;
|
||||
int _mist;
|
||||
bool _doWind;
|
||||
bool _tiggerOrMist;
|
||||
bool _timerEnabled;
|
||||
uint32 _timerStart;
|
||||
|
||||
int _roomOffset;
|
||||
int _objOffset;
|
||||
bool _isBigEndian;
|
||||
Common::Rect hotspotNorth, hotspotSouth, hotspotEast, hotspotWest;
|
||||
|
||||
void randomize();
|
||||
void intro();
|
||||
void drawPic(const char *);
|
||||
void gameLoop();
|
||||
|
||||
void parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len);
|
||||
void parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len);
|
||||
uint32 readRoom(int, uint8 *, WTP_ROOM_HDR &);
|
||||
|
||||
void drawRoomPic();
|
||||
int parser(int, int, uint8 *);
|
||||
int getObjInRoom(int);
|
||||
void getMenuSel(char *, int *, int[]);
|
||||
void keyHelp();
|
||||
void clrMenuSel(int *, int[]);
|
||||
void incMenuSel(int *, int[]);
|
||||
void decMenuSel(int *, int[]);
|
||||
void drawMenu(char *, int, int[]);
|
||||
void printRoomStr(int, int);
|
||||
void inventory();
|
||||
void printObjStr(int, int);
|
||||
uint32 readObj(int, uint8 *);
|
||||
void takeObj(int);
|
||||
bool dropObj(int);
|
||||
bool isRightObj(int, int, int *);
|
||||
void drawObjPic(int, int, int);
|
||||
void getMenuMouseSel(int *, int[], int, int);
|
||||
void setWinnieFlag(int);
|
||||
void clearWinnieFlag(int);
|
||||
void gameOver();
|
||||
void saveGame();
|
||||
void loadGame();
|
||||
void dropObjRnd();
|
||||
void setTakeDrop(int[]);
|
||||
bool makeSel(int *, int[]);
|
||||
|
||||
void wind();
|
||||
void mist();
|
||||
void tigger();
|
||||
void startTimer();
|
||||
void stopTimer();
|
||||
|
||||
void showOwlHelp();
|
||||
void showAmigaHelp();
|
||||
bool playSound(ENUM_WTP_SOUND);
|
||||
|
||||
void printStrWinnie(char *szMsg);
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user