31 #include "common/array.h" 32 #include "common/random.h" 33 #include "common/rect.h" 34 #include "common/rendermode.h" 35 #include "engines/advancedDetector.h" 36 #include "engines/engine.h" 40 class SeekableReadStreamEndian;
48 class MacWindowManager;
69 kActionToggleMouselook,
70 kActionToggleDashboard,
71 kActionToggleWireframe,
72 kActionToggleFullscreen,
83 enum WallFeatureType {
86 kWallFeatureWindow = 3,
87 kWallFeatureShelves = 4,
88 kWallFeatureUpStairs = 5,
89 kWallFeatureDnStairs = 6,
91 kWallFeatureGlyph = 8,
92 kWallFeatureElevator = 9,
93 kWallFeatureTunnel = 10,
94 kWallFeatureAirlock = 11,
95 kWallFeatureColor = 12
135 inline int robotWallPad(
int robotType) {
136 static const int kMaxPad = 112;
138 case kRobEye:
return 66;
140 case kRobUPyramid:
return 85;
141 case kRobCube:
return 100;
142 case kRobQueen:
return kMaxPad;
144 case kRobSoldier:
return kMaxPad;
145 case kRobSnoop:
return kMaxPad;
196 kColorChairBase = 27,
204 kColorDeskChair = 39,
206 kColorMacScreen = 41,
208 kColorCryoGlass = 34,
219 kColorTableBase = 62,
222 kColorProjector = 65,
242 kColorBottomSnoop = 60,
254 kColorMiniEyeIris = 107,
255 kColorDroneEye = 108,
256 kColorSoldierBody = 109,
257 kColorSoldierEye = 110,
258 kColorQueenBody = 111,
259 kColorQueenEye = 112,
260 kColorQueenWingRed = 113
264 kColonyDebugMove = 1 << 0,
265 kColonyDebugRender = 1 << 1,
266 kColonyDebugAnimation = 1 << 2,
267 kColonyDebugMap = 1 << 3,
268 kColonyDebugSound = 1 << 4,
269 kColonyDebugUI = 1 << 5,
270 kColonyDebugCombat = 1 << 6,
275 kMenuActionAbout = 1,
282 kMenuActionCrosshair,
284 kMenuActionCursorShoot
287 static const int kBaseObject = 20;
288 static const int kMeNum = 101;
300 int xmx = 0, xmn = 0;
301 int zmx = 0, zmn = 0;
326 struct { uint8 level, xindex, yindex; } from;
327 struct { uint8 level, xindex, yindex;
int xloc, yloc; uint8 ang; } to;
334 uint8 level, xindex, yindex;
343 uint8
object[kBaseObject + 1];
346 uint8 location[10][3];
365 Image() : width(0), height(0), align(0), rowBytes(0), bits(0), planes(0), data(
nullptr) {}
366 ~
Image() {
delete[] data; }
376 Sprite() : fg(
nullptr), mask(
nullptr), used(
false) {}
377 ~
Sprite() {
delete fg;
delete mask; }
400 ComplexSprite() : visible(
false), current(0), xloc(0), yloc(0), acurrent(0), axloc(0), ayloc(0), type(0), frozen(0), locked(0), link(0), key(0), lock(0), onoff(
true) {}
417 void pauseEngineIntern(
bool pause)
override;
419 bool isSoundEnabled()
const {
return _soundOn; }
423 void loadMacColors();
424 void loadMap(
int mnum);
428 bool hasInteractiveWallFeature(
int cx,
int cy,
int dir)
const;
429 void clampToWalls(
Locate *p);
430 void clampToDiagonalWalls(
Locate *p);
431 int checkwallMoveTo(
int xnew,
int ynew,
int xind2,
int yind2,
Locate *pobject, uint8 trailCode);
432 int checkwallTryFeature(
int xnew,
int ynew,
int xind2,
int yind2,
Locate *pobject,
int dir);
433 int checkwall(
int xnew,
int ynew,
Locate *pobject);
434 void cCommand(
int xnew,
int ynew,
bool allowInteraction);
436 bool checkSkipRequested();
439 void fallThroughHole();
440 void playTunnelEffect(
bool falling);
442 void doText(
int entry,
int center);
443 void inform(
const char *text,
bool hold);
444 void printMessage(
const char *text[],
bool hold);
452 uint8 _mapData[31][31][5][5];
453 uint8 _robotArray[32][32];
454 uint8 _foodArray[32][32];
455 uint8 _dirXY[32][32];
456 bool _visited[8][32][32];
463 int _dynamicObjectBase = 0;
466 Sound *_sound =
nullptr;
472 int _tsin = 0, _tcos = 0;
475 int _centerX, _centerY;
477 int _mouseSensitivity;
479 bool _soundOn =
true;
482 bool _cursorShoot =
false;
506 uint8 _animDisplay[6];
514 bool _gametest =
false;
515 uint32 _blackoutColor = 0;
516 uint32 _lastClickTime = 0;
517 uint32 _displayCount = 0;
518 uint32 _lastHotfootTime = 0;
519 uint32 _lastAnimUpdate = 0;
520 uint32 _lastWarningChimeTime = 0;
521 int _action0 = 0, _action1 = 0;
523 bool _allGrow =
false;
524 bool _suppressCollisionSound =
false;
527 int _gameMode = kModeColony;
532 bool _projon =
false;
536 int _battleRound = 0;
537 Locate *_battlePwh[100] = {};
539 Locate _pyramids[4][4][15];
552 int _lastLoggedCursorMode = -1;
558 int _menuBarHeight = 0;
560 void loadMacCursorResources();
561 void handleMenuAction(
int action);
562 static void menuCommandsCallback(
int action,
Common::String &text,
void *data);
564 int _frntxWall = 0, _frntyWall = 0;
565 int _sidexWall = 0, _sideyWall = 0;
566 int _frntx = 0, _frnty = 0;
567 int _sidex = 0, _sidey = 0;
568 int _front = 0, _side = 0;
582 int _powerHeight = 0;
588 int _pictPowerID = 0;
592 uint8 wallAt(
int x,
int y)
const;
593 const uint8 *mapFeatureAt(
int x,
int y,
int direction)
const;
594 bool _visibleCell[32][32] = {};
595 void computeVisibleCells();
596 void drawStaticObjects();
601 const int (*points)[3];
603 const int (*surfaces)[8];
607 void draw3DPrism(
Thing &obj,
const PrismPartDef &def,
bool useLook,
int colorOverride = -1,
bool accumulateBounds =
false,
bool forceVisible =
false);
609 void draw3DSphere(
Thing &obj,
int pt0x,
int pt0y,
int pt0z,
610 int pt1x,
int pt1y,
int pt1z, uint32 fillColor, uint32 outlineColor,
bool accumulateBounds =
false);
611 void drawPrismOval3D(
Thing &thing,
const PrismPartDef &def,
bool useLook,
int colorOverride,
bool forceVisible =
false);
612 void drawEyeOverlays3D(
Thing &thing,
const PrismPartDef &irisDef,
int irisColorOverride,
613 const PrismPartDef &pupilDef,
int pupilColorOverride,
bool useLook);
614 bool drawStaticObjectPrisms3D(
Thing &obj);
616 void renderCorridor3D();
617 void drawWallFeatures3D();
618 void drawWallFeature3D(
int cellX,
int cellY,
int direction);
619 void drawCellFeature3D(
int cellX,
int cellY);
620 void getWallFace3D(
int cellX,
int cellY,
int direction,
float corners[4][3]);
621 void getCellFace3D(
int cellX,
int cellY,
bool ceiling,
float corners[4][3]);
623 int occupiedObjectAt(
int x,
int y,
const Locate *pobject);
624 void interactWithObject(
int objNum);
627 void setPower(
int p0,
int p1,
int p2);
629 void destroyRobot(
int num);
630 void doShootCircles(
int cx,
int cy);
631 void doBurnHole(
int cx,
int cy,
int radius);
638 void enterColonyFromBattle(
int mapNum,
int xloc,
int yloc);
639 void battleCommand(
int xnew,
int ynew);
641 void battleProjCommand(
int xcheck,
int ycheck);
643 void draw3DBattlePrism(
const PrismPartDef &def,
int worldX,
int worldY, uint8 ang,
int zShift = 0);
644 void battleBackdrop();
645 void battleDrawPyramids();
646 void battleDrawTanks();
649 void resetObjectSlot(
int slot,
int type,
int xloc,
int yloc, uint8 ang);
650 bool createObject(
int type,
int xloc,
int yloc, uint8 ang);
651 void saveLevelState();
653 void saveWall(
int x,
int y,
int direction);
655 void newPatch(
int type,
const PassPatch &from,
const PassPatch &to,
const uint8 *mapdata);
656 bool patchMapTo(
const PassPatch &to, uint8 *mapdata);
657 bool patchMapFrom(
const PassPatch &from, uint8 *mapdata);
659 void dropCarriedObject();
660 bool setDoorState(
int x,
int y,
int direction,
int state);
661 int openAdjacentDoors(
int x,
int y);
662 int goToDestination(
const uint8 *map,
Locate *pobject);
663 int tryPassThroughFeature(
int fromX,
int fromY,
int direction,
Locate *pobject);
664 void playTunnelAirlockEffect();
665 void syncMacMenuChecks();
666 void updateMouseCapture(
bool recenter =
true);
668 void updateViewportLayout();
669 void drawDashboardStep1();
670 void drawDashboardMac();
671 void drawDOSBarGraph(
int x,
int y,
int height);
672 void updateDOSPowerBars();
673 static int qlog(int32 x);
674 void drawMiniMapMarker(
int x,
int y,
int halfSize, uint32 color,
bool isMac,
const Common::Rect *clip =
nullptr);
675 bool hasRobotAt(
int x,
int y)
const;
676 bool hasFoodAt(
int x,
int y)
const;
677 void drawMiniMap(uint32 lineColor);
680 void automapCellCorner(
int dx,
int dy,
int xloc,
int yloc,
int lExt,
int tsin,
int tcos,
int ccx,
int ccy,
int &sx,
int &sy);
681 void automapDrawWall(
const Common::Rect &vp,
int x1,
int y1,
int x2,
int y2, uint32 color);
682 int automapWallFeature(
int fx,
int fy,
int dir);
683 void automapDrawWallWithFeature(
const Common::Rect &vp,
int wx1,
int wy1,
int wx2,
int wy2,
int feat,
int lExt, uint32 color);
684 void drawForkliftOverlay();
685 void drawCrosshair();
686 bool clipLineToRect(
int &x1,
int &y1,
int &x2,
int &y2,
const Common::Rect &clip)
const;
687 void wallLine(
const float corners[4][3],
float u1,
float v1,
float u2,
float v2, uint32 color);
688 void wallPolygon(
const float corners[4][3],
const float *u,
const float *v,
int count, uint32 color);
689 void wallChar(
const float corners[4][3], uint8 cnum);
700 Image *_backgroundMask =
nullptr;
701 Image *_backgroundFG =
nullptr;
704 bool _backgroundActive;
708 byte _bottomBG[8] = {};
712 bool _animationRunning;
713 int _animationResult;
716 bool _liftUp =
false;
720 int _airlockDirection = -1;
721 bool _airlockTerminate =
false;
725 bool makeBlackHole();
728 bool drawPict(
int resID);
730 void deleteAnimation();
732 void gameOver(
bool kill);
733 int countSavedCryos()
const;
734 void playAnimation();
735 void updateAnimation();
736 void drawAnimation();
737 void drawComplexSprite(
int index,
int ox,
int oy);
738 void drawAnimationImage(
Image *img,
Image *mask,
int x,
int y, uint32 fillColor = 0xFFFFFFFF);
739 uint32 resolveAnimColor(int16 bmEntry)
const;
744 void handleAnimationClick(
int item);
745 void handleDeskClick(
int item);
746 void handleVanityClick(
int item);
747 void handleSlidesClick(
int item);
748 void handleTeleshowClick(
int item);
749 void handleKeypadClick(
int item);
750 void handleSuitClick(
int item);
751 void handleDoorClick(
int item);
752 void handleAirlockClick(
int item);
753 void handleElevatorClick(
int item);
754 void handleControlsClick(
int item);
755 void dolSprite(
int index);
756 void moveObject(
int index);
757 void setObjectState(
int num,
int state);
758 int objectState(
int num)
const;
759 void setObjectOnOff(
int num,
bool on);
760 void refreshAnimationDisplay();
761 void cryptArray(uint8 sarray[6],
int i,
int j,
int k,
int l);
762 void terminateGame(
bool blowup);
766 void cubeThink(
int num);
767 void pyramidThink(
int num);
768 void upyramidThink(
int num);
769 void eyeThink(
int num);
770 void queenThink(
int num);
771 void droneThink(
int num);
772 void snoopThink(
int num);
773 void eggThink(
int num);
774 int getColonyActiveRobotLimit()
const;
775 void copyOverflowObjectToSlot(
int num);
776 bool layEgg(
int type,
int xindex,
int yindex);
777 void moveThink(
int num);
778 void bigGrow(
int num);
779 void growRobot(
int num);
780 int scanForPlayer(
int num);
781 void robotShoot(
int num);
783 void respawnObject(
int num,
int type);
Definition: managed_surface.h:51
Definition: framelimiter.h:40
Definition: macresman.h:126
EngineFeature
Definition: engine.h:258
Definition: advancedDetector.h:164
RenderMode
Definition: rendermode.h:48
Definition: macwindowmanager.h:148
Definition: atari-cursor.h:35
Definition: renderer.h:38
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: movie_decoder.h:32