IMMORTAL: Formatting and comment adjustments across all several files

This commit is contained in:
Quote58 2022-09-26 01:31:35 -04:00 committed by Eugene Sandulenko
parent d47efc743b
commit a188dced15
18 changed files with 235 additions and 214 deletions

View File

@ -88,12 +88,11 @@ int Room::cycleGetFrame(int c) {
* This is essentially self-modifying code, and it saves 2 bytes of DP memory over the traditional
* STA DP : LDA (DP)
*/
//debug("%d", _cycPtrs[_cycles[c]._cycList]._frames[_cycles[c]._index]);
return g_immortal->_cycPtrs[g_immortal->_cycles[c]._cycList]._frames[g_immortal->_cycles[c]._index];
}
int Room::cycleGetNumFrames(int c) {
// Why in the world is this not kept as a property of the cycle? We have to calculate the size of the array each time
// For whatever reason, this is not a property of the cycle, so it has to be re-calculated each time
int index = 0;
while (g_immortal->_cycPtrs[g_immortal->_cycles[c]._cycList]._frames[index] != -1) {
index++;

View File

@ -295,7 +295,7 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
// It is a regular file if (dead < file type < pascal) and the file has a size
if ((kFileTypeDead < fileEntry._type) && (fileEntry._type < kFileTypePascal) && (fileEntry._eof > 0)) {
Common::String fileName = path + fileEntry._name;
debug("%s", fileName.c_str());
//debug("%s", fileName.c_str());
ProDOSFile *currFile = new ProDOSFile(fileEntry._name, fileEntry._type, fileEntry._totalBlocks, fileEntry._eof, fileEntry._blockPtr, &_disk);
_files.setVal(fileName, Common::SharedPtr<ProDOSFile>(currFile));
@ -305,7 +305,7 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
} else if (fileEntry._type == kFileTypeSubDir) {
_disk.seek(fileEntry._blockPtr * kBlockSize);
debug("--- diving into a subdirectory ---");
//debug("--- diving into a subdirectory ---");
uint16 subP = _disk.readUint16LE();
uint16 subN = _disk.readUint16LE();
@ -316,7 +316,7 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
Common::String subPath = Common::String(path + subHead._name + '/');
searchDirectory(&subHead, subP, subN, path);
debug("--- surfacing to parent directory ---");
//debug("--- surfacing to parent directory ---");
_disk.seek(currPos);
}
}
@ -425,7 +425,6 @@ Common::SeekableReadStream *ProDOSDisk::createReadStreamForMember(const Common::
return nullptr;
}
Common::SharedPtr<ProDOSFile> f = _files.getValOrDefault(name);
f->printInfo();
return f->createReadStream();
}

View File

@ -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
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
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
};
/* This class defines the entire disk volume. Upon using the open() method,
@ -126,12 +126,12 @@ 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
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 {

View File

@ -20,7 +20,6 @@
*/
/* [Alternate Name: Door Processing]
* --- What is a Door ---
*/
#include "immortal/immortal.h"
@ -28,10 +27,10 @@
namespace Immortal {
enum DoorMask {
kDoorXMask = 0x1f, // Only relevant for extracting the data from the compressed bytes in the story record
kDoorYMask = 0x1f,
kDoorXMask = 0x1f, // Only relevant for extracting the data from the compressed bytes in the story record
kDoorYMask = 0x1f,
kDoorFullMask = 0x40,
kDoorOnMask = 0x60
kDoorOnMask = 0x60
};
enum DoorIs {
@ -50,10 +49,6 @@ enum DoorSide {
kDoorTopBottom = 20
};
void ImmortalEngine::doorOpenSecret() {}
void ImmortalEngine::doorCloseSecret() {}
void ImmortalEngine::doorInit() {}
void ImmortalEngine::doorClrLock() {}
void ImmortalEngine::doorNew(SDoor door) {
Door d;
d._x = door._x;
@ -65,32 +60,46 @@ void ImmortalEngine::doorNew(SDoor door) {
_doors.push_back(d);
}
void ImmortalEngine::doorDrawAll() {}
void ImmortalEngine::doorOnDoorMat() {}
int ImmortalEngine::findDoorTop(int x, int y) {
int ImmortalEngine::findDoorTop(int x, int y) {
return 0;
}
int ImmortalEngine::findDoor(int x, int y) {
}
int ImmortalEngine::findDoor(int x, int y) {
return 0;
}
}
bool ImmortalEngine::doLockStuff(int d, MonsterID m, int top) {
return true;
}
bool ImmortalEngine::inDoorTop(int x, int y, MonsterID m) {
return true;
}
bool ImmortalEngine::inDoor(int x, int y, MonsterID m) {
return true;
}
int ImmortalEngine::doorDoStep(MonsterID m, int d, int index) {
int ImmortalEngine::doorDoStep(MonsterID m, int d, int index) {
return 0;
}
int ImmortalEngine::doorSetOn(int d) {
}
int ImmortalEngine::doorSetOn(int d) {
return 0;
}
int ImmortalEngine::doorComeOut(MonsterID m) {
}
int ImmortalEngine::doorComeOut(MonsterID m) {
return 0;
}
}
// These functions are not yet implemented
void ImmortalEngine::doorSetLadders(MonsterID m) {}
void ImmortalEngine::doorDrawAll() {}
void ImmortalEngine::doorOnDoorMat() {}
void ImmortalEngine::doorOpenSecret() {}
void ImmortalEngine::doorCloseSecret() {}
void ImmortalEngine::doorInit() {}
void ImmortalEngine::doorClrLock() {}
} // namespace immortal

View File

@ -23,9 +23,11 @@
namespace Immortal {
// These functions are not yet implemented
int ImmortalEngine::mungeCBM(int numChrs) {
return 0;
}
void ImmortalEngine::storeAddr() {}
void ImmortalEngine::mungeSolid() {}
void ImmortalEngine::mungeLRHC() {}

View File

@ -47,6 +47,7 @@ void Room::flameFreeAll() {
void Room::flameDrawAll(uint16 vX, uint16 vY) {
for (int i = 0; i < _fset.size(); i++) {
// For every flame in the room, add the sprite to the sprite table
univAddSprite(vX, vY, _fset[i]._x, _fset[i]._y, g_immortal->_cycPtrs[g_immortal->_cycles[_fset[i]._c]._cycList]._sName, cycleGetFrame(_fset[i]._c), 0);
if (cycleAdvance(_fset[i]._c) == true) {
cycleFree(_fset[i]._c);
@ -56,7 +57,7 @@ void Room::flameDrawAll(uint16 vX, uint16 vY) {
}
bool Room::roomLighted() {
// Just for now, we say it's always lit
// For testing purposes, we say it's always lit
return true;
// Very simple, just checks every torch and if any of them are lit, we say the room is lit
@ -94,7 +95,7 @@ void Room::flameSetRoom(Common::Array<SFlame> allFlames) {
f._x = allFlames[i]._x;
f._y = allFlames[i]._y;
f._c = flameGetCyc(&f, (0 | _candleTmp));
debug("made flame, cyc = %d", f._c);
//debug("made flame, cyc = %d", f._c);
_fset.push_back(f);
}
_candleTmp = 1;

View File

@ -55,16 +55,15 @@ uint16 ImmortalEngine::xba(uint16 ab) {
/* XBA in 65816 swaps the low and high bits of a given word in A.
* This is used very frequently, so this function just makes
* initial translation a little more straightforward. Eventually,
* logic should be refactored to not require this.
* code should be refactored to not require this.
*/
return ((ab & kMaskLow) << 8) | ((ab & kMaskHigh) >> 8);
}
uint16 ImmortalEngine::rol(uint16 ab, int n) {
/* Oops, another opcode that doesn't have a nice translation.
* This just replicates bit rotation because apparently C
* doesn't have this natively??? This assumes a 16 bit
* unsigned int because that's all we need for the 65816.
/* This just replicates bit rotation, and it
* assumes a 16 bit unsigned int because that's all
* we need for the 65816.
*/
return (ab << n) | (ab >> (-n & 15));
}
@ -150,7 +149,7 @@ Common::Error ImmortalEngine::run() {
return Common::kPathDoesNotExist;
}
//Main:
// Main:
_zero = 0;
_draw = 1;
_usingNormal = 1;
@ -163,7 +162,7 @@ Common::Error ImmortalEngine::run() {
// This is the equivalent of Main->InitGraphics->MyClearScreen in Driver
useNormal(); // The first palette will be the default
loadFont(); // Load the font sprite
loadFont(); // Load the font sprites
loadWindow(); // Load the window background
loadSingles("Song A"); // Music
loadSprites(); // Get all the sprite data into memory

View File

@ -226,9 +226,9 @@ public:
const uint16 kLCutaway = 4;
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,
@ -240,8 +240,8 @@ public:
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, 0, 0, 0,
0, 0, 0, 0, 0, 0};
// Disk offsets
const int kPaletteOffset = 21205; // This is the byte position of the palette data in the disk
@ -347,7 +347,7 @@ public:
uint8 _secretDelta = 0;
// Debug members
bool _singleStep = false; // Flag for _singleStep mode
bool _singleStep = false; // Flag for _singleStep mode
// Input members
int _pressedAction = 0;
@ -365,11 +365,11 @@ public:
// Music members
Song _playing; // Currently playing song
int _themeID = 0; // Not sure yet tbh
int _combatID = 0;
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
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];
@ -384,27 +384,27 @@ public:
// Screen members
byte *_screenBuff; // The final buffer that will transfer to the screen
uint16 _myCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModLCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
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 _myCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
uint16 _myModLCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
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 _tIndex[kMaxDrawItems];
uint16 _tPriority[kMaxDrawItems];
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;
uint16 _myUnivPointX = 0;
uint16 _myUnivPointY = 0;
int _num2DrawItems = 0;
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;
uint16 _myUnivPointX = 0;
uint16 _myUnivPointY = 0;
int _num2DrawItems = 0;
Graphics::Surface *_mainSurface;
GenericSprite _genSprites[6];
@ -412,6 +412,7 @@ GenericSprite _genSprites[6];
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];
@ -489,6 +490,7 @@ GenericSprite _genSprites[6];
// 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
void loadUniv(char mazeNum);
void loadMazeGraphics(int m); // Creates a universe with a maze
void loadFont(); // Gets the font.spr file, and centers the sprite
void clearSprites(); // Clears all sprites before drawing the current frame

View File

@ -43,7 +43,7 @@ void ImmortalEngine::levelNew(int l) {
levelStory(l);
if (kLevelToMaze[l] != _lastLevelLoaded) {
_lastLevelLoaded = kLevelToMaze[l];
//loadMazeGraphics(l);
loadMazeGraphics(l);
}
if (_level != _lastSongLoaded) {

View File

@ -519,7 +519,6 @@ bool ImmortalEngine::getCertificate() {
} else {
// The input was a key
if (certLen != kMaxCertificate) {
if ((k >= 'a') && (k < '{')) {
k -= 0x20;
@ -532,7 +531,6 @@ bool ImmortalEngine::getCertificate() {
else {
if (k < 'A') {
// Terrible, I know. But this seems to be the logic.
continue;
}
@ -584,8 +582,7 @@ void ImmortalEngine::printCertificate() {
* this one is nice and simple. You could also
* just add the appropriate offset for the letters,
* but grabbing it from a table is faster and doesn't
* use a lot of space (especially if it's used anywhere else).
* Why doesn't the game use rom table indexing like this more often?
* 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'};
@ -614,7 +611,7 @@ bool ImmortalEngine::isSavedAna() {
/*
* Functions that don't really need to be functions
* These functions don't really need to be functions
*/
void ImmortalEngine::setGameFlags(uint16 f) {

View File

@ -198,9 +198,7 @@ bool ImmortalEngine::textSub(Str s, FadeType f, int n) {
}
index++;
}
//debug("printing index: %d", index);
chr = text[index];
if (f != kTextFadeIn) {

View File

@ -12,8 +12,8 @@ MODULE_OBJS = \
misc.o \
cycle.o \
drawChr.o \
level.o \
story.o \
level.o \
story.o \
room.o \
flameSet.o \
univ.o \

View File

@ -119,20 +119,21 @@ public:
const uint8 kLightTorchX = 10;
const uint8 kMaxFlameCycs = 16;
Common::Array<SCycle> _cycPtrs;
Common::Array<Flame> _fset;
Common::Array<Monster> _monsters;
Common::Array<Object> _objects;
Common::Array<SCycle> _cycPtrs;
Common::Array<Flame> _fset;
Common::Array<Monster> _monsters;
Common::Array<Object> _objects;
RoomFlag _flags;
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 _numFlames = 0;
uint8 _numInRoom = 0;
RoomFlag _flags;
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 _numFlames = 0;
uint8 _numInRoom = 0;
/*
* --- Methods ---
@ -171,7 +172,7 @@ Common::Array<Object> _objects;
*/
// 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
@ -185,7 +186,7 @@ DataSprite *cycleGetDataSprite(int c); // This takes the place of getFile + ge
// Misc
bool cycleAdvance(int c);
CycID getCycList(int c);
CycID getCycList(int c);
/* Unneccessary cycle functions
void cycleInit();
@ -204,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
@ -221,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

@ -32,25 +32,25 @@ struct Image {
uint16 _deltaY;
uint16 _rectW;
uint16 _rectH;
Common::Array<uint16> _scanWidth;
Common::Array<uint16> _deltaPos;
CArray2D<byte> _bitmap;
Common::Array<uint16> _scanWidth;
Common::Array<uint16> _deltaPos;
CArray2D<byte> _bitmap;
};
struct DataSprite {
uint16 _cenX; // These are the base center positions
uint16 _cenY;
uint16 _numImages;
Common::Array<Image> _images;
Common::Array<Image> _images;
};
struct Sprite {
int _image; // Index of _dSprite._frames[]
int _image; // Index of _dSprite._images[]
uint16 _X;
uint16 _Y;
uint16 _on; // 1 = active
uint16 _priority;
DataSprite *_dSprite;
DataSprite *_dSprite;
};
enum SpriteFrame {

View File

@ -63,7 +63,7 @@ namespace Immortal {
// This function is basically setSpriteCenter + getSpriteInfo from the source
void ImmortalEngine::initDataSprite(Common::SeekableReadStream *f, DataSprite *d, int index, uint16 cenX, uint16 cenY) {
// We set the center X and Y, for some reason
// We set the center X and Y
d->_cenX = cenX;
d->_cenY = cenY;
@ -76,7 +76,6 @@ void ImmortalEngine::initDataSprite(Common::SeekableReadStream *f, DataSprite *d
uint16 numImages = f->readUint16LE();
d->_numImages = numImages;
//debug("Number of Frames: %d", numImages);
// Only here for dragon, but just in case, it's a high number so it should catch others
if (numImages >= 0x0200) {
@ -91,7 +90,7 @@ void ImmortalEngine::initDataSprite(Common::SeekableReadStream *f, DataSprite *d
f->seek(index + (i * 2));
int ptrFrame = f->readUint16LE();
f->seek(ptrFrame);
newImage._deltaX = f->readUint16LE() << 1; // the ASL might not be required, depending on whether the data is actually in bytes or pixels <-- this also might not be used in the game anyway? Lol
newImage._deltaX = f->readUint16LE() << 1; // This member does not seem to be used in the actual game, and it is not clear whether it needs the << 1 or if that was fixed before release
newImage._deltaY = f->readUint16LE();
newImage._rectW = f->readUint16LE();
newImage._rectH = f->readUint16LE();
@ -127,9 +126,10 @@ bool ImmortalEngine::clipSprite(uint16 &height, uint16 &pointIndex, uint16 &skip
_lastY = pointY;
if (pointY < kMaskNeg) {
// For the Apple IIGS, pointY in pixels needed to be converted to bytes. For us, it's the other way around, we need bmw in pixels
// This should probably use mult16() instead of *
_lastPoint = pointY * (bmw);
} else {
// Screen wrapping??
// Screen wrapping?
uint16 temp = (0 - pointY) + 1;
_lastPoint = temp * bmw;
_lastPoint = 0 - _lastPoint;
@ -175,8 +175,8 @@ void ImmortalEngine::spriteAligned(DataSprite *dSprite, Image &img, uint16 &skip
* that was indexed by the pixel itself, and used to find what nyble needed
* to be masked. However we are using a slightly different kind of screen buffer,
* and so I chose a more traditional method. Likewise, alignement was
* relevant for the source, but is not relevant here (thankfully, considering
* how confusing sprite drawing is when not an even position).
* relevant for the source, but is not relevant here, and the sprite drawing
* is not accomplished by indexed a set of code blocks.
*/
byte pixel1 = 0;
byte pixel2 = 0;
@ -218,7 +218,7 @@ void ImmortalEngine::spriteAligned(DataSprite *dSprite, Image &img, uint16 &skip
}
void ImmortalEngine::superSprite(DataSprite *dSprite, uint16 pointX, uint16 pointY, int img, uint16 bmw, byte *dst, uint16 superTop, uint16 superBottom) {
// Main image construction routine
// Main sprite image construction routine
// For the Apple IIGS, the bmw is in bytes, but for us it needs to be the reverse, in pixels
bmw <<= 1;
@ -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;

View File

@ -32,7 +32,8 @@
* objects, and everything in the rooms.
*/
/* UNIVAT 1024,480, 1152, 464, \-1, -1, zip,level1Ladders, rooma, 704/64, 544/32\
/* 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\
@ -149,7 +150,6 @@ void ImmortalEngine::initStoryStatic() {
"This room resembles part&of the map.@"};
_strPtrs = s;
// Scope, amirite?
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};
@ -158,9 +158,9 @@ void ImmortalEngine::initStoryStatic() {
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> 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};
@ -175,10 +175,10 @@ void ImmortalEngine::initStoryStatic() {
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> 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};
@ -277,9 +277,9 @@ void ImmortalEngine::initStoryDynamic() {
/* 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
@ -309,23 +309,23 @@ void ImmortalEngine::initStoryDynamic() {
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, 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,15 +341,19 @@ 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(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};
_stories[0]._monsters = monsters;
/*
* ::: Level 0: Intro 2 :::
*/
}
} // namespace Immortal

View File

@ -97,33 +97,33 @@ enum SObjPickup {
};
struct Pickup {
//pointer to function
int _param;
// This will be a pointer to function
};
// Iirc damage is used by object types as well as enemy types
// Damage is used by object types as well as enemy types
enum SDamage {
};
struct Damage {
};
// Use is self explanitory, it defines the function and parameters for using an object
// Use defines the function and parameters for using an object
enum SObjUse {
};
struct Use {
//pointer to function
int _param;
// This will be a pointer to function
};
struct ObjType {
Str _str = kStrNull;
Str _desc = kStrNull;
int _size = 0;
Pickup _pickup;
Use _use;
Use _run;
Pickup _pickup;
};
// Cycles define the animation of sprites within a level. There is a fixed total of cycles available, and they are not room dependant
@ -138,43 +138,48 @@ struct Cycle {
* for the moment there's no need to replicate this particular bit of space saving.
*/
struct SCycle {
SpriteName _sName;
bool _repeat;
Common::Array<int> _frames;
SpriteName _sName;
Common::Array<int> _frames;
bool _repeat;
SCycle() {}
SCycle(SpriteName s, bool r, Common::Array<int> f) {
_sName = s;
_repeat = r;
_frames = f;
_sName = s;
_repeat = r;
_frames = f;
}
};
struct SRoom {
uint16 _x = 0;
uint16 _y = 0;
RoomFlag _flags = kRoomFlag0;
SRoom() {}
SRoom(uint16 x, uint16 y, RoomFlag f) {
_x = x;
_y = y;
_flags = f;
}
RoomFlag _flags = kRoomFlag0;
SRoom() {}
SRoom(uint16 x, uint16 y, RoomFlag f) {
_x = x;
_y = y;
_flags = f;
}
};
struct SDoor {
uint8 _dir = 0;
uint16 _x = 0;
uint16 _y = 0;
uint8 _dir = 0;
uint16 _x = 0;
uint16 _y = 0;
uint16 _fromRoom = 0;
uint16 _toRoom = 0;
bool _isLocked = false;
SDoor() {}
SDoor(uint8 d, uint16 x, uint16 y, uint16 f, uint16 t, bool l) {
_dir = d;
_x = x;
_y = y;
_fromRoom = f;
_toRoom = t;
bool _isLocked = false;
SDoor() {}
SDoor(uint8 d, uint16 x, uint16 y, uint16 f, uint16 t, bool l) {
_dir = d;
_x = x;
_y = y;
_fromRoom = f;
_toRoom = t;
_isLocked = l;
}
};
@ -182,68 +187,71 @@ struct SDoor {
struct SFlame {
uint16 _x = 0;
uint16 _y = 0;
FPattern _p = kFlameOff;
FPattern _p = kFlameOff;
SFlame() {}
SFlame(uint16 x, uint16 y, FPattern p) {
_x = x;
SFlame(uint16 x, uint16 y, FPattern p) {
_x = x;
_y = y;
_p = p;
}
_p = p;
}
};
struct SObj {
uint16 _x = 0;
uint16 _y = 0;
SObjType _type = kTypeTrap;
uint8 _flags = 0;
SpriteFrame _frame = kNoFrame;
Common::Array<uint8> _traps;
uint16 _x = 0;
uint16 _y = 0;
uint8 _flags = 0;
SObjType _type = kTypeTrap;
SpriteFrame _frame = kNoFrame;
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;
_flags = f;
_traps = traps;
_frame = s;
_x = x;
_y = y;
_type = t;
_flags = f;
_traps = traps;
_frame = s;
}
};
struct SMonster {
uint16 _x = 0;
uint16 _y = 0;
uint16 _hits = 0;
MonsterFlag _madAt = kMonstIsNone;
uint8 _flags = 0;
SpriteName _sprite = kCandle;
Common::Array<Motive> _program;
uint16 _x = 0;
uint16 _y = 0;
uint16 _hits = 0;
uint8 _flags = 0;
MonsterFlag _madAt = kMonstIsNone;
SpriteName _sprite = kCandle;
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;
_madAt = m;
_flags = f;
_program = p;
_sprite = s;
_x = x;
_y = y;
_hits = h;
_madAt = m;
_flags = f;
_program = p;
_sprite = s;
}
};
struct Story {
int _level = 0;
int _part = 1;
int _level = 0;
int _part = 1;
uint16 _initialUnivX = 0;
uint16 _initialUnivY = 0;
uint16 _playerPointX = 0;
uint16 _playerPointY = 0;
uint16 _initialUnivX = 0;
uint16 _initialUnivY = 0;
uint16 _playerPointX = 0;
uint16 _playerPointY = 0;
Common::Array<int> _ladders;
Common::Array<SRoom> _rooms;
Common::Array<SDoor> _doors;
CArray2D<SFlame> _flames;
CArray2D<SObj> _objects;
CArray2D<SMonster> _monsters;
Common::Array<int> _ladders;
Common::Array<SRoom> _rooms;
Common::Array<SDoor> _doors;
CArray2D<SFlame> _flames;
CArray2D<SObj> _objects;
CArray2D<SMonster> _monsters;
};
} // namespace immortal

View File

@ -90,7 +90,9 @@ bool Utilities::insideRect(uint8 rectX, uint8 rectY, uint8 w, uint8 h, uint8 poi
* This is done by grabbing the delta X,Y and
* making sure it is not negative.
*/
if ((w | h) == 0) {
// The source specifically checks only for w *and* h being 0, so you could give it a rect with a width or height or 0, just not both
if ((w == 0) && (h == 0)) {
return false;
}