IMMORTAL: Use AStyle to fix indentation and format issues across all files

This commit is contained in:
Quote58 2023-01-30 21:01:19 -05:00 committed by Eugene Sandulenko
parent 9c2e1a55a8
commit deb3794626
18 changed files with 733 additions and 721 deletions

View File

@ -48,8 +48,8 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
// The 20k bytes of memory that compression gets allocated to work with for the dictionary and the stack of chars
uint16 start[0x4000]; // Really needs a better name, remember to do this future me
uint16 ptk[0x4000]; // Pointer To Keys? Also needs a better name
byte stack[0x4000]; // Stack of chars to be stored
uint16 ptk[0x4000]; // Pointer To Keys? Also needs a better name
byte stack[0x4000]; // Stack of chars to be stored
// These are the main variables we'll need for this
uint16 findEmpty;
@ -73,8 +73,8 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
}
finalChar = code;
oldCode = code;
myCode = code;
oldCode = code;
myCode = code;
outByte = code & kMaskLow;
dstW.writeByte(outByte); // Take just the lower byte and write it the output
@ -85,17 +85,17 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
code = getInputCode(carry, src, srcLen, evenOdd); // Get the next code
if (carry == true) {
index = code << 1;
index = code << 1;
inputCode = code;
myCode = code;
myCode = code;
// Split up the conditional statement to be easier to follow
uint16 cond;
cond = start[index] & kMaskLast;
cond |= ptk[index];
if ((cond & kMaskHigh) == 0) { // Empty code
index = topStack;
index = topStack;
outByte = finalChar & kMaskLow;
stack[index] = outByte;
topStack++;
@ -105,9 +105,9 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
// :nextsymbol
index = myCode << 1;
while (index >= 0x200) {
myCode = start[index] & kMask12Bit;
myCode = start[index] & kMask12Bit;
outByte = ptk[index] & kMaskLow;
index = topStack;
index = topStack;
stack[index] = outByte;
topStack++;
index = myCode << 1;
@ -115,7 +115,7 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
// :singlechar
finalChar = (myCode >> 1);
outByte = finalChar & kMaskLow;
outByte = finalChar & kMaskLow;
dstW.writeByte(outByte);
// :dump
@ -126,8 +126,8 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *src, int sr
}
topStack = 0;
code = getMember(oldCode, finalChar, findEmpty, start, ptk);
oldCode = inputCode;
code = getMember(oldCode, finalChar, findEmpty, start, ptk);
oldCode = inputCode;
}
}
@ -142,12 +142,12 @@ void ImmortalEngine::setupDictionary(uint16 start[], uint16 ptk[], uint16 &findE
// Clear the whole dictionary
for (int i = 0x3FFF; i >= 0; i--) {
start[i] = 0;
ptk[i] = 0;
ptk[i] = 0;
}
// Set the initial 256 bytes to be value 256, these are the characters without extensions
for (int i = 255; i >= 0; i--) {
ptk[i] = 256;
ptk[i] = 256;
}
// This shouldn't really be done inside the function, but for the sake of consistency with the source, we will
@ -177,7 +177,7 @@ int ImmortalEngine::getInputCode(bool &carry, Common::File *src, int &srcLen, ui
uint16 ImmortalEngine::getMember(uint16 codeW, uint16 k, uint16 &findEmpty, uint16 start[], uint16 ptk[]) {
// This function is effectively void, as the return value is only used in compression
// k and codeW are local variables with the value of oldCode and finalChar
uint16 hash;
@ -194,7 +194,7 @@ uint16 ImmortalEngine::getMember(uint16 codeW, uint16 k, uint16 &findEmpty, uint
uint16 b = ptk[hash] & kMaskHigh;
if (a | b) {
start[hash] = codeW;
ptk[hash] = k | 0x100;
ptk[hash] = k | 0x100;
return ptk[hash];
}
@ -228,7 +228,7 @@ void ImmortalEngine::appendList(uint16 codeW, uint16 k, uint16 &hash, uint16 &fi
prev = hash;
if (hash >= 0x200) {
setupDictionary(start, ptk, findEmpty);
} else {
bool found = false;
while (found == false) {
@ -244,9 +244,9 @@ void ImmortalEngine::appendList(uint16 codeW, uint16 k, uint16 &hash, uint16 &fi
cond |= ptk[hash];
if ((cond & kMaskHigh) == 0) {
findEmpty = hash;
findEmpty = hash;
start[hash] = codeW;
ptk[hash] = k | 0x100;
ptk[hash] = k | 0x100;
link = hash >> 1;

View File

@ -34,9 +34,9 @@
* Usually used as an index into the frame array by subtracting the frame enum first.
* Here's the movement of data from ROM to RAM:
* list of Cycles on heap (cyc)
* |
* |
* list of word pointers in wram to Cycles (cycPtrs)
* |
* |
* list of lexical pointers as byte indexes into word pointers (cycID -> cyclist)
*/
@ -89,7 +89,7 @@ int Room::cycleGetFrame(int c) {
* STA DP : LDA (DP)
*/
return g_immortal->_cycPtrs[g_immortal->_cycles[c]._cycList]._frames[g_immortal->_cycles[c]._index];
}
}
int Room::cycleGetNumFrames(int c) {
// For whatever reason, this is not a property of the cycle, so it has to be re-calculated each time

View File

@ -29,13 +29,13 @@ namespace Immortal {
// --- ProDOSFile methods ---
ProDOSFile::ProDOSFile(char name[15], uint8 type, uint16 tBlk, uint32 eof, uint16 bPtr, Common::File *disk)
: _type(type)
, _totalBlocks(tBlk)
, _eof(eof)
, _blockPtr(bPtr)
, _disk(disk) {
strncpy(_name, name, 15);
}
: _type(type)
, _totalBlocks(tBlk)
, _eof(eof)
, _blockPtr(bPtr)
, _disk(disk) {
strncpy(_name, name, 15);
}
/* For debugging purposes, this prints the meta data of a file */
@ -81,7 +81,7 @@ int ProDOSFile::parseIndexBlock(byte *memOffset, int blockNum, int rem) const {
for (int i = 0; i < blockNum; i++) {
dataSize = (i == (blockNum - 1)) ? rem : ProDOSDisk::kBlockSize;
dataOffset = _disk->readByte(); // Low byte is first
/* The cursor needs to know where to get the next pointer from in the index block,
* but it also needs to jump to the offset of data to read it, so we need to preserve
* the position in the index block it was in before.
@ -93,7 +93,7 @@ int ProDOSFile::parseIndexBlock(byte *memOffset, int blockNum, int rem) const {
getDataBlock(memOffset + readSize, dataOffset, dataSize);
readSize += dataSize;
// And now we resume the position before this call
_disk->seek(diskPos);
}
@ -129,7 +129,7 @@ Common::SeekableReadStream *ProDOSFile::createReadStream() const {
} else if (_type == kFileTypeSapling) {
_disk->seek(indexBlock);
parseIndexBlock(finalData, _totalBlocks - 1, remainder);
} else {
// If it's not a seed and not a sapling, it's a tree.
_disk->seek(indexBlock);
@ -222,7 +222,7 @@ void ProDOSDisk::getDirectoryHeader(DirHeader *h) {
getHeader(h);
h->_parentBlockPtr = _disk.readUint16LE();
h->_parentEntryIndex = _disk.readByte();
h->_parentEntryLen = _disk.readUint16LE();
h->_parentEntryLen = _disk.readUint16LE();
}
/* This is a little sneaky, but since the bulk of the header is the same, we're just going to pretend the volume header
@ -233,7 +233,7 @@ void ProDOSDisk::getVolumeHeader(VolHeader *h) {
getHeader((DirHeader *)h);
h->_bitmapPtr = _disk.readUint16LE();
h->_volBlocks = _disk.readUint16LE();
_volBlocks = h->_volBlocks;
_volBlocks = h->_volBlocks;
}
/* Getting a file entry header is very similar to getting a header, but with different data. */
@ -280,7 +280,7 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
for (int i = 0; i < h->_fileCount; i++) {
// When we have read all the files for a given block (_entriesPerBlock), we need to change to the next block of the directory
if (parsedFiles == h->_entriesPerBlock) {
parsedFiles = 0;
parsedFiles = 0;
_disk.seek(n * kBlockSize);
p = _disk.readUint16LE();
n = _disk.readUint16LE();
@ -300,8 +300,8 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
_files.setVal(fileName, Common::SharedPtr<ProDOSFile>(currFile));
_disk.seek(currPos);
// Otherwise, if it is a subdirectory, we want to explore that subdirectory
// Otherwise, if it is a subdirectory, we want to explore that subdirectory
} else if (fileEntry._type == kFileTypeSubDir) {
_disk.seek(fileEntry._blockPtr * kBlockSize);
@ -371,7 +371,7 @@ bool ProDOSDisk::open(const Common::String filename) {
ProDOSDisk::ProDOSDisk(const Common::String filename) {
if (open(filename)) {
debug ("%s has been loaded", filename.c_str());
debug("%s has been loaded", filename.c_str());
}
}

View File

@ -83,7 +83,7 @@ enum FileExt {
class ProDOSFile : public Common::ArchiveMember {
public:
ProDOSFile(char name[16], uint8 type, uint16 tBlk, uint32 eof, uint16 bPtr, Common::File *disk);
~ProDOSFile() {}; // File does not need a destructor, because the file it reads from is a pointer to Disk, and Disk has a destructor
~ProDOSFile() {}; // File does not need a destructor, because the file it reads from is a pointer to Disk, and Disk has a destructor
// -- These are the Common::ArchiveMember related functions --
Common::String getName() const override; // Returns _name
@ -95,12 +95,12 @@ public:
void printInfo();
private:
char _name[16];
uint8 _type; // As defined by enum FileType
uint16 _blockPtr; // Block index in volume of index block or data
char _name[16];
uint8 _type; // As defined by enum FileType
uint16 _blockPtr; // Block index in volume of index block or data
uint16 _totalBlocks;
uint32 _eof; // End Of File, used generally as size (exception being sparse files)
Common::File *_disk; // This is a pointer because it is the same _disk as in ProDosDisk, passed to the file object
uint32 _eof; // End Of File, used generally as size (exception being sparse files)
Common::File *_disk; // This is a pointer because it is the same _disk as in ProDosDisk, passed to the file object
};
/* This class defines the entire disk volume. Upon using the open() method,
@ -126,76 +126,76 @@ public:
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
private:
byte _loader1[kBlockSize]; // There's not much reason for these to be needed, but I included them just in case
byte _loader2[kBlockSize];
Common::String _name; // Name of volume
Common::File _disk; // The volume file itself
int _volBlocks; // Total blocks in volume
byte *_volBitmap; // This can determine if the volume is corrupt as it contains a bit for every block, where 0 = unused, 1 = used
Common::HashMap<Common::String, Common::SharedPtr<ProDOSFile>> _files; // Hashmap of files in the volume, where key=Path, Value=ProDOSFile
byte _loader1[kBlockSize]; // There's not much reason for these to be needed, but I included them just in case
byte _loader2[kBlockSize];
Common::String _name; // Name of volume
Common::File _disk; // The volume file itself
int _volBlocks; // Total blocks in volume
byte *_volBitmap; // This can determine if the volume is corrupt as it contains a bit for every block, where 0 = unused, 1 = used
Common::HashMap<Common::String, Common::SharedPtr<ProDOSFile>> _files; // Hashmap of files in the volume, where key=Path, Value=ProDOSFile
struct Date {
uint8 _day;
uint8 _month;
uint8 _year;
uint8 _day;
uint8 _month;
uint8 _year;
};
struct Time {
uint8 _hour;
uint8 _minute;
uint8 _hour;
uint8 _minute;
};
struct VolHeader {
uint8 _type; // Not really important for a volume header, as this will always be F
uint8 _nameLen;
char _name[16];
byte _reserved[8]; // Extra space reserved for possible future uses, not important
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer; // Should pretty much always be 0 as far as I know
uint8 _access; // If this ends up useful, there should be an enum for the access values
uint8 _entryLen; // Always 27 in ProDOS 1.0
uint8 _entriesPerBlock; // Always 0D in ProDOS 1.0
uint8 _type; // Not really important for a volume header, as this will always be F
uint8 _nameLen;
char _name[16];
byte _reserved[8]; // Extra space reserved for possible future uses, not important
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer; // Should pretty much always be 0 as far as I know
uint8 _access; // If this ends up useful, there should be an enum for the access values
uint8 _entryLen; // Always 27 in ProDOS 1.0
uint8 _entriesPerBlock; // Always 0D in ProDOS 1.0
uint16 _fileCount; // Number of files across all data blocks in this directory
uint16 _bitmapPtr; // Block pointer to the keyblock of the bitmap for the entire volume
uint16 _volBlocks; // Blocks in entire volume
};
struct DirHeader {
uint8 _type;
uint8 _nameLen;
char _name[16];
byte _reserved[8];
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer;
uint8 _access;
uint8 _entryLen;
uint8 _entriesPerBlock;
uint8 _type;
uint8 _nameLen;
char _name[16];
byte _reserved[8];
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer;
uint8 _access;
uint8 _entryLen;
uint8 _entriesPerBlock;
uint16 _fileCount;
uint16 _parentBlockPtr; // These values allow ProDOS to navigate back out of a directory, but they aren't really needed by the class to navigate
uint8 _parentEntryIndex; // Index in the current directory
uint8 _parentEntryLen; // This is always 27 in ProDOS 1.0
uint8 _parentEntryIndex; // Index in the current directory
uint8 _parentEntryLen; // This is always 27 in ProDOS 1.0
};
struct FileEntry {
uint8 _type; // 0 = inactive, 1-3 = file, 4 = pascal area, 14 = subdirectory, 15 = volume directory
uint8 _nameLen;
char _name[16];
uint8 _ext; // File extension, uses the enum FileExt
uint8 _type; // 0 = inactive, 1-3 = file, 4 = pascal area, 14 = subdirectory, 15 = volume directory
uint8 _nameLen;
char _name[16];
uint8 _ext; // File extension, uses the enum FileExt
uint16 _blockPtr; // Block pointer to data for seedling, index block for sapling, or master block for tree
uint16 _totalBlocks; // Really important to remember this is the total *including* the index block
uint32 _eof; // This is a long (3 bytes, read low to high) value representing the total readable data in a file (unless it's a sparse file, be careful!)
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer;
uint8 _access;
Date _date;
Time _time;
uint8 _ver;
uint8 _minVer;
uint8 _access;
uint16 _varUse;
Date _modDate;
Time _modTime;
Date _modDate;
Time _modTime;
uint16 _dirHeadPtr; // Pointer to the key block of the directory that contains this file entry
};

View File

@ -111,12 +111,14 @@ int Room::flameGetCyc(Flame *f, int first) {
* This gives us a random entry within the array to start at.
*/
CycID flamePatA[] = {kCycFNormal0, kCycFNormal1, kCycFNormal2,
kCycFNormal0, kCycFNormal1, kCycFNormal2,
kCycFNormal0, kCycFNormal1, kCycFNormal2,
kCycFNormal0, kCycFNormal1, kCycFNormal2};
kCycFNormal0, kCycFNormal1, kCycFNormal2,
kCycFNormal0, kCycFNormal1, kCycFNormal2,
kCycFNormal0, kCycFNormal1, kCycFNormal2
};
CycID flamePatB[] = {kCycFCandleBurst, kCycFCandleSway, kCycFCandleJump,
kCycFCandleLeap, kCycFCandleFlicker,
kCycFCandleFlicker, kCycFCandleFlicker, kCycFCandleFlicker};
kCycFCandleLeap, kCycFCandleFlicker,
kCycFCandleFlicker, kCycFCandleFlicker, kCycFCandleFlicker
};
CycID flamePatC[] = {kCycFOff};
CycID flamePatD[] = {kCycFFlicker0, kCycFFlicker1, kCycFFlicker2};

View File

@ -89,7 +89,7 @@ uint16 ImmortalEngine::mult16(uint16 a, uint16 b) {
/* We aren't using the game's multiplication function (mult16), but we do want
* to retain the ability to drop the second word, without doing (uint16) every time
*/
return (uint16) (a * b);
return (uint16)(a * b);
}
// -----------------------------------------------------
@ -141,7 +141,7 @@ Common::Error ImmortalEngine::run() {
_mainSurface = new Graphics::Surface();
_mainSurface->create(kResH, kResV, Graphics::PixelFormat::createFormatCLUT8());
_screenBuff = new byte[kScreenSize];
if (initDisks() != Common::kNoError) {
@ -156,33 +156,33 @@ Common::Error ImmortalEngine::run() {
_penY = 7;
_penX = 1;
initStoryStatic(); // Init the arrays of static story elements (done at compile time in the source)
loadPalette(); // We need to grab the palette from the disk first
initStoryStatic(); // Init the arrays of static story elements (done at compile time in the source)
loadPalette(); // We need to grab the palette from the disk first
// This is the equivalent of Main->InitGraphics->MyClearScreen in Driver
useNormal(); // The first palette will be the default
loadFont(); // Load the font sprites
loadWindow(); // Load the window background
loadSingles("Song A"); // Music
loadSprites(); // Get all the sprite data into memory
useNormal(); // The first palette will be the default
loadFont(); // Load the font sprites
loadWindow(); // Load the window background
loadSingles("Song A"); // Music
loadSprites(); // Get all the sprite data into memory
_playing = kSongNothing;
_themePaused = 0;
clearSprites(); // Clear the sprites before we start
clearSprites(); // Clear the sprites before we start
// This is where the request play disk would happen, but that's not needed here
logicInit(); // Init the game logic
logicInit(); // Init the game logic
_err = Common::kNoError;
while (!shouldQuit()) {
/* The game loop runs at 60fps, which is 16 milliseconds per frame.
* This loop keeps that time by getting the time in milliseconds at the start of the loop,
* then again at the end, and the difference between them is the remainder
* of the frame budget. If that remainder is within the 16 millisecond budget,
* then it delays ScummVM for the remainder. If it is 0 or negative, then it continues.
*/
/* The game loop runs at 60fps, which is 16 milliseconds per frame.
* This loop keeps that time by getting the time in milliseconds at the start of the loop,
* then again at the end, and the difference between them is the remainder
* of the frame budget. If that remainder is within the 16 millisecond budget,
* then it delays ScummVM for the remainder. If it is 0 or negative, then it continues.
*/
int64 loopStart = g_system->getMillis();
// Main

View File

@ -70,11 +70,11 @@ namespace Immortal {
enum InputAction {
kActionNothing,
kActionKey,
kActionRestart, // Key "R" <-- Debug?
kActionRestart, // Key "R" <-- Debug?
kActionSound,
kActionFire,
kActionButton, // Does this just refer to whatever is not the fire button?
kActionDBGStep // Debug key for moving engine forward one frame at a time
kActionButton, // Does this just refer to whatever is not the fire button?
kActionDBGStep // Debug key for moving engine forward one frame at a time
};
enum ButtonHeldMask {
@ -154,18 +154,18 @@ struct GenericSprite {
// Doors are a property of the level, not the room, they define the connections between rooms
struct Door {
uint8 _x = 0;
uint8 _y = 0;
uint8 _fromRoom = 0;
uint8 _toRoom = 0;
uint8 _x = 0;
uint8 _y = 0;
uint8 _fromRoom = 0;
uint8 _toRoom = 0;
uint8 _busyOnRight = 0;
uint8 _on = 0;
uint8 _on = 0;
};
// Universe is a set of properties for the entire level, nor just the room
struct Univ {
uint16 _rectX = 0;
uint16 _rectY = 0;
uint16 _rectX = 0;
uint16 _rectY = 0;
uint16 _numAnims = 0;
uint16 _numCols = 0;
uint16 _numRows = 0;
@ -199,10 +199,10 @@ public:
/* Terrible functions because C doesn't like
* bit manipulation enough
*/
uint16 xba(uint16 ab); // This just replicates the XBA command from the 65816, because flipping the byte order is somehow not a common library function???
uint16 rol(uint16 ab, int n); // Rotate bits left by n
uint16 ror(uint16 ab, int n); // Rotate bits right by n
uint16 mult16(uint16 a, uint16 b); // Just avoids using (uint16) everywhere, and is slightly closer to the original
uint16 xba(uint16 ab); // This just replicates the XBA command from the 65816, because flipping the byte order is somehow not a common library function???
uint16 rol(uint16 ab, int n); // Rotate bits left by n
uint16 ror(uint16 ab, int n); // Rotate bits right by n
uint16 mult16(uint16 a, uint16 b); // Just avoids using (uint16) everywhere, and is slightly closer to the original
/*
* --- Members ---
@ -219,239 +219,244 @@ public:
const int kMaxCertificate = 16;
// Screen constants
const int kScreenW__ = 128; // ??? labeled in source as SCREENWIDTH
const int kScreenH__ = 128; // ???
const int kScreenW__ = 128; // ??? labeled in source as SCREENWIDTH
const int kScreenH__ = 128; // ???
const int kViewPortW = 256;
const int kViewPortH = 128;
const int kScreenSize = (kResH * kResV) * 2; // The size of the screen buffer is (320x200) * 2 byte words
const int kScreenSize = (kResH *kResV) * 2; // The size of the screen buffer is (320x200) * 2 byte words
const uint16 kScreenLeft = 32;
const uint16 kScreenTop = 20;
const uint8 kTextLeft = 8;
const uint8 kTextTop = 4;
const uint8 kGaugeX = 0;
const uint8 kGaugeY = -13; // ???
const uint16 kScreenBMW = 160; // Screen BitMap Width?
const uint16 kChrW = 64;
const uint8 kGaugeY = -13; // ???
const uint16 kScreenBMW = 160; // Screen BitMap Width?
const uint16 kChrW = 64;
const uint16 kChrH = 32;
const uint16 kChrH2 = kChrH * 2;
const uint16 kChrH3 = kChrH * 3;
const uint16 kChrLen = (kChrW / 2) * kChrH;
const uint16 kChrBMW = kChrW / 2;
const uint16 kChrLen = (kChrW / 2) * kChrH;
const uint16 kChrBMW = kChrW / 2;
const uint16 kLCutaway = 4;
const uint16 kLDrawSolid = 32 * ((3 * 16) + 5);
const uint16 kChrDy[19] = {kChr0, kChrH, kChrH2, kChrH, kChrH2,
kChrH2, kChrH, kChrH2, kChrH2, kChr0,
kChr0, kChrH2, kChrH, kChrH2, kChrH2,
kChrH2, kChrH, kChrH2, kChrH2};
kChrH2, kChrH, kChrH2, kChrH2, kChr0,
kChr0, kChrH2, kChrH, kChrH2, kChrH2,
kChrH2, kChrH, kChrH2, kChrH2
};
const uint16 kChrMask[19] = {kChr0, kChr0, kChr0, kChr0,
kChrR, kChrL, kChr0, kChrL,
kChrR, kChr0, kChr0, kChrLD,
kChr0, kChrR, kChrLD, kChrRD,
kChr0, kChrRD, kChrL};
kChrR, kChrL, kChr0, kChrL,
kChrR, kChr0, kChr0, kChrLD,
kChr0, kChrR, kChrLD, kChrRD,
kChr0, kChrRD, kChrL
};
const uint16 kIsBackground[36] = {1, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0};
0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0
};
const uint16 kTBlisterCorners[60] = {7, 1, 1, 1, 1, 1, 5, 3, 1, 1, 1, 1, 1, 3, 5, 3, 5, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 16, 16, 16, 16, 8,
8, 8, 8, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 16, 16, 16, 16, 8,
8, 8, 8, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
const uint16 kTLogicalCorners[19] = {1, 1, 1, 1, 16, 8, 1, 8,
16, 1, 1, 8, 1, 16, 8, 16,
1, 16, 8};
16, 1, 1, 8, 1, 16, 8, 16,
1, 16, 8
};
// Disk offsets
const int kPaletteOffset = 21205; // This is the byte position of the palette data in the disk
const int kPaletteOffset = 21205; // This is the byte position of the palette data in the disk
// Sprite constants
const uint16 kMaxSpriteW = 64;
const uint16 kMaxSpriteH = 64;
const uint16 kSpriteDY = 32;
const uint16 kVSX = kMaxSpriteW;
const uint16 kVSY = kSpriteDY;
const uint16 kVSBMW = (kViewPortW + kMaxSpriteW) / 2;
const uint16 kVSLen = kVSBMW * (kViewPortH + kMaxSpriteH);
const uint16 kVSDY = 32; // difference from top of screen to top of viewport in the virtual screen buffer
const uint16 kMaxSpriteW = 64;
const uint16 kMaxSpriteH = 64;
const uint16 kSpriteDY = 32;
const uint16 kVSX = kMaxSpriteW;
const uint16 kVSY = kSpriteDY;
const uint16 kVSBMW = (kViewPortW + kMaxSpriteW) / 2;
const uint16 kVSLen = kVSBMW * (kViewPortH + kMaxSpriteH);
const uint16 kVSDY = 32; // difference from top of screen to top of viewport in the virtual screen buffer
const uint16 kMySuperBottom = kVSDY + kViewPortH;
const uint16 kSuperBottom = 200;
const uint16 kMySuperTop = kVSDY;
const uint16 kSuperTop = 0;
const uint16 kViewPortSpX = 32;
const uint16 kViewPortSpY = 0;
const uint16 kWizardX = 28; // Common sprite center for some reason
const uint16 kWizardY = 37;
const uint16 kObjectY = 24;
const uint16 kObjectX = 32;
const uint16 kSuperBottom = 200;
const uint16 kMySuperTop = kVSDY;
const uint16 kSuperTop = 0;
const uint16 kViewPortSpX = 32;
const uint16 kViewPortSpY = 0;
const uint16 kWizardX = 28; // Common sprite center for some reason
const uint16 kWizardY = 37;
const uint16 kObjectY = 24;
const uint16 kObjectX = 32;
const uint16 kObjectHeight = 48;
const uint16 kObjectWidth = 64;
const uint16 kObjectWidth = 64;
// Text constants
const uint8 kMaxRows = 5;
const uint8 kMaxCollumns = 26;
const uint8 kMaxRows = 5;
const uint8 kMaxCollumns = 26;
const uint16 kYesNoY = 88;
const uint16 kYesNoX1 = 8;
const uint16 kYesNoX2 = 182;
const uint16 kYesNoY = 88;
const uint16 kYesNoX1 = 8;
const uint16 kYesNoX2 = 182;
// Asset constants
const char kGaugeOn = 1; // On uses the sprite at index 1 of the font spriteset
const char kGaugeOff = 0; // Off uses the sprite at index 0 of the font spriteset
const char kGaugeStop = 1; // Literally just means the final kGaugeOn char to draw
const char kGaugeStart = 1; // First kGaugeOn char to draw
const char kGaugeOn = 1; // On uses the sprite at index 1 of the font spriteset
const char kGaugeOff = 0; // Off uses the sprite at index 0 of the font spriteset
const char kGaugeStop = 1; // Literally just means the final kGaugeOn char to draw
const char kGaugeStart = 1; // First kGaugeOn char to draw
// Level constants
const int kStoryNull = 5;
const int kStoryNull = 5;
const int kMaxFilesPerLevel = 16;
const int kMaxPartInstances = 4;
const int kLevelToMaze[8] = {0,0,1,1,2,2,2,3};
const int kLevelToMaze[8] = {0, 0, 1, 1, 2, 2, 2, 3};
/*
/*
* 'global' members
*/
// Misc
Common::ErrorCode _err; // If this is not kNoError at any point, the engine will stop
uint8 _certificate[16]; // The certificate (password) is basically the inventory/equipment array
uint8 _lastCertLen = 0;
bool _draw = 0; // Whether the screen should draw this frame
int _zero = 0; // No idea what this is yet
bool _gameOverFlag = false;
uint8 _gameFlags = 0; // Bitflag array of event flags, but only two were used (saving ana and saving the king) <-- why is gameOverFlag not in this? Lol
bool _themePaused = false; // In the source, this is actually considered a bit flag array of 2 bits (b0 and b1). However, it only ever checks for non-zero, so it's effectively only 1 bit.
int _titlesShown = 0;
int _time = 0;
int _promoting = 0; // I think promoting means the title stuff
bool _restart = false;
Common::ErrorCode _err; // If this is not kNoError at any point, the engine will stop
uint8 _certificate[16]; // The certificate (password) is basically the inventory/equipment array
uint8 _lastCertLen = 0;
bool _draw = 0; // Whether the screen should draw this frame
int _zero = 0; // No idea what this is yet
bool _gameOverFlag = false;
uint8 _gameFlags = 0; // Bitflag array of event flags, but only two were used (saving ana and saving the king) <-- why is gameOverFlag not in this? Lol
bool _themePaused = false; // In the source, this is actually considered a bit flag array of 2 bits (b0 and b1). However, it only ever checks for non-zero, so it's effectively only 1 bit.
int _titlesShown = 0;
int _time = 0;
int _promoting = 0; // I think promoting means the title stuff
bool _restart = false;
// Story members
Story _stories[8];
// Level members
int _maxLevels = 0; // This is determined when loading in story files
int _level = 0;
bool _levelOver = false;
int _count = 0;
int _lastLevelLoaded = 0;
int _lastSongLoaded = 0;
int _storyLevel = 0;
int _storyX = 0;
int _loadA = 0;
int _loadY = 0;
uint16 _initialX = 0;
uint16 _initialY = 0;
int _initialBX = 0;
int _initialBY = 0;
int _dRoomNum = 0;
int _initialRoom = 0;
int _currentRoom = 0;
int _lastType = 0;
int _roomCellX = 0;
int _roomCellY = 0;
Room *_rooms[kMaxRooms]; // Rooms within the level
Common::Array<SFlame> _allFlames[kMaxRooms]; // The level needs it's own set of flames so that the flames can be turned on/off permenantly. This is technically more like a hashmap in the source, but it could also be seen as a 2d array, just hashed together in the source
int _maxLevels = 0; // This is determined when loading in story files
int _level = 0;
bool _levelOver = false;
int _count = 0;
int _lastLevelLoaded = 0;
int _lastSongLoaded = 0;
int _storyLevel = 0;
int _storyX = 0;
int _loadA = 0;
int _loadY = 0;
uint16 _initialX = 0;
uint16 _initialY = 0;
int _initialBX = 0;
int _initialBY = 0;
int _dRoomNum = 0;
int _initialRoom = 0;
int _currentRoom = 0;
int _lastType = 0;
int _roomCellX = 0;
int _roomCellY = 0;
Room *_rooms[kMaxRooms]; // Rooms within the level
Common::Array<SFlame> _allFlames[kMaxRooms]; // The level needs it's own set of flames so that the flames can be turned on/off permenantly. This is technically more like a hashmap in the source, but it could also be seen as a 2d array, just hashed together in the source
// Door members
Common::Array<Door> _doors;
uint8 _numDoors = 0;
uint8 _doorRoom = 0;
uint8 _numDoors = 0;
uint8 _doorRoom = 0;
uint8 _doorToNextLevel = 0;
uint8 _doorCameInFrom = 0;
uint8 _ladders = 0;
uint8 _numLadders = 0;
uint8 _ladderInUse = 0;
uint8 _ladders = 0;
uint8 _numLadders = 0;
uint8 _ladderInUse = 0;
uint8 _secretLadder = 0;
uint8 _secretCount = 0;
uint8 _secretDelta = 0;
// Debug members
bool _singleStep = false; // Flag for _singleStep mode
bool _singleStep = false; // Flag for _singleStep mode
// Input members
int _pressedAction = 0;
int _heldAction = 0;
int _pressedAction = 0;
int _heldAction = 0;
int _pressedDirection = 0;
int _heldDirection = 0;
int _heldDirection = 0;
// Text printing members
uint8 _slowText = 0;
uint8 _formatted = 0;
uint8 _collumn = 0;
uint8 _row = 0;
uint8 _myButton = 0;
uint8 _lastYes = 0;
uint8 _collumn = 0;
uint8 _row = 0;
uint8 _myButton = 0;
uint8 _lastYes = 0;
// Music members
Song _playing; // Currently playing song
int _themeID = 0; // Not sure yet tbh
Song _playing; // Currently playing song
int _themeID = 0; // Not sure yet tbh
int _combatID = 0;
// Asset members
int _numSprites = 0; // This is more accurately actually the index within the sprite array, so _numSprites + 1 is the current number of sprites
DataSprite _dataSprites[kFont + 1]; // All the sprite data, indexed by SpriteName
Sprite _sprites[kMaxSprites]; // All the sprites shown on screen
Cycle _cycles[kMaxCycles];
Common::Array<Common::String> _strPtrs; // Str should really be a char array, but inserting frame values will be stupid so it's just a string instead
int _numSprites = 0; // This is more accurately actually the index within the sprite array, so _numSprites + 1 is the current number of sprites
DataSprite _dataSprites[kFont + 1]; // All the sprite data, indexed by SpriteName
Sprite _sprites[kMaxSprites]; // All the sprites shown on screen
Cycle _cycles[kMaxCycles];
Common::Array<Common::String> _strPtrs; // Str should really be a char array, but inserting frame values will be stupid so it's just a string instead
Common::Array<Motive> _motivePtrs;
Common::Array<Damage> _damagePtrs;
Common::Array<Use> _usePtrs;
Common::Array<Use> _usePtrs;
Common::Array<Pickup> _pickupPtrs;
Common::Array<SCycle> _cycPtrs; // This is not actually a set of pointers, but it is serving the function of what was called cycPtrs in the source
CArray2D<Motive> _programPtrs;
Common::Array<SCycle> _cycPtrs; // This is not actually a set of pointers, but it is serving the function of what was called cycPtrs in the source
CArray2D<Motive> _programPtrs;
Common::Array<ObjType> _objTypePtrs;
// Universe members in order of their original memory layout
uint16 *_logicalCNM; // As confusing as this is, we get Logical CNM from the .CNM file, and we get the CNM from the .UNV file
uint16 *_logicalCNM; // As confusing as this is, we get Logical CNM from the .CNM file, and we get the CNM from the .UNV file
uint16 *_modCNM;
uint16 *_modLogicalCNM;
Univ *_univ; // Pointer to the struct that contains the universe properties
Common::SeekableReadStream *_dataBuffer; // This contains the CNM and the CBM
uint16 *_CNM; // Stands for CHARACTER NUMBER MAP
byte *_CBM; // Stands for CHARACTER BIT MAP (?)
byte *_oldCBM;
Univ *_univ; // Pointer to the struct that contains the universe properties
Common::SeekableReadStream *_dataBuffer; // This contains the CNM and the CBM
uint16 *_CNM; // Stands for CHARACTER NUMBER MAP
byte *_CBM; // Stands for CHARACTER BIT MAP (?)
byte *_oldCBM;
uint16 _myCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModLCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
// Screen members
byte *_screenBuff; // The final buffer that will transfer to the screen
byte *_screenBuff; // The final buffer that will transfer to the screen
uint16 _columnX[kViewPortCW + 1];
uint16 _columnTop[kViewPortCW + 1];
uint16 _columnIndex[kViewPortCW + 1]; // Why the heck is this an entire array, when it's just an index that gets zeroed before it gets used anyway...
uint16 _columnIndex[kViewPortCW + 1]; // Why the heck is this an entire array, when it's just an index that gets zeroed before it gets used anyway...
uint16 _tIndex[kMaxDrawItems];
uint16 _tPriority[kMaxDrawItems];
uint16 _viewPortX = 0;
uint16 _viewPortY = 0;
uint16 _myViewPortX = 0; // Probably mirror of viewportX
uint16 _viewPortX = 0;
uint16 _viewPortY = 0;
uint16 _myViewPortX = 0; // Probably mirror of viewportX
uint16 _myViewPortY = 0;
int _lastGauge = 0; // Mirror for player health, used to update health gauge display
uint16 _lastBMW = 0; // Mirrors used to determine where bitmap width needs to be re-calculated
uint16 _lastY = 0;
uint16 _lastPoint = 0;
uint16 _penX = 0; // Basically where in the screen we are currently drawing
uint16 _penY = 0;
int _lastGauge = 0; // Mirror for player health, used to update health gauge display
uint16 _lastBMW = 0; // Mirrors used to determine where bitmap width needs to be re-calculated
uint16 _lastY = 0;
uint16 _lastPoint = 0;
uint16 _penX = 0; // Basically where in the screen we are currently drawing
uint16 _penY = 0;
uint16 _myUnivPointX = 0;
uint16 _myUnivPointY = 0;
int _num2DrawItems = 0;
int _num2DrawItems = 0;
Graphics::Surface *_mainSurface;
GenericSprite _genSprites[6];
GenericSprite _genSprites[6];
// Palette members
int _dontResetColors = 0; // Not sure yet
bool _usingNormal = 0; // Whether the palette is using normal
bool _dim = 0; // Whether the palette is dim
int _dontResetColors = 0; // Not sure yet
bool _usingNormal = 0; // Whether the palette is using normal
bool _dim = 0; // Whether the palette is dim
uint16 _palUniv[16];
uint16 _palDefault[16];
uint16 _palWhite[16];
uint16 _palBlack[16];
uint16 _palDim[16];
byte _palRGB[48]; // Palette that ScummVM actually uses, which is an RGB conversion of the original
byte _palRGB[48]; // Palette that ScummVM actually uses, which is an RGB conversion of the original
/*
@ -464,34 +469,34 @@ GenericSprite _genSprites[6];
*/
// Screen
void clearScreen(); // Draws a black rectangle on the screen buffer but only inside the frame
void whiteScreen(); // Draws a white rectanlge on the screen buffer (but does not do anything with resetColors)
void rect(int x, int y, int w, int h); // Draws a solid rectangle at x,y with size w,h. Also shadows for blit?
void backspace(); // Moves draw position back and draws empty rect in place of char
void clearScreen(); // Draws a black rectangle on the screen buffer but only inside the frame
void whiteScreen(); // Draws a white rectanlge on the screen buffer (but does not do anything with resetColors)
void rect(int x, int y, int w, int h); // Draws a solid rectangle at x,y with size w,h. Also shadows for blit?
void backspace(); // Moves draw position back and draws empty rect in place of char
void printByte(int b);
void printChr(char c);
void loadWindow(); // Gets the window.bm file
void drawUniv(); // Draw the background, add the sprites, determine draw order, draw the sprites
void copyToScreen(); // If draw is 0, just check input, otherwise also copy the screen buffer to the scummvm surface and update screen
void mungeBM(); // Put together final bitmap?
void blit(); // Will probably want this to be it's own function
void blit40(); // Uses macro blit 40 times
void loadWindow(); // Gets the window.bm file
void drawUniv(); // Draw the background, add the sprites, determine draw order, draw the sprites
void copyToScreen(); // If draw is 0, just check input, otherwise also copy the screen buffer to the scummvm surface and update screen
void mungeBM(); // Put together final bitmap?
void blit(); // Will probably want this to be it's own function
void blit40(); // Uses macro blit 40 times
void sBlit();
void scroll();
void makeMyCNM(); // ?
void drawBGRND(); // Draw floor parts of leftmask rightmask and maskers
void addRows(); // Add rows to drawitem array
void makeMyCNM(); // ?
void drawBGRND(); // Draw floor parts of leftmask rightmask and maskers
void addRows(); // Add rows to drawitem array
void addSprite(uint16 vpX, uint16 vpY, SpriteName s, int img, uint16 x, uint16 y, uint16 p);
void addSprites(); // Add all active sprites that are in the viewport, into a list that will be sorted by priority
void sortDrawItems(); // Sort said items
void drawItems(); // Draw the items over the background
void addSprites(); // Add all active sprites that are in the viewport, into a list that will be sorted by priority
void sortDrawItems(); // Sort said items
void drawItems(); // Draw the items over the background
void drawIcon(int img);
void setPen(uint16 penX, uint16 penY); // Sets the 'pen' x and y positions, including making y negative if above a certain point
void setPen(uint16 penX, uint16 penY); // Sets the 'pen' x and y positions, including making y negative if above a certain point
void center();
void carriageReturn();
// Music
void toggleSound(); // Actually pauses the sound, doesn't just turn it off/mute
void toggleSound(); // Actually pauses the sound, doesn't just turn it off/mute
void fixPause();
Song getPlaying();
void playMazeSong();
@ -501,46 +506,46 @@ GenericSprite _genSprites[6];
void stopMusic();
void musicPause(int sID);
void musicUnPause(int sID);
void loadSingles(Common::String songName); // Loads and then parse the maze song
void loadSingles(Common::String songName); // Loads and then parse the maze song
void standardBeep();
// Palette
void loadPalette(); // Get the static palette data from the disk
void setColors(uint16 pal[]); // Applies the current palette to the ScummVM surface palette
void fixColors(); // Determine whether the screen should be dim or normal
void loadPalette(); // Get the static palette data from the disk
void setColors(uint16 pal[]); // Applies the current palette to the ScummVM surface palette
void fixColors(); // Determine whether the screen should be dim or normal
void useNormal();
void useDim();
void useBlack();
void useWhite();
void pump(); // Alternates between white and black with delays in between (flashes screen)
void pump(); // Alternates between white and black with delays in between (flashes screen)
void fadePal(uint16 pal[], int count, uint16 target[]); // Fades the palette except the frame
void fade(uint16 pal[], int dir, int delay); // Calls fadePal() by a given delay each iteration
void fadeOut(int j); // Calls Fade with a delay of j jiffies and direction 1
void fadeIn(int j); // || and direction 0
void fade(uint16 pal[], int dir, int delay); // Calls fadePal() by a given delay each iteration
void fadeOut(int j); // Calls Fade with a delay of j jiffies and direction 1
void fadeIn(int j); // || and direction 0
void normalFadeOut();
void slowFadeOut();
void normalFadeIn();
// Assets
Common::SeekableReadStream *loadIFF(Common::String fileName); // Loads a file and uncompresses if it is compressed
void initStoryStatic(); // Sets up all of the global static story elements
int loadUniv(char mazeNum); // Unpacks the .CNM and .UNV files into all the CNM stuff, returns the total length of everything
void loadMazeGraphics(int m); // Creates a universe with a maze
void makeBlisters(int povX, int povY); // Turns the unmodified CNM/CBM/LCNM etc into the modified ones to actually be used for drawing the game
void loadFont(); // Gets the font.spr file, and centers the sprite
void clearSprites(); // Clears all sprites before drawing the current frame
void loadSprites(); // Loads all the sprite files and centers their sprites (in spritelist, but called from kernal)
void initStoryStatic(); // Sets up all of the global static story elements
int loadUniv(char mazeNum); // Unpacks the .CNM and .UNV files into all the CNM stuff, returns the total length of everything
void loadMazeGraphics(int m); // Creates a universe with a maze
void makeBlisters(int povX, int povY); // Turns the unmodified CNM/CBM/LCNM etc into the modified ones to actually be used for drawing the game
void loadFont(); // Gets the font.spr file, and centers the sprite
void clearSprites(); // Clears all sprites before drawing the current frame
void loadSprites(); // Loads all the sprite files and centers their sprites (in spritelist, but called from kernal)
// Input
void userIO(); // Get input
void pollKeys(); // Buffer input
void noNetwork(); // Setup input mirrors
void waitKey(); // Waits until a key is pressed (until getInput() returns true)
void waitClick(); // Waits until one of the two buttons is pressed
void blit8(); // This is actually just input, but it is called blit because it does a 'paddle blit' 8 times
void userIO(); // Get input
void pollKeys(); // Buffer input
void noNetwork(); // Setup input mirrors
void waitKey(); // Waits until a key is pressed (until getInput() returns true)
void waitClick(); // Waits until one of the two buttons is pressed
void blit8(); // This is actually just input, but it is called blit because it does a 'paddle blit' 8 times
// These will replace the myriad of hardware input handling from the source
bool getInput(); // True if there was input, false if not
bool getInput(); // True if there was input, false if not
void addKeyBuffer();
void clearKeyBuff();
@ -564,24 +569,24 @@ GenericSprite _genSprites[6];
void drawLRHC(int chr, int x, int y);
/*
/*
* [Logic.cpp] Functions from Logic.GS
*/
// Debug
void doSingleStep(); // Let the user advance the engine one frame at a time
void doSingleStep(); // Let the user advance the engine one frame at a time
// Main
void trapKeys(); // Poorly named, this checks if the player wants to restart/pause music/use debug step
int keyOrButton(); // Returns value based on whether it was a keyboard key or a button press
void trapKeys(); // Poorly named, this checks if the player wants to restart/pause music/use debug step
int keyOrButton(); // Returns value based on whether it was a keyboard key or a button press
void logicInit();
void logic(); // Keeps time, handles win and lose conditions, then general logic
void restartLogic(); // This is the actual logic init
int logicFreeze(); // Overcomplicated way to check if game over or level over
void logic(); // Keeps time, handles win and lose conditions, then general logic
void restartLogic(); // This is the actual logic init
int logicFreeze(); // Overcomplicated way to check if game over or level over
void updateHitGauge();
void drawGauge(int h);
void makeCertificate();
void calcCheckSum(int l, uint8 checksum[]); // Checksum is one word, but the source called it CheckSum
void calcCheckSum(int l, uint8 checksum[]); // Checksum is one word, but the source called it CheckSum
bool getCertificate();
void printCertificate();
@ -594,7 +599,7 @@ GenericSprite _genSprites[6];
bool isSavedKing();
void setSavedAna();
bool isSavedAna();
int getLevel(); // Literally just return _level...
int getLevel(); // Literally just return _level...
void gameOverDisplay();
void gameOver();
void levelOver();
@ -662,7 +667,7 @@ GenericSprite _genSprites[6];
*/
// Misc
void cycleFreeAll(); // Delete all cycles
void cycleFreeAll(); // Delete all cycles
/*
@ -678,7 +683,7 @@ GenericSprite _genSprites[6];
// Init
void initDataSprite(Common::SeekableReadStream *f, DataSprite *d, int index, uint16 cenX, uint16 cenY); // Initializes the data sprite
// Main
void superSprite(DataSprite *dSprite, uint16 x, uint16 y, int img, uint16 bmw, byte *dst, uint16 superTop, uint16 superBottom);
bool clipSprite(uint16 &height, uint16 &pointIndex, uint16 &skipY, DataSprite *dSprite, uint16 &pointX, uint16 &pointY, int img, uint16 bmw, uint16 superTop, uint16 superBottom);
@ -702,7 +707,7 @@ GenericSprite _genSprites[6];
* [door.cpp] Functions from Door.GS
*/
void roomTransfer(int r, int x, int y); // Transfers the player from the current room to a new room at x,y
void roomTransfer(int r, int x, int y); // Transfers the player from the current room to a new room at x,y
void doorOpenSecret();
void doorCloseSecret();
//void doorToNextLevel();
@ -711,7 +716,7 @@ GenericSprite _genSprites[6];
void doorNew(SDoor door);
void doorDrawAll();
void doorOnDoorMat();
//void doorEnter(); // <-- this is actually a method of Player Monster, should probably move it there later
//void doorEnter(); // <-- this is actually a method of Player Monster, should probably move it there later
int findDoorTop(int x, int y);
int findDoor(int x, int y);
bool doLockStuff(int d, MonsterID m, int top);
@ -735,9 +740,9 @@ GenericSprite _genSprites[6];
*
*/
Common::ErrorCode initDisks(); // Opens and parses IMMORTAL.dsk and IMMORTAL_GFX.dsk
uint32 getFeatures() const; // Returns the game description flags
Common::String getGameId() const; // Returns the game Id
Common::ErrorCode initDisks(); // Opens and parses IMMORTAL.dsk and IMMORTAL_GFX.dsk
uint32 getFeatures() const; // Returns the game description flags
Common::String getGameId() const; // Returns the game Id
/* Gets a random number
*/
@ -747,9 +752,9 @@ GenericSprite _genSprites[6];
bool hasFeature(EngineFeature f) const override {
return
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime) ||
(f == kSupportsReturnToLauncher);
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime) ||
(f == kSupportsReturnToLauncher);
};
bool canLoadGameStateCurrently() override {
@ -765,13 +770,13 @@ GenericSprite _genSprites[6];
Common::Error syncGame(Common::Serializer &s);
/* Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) {
Common::Serializer s(nullptr, stream);
return syncGame(s);
Common::Serializer s(nullptr, stream);
return syncGame(s);
}
Common::Error loadGameStream(Common::SeekableReadStream *stream) {
Common::Serializer s(stream, nullptr);
return syncGame(s);
Common::Serializer s(stream, nullptr);
return syncGame(s);
} */
};

View File

@ -30,7 +30,7 @@
namespace Immortal {
/*
/*
*
* ----- -----
* ----- Screen Drawing Functions -----
@ -49,11 +49,11 @@ void ImmortalEngine::drawUniv() {
_myUnivPointY = !(_myViewPortY & (kChrH - 1)) + kViewPortSpY;
//makeMyCNM();
//drawBGRND(); // Draw floor parts of leftmask rightmask and maskers
//addRows(); // Add rows to drawitem array
//addSprites(); // Add all active sprites that are in the viewport, into a list that will be sorted by priority
//sortDrawItems(); // Sort said items
//drawItems(); // Draw the items over the background
//drawBGRND(); // Draw floor parts of leftmask rightmask and maskers
//addRows(); // Add rows to drawitem array
//addSprites(); // Add all active sprites that are in the viewport, into a list that will be sorted by priority
//sortDrawItems(); // Sort said items
//drawItems(); // Draw the items over the background
}
void ImmortalEngine::copyToScreen() {
@ -79,7 +79,7 @@ void ImmortalEngine::clearScreen() {
_screenBuff[((y + 20) * kResH) + (x + 32)] = 0;
}
}
_penX = kTextLeft;
_penY = kTextTop;
@ -109,8 +109,8 @@ void ImmortalEngine::addRows() {
// I'm not really sure how this works yet
int i = _num2DrawItems;
_tPriority[i] = !(!(_myViewPortY & (kChrH - 1)) + _myViewPortY);
for (int j = 0; j != kViewPortCH+4; j++, i++) {
for (int j = 0; j != kViewPortCH + 4; j++, i++) {
_tIndex[i] = (j << 5) | 0x8000;
_tPriority[i] = _tPriority[i] - kChrH;
}
@ -123,13 +123,13 @@ void ImmortalEngine::addSprite(uint16 vpX, uint16 vpY, SpriteName s, int img, ui
if (x >= (kResH + kMaxSpriteLeft)) {
x |= kMaskHigh; // Make it negative
}
_sprites[_numSprites]._X = (x << 1) + vpX;
if (y >= (kMaxSpriteAbove + kResV)) {
y |= kMaskHigh;
}
_sprites[_numSprites]._Y = (y << 1) + vpY;
if (p >= 0x80) {
@ -137,7 +137,7 @@ void ImmortalEngine::addSprite(uint16 vpX, uint16 vpY, SpriteName s, int img, ui
}
_sprites[_numSprites]._priority = ((p + y) ^ 0xFFFF) + 1;
_sprites[_numSprites]._image = img;
_sprites[_numSprites]._dSprite = &_dataSprites[s];
_sprites[_numSprites]._on = 1;
@ -153,7 +153,9 @@ void ImmortalEngine::addSprites() {
int tmpNum = _num2DrawItems;
for (int i = 0; i < kMaxSprites; i++) {
// If the sprite is active
// This is commented out for testing until the issue with the function is resolved
/* TODO
* This is commented out for testing until the issue with the function is resolved
*/
if (/*_sprites[i]._on*/0 == 1) {
// If sprite X is an odd number???
if ((_sprites[i]._X & 1) != 0) {
@ -185,7 +187,7 @@ void ImmortalEngine::addSprites() {
int sx = ((_sprites[i]._X + tempImg->_deltaX) - tempD->_cenX) - _myViewPortX;
int sy = ((_sprites[i]._Y + tempImg->_deltaY) - tempD->_cenY) - _myViewPortY;
if (sx >= 0 ) {
if (sx >= 0) {
if (sx >= kViewPortW) {
continue;
}
@ -193,7 +195,7 @@ void ImmortalEngine::addSprites() {
continue;
}
if (sy >= 0 ) {
if (sy >= 0) {
if (sy >= kViewPortH) {
continue;
}
@ -226,10 +228,10 @@ void ImmortalEngine::sortDrawItems() {
// Assume that the list is sorted
bailout = true;
for (int i = 1; i < top; i++) {
if (_tPriority[i] > _tPriority[i-1]) {
if (_tPriority[i] > _tPriority[i - 1]) {
uint16 tmp = _tPriority[i];
_tPriority[i] = _tPriority[i-1];
_tPriority[i-1] = tmp;
_tPriority[i] = _tPriority[i - 1];
_tPriority[i - 1] = tmp;
// List was not sorted yet, therefor we need to check it again
bailout = false;
@ -264,9 +266,9 @@ void ImmortalEngine::drawBGRND() {
// Left Mask, draw upper right hand corner (UPHC) of floor
drawURHC(_myCNM[y2][x], pointX, pointY);
}
pointX += kChrW; // This (and the H version) could be added to the for loop iterator arugment
pointX += kChrW; // This (and the H version) could be added to the for loop iterator arugment
}
pointX -= (kChrW * (kViewPortCW + 1)); // They could have also just done pointX = _myUnivPointX
pointX -= (kChrW * (kViewPortCW + 1)); // They could have also just done pointX = _myUnivPointX
pointY += kChrH;
}
}
@ -290,7 +292,7 @@ void ImmortalEngine::drawItems() {
uint16 rowY = 0;
do {
uint16 index = _tIndex[n];
if (index >= 0x8000) { // If negative, it's a row to draw
if (index >= 0x8000) { // If negative, it's a row to draw
// rowY is (I think) the position of the start of the scroll window within the tile data
rowY = (index & 0x7FFF) + _myUnivPointY;
@ -376,10 +378,10 @@ void ImmortalEngine::printByte(int b) {
void ImmortalEngine::printChr(char c) {
// This draws a character from the font sprite table, indexed as an ascii char, using superSprite
c &= kMaskASCII; // Grab just the non-extended ascii part
c &= kMaskASCII; // Grab just the non-extended ascii part
if (c == ' ') {
_penX += 8; // A space just moves the position on the screen to draw ahead by the size of a space
_penX += 8; // A space just moves the position on the screen to draw ahead by the size of a space
return;
}
@ -394,7 +396,7 @@ void ImmortalEngine::printChr(char c) {
case 'M':
case 'W':
_penX += 8;
// fall through
// fall through
default:
break;
}
@ -408,13 +410,13 @@ void ImmortalEngine::printChr(char c) {
_penX -= 3;
break;
case 'j':
// fall through
// fall through
case 't':
_penX -= 2;
break;
case 'l':
_penX -= 4;
// fall through
// fall through
default:
break;
}
@ -517,13 +519,13 @@ int ImmortalEngine::loadUniv(char mazeNum) {
// The view port of the level is longer than it is wide, so there are more columns than rows
// numCols = rectX / 64 (charW)
_univ->_rectX = mazeUNV->readUint16LE() << 1;
_univ->_rectX = mazeUNV->readUint16LE() << 1;
_univ->_numCols = _univ->_rectX >> 6;
_univ->_num2Cols = _univ->_numCols << 1;
// univRectY is mazeUNV[22]
// numRows = rectY / 32 (charH)
_univ->_rectY = mazeUNV->readUint16LE();
_univ->_rectY = mazeUNV->readUint16LE();
_univ->_numRows = _univ->_rectY >> 5;
_univ->_num2Rows = _univ->_numRows << 1;
@ -557,7 +559,7 @@ int ImmortalEngine::loadUniv(char mazeNum) {
}
_dataBuffer->seek(0);
_univ->_numChrs++; // Inc one more time being 0 counts
_univ->_numChrs++; // Inc one more time being 0 counts
_univ->_num2Chrs = _univ->_numChrs << 1;
//int lCNMCBM = mungeCBM(_univ->_num2Chrs);
@ -591,37 +593,39 @@ void ImmortalEngine::loadSprites() {
*/
Common::String spriteNames[] = {"MORESPRITES.SPR", "NORLAC.SPR", "POWWOW.SPR", "TURRETS.SPR",
"WORM.SPR", "IANSPRITES.SPR", "LAST.SPR", "DOORSPRITES.SPR",
"GENSPRITES.SPR", "DRAGON.SPR", "MORDAMIR.SPR", "FLAMES.SPR",
"ROPE.SPR", "RESCUE.SPR", "TROLL.SPR", "GOBLIN.SPR", "WIZARDA.SPR",
"WIZARDB.SPR", "ULINDOR.SPR", "SPIDER.SPR", "DRAG.SPR"};
"WORM.SPR", "IANSPRITES.SPR", "LAST.SPR", "DOORSPRITES.SPR",
"GENSPRITES.SPR", "DRAGON.SPR", "MORDAMIR.SPR", "FLAMES.SPR",
"ROPE.SPR", "RESCUE.SPR", "TROLL.SPR", "GOBLIN.SPR", "WIZARDA.SPR",
"WIZARDB.SPR", "ULINDOR.SPR", "SPIDER.SPR", "DRAG.SPR"
};
// Number of sprites in each file
int spriteNum[] = {10, 5, 7, 10, 4, 6, 3, 10, 5, 3, 2, 1, 3, 2, 9, 10, 8, 3, 9, 10, 9};
// Pairs of (x,y) for each sprite
// Should probably have made this a 2d array, oops
uint16 centerXY[] = {16,56, 16,32, 27,39, 16,16, 32,16, 34,83, 28,37, 8,12, 8,19, 24,37,
/* Norlac */ 46,18, 40,0, 8,13, 32,48, 32,40,
/* Powwow */ 53,43, 28,37, 27,37, 26,30, 26,30, 26,29, 28,25,
/* Turrets */ 34,42, 28,37, 24,32, 32,56, 26,56, 8,48, 8,32, 8,14, 8,24, 32,44,
/* Worm */ 20,65, 25,46, 9,56, 20,53,
/* Iansprites */ 24,50, 32,52, 32,53, 32,52, 40,16, 40,16,
/* Last */ 32,56, 24,32, 24,36,
/* Doorsprites */ 0,64, 4,49, 18,49, 18,56, 24,32, 24,16, 24,56, 24,32, 24,32, 36,32,
/* Gensprites */ 16,44, 16,28, 32,24, 34,45, 20,28,
/* Dragon */ 24,93, 32,48, 0,64,
/* Mordamir */ 104,104, 30,30,
/* Flames */ 64,0,
/* Rope */ 0,80, 32,52, 32,40,
/* Rescue */ 0,112, 0,112,
/* Troll */ 28,38, 28,37, 28,37, 31,38, 28,37, 25,39, 28,37, 28,37, 28,37,
/* Goblin */ 28,38, 30,38, 26,37, 30,38, 26,37, 26,37, 26,37, 26,37, 26,36, 44,32,
/* Wizarda */ 28,37, 28,37, 28,37, 28,37, 28,37, 28,37, 28,37, 28,37,
/* Wizardb */ 28,37, 28,37, 28,37,
/* Ulindor */ 42,42, 42,42, 42,42, 42,42, 42,42, 42,42, 42,42, 42,42, 42,42,
/* Spider */ 64,44, 64,44, 64,44, 64,44, 64,44, 64,44, 64,44, 64,44, 64,44, 64,44,
/* Drag */ 19,36, 19,36, 19,36, 19,36, 19,36, 19,36, 19,36, 19,36, 19,36};
uint16 centerXY[] = {16, 56, 16, 32, 27, 39, 16, 16, 32, 16, 34, 83, 28, 37, 8, 12, 8, 19, 24, 37,
/* Norlac */ 46, 18, 40, 0, 8, 13, 32, 48, 32, 40,
/* Powwow */ 53, 43, 28, 37, 27, 37, 26, 30, 26, 30, 26, 29, 28, 25,
/* Turrets */ 34, 42, 28, 37, 24, 32, 32, 56, 26, 56, 8, 48, 8, 32, 8, 14, 8, 24, 32, 44,
/* Worm */ 20, 65, 25, 46, 9, 56, 20, 53,
/* Iansprites */ 24, 50, 32, 52, 32, 53, 32, 52, 40, 16, 40, 16,
/* Last */ 32, 56, 24, 32, 24, 36,
/* Doorsprites */ 0, 64, 4, 49, 18, 49, 18, 56, 24, 32, 24, 16, 24, 56, 24, 32, 24, 32, 36, 32,
/* Gensprites */ 16, 44, 16, 28, 32, 24, 34, 45, 20, 28,
/* Dragon */ 24, 93, 32, 48, 0, 64,
/* Mordamir */ 104, 104, 30, 30,
/* Flames */ 64, 0,
/* Rope */ 0, 80, 32, 52, 32, 40,
/* Rescue */ 0, 112, 0, 112,
/* Troll */ 28, 38, 28, 37, 28, 37, 31, 38, 28, 37, 25, 39, 28, 37, 28, 37, 28, 37,
/* Goblin */ 28, 38, 30, 38, 26, 37, 30, 38, 26, 37, 26, 37, 26, 37, 26, 37, 26, 36, 44, 32,
/* Wizarda */ 28, 37, 28, 37, 28, 37, 28, 37, 28, 37, 28, 37, 28, 37, 28, 37,
/* Wizardb */ 28, 37, 28, 37, 28, 37,
/* Ulindor */ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
/* Spider */ 64, 44, 64, 44, 64, 44, 64, 44, 64, 44, 64, 44, 64, 44, 64, 44, 64, 44, 64, 44,
/* Drag */ 19, 36, 19, 36, 19, 36, 19, 36, 19, 36, 19, 36, 19, 36, 19, 36, 19, 36
};
// s = current sprite index, f = current file index, n = current number of sprites for this file
int s = 0;
@ -632,7 +636,7 @@ void ImmortalEngine::loadSprites() {
for (int n = 0; n < (spriteNum[f] * 2); n += 2, s++) {
// For every data sprite in the file, make a datasprite and initialize it
DataSprite d;
initDataSprite(file, &d, n/2, centerXY[s * 2], centerXY[(s * 2) + 1]);
initDataSprite(file, &d, n / 2, centerXY[s * 2], centerXY[(s * 2) + 1]);
_dataSprites[s] = d;
}
}
@ -716,7 +720,7 @@ Common::SeekableReadStream *ImmortalEngine::loadIFF(Common::String fileName) {
* allowing us to directly compare it with 'CMP0'.
*/
char compSig[] = "CMP0";
char sig[] = "0000";
char sig[] = "0000";
f.seek(8);
@ -726,7 +730,7 @@ Common::SeekableReadStream *ImmortalEngine::loadIFF(Common::String fileName) {
if (strcmp(sig, compSig) == 0) {
debug("compressed");
/* The size of the compressed data is stored in the header, but doesn't
* account for the FORM part?? Also, **technically** this is a uint32LE,
* but the engine itself actually /doesn't/ use it like that. It only
@ -775,7 +779,7 @@ void ImmortalEngine::loadPalette() {
// The palettes are stored at a particular location in the disk, this just grabs them
Common::File d;
d.open("IMMORTAL.dsk");
d.seek(kPaletteOffset);
d.read(_palDefault, 32);
d.read(_palWhite, 32);
@ -797,8 +801,8 @@ void ImmortalEngine::setColors(uint16 pal[]) {
// Blue is the first nyble of the first byte, so it needs to move left by 4 bits (000B -> 00B0)
// We also need to repeat the bits so that the colour is the same proportion of 255 as it is of 15
_palRGB[(i * 3)] = ((pal[i] & kMaskRed) >> 4) | ((pal[i] & kMaskRed) >> 8);
_palRGB[(i * 3) + 1] = (pal[i] & kMaskGreen) | ((pal[i] & kMaskGreen) >> 4);
_palRGB[(i * 3) + 2] = (pal[i] & kMaskBlue) | ((pal[i] & kMaskBlue) << 4);
_palRGB[(i * 3) + 1] = (pal[i] & kMaskGreen) | ((pal[i] & kMaskGreen) >> 4);
_palRGB[(i * 3) + 2] = (pal[i] & kMaskBlue) | ((pal[i] & kMaskBlue) << 4);
}
}
// Palette index to update first is 0, and there are 16 colours to update
@ -847,9 +851,10 @@ void ImmortalEngine::fadePal(uint16 pal[], int count, uint16 target[]) {
* kept, this is a direct translation of the bit manipulation sequence.
*/
uint16 maskPal[16] = {0xFFFF, 0x0000, 0x0000, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF, 0xFFFF, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF, 0xFFFF, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF
};
uint16 result;
uint16 temp;
@ -930,7 +935,7 @@ void ImmortalEngine::useWhite() {
void ImmortalEngine::useNormal() {
setColors(_palDefault);
_usingNormal = 1;
_usingNormal = 1;
}
void ImmortalEngine::useDim() {
@ -1007,13 +1012,13 @@ void ImmortalEngine::fixPause() {
// This is a nasty bit of code isn't it? It's accurate to the source though :D
switch (_playing) {
case kSongText:
// fall through
// fall through
case kSongMaze:
if (_themePaused) {
musicUnPause(_themeID);
break;
}
// fall through
// fall through
default:
musicPause(_themeID);
break;
@ -1026,7 +1031,7 @@ void ImmortalEngine::fixPause() {
musicUnPause(_combatID);
break;
}
// fall through
// fall through
default:
musicPause(_combatID);
break;
@ -1087,7 +1092,7 @@ void ImmortalEngine::center() {
// Reset the X position and move the Y position down by 16 pixels
void ImmortalEngine::carriageReturn() {
_penY += 16;
_penX = kTextLeft;
_penX = kTextLeft;
}
} // namespace Immortal

View File

@ -129,7 +129,7 @@ void ImmortalEngine::levelDrawAll() {
void ImmortalEngine::levelShowRoom(int r, int bX, int bY) {
_currentRoom = r;
cycleFreeAll(); // This may not be needed, or it may need to be changed slightly
cycleFreeAll(); // This may not be needed, or it may need to be changed slightly
_rooms[_currentRoom]->flameSetRoom(_allFlames[r]);
//univSetRoom(r, bX, bY);
//fset, spark, bullet, and door get set to the current room

View File

@ -48,14 +48,14 @@ void ImmortalEngine::restartLogic() {
miscInit();
cycleFreeAll();
levelInit();
//roomInit(); <-- will be run in constructor of room
//monstInit(); <-- room.initMonsters() \
//objectInit(); <-- room.initObjects()
//doorInit(); <-- room.initDoors() |- probably all get run from room constructor
//sparkInit(); <-- room.initSparks()
//bulletInit(); <-- room.initProjectiles() /
//objectInit(); <-- again? Odd...
//genericSpriteInit(); <-- room.initGenSprites()
//roomInit(); <-- will be run in constructor of room
//monstInit(); <-- room.initMonsters() \
//objectInit(); <-- room.initObjects()
//doorInit(); <-- room.initDoors() |- probably all get run from room constructor
//sparkInit(); <-- room.initSparks()
//bulletInit(); <-- room.initProjectiles() /
//objectInit(); <-- again? Odd...
//genericSpriteInit(); <-- room.initGenSprites()
if (fromOldGame() == false) {
_level = 0;
@ -65,12 +65,12 @@ void ImmortalEngine::restartLogic() {
_rooms[_currentRoom]->flameInit();
if (_level != 7) {
_themePaused = true; // and #-1-2 = set both flags for themePaused
_themePaused = true; // and #-1-2 = set both flags for themePaused
}
}
void ImmortalEngine::logic() {
trapKeys(); // First thing in any gameloop is to check if we should restart/toggle sound
trapKeys(); // First thing in any gameloop is to check if we should restart/toggle sound
_time += 1;
/* This is actually the main game state loop. I think the best way to translate it
@ -98,7 +98,7 @@ void ImmortalEngine::logic() {
_themePaused = true;
_levelOver = false;
if (_level == (_maxLevels-1)) {
if (_level == (_maxLevels - 1)) {
textPrint(kStrYouWin, 0);
} else {
@ -111,7 +111,7 @@ void ImmortalEngine::logic() {
} else {
// Here's where the gameplay sequence actually happens!
doSingleStep(); // Debug step function
doSingleStep(); // Debug step function
//monstRunAll();
//objectRunAll();
//doInfiniteHallways();
@ -158,7 +158,7 @@ void ImmortalEngine::trapKeys() {
break;
case kActionSound:
toggleSound();
// fall through
// fall through
default:
break;
}
@ -175,10 +175,10 @@ int ImmortalEngine::keyOrButton() {
button = _pressedAction;
break;
case kActionFire:
// fall through
// fall through
case kActionButton:
button = 13;
// fall through
// fall through
default:
break;
}
@ -293,13 +293,13 @@ bool ImmortalEngine::fromOldGame() {
_dontResetColors = 0;
if (_promoting == 1) {
_promoting = 0;
} else {
do {
if (!textPrint(kStrOldGame, 0)) {
// They choose not to load an old game
return false;
return false;
}
} while (getCertificate() == true);
@ -318,7 +318,7 @@ bool ImmortalEngine::fromOldGame() {
//uint8 hits = _certificate[kCertHits];
//uint8 quick = _certificate[kCertQuickness];
//uint8 gold = (_certificate[kCertGoldHi] << 4) | _certificate[kCertGoldLo];
// monstMakePlayer(hits, quick, gold); <- will become room.makePlayer();
// monstMakePlayer(hits, quick, gold); <- will become room.makePlayer();
// Create the inventory
// room.makeObject(3, kObjIsRunning, 0, goldType);
@ -326,7 +326,7 @@ bool ImmortalEngine::fromOldGame() {
// Hi bits of inventory
int certInv = _certificate[kCertInvHi];
if ((certInv & 1) != 0 ) {
if ((certInv & 1) != 0) {
if (_level < 2) {
//room.makeObject(3, 0, 0, waterType);
}
@ -386,7 +386,7 @@ bool ImmortalEngine::fromOldGame() {
if ((certInv & 4) != 0) {
//room.makeObject(3, 0, kSporesFrame, antiType);
}
// fall through
// fall through
default:
break;
}
@ -446,17 +446,17 @@ void ImmortalEngine::makeCertificate() {
if (true/*room.monster[kPlayerID].hasObject(wowCharmType)*/) {
_certificate[kCertInvLo] |= 4;
}
// fall through
// fall through
case 3:
if (true/*room.monster[kPlayerID].hasObject(faceRingType)*/) {
_certificate[kCertInvLo] |= 1;
}
// fall through
// fall through
case 4:
if (true/*room.monster[kPlayerID].hasObject(coffeeType)*/) {
_certificate[kCertInvLo] |= 2;
}
// fall through
// fall through
case 7:
if (true/*room.monster[kPlayerID].hasObject(bronzeType)*/) {
_certificate[kCertInvLo] |= 1;
@ -469,7 +469,7 @@ void ImmortalEngine::makeCertificate() {
if (true/*room.monster[kPlayerID].hasObject(antiType)*/) {
_certificate[kCertInvLo] |= 4;
}
// fall through
// fall through
default:
_lastCertLen = 13;
uint8 checksum[4];
@ -515,11 +515,11 @@ bool ImmortalEngine::getCertificate() {
} else if (k == 0x7f) {
// The input was a backspace
if (certLen != 0) {
certLen--; // Length is one smaller now
backspace(); // move the drawing position back and reprint the '-' char
certLen--; // Length is one smaller now
backspace(); // move the drawing position back and reprint the '-' char
backspace();
printChr('-');
}
}
} else {
// The input was a key
@ -588,7 +588,7 @@ void ImmortalEngine::printCertificate() {
* but grabbing it from a table is faster and doesn't
* use a lot of space (especially if it's used anywhere else)
*/
char toHex[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
char toHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
textBeginning(kStrCert, 0);
for (int i = 0; i < _lastCertLen; i++) {

View File

@ -34,12 +34,12 @@ Common::Error ImmortalMetaEngine::createInstance(OSystem *syst, Engine **engine,
bool ImmortalMetaEngine::hasFeature(MetaEngineFeature f) const {
return (f == kSavesUseExtendedFormat) ||
(f == kSimpleSavesNames) ||
(f == kSupportsListSaves) ||
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
(f == kSupportsLoadingDuringStartup);
(f == kSimpleSavesNames) ||
(f == kSupportsListSaves) ||
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
(f == kSupportsLoadingDuringStartup);
}
#if PLUGIN_ENABLED_DYNAMIC(IMMORTAL)

View File

@ -23,7 +23,7 @@
namespace Immortal {
/*
/*
*
* ----- -----
* ----- Main Functions -----
@ -39,7 +39,7 @@ void ImmortalEngine::miscInit() {
void ImmortalEngine::setRandomSeed() {}
void ImmortalEngine::getRandom() {}
/*
/*
*
* ----- -----
* ----- Text Printing -----
@ -170,7 +170,7 @@ bool ImmortalEngine::textSub(Str s, FadeType f, int n) {
index = -1;
}
textDoSpace(text, index);
} else {
printChr(chr);
// We need this to show up now, not when the frame ends, so we have to update the screen here
@ -179,16 +179,16 @@ bool ImmortalEngine::textSub(Str s, FadeType f, int n) {
myDelay(5);
switch (chr) {
case '?':
// fall through
// fall through
case ':':
myDelay(13);
// fall through
// fall through
case '.':
myDelay(13);
// fall through
// fall through
case ',':
myDelay(13);
// fall through
// fall through
default:
break;
}
@ -202,7 +202,7 @@ bool ImmortalEngine::textSub(Str s, FadeType f, int n) {
}
index++;
}
chr = text[index];
if (f != kTextFadeIn) {
@ -277,16 +277,16 @@ void ImmortalEngine::textDoSpace(Common::String s, int index) {
index++;
switch (s[index]) {
case '=':
// fall through
// fall through
case '@':
// fall through
// fall through
case '%':
// fall through
// fall through
case '[':
// fall through
// fall through
case ' ':
foundEnd = true;
// fall through
// fall through
default:
break;
}
@ -294,7 +294,7 @@ void ImmortalEngine::textDoSpace(Common::String s, int index) {
if (((index - start) + _collumn) >= kMaxCollumns) {
if (_row < kMaxRows) {
textCR();
} else {
textAutoPageBreak();
}
@ -316,7 +316,7 @@ bool ImmortalEngine::yesNo() {
if (tyes[_heldDirection] == 0) {
noOn();
_lastYes = 0;
} else {
yesOn();
_lastYes = 1;
@ -333,7 +333,7 @@ bool ImmortalEngine::yesNo() {
standardBeep();
if (_lastYes == 0) {
noOn();
} else {
yesOn();
}
@ -397,9 +397,9 @@ void ImmortalEngine::myDelay(int j) {
break;
case 0:
Utilities::delay(1);
// fall through
// fall through
case 2:
// fall through
// fall through
default:
break;
}
@ -408,7 +408,7 @@ void ImmortalEngine::myDelay(int j) {
} while (j != 0);
}
/*
/*
*
* ----- -----
* ----- Input Related -----
@ -419,11 +419,11 @@ void ImmortalEngine::myDelay(int j) {
bool ImmortalEngine::buttonPressed() {
// Returns false if the button was pressed, but not held or up
getInput();
if (_heldAction == kActionButton) {
// Zero just the button0held bit
_myButton &= (0xFF - kButton0Held);
} else if ((_myButton & kButton0Held) == 0) {
_myButton |= kButton0Held;
return false;
@ -435,10 +435,10 @@ bool ImmortalEngine::buttonPressed() {
bool ImmortalEngine::firePressed() {
// Returns false if the button was pressed, but not held or up
getInput();
if (_heldAction == kActionFire) {
_myButton &= (0xFF - kButton1Held);
} else if ((_myButton & kButton1Held) == 0) {
_myButton |= kButton1Held;
return false;
@ -448,7 +448,7 @@ bool ImmortalEngine::firePressed() {
}
/*
/*
*
* ----- -----
* ----- Screen Related -----
@ -459,9 +459,9 @@ bool ImmortalEngine::firePressed() {
/*
*
* ----- -----
* ----- -----
* ----- Sound Related -----
* ----- -----
* ----- -----
*
*/

View File

@ -90,10 +90,10 @@ struct Monster {
};
struct Flame {
FPattern _p = kFlameOff;
FPattern _p = kFlameOff;
uint8 _x = 0;
uint8 _y = 0;
int _c = 0;
int _c = 0;
};
struct Chest {
@ -126,12 +126,12 @@ public:
RoomFlag _flags;
uint8 _xPos = 0;
uint8 _yPos = 0;
uint8 _xPos = 0;
uint8 _yPos = 0;
uint8 _holeRoom = 0;
uint8 _holeCellX = 0;
uint8 _holeCellY = 0;
uint8 _candleTmp = 0; // Special case for candle in maze 0
uint8 _candleTmp = 0; // Special case for candle in maze 0
uint8 _numFlames = 0;
uint8 _numInRoom = 0;
@ -150,7 +150,7 @@ public:
//void init();
//void inRoomNew();
//void getTilePair(uint8 x, uint8 y); // Modifies a struct of the tile number, aboveTile number, and the cell coordinates of the tile
//void getTilePair(uint8 x, uint8 y); // Modifies a struct of the tile number, aboveTile number, and the cell coordinates of the tile
void setHole();
void drawContents(uint16 vX, uint16 vY);
@ -172,14 +172,14 @@ public:
*/
// Init
int cycleNew(CycID id); // Adds a cycle to the current list
int cycleNew(CycID id); // Adds a cycle to the current list
void cycleFree(int c);
// Getters
DataSprite *cycleGetDataSprite(int c); // This takes the place of getFile + getNum
int cycleGetIndex(int c);
int cycleGetFrame(int c);
int cycleGetNumFrames(int c);
DataSprite *cycleGetDataSprite(int c); // This takes the place of getFile + getNum
int cycleGetIndex(int c);
int cycleGetFrame(int c);
int cycleGetNumFrames(int c);
// Setters
void cycleSetIndex(int c, int f);
@ -205,7 +205,7 @@ DataSprite *cycleGetDataSprite(int c); // This takes the place of getFile + ge
void lightTorch(uint8 x, uint8 y);
void flameFreeAll();
void flameSetRoom(Common::Array<SFlame>);
int flameGetCyc(Flame *f, int first);
int flameGetCyc(Flame *f, int first);
/*
* [bullet.cpp] Functions from Bullet.GS
@ -222,7 +222,7 @@ DataSprite *cycleGetDataSprite(int c); // This takes the place of getFile + ge
* [Univ.cpp] Functions from Univ.GS
*/
void univAddSprite(uint16 vX, uint16 vY, uint16 x, uint16 y, SpriteName s, int img, uint16 p);
void univAddSprite(uint16 vX, uint16 vY, uint16 x, uint16 y, SpriteName s, int img, uint16 p);
};
} // namespace immortal

View File

@ -38,17 +38,17 @@ struct Image {
};
struct DataSprite {
uint16 _cenX; // These are the base center positions
uint16 _cenX; // These are the base center positions
uint16 _cenY;
uint16 _numImages;
Common::Array<Image> _images;
};
struct Sprite {
int _image; // Index of _dSprite._images[]
int _image; // Index of _dSprite._images[]
uint16 _X;
uint16 _Y;
uint16 _on; // 1 = active
uint16 _on; // 1 = active
uint16 _priority;
DataSprite *_dSprite;
};

View File

@ -53,7 +53,7 @@
namespace Immortal {
/*
/*
*
* ----- -----
* ----- Main Functions -----
@ -145,10 +145,10 @@ bool ImmortalEngine::clipSprite(uint16 &height, uint16 &pointIndex, uint16 &skip
} else if ((pointY + height) < superTop) {
return true;
/* The actual clipping is pretty simple:
* Lower height = stop drawing the sprite early. Higher SkipY = start drawing the sprite late
* So we just determine the delta for each based on superTop and superBottom
*/
/* The actual clipping is pretty simple:
* Lower height = stop drawing the sprite early. Higher SkipY = start drawing the sprite late
* So we just determine the delta for each based on superTop and superBottom
*/
} else {
// Starting with checking if any of the sprite is under the bottom of the screen
@ -203,7 +203,7 @@ void ImmortalEngine::spriteAligned(DataSprite *dSprite, Image &img, uint16 &skip
// as that is the transparent colour
pixel1 = (img._bitmap[y][x] & kMask8High) >> 4;
pixel2 = (img._bitmap[y][x] & kMask8Low);
if (pixel1 != 0) {
_screenBuff[pointIndex] = pixel1;
}
@ -229,7 +229,7 @@ void ImmortalEngine::superSprite(DataSprite *dSprite, uint16 pointX, uint16 poin
uint16 height = dSprite->_images[img]._rectH;
uint16 skipY = 0;
uint16 pointIndex = 0; // This is 'screen' and 'screen + 2' in the source
uint16 pointIndex = 0; // This is 'screen' and 'screen + 2' in the source
pointX -= cenX;
pointY -= cenY;
@ -237,7 +237,7 @@ void ImmortalEngine::superSprite(DataSprite *dSprite, uint16 pointX, uint16 poin
// Normally I would just make the return from clip be reversed, but the idea is that the return would be 'offscreen == true'
if (!(clipSprite(height, pointIndex, skipY, dSprite, pointX, pointY, img, bmw, superTop, superBottom))) {
// Alignment was a factor in the assembly because it was essentially 2 pixels per byte. However ScummVM is 1 pixel per byte
spriteAligned(dSprite, dSprite->_images[img], skipY, pointIndex, height, bmw, dst);
}

View File

@ -32,16 +32,16 @@
* objects, and everything in the rooms.
*/
/* These are the UNIVAT for each Story entry
UNIVAT 1024,480, 1152, 464, \-1, -1, zip,level1Ladders, rooma, 704/64, 544/32\
UNIVAT 304, 448, 472+32, 500+16, \-1, -1, zip,level12Ladders, -1, 0, 0\
UNIVAT 600, 450, 560, 598, \-1, r2.b+(16*r2.a), zip,level3Ladders, r2.b, 640/64, 576/32\
UNIVAT 120, 540, 188, 584, \-1, -1, zip,level4Ladders, -1, 0, 0\
UNIVAT 64, 128, 128, 128+32, \-1, -1, zip,level5Ladders, -1, 1088/64, 928/32\
UNIVAT 768, 224, 896, 288-16, \-1, -1, zip,level5Ladders, -1, 1088/64, 928/32\
UNIVAT 896, 672+64, 960, 832-16, \-1, -1, zip,level6Ladders, -1, 0, 0\
UNIVAT 688, 800, 912-64, 888-32, \-1, -1, zip,level7Ladders, -1, 1088/64, 928/32\
UNIVAT 64, 704, 64+96, 704+64, \-1, -1, zip,level8Ladders, -1, 0, 0\
/* These are the UNIVAT for each Story entry
UNIVAT 1024,480, 1152, 464, \-1, -1, zip,level1Ladders, rooma, 704/64, 544/32\
UNIVAT 304, 448, 472+32, 500+16, \-1, -1, zip,level12Ladders, -1, 0, 0\
UNIVAT 600, 450, 560, 598, \-1, r2.b+(16*r2.a), zip,level3Ladders, r2.b, 640/64, 576/32\
UNIVAT 120, 540, 188, 584, \-1, -1, zip,level4Ladders, -1, 0, 0\
UNIVAT 64, 128, 128, 128+32, \-1, -1, zip,level5Ladders, -1, 1088/64, 928/32\
UNIVAT 768, 224, 896, 288-16, \-1, -1, zip,level5Ladders, -1, 1088/64, 928/32\
UNIVAT 896, 672+64, 960, 832-16, \-1, -1, zip,level6Ladders, -1, 0, 0\
UNIVAT 688, 800, 912-64, 888-32, \-1, -1, zip,level7Ladders, -1, 1088/64, 928/32\
UNIVAT 64, 704, 64+96, 704+64, \-1, -1, zip,level8Ladders, -1, 0, 0\
*/
#include "immortal/immortal.h"
@ -50,155 +50,155 @@ namespace Immortal {
void ImmortalEngine::initStoryStatic() {
Common::Array<Common::String> s{"#" + Common::String(kSwordBigFrame) + "sword@",
"You find an Elven sword of&agility. Take it?@",
"Search the bones?%",
"}The sword permanently endows you with Elven agility and quickness in combat.@",
"}You notice something that looks wet and green under the pile. Search further?%",
"#" + Common::String(kBagBigFrame) + " dust@",
"}You find a bag containing Dust of Complaisance.&@",
"}Drop the bait on the ground here?%",
"}To use this dust, you throw it in the air. Do that here?%",
"_}Don+t bother me, I+m cutting a gem. Yes, you need it. No, you can+t have it. I wouldn+t give it to anyone, least of all you. Go away. ]]]]=",
"_}Let me help you. Please take this gem. No, really, I insist. Take it and go with my blessings. Good luck. ]]]]=",
"#" + Common::String(kCarpetBigFrame) + "carpet@",
"#" + Common::String(kBombBigFrame) + " bomb@",
"A gas bomb that goblins&use to paralyze trolls.&@",
"Take it?<>@",
"%",
" other@",
"#" + Common::String(kKeyBigFrame) + " key@",
"#" + Common::String(kKeyBigFrame) + " key@",
"A key to a chest.&@",
"The chest is open. Examine&contents?%",
"Put it on?%",
"Drop it?%",
"It+s unlocked. Open it?%",
"It+s locked but you have&the key. Open it?%",
"It+s locked and you don+t&have the key.@",
"The lock, triggered by a&complicated set of latches,&is unfamiliar to you.@",
"#" + Common::String(kGoldBigFrame) + "$0 gold@",
"You find $0 gold pieces.&&^#" + Common::String(kPileFrame) + "@",
"@",
"You can+t plant them on&stone tiles.@",
"It+s locked but you are&able to unlock it with&the key.@",
"_}The king is not dead, but the poison is taking effect. When he sees you, he attempts to speak:[(Give me water... the fountain... I give you... information... peace...+[Give him water?%",
"_}You dont have any water to give him. He mumbles something. Then silence... You find a key on his body.]]]]=",
"_}He mumbles something. Then silence... You find a key on his body.]]]]=",
"_}I+ll tell you how to... next level... past slime... three jewels... slime... rock becomes... floor... right, left, center of the... [Then silence. His hand opens, releasing a key.]]]]=",
"You find a door key.&@",
"You find a note.&@",
"#" + Common::String(kNoteBigFrame) + "note@",
"He+s dead.&Look for possessions?%",
"You don+t have it. Check&your inventory.@",
"Game Over&&Play again?@",
"Congratulations!&&Play again?@",
"You find a bag of bait.&@",
"#" + Common::String(kBagBigFrame) + " bait@",
"You find a stone. @",
"#" + Common::String(kStoneBigFrame) + " stone@",
"You find a red gem.&@",
"#" + Common::String(kGemBigFrame) + " gem@",
"You find a scroll with&fireball spells.&@",
"#" + Common::String(kScrollBigFrame) + "$ shots@",
"You find a map warning&you about pit traps.&@",
"#" + Common::String(kMapBigFrame) + " map@",
"#" + Common::String(kVaseBigFrame) + " oil@",
"You apply the oil but notice&as you walk that the leather&is drying out quickly.@",
"}You discover a scroll with a charm spell to use on will o+ the wisps.&@",
"#" + Common::String(kScrollBigFrame) + " charm@",
"}This charms the will o+ the wisps to follow you. Read the spell again to turn them against your enemies.@",
"}It looks like water. Drink it?%",
"Drink it?%",
"}It works! You are much stronger.]]]=",
"}It looks like it has green stuff inside. Open it?%",
"Now this will take&effect when you press the&fire button.@",
"You find a potion,&Magic Muscle.&@",
"#" + Common::String(kVaseBigFrame) + " potion@",
"You find a bottle.&@",
"#" + Common::String(kVaseBigFrame) + " bottle@",
"#" + Common::String(kRingBigFrame) + "Protean@",
"You find a Protean Ring.&@",
"You find a troll ritual knife,&used to declare a fight to&the death. @",
"#" + Common::String(kKnifeBigFrame) + " knife@",
"_}It is a fine woman+s garment. Folded inside is a ring with the words,[`To Ana, so harm will never find you. -Your loving father, Dunric.+&@",
"You find a small, well&crafted ring. @",
"#" + Common::String(kRingBigFrame) + " gift@",
"#" + Common::String(kRingBigFrame) + " Ana+s@",
"_}She is hurt and upset when she finds you don+t have her ring or won+t give it to her. She scurries back into the hole. The hole is too small for you to follow.&@",
"_}`Sir, can you help me,+ the girl pleads. `I was kidnapped and dragged down here. All the man would say is `Mordamir+s orders.+[I ~" + Common::String(kStrGive2),
"escaped using a ring my father gave me, but now I+ve lost it. Did you find it?+%",
"_}We have met before, old man. Do you remember? Because you helped me, you may pass. But I warn you, we are at war with the trolls.[Over this ladder, across the spikes, is troll territory. Very dangerous.@",
"_}You are an impostor!]]]]=",
"_}Old man, do you remember me? I am king of the goblins. You didn+t give me the water. You left me to die after you took the key from me. Now you will pay.]]]]=",
"_}You quickly fall into a deep, healing sleep...[Vivid images of a beautiful enchanted city pass by. All the city people are young and glowing. Fountains fill the city, and the splash and ~" + Common::String(kStrDream1P2),
"sparkle of water is everywhere...[Suddenly the images go black. A face appears... Mordamir!]][ ~" + Common::String(kStrDream1P3),
"He is different from how you remember him. His gentle features are now withered. His kind eyes, now cold and sunken, seem to look through you with a dark, penetrating stare. You wake rejuvenated, but disturbed.]]]]]=",
"_}Here, take this ring in return. [I don+t know if it will help, but I heard the unpleasant little dwarf say, (Clockwise, three rings around the triangle.+[Could that be a clue to his exit puzzle? I must go. Goodbye.]]]]=",
"#" + Common::String(kSackBigFrame) + " spores@",
"You find a sack of bad&smelling spores.&@",
"Please insert play disk.@",
"New game?%",
"Enter certificate:&-=",
"Invalid certificate.@",
"End of level!&Here is your certificate:&&=",
"&@",
"\\ Electronic Arts presents&& The Immortal&&&&  1990 Will Harvey|]]]]]]]]\\]=",
" written by&& Will Harvey& Ian Gooding& Michael Marcantel& Brett G. Durrett& Douglas Fulton|]]]]]]]/=",
"_}Greetings, friend! Come, I+ve got something you need. These parts are plagued with slime.[You can+t venture safely without my slime oil for boots, a bargain at only 80 gold pieces.%",
"_}All right, 60 gold pieces for my oil. Rub it on your boots and slime won+t touch you. 60, friend.%",
"This room doesn+t resemble&any part of the map.@",
"This room resembles part&of the map.@"};
"You find an Elven sword of&agility. Take it?@",
"Search the bones?%",
"}The sword permanently endows you with Elven agility and quickness in combat.@",
"}You notice something that looks wet and green under the pile. Search further?%",
"#" + Common::String(kBagBigFrame) + " dust@",
"}You find a bag containing Dust of Complaisance.&@",
"}Drop the bait on the ground here?%",
"}To use this dust, you throw it in the air. Do that here?%",
"_}Don+t bother me, I+m cutting a gem. Yes, you need it. No, you can+t have it. I wouldn+t give it to anyone, least of all you. Go away. ]]]]=",
"_}Let me help you. Please take this gem. No, really, I insist. Take it and go with my blessings. Good luck. ]]]]=",
"#" + Common::String(kCarpetBigFrame) + "carpet@",
"#" + Common::String(kBombBigFrame) + " bomb@",
"A gas bomb that goblins&use to paralyze trolls.&@",
"Take it?<>@",
"%",
" other@",
"#" + Common::String(kKeyBigFrame) + " key@",
"#" + Common::String(kKeyBigFrame) + " key@",
"A key to a chest.&@",
"The chest is open. Examine&contents?%",
"Put it on?%",
"Drop it?%",
"It+s unlocked. Open it?%",
"It+s locked but you have&the key. Open it?%",
"It+s locked and you don+t&have the key.@",
"The lock, triggered by a&complicated set of latches,&is unfamiliar to you.@",
"#" + Common::String(kGoldBigFrame) + "$0 gold@",
"You find $0 gold pieces.&&^#" + Common::String(kPileFrame) + "@",
"@",
"You can+t plant them on&stone tiles.@",
"It+s locked but you are&able to unlock it with&the key.@",
"_}The king is not dead, but the poison is taking effect. When he sees you, he attempts to speak:[(Give me water... the fountain... I give you... information... peace...+[Give him water?%",
"_}You dont have any water to give him. He mumbles something. Then silence... You find a key on his body.]]]]=",
"_}He mumbles something. Then silence... You find a key on his body.]]]]=",
"_}I+ll tell you how to... next level... past slime... three jewels... slime... rock becomes... floor... right, left, center of the... [Then silence. His hand opens, releasing a key.]]]]=",
"You find a door key.&@",
"You find a note.&@",
"#" + Common::String(kNoteBigFrame) + "note@",
"He+s dead.&Look for possessions?%",
"You don+t have it. Check&your inventory.@",
"Game Over&&Play again?@",
"Congratulations!&&Play again?@",
"You find a bag of bait.&@",
"#" + Common::String(kBagBigFrame) + " bait@",
"You find a stone. @",
"#" + Common::String(kStoneBigFrame) + " stone@",
"You find a red gem.&@",
"#" + Common::String(kGemBigFrame) + " gem@",
"You find a scroll with&fireball spells.&@",
"#" + Common::String(kScrollBigFrame) + "$ shots@",
"You find a map warning&you about pit traps.&@",
"#" + Common::String(kMapBigFrame) + " map@",
"#" + Common::String(kVaseBigFrame) + " oil@",
"You apply the oil but notice&as you walk that the leather&is drying out quickly.@",
"}You discover a scroll with a charm spell to use on will o+ the wisps.&@",
"#" + Common::String(kScrollBigFrame) + " charm@",
"}This charms the will o+ the wisps to follow you. Read the spell again to turn them against your enemies.@",
"}It looks like water. Drink it?%",
"Drink it?%",
"}It works! You are much stronger.]]]=",
"}It looks like it has green stuff inside. Open it?%",
"Now this will take&effect when you press the&fire button.@",
"You find a potion,&Magic Muscle.&@",
"#" + Common::String(kVaseBigFrame) + " potion@",
"You find a bottle.&@",
"#" + Common::String(kVaseBigFrame) + " bottle@",
"#" + Common::String(kRingBigFrame) + "Protean@",
"You find a Protean Ring.&@",
"You find a troll ritual knife,&used to declare a fight to&the death. @",
"#" + Common::String(kKnifeBigFrame) + " knife@",
"_}It is a fine woman+s garment. Folded inside is a ring with the words,[`To Ana, so harm will never find you. -Your loving father, Dunric.+&@",
"You find a small, well&crafted ring. @",
"#" + Common::String(kRingBigFrame) + " gift@",
"#" + Common::String(kRingBigFrame) + " Ana+s@",
"_}She is hurt and upset when she finds you don+t have her ring or won+t give it to her. She scurries back into the hole. The hole is too small for you to follow.&@",
"_}`Sir, can you help me,+ the girl pleads. `I was kidnapped and dragged down here. All the man would say is `Mordamir+s orders.+[I ~" + Common::String(kStrGive2),
"escaped using a ring my father gave me, but now I+ve lost it. Did you find it?+%",
"_}We have met before, old man. Do you remember? Because you helped me, you may pass. But I warn you, we are at war with the trolls.[Over this ladder, across the spikes, is troll territory. Very dangerous.@",
"_}You are an impostor!]]]]=",
"_}Old man, do you remember me? I am king of the goblins. You didn+t give me the water. You left me to die after you took the key from me. Now you will pay.]]]]=",
"_}You quickly fall into a deep, healing sleep...[Vivid images of a beautiful enchanted city pass by. All the city people are young and glowing. Fountains fill the city, and the splash and ~" + Common::String(kStrDream1P2),
"sparkle of water is everywhere...[Suddenly the images go black. A face appears... Mordamir!]][ ~" + Common::String(kStrDream1P3),
"He is different from how you remember him. His gentle features are now withered. His kind eyes, now cold and sunken, seem to look through you with a dark, penetrating stare. You wake rejuvenated, but disturbed.]]]]]=",
"_}Here, take this ring in return. [I don+t know if it will help, but I heard the unpleasant little dwarf say, (Clockwise, three rings around the triangle.+[Could that be a clue to his exit puzzle? I must go. Goodbye.]]]]=",
"#" + Common::String(kSackBigFrame) + " spores@",
"You find a sack of bad&smelling spores.&@",
"Please insert play disk.@",
"New game?%",
"Enter certificate:&-=",
"Invalid certificate.@",
"End of level!&Here is your certificate:&&=",
"&@",
"\\ Electronic Arts presents&& The Immortal&&&&  1990 Will Harvey|]]]]]]]]\\]=",
" written by&& Will Harvey& Ian Gooding& Michael Marcantel& Brett G. Durrett& Douglas Fulton|]]]]]]]/=",
"_}Greetings, friend! Come, I+ve got something you need. These parts are plagued with slime.[You can+t venture safely without my slime oil for boots, a bargain at only 80 gold pieces.%",
"_}All right, 60 gold pieces for my oil. Rub it on your boots and slime won+t touch you. 60, friend.%",
"This room doesn+t resemble&any part of the map.@",
"This room resembles part&of the map.@"};
_strPtrs = s;
Common::Array<int> cyc0{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,-1};
Common::Array<int> cyc1{15,16,17,18,19,20,21,22,-1};
Common::Array<int> cyc2{0,1,2,-1};
Common::Array<int> cyc3{3,4,5,-1};
Common::Array<int> cyc4{6,7,8,9,10,-1};
Common::Array<int> cyc5{11,12,13,14,15,-1};
Common::Array<int> cyc6{16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,-1};
Common::Array<int> cyc7{0,1,2,3,4,-1};
Common::Array<int> cyc8{5,1 + 5,2 + 5,3 + 5,4 + 5,-1};
Common::Array<int> cyc9{10,1 + 10,2 + 10,3 + 10,4 + 10,-1};
Common::Array<int> cyc10{15,1 + 15,2 + 15,3 + 15,4 + 15,-1};
Common::Array<int> cyc11{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,-1};
Common::Array<int> cyc12{0,1,2,3,4,5,6,7,8,9,-1};
Common::Array<int> cyc13{0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3, -1};
Common::Array<int> cyc14{31,32,33,32, 34,35,36,35, 37,38,39,38, 40,41,42,41, 43,44,45,44, 46,47,48,47, 49,50,51,50, 52,53,54,53, -1};
Common::Array<int> cyc0{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1};
Common::Array<int> cyc1{15, 16, 17, 18, 19, 20, 21, 22, -1};
Common::Array<int> cyc2{0, 1, 2, -1};
Common::Array<int> cyc3{3, 4, 5, -1};
Common::Array<int> cyc4{6, 7, 8, 9, 10, -1};
Common::Array<int> cyc5{11, 12, 13, 14, 15, -1};
Common::Array<int> cyc6{16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, -1};
Common::Array<int> cyc7{0, 1, 2, 3, 4, -1};
Common::Array<int> cyc8{5, 1 + 5, 2 + 5, 3 + 5, 4 + 5, -1};
Common::Array<int> cyc9{10, 1 + 10, 2 + 10, 3 + 10, 4 + 10, -1};
Common::Array<int> cyc10{15, 1 + 15, 2 + 15, 3 + 15, 4 + 15, -1};
Common::Array<int> cyc11{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1};
Common::Array<int> cyc12{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1};
Common::Array<int> cyc13{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, -1};
Common::Array<int> cyc14{31, 32, 33, 32, 34, 35, 36, 35, 37, 38, 39, 38, 40, 41, 42, 41, 43, 44, 45, 44, 46, 47, 48, 47, 49, 50, 51, 50, 52, 53, 54, 53, -1};
Common::Array<int> cyc15{55, -1};
Common::Array<int> cyc16{63,64,65,66, 63,64,65,66, 63,64,65,66, 63,64,65,66, 63,64,65,66, 63,64,65,66, 63,64,65,66, 63,64,65,66,-1};
Common::Array<int> cyc17{0,1,0,-1};
Common::Array<int> cyc18{0,1,2,4,5,6,7,8,9,10,11,12,2,1,-1};
Common::Array<int> cyc19{0,0,1,2,13,14,15,16,4,2,3,-1};
Common::Array<int> cyc20{0,1,2,3,20,21,22,23,24,25,26,27,5,4,3,-1};
Common::Array<int> cyc21{0,1,2,3,-1};
Common::Array<int> cyc22{0,17,18,19,3,-1};
Common::Array<int> cyc23{0,1,-1};
Common::Array<int> cyc24{28,28,28,28,-1};
Common::Array<int> cyc25{15,16,15,16,15,1 + 15,1 + 15,-1};
Common::Array<int> cyc26{10 + 15,11+ 15,12 + 15,13 + 15,14 + 15,15 + 15,16 + 15,-1};
Common::Array<int> cyc27{2 + 15,3 + 15,4 + 15,5 + 15,-1};
Common::Array<int> cyc28{6 + 15,7 + 15,8 + 15,9 + 15,-1};
Common::Array<int> cyc29{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,-1};
Common::Array<int> cyc30{0,1,2,3,3,3,3,4,5,6,-1};
Common::Array<int> cyc31{0,1,2,3,4,5,6,7,8,-1};
Common::Array<int> cyc16{63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, 63, 64, 65, 66, -1};
Common::Array<int> cyc17{0, 1, 0, -1};
Common::Array<int> cyc18{0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 2, 1, -1};
Common::Array<int> cyc19{0, 0, 1, 2, 13, 14, 15, 16, 4, 2, 3, -1};
Common::Array<int> cyc20{0, 1, 2, 3, 20, 21, 22, 23, 24, 25, 26, 27, 5, 4, 3, -1};
Common::Array<int> cyc21{0, 1, 2, 3, -1};
Common::Array<int> cyc22{0, 17, 18, 19, 3, -1};
Common::Array<int> cyc23{0, 1, -1};
Common::Array<int> cyc24{28, 28, 28, 28, -1};
Common::Array<int> cyc25{15, 16, 15, 16, 15, 1 + 15, 1 + 15, -1};
Common::Array<int> cyc26{10 + 15, 11 + 15, 12 + 15, 13 + 15, 14 + 15, 15 + 15, 16 + 15, -1};
Common::Array<int> cyc27{2 + 15, 3 + 15, 4 + 15, 5 + 15, -1};
Common::Array<int> cyc28{6 + 15, 7 + 15, 8 + 15, 9 + 15, -1};
Common::Array<int> cyc29{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1};
Common::Array<int> cyc30{0, 1, 2, 3, 3, 3, 3, 4, 5, 6, -1};
Common::Array<int> cyc31{0, 1, 2, 3, 4, 5, 6, 7, 8, -1};
Common::Array<SCycle> c{SCycle(kBubble, false, cyc0), SCycle(kBubble, false, cyc1),
SCycle(kSpark, false, cyc2), SCycle(kSpark, false, cyc3),
SCycle(kSpark, false, cyc4), SCycle(kSpark, false, cyc5), SCycle(kSpark, false, cyc6),
SCycle(kPipe, false, cyc7), SCycle(kPipe, false, cyc8),
SCycle(kPipe, false, cyc9), SCycle(kPipe, false, cyc10),
SCycle(kAnaVanish, false, cyc11), SCycle(kAnaGlimpse, false, cyc12),
SCycle(kKnife, true, cyc13),
SCycle(kSpark, true, cyc14), SCycle(kSpark, true, cyc15), SCycle(kSpark, true, cyc16),
SCycle(kBigBurst, false, cyc17),
SCycle(kFlame, false, cyc18), SCycle(kFlame, false, cyc19), SCycle(kFlame, false, cyc20),
SCycle(kFlame, false, cyc21), SCycle(kFlame, false, cyc22), SCycle(kFlame, false, cyc23),
SCycle(kFlame, false, cyc24),
SCycle(kCandle, false, cyc25), SCycle(kCandle, false, cyc26), SCycle(kCandle, false, cyc27),
SCycle(kCandle, false, cyc28), SCycle(kCandle, false, cyc29),
SCycle(kSink, false, cyc30),
SCycle(kNorlacDown, false, cyc31)};
Common::Array<SCycle> c{SCycle(kBubble, false, cyc0), SCycle(kBubble, false, cyc1),
SCycle(kSpark, false, cyc2), SCycle(kSpark, false, cyc3),
SCycle(kSpark, false, cyc4), SCycle(kSpark, false, cyc5), SCycle(kSpark, false, cyc6),
SCycle(kPipe, false, cyc7), SCycle(kPipe, false, cyc8),
SCycle(kPipe, false, cyc9), SCycle(kPipe, false, cyc10),
SCycle(kAnaVanish, false, cyc11), SCycle(kAnaGlimpse, false, cyc12),
SCycle(kKnife, true, cyc13),
SCycle(kSpark, true, cyc14), SCycle(kSpark, true, cyc15), SCycle(kSpark, true, cyc16),
SCycle(kBigBurst, false, cyc17),
SCycle(kFlame, false, cyc18), SCycle(kFlame, false, cyc19), SCycle(kFlame, false, cyc20),
SCycle(kFlame, false, cyc21), SCycle(kFlame, false, cyc22), SCycle(kFlame, false, cyc23),
SCycle(kFlame, false, cyc24),
SCycle(kCandle, false, cyc25), SCycle(kCandle, false, cyc26), SCycle(kCandle, false, cyc27),
SCycle(kCandle, false, cyc28), SCycle(kCandle, false, cyc29),
SCycle(kSink, false, cyc30),
SCycle(kNorlacDown, false, cyc31)};
_cycPtrs = c;
Common::Array<Motive> m{};
@ -251,7 +251,7 @@ void ImmortalEngine::initStoryDynamic() {
/* Universe related properties
* including spawn point and entry/exit points
*/
*/
int univRoom = 4; // The room the player starts in when beginning this level
uint16 univRoomX = 512;
uint16 univRoomY = 416;
@ -263,39 +263,39 @@ void ImmortalEngine::initStoryDynamic() {
_stories[0]._playerPointX = (1152 - univRoomX) / 2;
_stories[0]._playerPointY = 464 - univRoomY;
Common::Array<int> ladders{-1, -1, kStoryNull, 2, 0, univRoom, (704 / 64),(544 / 32)};
Common::Array<int> ladders{-1, -1, kStoryNull, 2, 0, univRoom, (704 / 64), (544 / 32)};
_stories[0]._ladders = ladders;
/* All of the rooms
*/
Common::Array<SRoom> rooms{SRoom(384, 256, kRoomFlag0), SRoom(512, 64, kRoomFlag0),
SRoom(640, 160, kRoomFlag0), SRoom(768, 224, kRoomFlag0),
SRoom(univRoomX, univRoomY, kRoomFlag0), SRoom(960, 512, kRoomFlag0),
SRoom(1024, 352, kRoomFlag0), SRoom(896, 64, kRoomFlag0)};
SRoom(640, 160, kRoomFlag0), SRoom(768, 224, kRoomFlag0),
SRoom(univRoomX, univRoomY, kRoomFlag0), SRoom(960, 512, kRoomFlag0),
SRoom(1024, 352, kRoomFlag0), SRoom(896, 64, kRoomFlag0)};
_stories[0]._rooms = rooms;
/* All of the doors
*/
Common::Array<SDoor> doors{SDoor(0, 704, 224, 0, 2, false), SDoor(1, 576, 352, 4, 0, true),
SDoor(1, 704, 96, 2, 1, false), SDoor(1, 960, 128, 7, 2, false),
SDoor(1, 1088,160, 3, 7, false), SDoor(1, 1088,320, 6, 3, false),
SDoor(1, 896, 416, 4, 3, false)};
SDoor(1, 704, 96, 2, 1, false), SDoor(1, 960, 128, 7, 2, false),
SDoor(1, 1088, 160, 3, 7, false), SDoor(1, 1088, 320, 6, 3, false),
SDoor(1, 896, 416, 4, 3, false)};
_stories[0]._doors = doors;
/* All of the flames
* Macro for flames is (x - roomx), (y - roomy), pattern number
*/
Common::Array<SFlame> f5{SFlame(512 - 384, (240 + 32) - 256, kFlameOff), SFlame(672 - 384, (240 + 32) - 256, kFlameOff)};
Common::Array<SFlame> f7{SFlame(576 - 384, (112 + 32) - 256, kFlameNormal), SFlame(576 - 384, (112 + 32) - 256, kFlameNormal),
SFlame(928 - 384, (48 + 32) - 256, kFlameNormal)};
Common::Array<SFlame> f8{SFlame(800 - 640, (144 + 32) - 160, kFlameNormal)};
Common::Array<SFlame> f9{SFlame(768 - 768, (304 + 32) - 224, kFlameNormal), SFlame((928 - 768), (304 + 32) - 224, kFlameNormal),
SFlame(1024 - 768, (240 + 32) - 224, kFlameNormal)};
Common::Array<SFlame> fA{SFlame(672 - 512, (400 + 32) - 416, kFlameNormal), SFlame((800 - 64) - 512, (496 - 32) - 416, kFlameNormal),
SFlame(576 - 512, (528 + 32) - 416, kFlameNormal)};
Common::Array<SFlame> fD{SFlame(1024 - 960, (496 + 32) - 512, kFlameNormal)};
Common::Array<SFlame> fE{SFlame(1184 - 1024, 432 - 352, kFlameCandle)};
Common::Array<SFlame> fF{SFlame(1024 - 896, (144 + 32) - 64, kFlameNormal)};
Common::Array<SFlame> f5{SFlame(512 - 384, (240 + 32) - 256, kFlameOff), SFlame(672 - 384, (240 + 32) - 256, kFlameOff)};
Common::Array<SFlame> f7{SFlame(576 - 384, (112 + 32) - 256, kFlameNormal), SFlame(576 - 384, (112 + 32) - 256, kFlameNormal),
SFlame(928 - 384, (48 + 32) - 256, kFlameNormal)};
Common::Array<SFlame> f8{SFlame(800 - 640, (144 + 32) - 160, kFlameNormal)};
Common::Array<SFlame> f9{SFlame(768 - 768, (304 + 32) - 224, kFlameNormal), SFlame((928 - 768), (304 + 32) - 224, kFlameNormal),
SFlame(1024 - 768, (240 + 32) - 224, kFlameNormal)};
Common::Array<SFlame> fA{SFlame(672 - 512, (400 + 32) - 416, kFlameNormal), SFlame((800 - 64) - 512, (496 - 32) - 416, kFlameNormal),
SFlame(576 - 512, (528 + 32) - 416, kFlameNormal)};
Common::Array<SFlame> fD{SFlame(1024 - 960, (496 + 32) - 512, kFlameNormal)};
Common::Array<SFlame> fE{SFlame(1184 - 1024, 432 - 352, kFlameCandle)};
Common::Array<SFlame> fF{SFlame(1024 - 896, (144 + 32) - 64, kFlameNormal)};
CArray2D<SFlame> flames{f5, f7, f8, f9, fA, fD, fE, fF};
_stories[0]._flames = flames;
@ -303,29 +303,29 @@ void ImmortalEngine::initStoryDynamic() {
* Macro for traps is arrowType,freq,#sinkTraps,#1(going toward 5),#3,#5,#7,#trapdoors
*/
Common::Array<uint8> noTraps{};
Common::Array<uint8> o5Traps{0,0x80,0,0,0,0,0,5};
Common::Array<uint8> o7Traps{0,0x80,15,5,3,0,0,0};
Common::Array<uint8> o8Traps{0,0x80,0,0,0,0,0,3};
Common::Array<uint8> o5Traps{0, 0x80, 0, 0, 0, 0, 0, 5};
Common::Array<uint8> o7Traps{0, 0x80, 15, 5, 3, 0, 0, 0};
Common::Array<uint8> o8Traps{0, 0x80, 0, 0, 0, 0, 0, 3};
Common::Array<SObj> noObj{};
Common::Array<SObj> o5{SObj(kZip, kZip, kTypeTrap, kNoFrame, kObjIsRunning + kObjIsInvisible, o5Traps),
SObj(459, 379, kTypeCoin, kRingFrame, kObjNone, noTraps),
SObj(446, 327, kTypeWowCharm, kScrollFrame, kObjNone, noTraps)};
SObj(459, 379, kTypeCoin, kRingFrame, kObjNone, noTraps),
SObj(446, 327, kTypeWowCharm, kScrollFrame, kObjNone, noTraps)};
Common::Array<SObj> o7{SObj(145, 138, kTypeTrap, kNoFrame, kObjIsRunning + kObjIsInvisible, o7Traps)};
Common::Array<SObj> o8{SObj(kZip, kZip, kTypeTrap, kNoFrame, kObjIsRunning + kObjIsInvisible, o8Traps)};
Common::Array<SObj> o9{SObj(1052, 309, kTypeDead, kDeadGoblinFrame, kObjIsChest + kObjIsOnGround, noTraps),
SObj(kZip, kZip, kTypeFireBall, kScrollFrame, kObjUsesFireButton, noTraps),
SObj(128, 464, kTypeDunRing, kRingFrame, 0, noTraps),
SObj(837, 421, kTypeChest, kChest0Frame, kObjIsChest, noTraps),
SObj(kZip, kZip, kTypeDeathMap, kScrollFrame, 0, noTraps),
SObj(597, 457, kTypeWater, kVaseFrame, 0, noTraps),
SObj(kZip, kZip, kTypeSpores, kSporesFrame, 0, noTraps),
SObj(kZip, kZip, kTypeWormFood, kNoFrame, 0, noTraps),
SObj(205, 158, kTypeChestKey, kKeyFrame, 0, noTraps)};
SObj(kZip, kZip, kTypeFireBall, kScrollFrame, kObjUsesFireButton, noTraps),
SObj(128, 464, kTypeDunRing, kRingFrame, 0, noTraps),
SObj(837, 421, kTypeChest, kChest0Frame, kObjIsChest, noTraps),
SObj(kZip, kZip, kTypeDeathMap, kScrollFrame, 0, noTraps),
SObj(597, 457, kTypeWater, kVaseFrame, 0, noTraps),
SObj(kZip, kZip, kTypeSpores, kSporesFrame, 0, noTraps),
SObj(kZip, kZip, kTypeWormFood, kNoFrame, 0, noTraps),
SObj(205, 158, kTypeChestKey, kKeyFrame, 0, noTraps)};
Common::Array<SObj> oE{SObj(1184, 426, kTypePhant, kAltarFrame, 0, noTraps),
SObj(145, 138, kTypeGold, kNoFrame, kObjIsRunning, noTraps),
SObj(671, 461, kTypeHay, kNoFrame, kObjIsRunning + kObjIsInvisible, noTraps),
SObj(780, 508, kTypeBeam, kNoFrame, kObjIsRunning + kObjIsInvisible, noTraps)};
SObj(145, 138, kTypeGold, kNoFrame, kObjIsRunning, noTraps),
SObj(671, 461, kTypeHay, kNoFrame, kObjIsRunning + kObjIsInvisible, noTraps),
SObj(780, 508, kTypeBeam, kNoFrame, kObjIsRunning + kObjIsInvisible, noTraps)};
CArray2D<SObj> objects{o5, o7, o8, o9, noObj, noObj, oE, noObj};
_stories[0]._objects = objects;
@ -341,10 +341,10 @@ void ImmortalEngine::initStoryDynamic() {
Common::Array<SMonster> noMonst{};
Common::Array<SMonster> m5{SMonster(448, 344, 12, kMonstPlayer, kMonstA + kMonstIsEngage + kMonstIsTough, progShade, kShadow),
SMonster(590, 381, 12, kMonstPlayer, kMonstA + kMonstIsEngage + kMonstIsTough, progShade, kShadow)};
SMonster(590, 381, 12, kMonstPlayer, kMonstA + kMonstIsEngage + kMonstIsTough, progShade, kShadow)};
Common::Array<SMonster> m9{SMonster(1106, 258, 3, kMonstPlayer, kMonstA + kMonstIsEngage, progEasy, kGoblin0),
SMonster(832, 364, 10, kMonstA, kMonstB + kMonstIsPoss, progUlindor, kUlindor3),
SMonster(838, 370, 15, kMonstPlayer, kMonstA + kMonstIsEngage, progGoblin5, kGoblin7)};
SMonster(832, 364, 10, kMonstA, kMonstB + kMonstIsPoss, progUlindor, kUlindor3),
SMonster(838, 370, 15, kMonstPlayer, kMonstA + kMonstIsEngage, progGoblin5, kGoblin7)};
Common::Array<SMonster> mE{SMonster(1136, 464, 15, kMonstMonster, kMonstPlayer + kMonstIsEngage, progPlayer, kWizard0)};
Common::Array<SMonster> mF{SMonster(1182, 116, 5, kMonstPlayer, kMonstA + kMonstIsEngage, progWill2, kGoblin5)};
CArray2D<SMonster> monsters{m5, noMonst, noMonst, m9, noMonst, noMonst, mE, mF};

View File

@ -32,25 +32,25 @@ namespace Immortal {
// These maximum numbers aren't really needed, because most of these are vectors and have .size()
enum StoryMaxes {
kMaxRooms = 16,
kMaxDoors = 10,
kMaxFlames = 32,
kMaxRooms = 16,
kMaxDoors = 10,
kMaxFlames = 32,
kMaxFlamesInRoom = 5,
kMaxObjects = 42,
kMaxMonsters = 20,
kMaxGenSprites = 6,
kMaxCycles = 32
kMaxObjects = 42,
kMaxMonsters = 20,
kMaxGenSprites = 6,
kMaxCycles = 32
};
// These are flags that are relevant to their specific story data structures
enum RoomFlag : uint8 { // Generic properties available to each room
enum RoomFlag : uint8 { // Generic properties available to each room
kRoomFlag0 = 0x01,
kRoomFlag1 = 0x02,
kRoomFlag2 = 0x04,
kRoomFlag3 = 0x08
};
enum ObjFlag : uint8 { // Properties of the object essentially
enum ObjFlag : uint8 { // Properties of the object essentially
kObjUsesFireButton = 0x40,
kObjIsInvisible = 0x20,
kObjIsRunning = 0x10,
@ -58,16 +58,16 @@ enum ObjFlag : uint8 { // Properties of the object essentially
kObjIsOnGround = 0x04,
kObjIsF1 = 0x02,
kObjIsF2 = 0x01,
kObjNone = 0x0
kObjNone = 0x0
};
enum IsA : uint8 { // To be completely honest, I'm not really sure what this is. It seems to be more object flags, but they act a little strangely
kIsAF1 = 0x20,
kIsAF2 = 0x40,
enum IsA : uint8 { // To be completely honest, I'm not really sure what this is. It seems to be more object flags, but they act a little strangely
kIsAF1 = 0x20,
kIsAF2 = 0x40,
kIsANone = 0x0,
};
enum MonsterFlag : uint8 { // Mostly properties of the AI for a given monster, *including the player*
enum MonsterFlag : uint8 { // Mostly properties of the AI for a given monster, *including the player*
kMonstIsNone = 0x00,
kMonstIsTough = 0x10,
kMonstIsDead = 0x20,
@ -78,14 +78,14 @@ enum MonsterFlag : uint8 { // Mostly properties of the AI for a given monst
kMonstMonster = 0x01,
kMonstAnybody = 0x02,
kMonstNobody = 0x03,
kMonstA = 0x04,
kMonstB = 0x05,
kMonstC = 0x06,
kMonstD = 0x07
kMonstA = 0x04,
kMonstB = 0x05,
kMonstC = 0x06,
kMonstD = 0x07
};
// Flame pattern is used by the story data, in-room data, *and* the level based total flame data. So it needs to be in story.h to be used by immortal.h and room.h
enum FPattern : uint8 { // This defines which Cyc animation it uses
enum FPattern : uint8 { // This defines which Cyc animation it uses
kFlameNormal,
kFlameCandle,
kFlameOff,
@ -128,7 +128,7 @@ struct ObjType {
// Cycles define the animation of sprites within a level. There is a fixed total of cycles available, and they are not room dependant
struct Cycle {
int _index; // In source this is actually the position within the *instruction list*, but since cycle's are structs, it's just the index of frames now
int _index; // In source this is actually the position within the *instruction list*, but since cycle's are structs, it's just the index of frames now
CycID _cycList;
};
@ -141,12 +141,12 @@ struct SCycle {
SpriteName _sName;
Common::Array<int> _frames;
bool _repeat;
SCycle() {}
SCycle(SpriteName s, bool r, Common::Array<int> f) {
_sName = s;
_repeat = r;
_frames = f;
}
SCycle() {}
SCycle(SpriteName s, bool r, Common::Array<int> f) {
_sName = s;
_repeat = r;
_frames = f;
}
};
struct SRoom {
@ -156,8 +156,8 @@ struct SRoom {
RoomFlag _flags = kRoomFlag0;
SRoom() {}
SRoom(uint16 x, uint16 y, RoomFlag f) {
_x = x;
_y = y;
_x = x;
_y = y;
_flags = f;
}
};
@ -174,19 +174,19 @@ struct SDoor {
SDoor() {}
SDoor(uint8 d, uint16 x, uint16 y, uint16 f, uint16 t, bool l) {
_dir = d;
_x = x;
_y = y;
_x = x;
_y = y;
_fromRoom = f;
_toRoom = t;
_toRoom = t;
_isLocked = l;
}
}
};
struct SFlame {
uint16 _x = 0;
uint16 _y = 0;
uint16 _x = 0;
uint16 _y = 0;
FPattern _p = kFlameOff;
SFlame() {}
@ -207,9 +207,9 @@ struct SObj {
Common::Array<uint8> _traps;
SObj() {}
SObj(uint16 x, uint16 y, SObjType t, SpriteFrame s, uint8 f, Common::Array<uint8> traps) {
_x = x;
_y = y;
_type = t;
_x = x;
_y = y;
_type = t;
_flags = f;
_traps = traps;
_frame = s;
@ -227,13 +227,13 @@ struct SMonster {
Common::Array<Motive> _program;
SMonster() {}
SMonster(uint16 x, uint16 y, uint16 h, MonsterFlag m, uint8 f, Common::Array<Motive> p, SpriteName s) {
_x = x;
_y = y;
_hits = h;
_x = x;
_y = y;
_hits = h;
_madAt = m;
_flags = f;
_program = p;
_sprite = s;
_program = p;
_sprite = s;
}
};
@ -246,12 +246,12 @@ struct Story {
uint16 _playerPointX = 0;
uint16 _playerPointY = 0;
Common::Array<int> _ladders;
Common::Array<int> _ladders;
Common::Array<SRoom> _rooms;
Common::Array<SDoor> _doors;
CArray2D<SFlame> _flames;
CArray2D<SObj> _objects;
CArray2D<SMonster> _monsters;
CArray2D<SFlame> _flames;
CArray2D<SObj> _objects;
CArray2D<SMonster> _monsters;
};
} // namespace immortal

View File

@ -23,7 +23,7 @@
namespace Immortal {
/*
/*
*
* ----- -----
* ----- General Use -----