26 #include "audio/mixer.h" 29 #include "engines/engine.h" 30 #include "engines/savestate.h" 33 #include "graphics/screen.h" 34 #include "graphics/surface.h" 37 #include "immortal/detection.h" 39 #include "common/formats/prodos.h" 40 #include "common/debug-channels.h" 41 #include "common/events.h" 42 #include "common/scummsys.h" 43 #include "common/system.h" 44 #include "common/fs.h" 45 #include "common/hash-str.h" 46 #include "common/random.h" 47 #include "common/serializer.h" 48 #include "common/util.h" 49 #include "common/platform.h" 52 #include "immortal/utilities.h" 55 #include "immortal/room.h" 111 enum CertificateIndex : uint8 {
124 enum GameFlags : uint8 {
151 uint8 _busyOnRight = 0;
159 uint16 _numAnims = 0;
163 uint16 _num2Cols = 0;
164 uint16 _num2Rows = 0;
165 uint16 _num2Cells = 0;
166 uint16 _num2Chrs = 0;
170 byte *_scanlines[32];
173 struct ImmortalGameDescription;
196 uint16 xba(uint16 ab);
197 uint16 rol(uint16 ab,
int n);
198 uint16 ror(uint16 ab,
int n);
199 uint16 mult16(uint16 a, uint16 b);
211 const int kNumLengths = 21;
212 const int kNiceTime = 36;
213 const int kMaxCertificate = 16;
216 const int kScreenW__ = 128;
217 const int kScreenH__ = 128;
218 const int kViewPortW = 256;
219 const int kViewPortH = 128;
220 const int kScreenSize = (kResH * kResV) * 2;
221 const uint16 kScreenLeft = 32;
222 const uint16 kScreenTop = 20;
223 const uint8 kTextLeft = 8;
224 const uint8 kTextTop = 4;
225 const uint8 kGaugeX = 0;
226 const uint8 kGaugeY =
static_cast<uint8
>((-13) & 0xff);
227 const uint16 kScreenBMW = 160;
228 const uint16 kChrW = 64;
229 const uint16 kChrH = 32;
230 const uint16 kChrH2 = kChrH * 2;
231 const uint16 kChrH3 = kChrH * 3;
232 const uint16 kChrLen = (kChrW / 2) * kChrH;
233 const uint16 kChrBMW = kChrW / 2;
234 const uint16 kLCutaway = 4;
235 const uint16 kLDrawSolid = 32 * ((3 * 16) + 5);
237 const uint16 kChrDy[19] = {kChr0, kChrH, kChrH2, kChrH, kChrH2,
238 kChrH2, kChrH, kChrH2, kChrH2, kChr0,
239 kChr0, kChrH2, kChrH, kChrH2, kChrH2,
240 kChrH2, kChrH, kChrH2, kChrH2
243 const uint16 kChrMask[19] = {kChr0, kChr0, kChr0, kChr0,
244 kChrR, kChrL, kChr0, kChrL,
245 kChrR, kChr0, kChr0, kChrLD,
246 kChr0, kChrR, kChrLD, kChrRD,
250 const uint16 kIsBackground[36] = {1, 0, 0, 0, 0, 0,
259 const int kPaletteOffset = 21205;
262 const uint16 kMaxSpriteW = 64;
263 const uint16 kMaxSpriteH = 64;
264 const uint16 kSpriteDY = 32;
265 const uint16 kVSX = kMaxSpriteW;
266 const uint16 kVSY = kSpriteDY;
267 const uint16 kVSBMW = (kViewPortW + kMaxSpriteW) / 2;
268 const uint16 kVSLen = kVSBMW * (kViewPortH + kMaxSpriteH);
269 const uint16 kVSDY = 32;
270 const uint16 kMySuperBottom = kVSDY + kViewPortH;
271 const uint16 kSuperBottom = 200;
272 const uint16 kMySuperTop = kVSDY;
273 const uint16 kSuperTop = 0;
274 const uint16 kViewPortSpX = 32;
275 const uint16 kViewPortSpY = 0;
276 const uint16 kWizardX = 28;
277 const uint16 kWizardY = 37;
278 const uint16 kObjectY = 24;
279 const uint16 kObjectX = 32;
280 const uint16 kObjectHeight = 48;
281 const uint16 kObjectWidth = 64;
284 const uint8 kMaxRows = 5;
285 const uint8 kMaxCollumns = 26;
287 const uint16 kYesNoY = 88;
288 const uint16 kYesNoX1 = 8;
289 const uint16 kYesNoX2 = 182;
292 const char kGaugeOn = 1;
293 const char kGaugeOff = 0;
294 const char kGaugeStop = 1;
295 const char kGaugeStart = 1;
298 const int kStoryNull = 5;
299 const int kMaxFilesPerLevel = 16;
300 const int kMaxPartInstances = 4;
301 const int kLevelToMaze[8] = {0, 0, 1, 1, 2, 2, 2, 3};
309 uint8 _certificate[16];
310 uint8 _lastCertLen = 0;
313 bool _gameOverFlag =
false;
314 uint8 _gameFlags = 0;
315 bool _themePaused =
false;
316 int _titlesShown = 0;
319 bool _restart =
false;
327 bool _levelOver =
false;
329 int _lastLevelLoaded = 0;
330 int _lastSongLoaded = 0;
335 uint16 _initialX = 0;
336 uint16 _initialY = 0;
340 int _initialRoom = 0;
341 int _currentRoom = 0;
345 Room *_rooms[kMaxRooms];
352 uint8 _doorToNextLevel = 0;
353 uint8 _doorCameInFrom = 0;
355 uint8 _numLadders = 0;
356 uint8 _ladderInUse = 0;
357 uint8 _secretLadder = 0;
358 uint8 _secretCount = 0;
359 uint8 _secretDelta = 0;
362 bool _singleStep =
false;
365 int _pressedAction = 0;
367 int _pressedDirection = 0;
368 int _heldDirection = 0;
372 uint8 _formatted = 0;
386 Sprite _sprites[kMaxSprites];
387 Cycle _cycles[kMaxCycles];
409 uint16 *_modLogicalCNM;
411 uint16 _myCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
412 uint16 _myModCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
413 uint16 _myModLCNM[(kViewPortCW + 1)][(kViewPortCH + 1)];
419 uint16 _columnX[kViewPortCW + 1];
420 uint16 _columnTop[kViewPortCW + 1];
421 uint16 _columnIndex[kViewPortCW + 1];
422 uint16 _tIndex[kMaxDrawItems];
423 uint16 _tPriority[kMaxDrawItems];
424 uint16 _viewPortX = 0;
425 uint16 _viewPortY = 0;
426 uint16 _myViewPortX = 0;
427 uint16 _myViewPortY = 0;
431 uint16 _lastPoint = 0;
434 uint16 _myUnivPointX = 0;
435 uint16 _myUnivPointY = 0;
436 int _num2DrawItems = 0;
440 int _dontResetColors = 0;
441 bool _usingNormal = 0;
444 uint16 _palDefault[16];
445 uint16 _palWhite[16];
446 uint16 _palBlack[16];
463 void rect(
int x,
int y,
int w,
int h);
465 void printByte(
int b);
466 void printChr(
char c);
478 void addSprite(uint16 vpX, uint16 vpY, SpriteName s,
int img, uint16 x, uint16 y, uint16 p);
480 void sortDrawItems();
482 void drawIcon(
int img);
483 void setPen(uint16 penX, uint16 penY);
485 void carriageReturn();
492 void playCombatSong();
496 void musicPause(
int sID);
497 void musicUnPause(
int sID);
503 void setColors(uint16 pal[]);
510 void fadePal(uint16 pal[],
int count, uint16 target[]);
511 void fade(uint16 pal[],
int dir,
int delay);
514 void normalFadeOut();
520 void initStoryStatic();
521 int loadUniv(
char mazeNum);
522 void loadMazeGraphics(
int m);
523 void makeBlisters(
int povX,
int povY);
547 int mungeCBM(uint16 num2Chrs);
548 void storeAddr(uint16 *drawType, uint16 chr2, uint16 drawIndex);
549 void mungeSolid(
int oldChr, uint16 &drawIndex);
550 void mungeLRHC(
int oldChr, uint16 &drawIndex);
551 void mungeLLHC(
int oldChr, uint16 &drawIndex);
552 void mungeULHC(
int oldChr, uint16 &drawIndex);
553 void mungeURHC(
int oldChr, uint16 &drawIndex);
554 void drawSolid(
int chr,
int x,
int y);
555 void drawULHC(
int chr,
int x,
int y);
556 void drawURHC(
int chr,
int x,
int y);
557 void drawLLHC(
int chr,
int x,
int y);
558 void drawLRHC(
int chr,
int x,
int y);
575 void updateHitGauge();
576 void drawGauge(
int h);
577 void makeCertificate();
578 void calcCheckSum(
int l, uint8 checksum[]);
579 bool getCertificate();
580 void printCertificate();
583 bool printAnd(Str s);
585 void setGameFlags(uint16 f);
586 uint16 getGameFlags();
592 void gameOverDisplay();
603 void setRandomSeed();
607 bool buttonPressed();
613 bool textPrint(Str s,
int n);
614 bool textBeginning(Str s,
int n);
615 bool textSub(Str s, FadeType f,
int n);
616 void textEnd(Str s,
int n);
617 void textMiddle(Str s,
int n);
621 void textAutoPageBreak();
623 void textBounceDelay();
637 void levelInitAtStartOfGameOnly();
642 void levelStory(
int l);
643 void levelLoadFile(
int l);
644 void levelNew(
int l);
646 void levelShowRoom(
int r,
int bX,
int bY);
647 bool levelIsShowRoom(
int r);
648 bool levelIsLoaded(
int l);
649 void univAtNew(
int l);
667 void initStoryDynamic();
677 void superSprite(
DataSprite *dSprite, uint16 x, uint16 y,
int img, uint16 bmw, byte *dst, uint16 superTop, uint16 superBottom);
678 bool clipSprite(uint16 &height, uint16 &pointIndex, uint16 &skipY,
DataSprite *dSprite, uint16 &pointX, uint16 &pointY,
int img, uint16 bmw, uint16 superTop, uint16 superBottom);
679 void spriteAligned(
DataSprite *dSprite,
Image &img, uint16 &skipY, uint16 &pointIndex, uint16 &height, uint16 bmw, byte *dst);
689 void setUpDictionary(uint16 *pCodes, uint16 *pTk, uint16 &findEmpty);
690 int inputCode(uint16 &outCode,
int &lSource,
Common::File *source, uint16 &evenOdd);
691 int member(uint16 &codeW, uint16 &k, uint16 *pCodes, uint16 *pTk, uint16 &findEmpty, uint16 &index);
697 void roomTransfer(
int r,
int x,
int y);
698 void doorOpenSecret();
699 void doorCloseSecret();
703 void doorNew(
SDoor door);
705 void doorOnDoorMat();
707 int findDoorTop(
int x,
int y);
708 int findDoor(
int x,
int y);
709 bool doLockStuff(
int d, MonsterID m,
int top);
710 bool inDoorTop(
int x,
int y, MonsterID m);
711 bool inDoor(
int x,
int y, MonsterID m);
712 int doorDoStep(MonsterID m,
int d,
int index);
713 int doorSetOn(
int d);
714 int doorComeOut(MonsterID m);
715 void doorSetLadders(MonsterID m);
731 uint32 getFeatures()
const;
736 uint32 getRandomNumber(uint maxNum) {
742 (f == kSupportsLoadingDuringRuntime) ||
743 (f == kSupportsSavingDuringRuntime) ||
744 (f == kSupportsReturnToLauncher);
771 #define SHOULD_QUIT ::Immortal::g_immortal->shouldQuit() Definition: sprite_list.h:47
EngineFeature
Definition: engine.h:253
Definition: immortal.h:142
Definition: definitions.h:25
Definition: advancedDetector.h:163
ErrorCode
Definition: error.h:47
Definition: immortal.h:179
uint getRandomNumber(uint max)
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: immortal.h:747
Definition: serializer.h:79
bool hasFeature(EngineFeature f) const override
Definition: immortal.h:740
Definition: immortal.h:156
Definition: immortal.h:146
Definition: immortal.h:169
Definition: sprite_list.h:40
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: immortal.h:750
Definition: movie_decoder.h:32
Definition: immortal.h:138