diff options
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_logic.h')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 285 |
1 files changed, 185 insertions, 100 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 0b573bf7f0..c9695c921d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -42,9 +42,8 @@ public: static Scene *createScene(int sceneNumber); }; -class SceneArea: public EventHandler { +class SceneArea: public SceneItem { public: - Rect _bounds; bool _enabled; bool _insideArea; CursorType _cursorNum; @@ -54,9 +53,12 @@ public: SceneArea(); void setDetails(const Rect &bounds, CursorType cursor); + virtual Common::String getClassName() { return "SceneArea"; } virtual void synchronize(Serializer &s); virtual void remove(); virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event) { return false; } + virtual void doAction(int action) {} }; class SceneExit: public SceneArea { @@ -79,27 +81,23 @@ private: static void startStrip(); static void endStrip(); public: - byte _field312[256]; - int _field372; + byte _shadowPaletteMap[256]; bool _savedPlayerEnabled; bool _savedUiEnabled; bool _savedCanWalk; - int _field37A; + bool _preventSaving; - SceneObject *_focusObject; Visage _cursorVisage; - SynchronizedList<SceneArea *> _sceneAreas; - - Rect _v51C34; + SynchronizedList<EventHandler *> _sceneAreas; public: SceneExt(); virtual Common::String getClassName() { return "SceneExt"; } + virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void process(Event &event); virtual void dispatch(); - virtual void loadScene(int sceneNum); virtual void refreshBackground(int xAmount, int yAmount); virtual void saveCharacter(int characterIndex); virtual void restore() {} @@ -108,12 +106,14 @@ public: void fadeOut(); void clearScreen(); void scalePalette(int RFactor, int GFactor, int BFactor); + void loadBlankScene(); }; class SceneHandlerExt: public SceneHandler { public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); + virtual void postLoad(int priorSceneBeforeLoad, int currentSceneBeforeLoad); void setupPaletteMaps(); }; @@ -159,60 +159,63 @@ public: /*--------------------------------------------------------------------------*/ class Ringworld2InvObjectList : public InvObjectList { +private: + static bool SelectItem(int objectNumber); + static void selectDefault(int obectNumber); public: InvObject _none; - InvObject _inv1; - InvObject _inv2; + InvObject _optoDisk; + InvObject _reader; InvObject _negatorGun; InvObject _steppingDisks; - InvObject _inv5; - InvObject _inv6; - InvObject _inv7; - InvObject _inv8; - InvObject _inv9; - InvObject _inv10; - InvObject _inv11; - InvObject _inv12; - InvObject _inv13; - InvObject _inv14; - InvObject _inv15; - InvObject _inv16; - InvObject _inv17; - InvObject _inv18; - InvObject _inv19; - InvObject _inv20; - InvObject _inv21; - InvObject _inv22; - InvObject _inv23; - InvObject _inv24; - InvObject _inv25; - InvObject _inv26; - InvObject _inv27; - InvObject _inv28; - InvObject _inv29; - InvObject _inv30; - InvObject _inv31; - InvObject _inv32; - InvObject _inv33; - InvObject _inv34; - InvObject _inv35; - InvObject _inv36; - InvObject _inv37; - InvObject _inv38; - InvObject _inv39; - InvObject _inv40; - InvObject _inv41; - InvObject _inv42; - InvObject _inv43; - InvObject _inv44; - InvObject _inv45; - InvObject _inv46; - InvObject _inv47; - InvObject _inv48; - InvObject _inv49; - InvObject _inv50; - InvObject _inv51; - InvObject _inv52; + InvObject _attractorUnit; + InvObject _sensorProbe; + InvObject _sonicStunner; + InvObject _cableHarness; + InvObject _comScanner; + InvObject _spentPowerCapsule; // 10 + InvObject _chargedPowerCapsule; + InvObject _aerosol; + InvObject _remoteControl; + InvObject _opticalFibre; + InvObject _clamp; + InvObject _attractorHarness; + InvObject _fuelCell; + InvObject _gyroscope; + InvObject _airbag; + InvObject _rebreatherTank; // 20 + InvObject _reserveTank; + InvObject _guidanceModule; + InvObject _thrusterValve; + InvObject _balloonBackpack; + InvObject _radarMechanism; + InvObject _joystick; + InvObject _ignitor; + InvObject _diagnosticsDisplay; + InvObject _glassDome; + InvObject _wickLamp; // 30 + InvObject _scrithKey; + InvObject _tannerMask; + InvObject _pureGrainAlcohol; + InvObject _blueSapphire; + InvObject _ancientScrolls; + InvObject _flute; + InvObject _gunpowder; + InvObject _unused; + InvObject _comScanner2; + InvObject _superconductorWire; // 40 + InvObject _pillow; + InvObject _foodTray; + InvObject _laserHacksaw; + InvObject _photonStunner; + InvObject _battery; + InvObject _soakedFaceMask; + InvObject _lightBulb; + InvObject _alcoholLamp1; + InvObject _alcoholLamp2; + InvObject _alocholLamp3; // 50 + InvObject _brokenDisplay; + InvObject _toolbox; Ringworld2InvObjectList(); void reset(); @@ -226,6 +229,7 @@ public: class Ringworld2Game: public Game { public: virtual void start(); + virtual void restartGame(); virtual void restart(); virtual void endGame(int resNum, int lineNum); @@ -260,7 +264,9 @@ class SceneActor: public SceneObject { public: virtual Common::String getClassName() { return "SceneActor"; } virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); virtual bool startAction(CursorType action, Event &event); + virtual GfxSurface getFrame(); }; class SceneActorExt: public SceneActor { @@ -276,6 +282,48 @@ public: } }; +enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_NORTHEAST = 2, MAZEDIR_EAST = 3, + MAZEDIR_SOUTHEAST = 4, MAZEDIR_SOUTH = 5, MAZEDIR_SOUTHWEST = 6, MAZEDIR_WEST = 7, + MAZEDIR_NORTHWEST = 8 }; + +class MazeUI: public SceneObject { +private: + void clear(); +public: + // The dimensions (in cells) of the entire maze map + Rect _mapBounds; + + // Encoded cell map specifying the features of the maze + byte *_mapData; + // Image surface used to store a line of the map for rendering + GfxSurface _mapImage; + + Common::Point _cellsVisible; + Common::Point _mapCells; + Common::Point _cellSize; + Common::Point _mapOffset; + int _resNum; + int _cellsResNum; + int _frameCount; + int _resCount; + int _mapImagePitch; +public: + MazeUI(); + virtual ~MazeUI(); + + void setDisplayBounds(const Rect &r); + bool setMazePosition(const Common::Point &pt); + void load(int resNum); + int getCellFromPixelXY(const Common::Point &pt); + int getCellFromCellXY(const Common::Point &p); + int pixelToCellXY(Common::Point &pt); + + virtual Common::String getClassName() { return "MazeUI"; } + void synchronize(Serializer &s); + virtual void reposition(); + virtual void draw(); +}; + class SceneAreaObject: public SceneArea { class Object1: public SceneActor { public: @@ -290,41 +338,6 @@ public: void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; -class UnkObject1200 : public SavedObject { -public: - Rect _rect1; - Rect _rect2; - - int *_field16; - int *_field3A; - - int _field12; - int _field14; - int _field26; - int _field28; - int _field2A; - int _field2C; - int _field2E; - int _field30; - int _field32; - int _field34; - int _field36; - int _field38; - int _field3E; - int _field40; - - UnkObject1200(); - void synchronize(Serializer &s); - - void sub51AE9(int arg1); - int sub51AF8(Common::Point pt); - bool sub51AFD(Common::Point pt); - void sub51B02(); - void sub9EDE8(Rect rect); - int sub9EE22(int &arg1, int &arg2); - virtual Common::String getClassName() { return "UnkObject1200"; } -}; - /*--------------------------------------------------------------------------*/ class AnimationSlice { @@ -378,6 +391,8 @@ public: enum AnimationPaletteMode { ANIMPALMODE_REPLACE_PALETTE = 0, ANIMPALMODE_CURR_PALETTE = 1, ANIMPALMODE_NONE = 2 }; +enum AnimationObjectMode { ANIMOBJMODE_1 = 1, ANIMOBJMODE_2 = 2, ANIMOBJMODE_42 = 42 }; + class AnimationPlayer: public EventHandler { private: void rleDecode(const byte *pSrc, byte *pDest, int size); @@ -391,10 +406,11 @@ public: AnimationData *_sliceNext; Common::File _resourceFile; Rect _rect1, _screenBounds; - int _field38; - int _field3A, _paletteMode; - int _objectMode; - int _field58, _sliceHeight; + bool _animLoaded; + bool _canSkip; + AnimationPaletteMode _paletteMode; + AnimationObjectMode _objectMode; + int _sliceHeight; byte _palIndexes[256]; ScenePalette _palette; AnimationPlayerSubData _subData; @@ -418,6 +434,7 @@ public: virtual void changePane() {} virtual void closing() {} + bool load(int animId, Action *endAction = NULL); bool isCompleted(); void close(); @@ -425,13 +442,81 @@ public: class AnimationPlayerExt: public AnimationPlayer { public: - int _v; + bool _isActive; public: AnimationPlayerExt(); virtual void synchronize(Serializer &s); }; +class ModalWindow: public SceneArea { +public: + SceneActor _object1; + int _insetCount; +public: + ModalWindow(); + + virtual void remove(); + virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ModalWindow"; } + virtual void process(Event &event); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum); +}; + +class ScannerDialog: public ModalWindow { + + class Button: public SceneActor { + private: + void reset(); + public: + int _buttonId; + bool _buttonDown; + public: + Button(); + void setup(int buttonId); + + virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerButton"; } + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + class Slider: public SceneActor { + private: + void update(); + public: + int _initial; + int _xStart; + int _yp; + int _width; + int _xInc; + bool _sliderDown; + public: + Slider(); + void setup(int initial, int xStart, int yp, int width, int xInc); + + virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerSlider"; } + virtual void remove(); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; +public: + Button _talkButton; + Button _scanButton; + Slider _slider; + SceneActor _obj4; + SceneActor _obj5; + SceneActor _obj6; + SceneActor _obj7; +public: + ScannerDialog(); + + virtual Common::String getClassName() { return "ScannerDialog"; } + virtual void remove(); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE |