1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
|
/* 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 NANCY_COMMONYPES_H
#define NANCY_COMMONYPES_H
#include "common/rect.h"
#include "common/array.h"
#include "common/language.h"
#include "common/str.h"
#include "math/vector3d.h"
namespace Common {
class SeekableReadStream;
}
namespace Nancy {
class NancyEngine;
// The original engine used a large amount of #defines for numerical constants,
// which can be found listed inside the gameflow.h file shipping with many of
// the titles (the Russian variant of nancy1 has it as a separate file, while
// nancy2 and above embed it within the ciftree).
//
// Other, more specific constants are declared within their related classes,
// so as not to litter the namespace
static const int8 kFlagNoLabel = -1;
static const int8 kEvNoEvent = -1;
static const int8 kFrNoFrame = -1;
static const uint16 kNoScene = 9999;
// Inventory items use types
static const byte kInvItemUseThenLose = 0;
static const byte kInvItemKeepAlways = 1;
static const byte kInvItemReturn = 2;
static const byte kInvItemNewSceneView = 3;
// Inventory item sound override commands
static const byte kInvSoundOverrideCommandNoSound = 0;
static const byte kInvSoundOverrideCommandTurnOff = 1;
static const byte kInvSoundOverrideCommandNewSound = 2;
static const byte kInvSoundOverrideCommandICant = 3;
// Dependency types
static const byte kFlagEvent = 1;
static const byte kFlagInventory = 2;
static const byte kFlagCursor = 3;
// Scene panning
static const byte kPanNone = 0;
static const byte kPan360 = 1;
static const byte kPanLeftRight = 2;
// Scene sound flags
static const byte kContinueSceneSound = 1;
static const byte kLoadSceneSound = 0;
// Scene rotation special values
static const uint16 kInvertedNode = 77;
static const uint16 kNoAutoScroll = 333;
// Clock bump types
static const byte kAbsoluteClockBump = 1;
static const byte kRelativeClockBump = 2;
// Time of day
static const byte kPlayerDay = 0;
static const byte kPlayerNight = 1;
static const byte kPlayerDuskDawn = 2;
// Video
static const byte kSmallVideoFormat = 1;
static const byte kLargeVideoFormat = 2;
static const byte kVideoPlaytypeAVF = 0;
static const byte kVideoPlaytypeBink = 1;
// Overlay
static const byte kPlayOverlayPlain = 1;
static const byte kPlayOverlayTransparent = 2;
static const byte kPlayOverlaySceneChange = 1;
static const byte kPlayOverlayNoSceneChange = 2;
static const byte kPlayOverlayStatic = 1;
static const byte kPlayOverlayAnimated = 2;
static const byte kPlayOverlayOnce = 1;
static const byte kPlayOverlayLoop = 2;
static const byte kPlayOverlayForward = 1;
static const byte kPlayOverlayReverse = 2;
static const byte kPlayOverlayWithHotspot = 1;
static const byte kPlayOverlayNoHotspot = 2;
// Table access
static const byte kNoChangeTableValue = 0;
static const byte kIncrementTableValue = 1;
static const byte kDecrementTableValue = 2;
static const uint16 kNoTableIndex = 99;
static const int16 kNoTableValue = 9999;
// Autotext ordering info
static const uint16 kListLIFO = 0;
static const uint16 kListFIFO = 1;
// 3D sound rotation
static const byte kRotateAroundX = 0;
static const byte kRotateAroundY = 1;
static const byte kRotateAroundZ = 2;
enum MovementDirection : byte { kUp = 1, kDown = 2, kLeft = 4, kRight = 8, kMoveFast = 16 };
// Separate namespace to remove possible clashes
namespace NancyState {
enum NancyState {
// Original engine states
kBoot, kLogo, kCredits, kMap,
kMainMenu, kLoadSave, kSetup,
kHelp, kScene, kSaveDialog,
// Not real states
kNone,
kQuit,
kPause, // only used when the GMM is on screen
};
}
// Describes a scene transition
struct SceneChangeDescription {
uint16 sceneID = kNoScene;
uint16 frameID = 0;
uint16 verticalOffset = 0;
uint16 continueSceneSound = kLoadSceneSound;
int8 paletteID = -1; // TVD only
Math::Vector3d listenerFrontVector = Math::Vector3d(0, 0, 1);
uint16 frontVectorFrameID = 0;
void readData(Common::SeekableReadStream &stream, bool longFormat = false);
};
// Describes a single flag change or comparison
struct FlagDescription {
int16 label = -1;
byte flag = 0;
};
struct SceneChangeWithFlag {
SceneChangeDescription _sceneChange;
FlagDescription _flag;
void readData(Common::SeekableReadStream &stream, bool reverseFormat = false);
void execute();
};
// Describes a hotspot
struct HotspotDescription {
uint16 frameID = 0;
Common::Rect coords;
void readData(Common::SeekableReadStream &stream);
};
// Describes a blit operation, dependent on a background frame
struct FrameBlitDescription {
uint16 frameID = 0; // Frame ID of the Scene background
uint16 staticRectID = 0; // Used in Overlay
uint hasHotspot = kPlayOverlayNoHotspot;
Common::Rect src;
Common::Rect dest;
void readData(Common::SeekableReadStream &stream, bool longFormat = false);
};
// Describes 10 event flag changes to be executed when an action is triggered
struct MultiEventFlagDescription {
FlagDescription descs[10];
void readData(Common::SeekableReadStream &stream);
void execute();
};
struct SecondaryVideoDescription {
int16 frameID = kFrNoFrame;
Common::Rect srcRect;
Common::Rect destRect;
// 2 unknown/empty rects
void readData(Common::SeekableReadStream &stream);
};
// Describes set of effects that can be applied to sounds.
// Defaults are set according to the values used by PlaySoundTerse
struct SoundEffectDescription {
uint32 minTimeDelay = 500;
uint32 maxTimeDelay = 2000;
int32 randomMoveMinX = 0;
int32 randomMoveMaxX = 0;
int32 randomMoveMinY = 0;
int32 randomMoveMaxY = 0;
int32 randomMoveMinZ = 0;
int32 randomMoveMaxZ = 0;
int32 fixedPosX = 0;
int32 fixedPosY = 0;
int32 fixedPosZ = 0;
uint32 moveStepTime = 1000;
int32 numMoveSteps = 10;
int32 linearMoveStartX = 0;
int32 linearMoveEndX = 0;
int32 linearMoveStartY = 0;
int32 linearMoveEndY = 0;
int32 linearMoveStartZ = 0;
int32 linearMoveEndZ = 0;
int32 rotateMoveStartX = 0;
int32 rotateMoveStartY = 0;
int32 rotateMoveStartZ = 0;
byte rotateMoveAxis = kRotateAroundY;
uint32 minDistance = 0;
uint32 maxDistance = 0;
void readData(Common::SeekableReadStream &stream);
};
// Descrbes a single sound. Combines four different structs found in the data in one
struct SoundDescription {
Common::String name = "NO SOUND";
uint16 channelID = 0;
uint16 playCommands = 1;
uint16 numLoops = 1;
uint16 volume = 50;
uint16 panAnchorFrame = 0;
uint32 samplesPerSec = 0;
bool isPanning = false;
void readNormal(Common::SeekableReadStream &stream);
void readDIGI(Common::SeekableReadStream &stream);
void readMenu(Common::SeekableReadStream &stream);
void readScene(Common::SeekableReadStream &stream);
void readTerse(Common::SeekableReadStream &stream);
};
// Structs inside nancy.dat, which contains all the data that was
// originally stored inside the executable
enum class StaticDataConditionType { kEvent = 0, kInventory = 1, kDifficulty = 2 };
struct StaticDataFlag { byte type; int16 label; byte flag; };
struct ConditionalDialogue {
byte textID;
uint16 sceneID;
Common::String soundID;
Common::Array<StaticDataFlag> conditions;
void readData(Common::SeekableReadStream &stream);
};
struct GoodbyeSceneChange {
Common::Array<uint16> sceneIDs;
Common::Array<StaticDataFlag> conditions;
StaticDataFlag flagToSet;
void readData(Common::SeekableReadStream &stream);
};
struct Goodbye {
Common::String soundID;
Common::Array<GoodbyeSceneChange> sceneChanges;
void readData(Common::SeekableReadStream &stream);
};
struct Hint {
byte textID;
int16 hintWeight;
SceneChangeDescription sceneChange;
Common::String soundIDs[3];
Common::Array<StaticDataFlag> conditions;
void readData(Common::SeekableReadStream &stream);
};
struct SoundChannelInfo {
byte numChannels;
byte numSceneSpecificChannels;
Common::Array<byte> speechChannels;
Common::Array<byte> musicChannels;
Common::Array<byte> sfxChannels;
void readData(Common::SeekableReadStream &stream);
};
struct StaticData {
// Default values are for nancy1, provided for debugging purposes
uint16 numItems = 11;
uint16 numEventFlags = 168;
Common::Array<uint16> mapAccessSceneIDs;
Common::Array<uint16> genericEventFlags;
uint16 numCursorTypes = 4;
uint32 logoEndAfter = 7000;
int16 wonGameFlagID = -1;
// Data for sound channels
SoundChannelInfo soundChannelInfo;
// In-game strings and related logic
Common::Array<Common::Array<ConditionalDialogue>> conditionalDialogue;
Common::Array<Goodbye> goodbyes;
Common::Array<Common::Array<Hint>> hints;
Common::Array<Common::String> conditionalDialogueTexts;
Common::Array<Common::String> goodbyeTexts;
Common::Array<Common::String> hintTexts;
Common::String ringingText;
Common::String emptySaveText;
// Debug strings
Common::Array<Common::String> eventFlagNames;
void readData(Common::SeekableReadStream &stream, Common::Language language, uint32 endPos, int8 majorVersion, int8 minorVersion);
};
} // End of namespace Nancy
#endif // NANCY_COMMONYPES_H
|